From 59162fd880229009175752f065f168b0064a1431 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 27 Jun 2022 18:10:04 -0700 Subject: [PATCH 01/51] Support for auto-accessor fields --- scripts/eslint/rules/debug-assert.js | 2 +- src/compiler/binder.ts | 5 +- src/compiler/checker.ts | 89 +- src/compiler/diagnosticMessages.json | 12 + src/compiler/emitter.ts | 187 ++- src/compiler/factory/nodeFactory.ts | 69 +- src/compiler/factory/nodeTests.ts | 5 + src/compiler/factory/parenthesizerRules.ts | 4 +- src/compiler/factory/utilities.ts | 137 ++ src/compiler/parser.ts | 4 + src/compiler/program.ts | 5 +- src/compiler/scanner.ts | 1 + src/compiler/transformers/classFields.ts | 729 ++++++--- src/compiler/transformers/legacyDecorators.ts | 2 +- src/compiler/transformers/utilities.ts | 4 +- src/compiler/types.ts | 57 +- src/compiler/utilities.ts | 17 +- src/compiler/utilitiesPublic.ts | 28 +- src/compiler/visitorPublic.ts | 15 +- .../4.0/nodeFactoryTopLevelExports.ts | 2 +- src/harness/fourslashInterfaceImpl.ts | 1 + src/services/classifier.ts | 1 + src/services/codefixes/generateAccessors.ts | 12 +- src/services/codefixes/helpers.ts | 40 +- src/services/completions.ts | 1 + src/services/formatting/rules.ts | 1 + src/services/symbolDisplay.ts | 6 +- src/services/types.ts | 3 + .../accessorField1(target=es2015).js | 39 + .../accessorField1(target=es2015).symbols | 17 + .../accessorField1(target=es2015).types | 19 + .../accessorField1(target=es2022).js | 24 + .../accessorField1(target=es2022).symbols | 17 + .../accessorField1(target=es2022).types | 19 + .../accessorField1(target=es5).errors.txt | 22 + .../accessorField1(target=es5).symbols | 17 + .../accessorField1(target=es5).types | 19 + .../accessorField1(target=esnext).js | 16 + .../accessorField1(target=esnext).symbols | 17 + .../accessorField1(target=esnext).types | 19 + .../accessorField2(target=es2015).js | 48 + .../accessorField2(target=es2015).symbols | 37 + .../accessorField2(target=es2015).types | 47 + .../accessorField2(target=es2022).js | 42 + .../accessorField2(target=es2022).symbols | 37 + .../accessorField2(target=es2022).types | 47 + .../accessorField2(target=esnext).js | 34 + .../accessorField2(target=esnext).symbols | 37 + .../accessorField2(target=esnext).types | 47 + .../accessorField3(target=es2015).js | 39 + .../accessorField3(target=es2015).symbols | 17 + .../accessorField3(target=es2015).types | 19 + .../accessorField3(target=es2022).js | 24 + .../accessorField3(target=es2022).symbols | 17 + .../accessorField3(target=es2022).types | 19 + .../accessorField3(target=es5).errors.txt | 22 + .../accessorField3(target=es5).symbols | 17 + .../accessorField3(target=es5).types | 19 + .../accessorField3(target=esnext).js | 16 + .../accessorField3(target=esnext).symbols | 17 + .../accessorField3(target=esnext).types | 19 + .../accessorField4(target=es2015).js | 39 + .../accessorField4(target=es2015).symbols | 17 + .../accessorField4(target=es2015).types | 19 + .../accessorField4(target=es2022).js | 24 + .../accessorField4(target=es2022).symbols | 17 + .../accessorField4(target=es2022).types | 19 + .../accessorField4(target=es5).errors.txt | 22 + .../accessorField4(target=es5).symbols | 17 + .../accessorField4(target=es5).types | 19 + .../accessorField4(target=esnext).js | 16 + .../accessorField4(target=esnext).symbols | 17 + .../accessorField4(target=esnext).types | 19 + .../accessorField5(target=es2015).js | 53 + .../accessorField5(target=es2015).symbols | 32 + .../accessorField5(target=es2015).types | 36 + .../accessorField5(target=es2022).js | 36 + .../accessorField5(target=es2022).symbols | 32 + .../accessorField5(target=es2022).types | 36 + .../accessorField5(target=es5).errors.txt | 27 + .../accessorField5(target=es5).symbols | 32 + .../accessorField5(target=es5).types | 36 + .../accessorField5(target=esnext).js | 25 + .../accessorField5(target=esnext).symbols | 32 + .../accessorField5(target=esnext).types | 36 + ...,usedefineforclassfields=false).errors.txt | 18 + ...t=es2015,usedefineforclassfields=false).js | 41 + ...015,usedefineforclassfields=false).symbols | 27 + ...s2015,usedefineforclassfields=false).types | 28 + ...5,usedefineforclassfields=true).errors.txt | 18 + ...et=es2015,usedefineforclassfields=true).js | 49 + ...2015,usedefineforclassfields=true).symbols | 27 + ...es2015,usedefineforclassfields=true).types | 28 + ...,usedefineforclassfields=false).errors.txt | 18 + ...t=es2022,usedefineforclassfields=false).js | 29 + ...022,usedefineforclassfields=false).symbols | 27 + ...s2022,usedefineforclassfields=false).types | 28 + ...2,usedefineforclassfields=true).errors.txt | 18 + ...et=es2022,usedefineforclassfields=true).js | 26 + ...2022,usedefineforclassfields=true).symbols | 27 + ...es2022,usedefineforclassfields=true).types | 28 + ...,usedefineforclassfields=false).errors.txt | 18 + ...t=esnext,usedefineforclassfields=false).js | 26 + ...ext,usedefineforclassfields=false).symbols | 27 + ...snext,usedefineforclassfields=false).types | 28 + ...t,usedefineforclassfields=true).errors.txt | 18 + ...et=esnext,usedefineforclassfields=true).js | 24 + ...next,usedefineforclassfields=true).symbols | 27 + ...esnext,usedefineforclassfields=true).types | 28 + ...t=es2015,usedefineforclassfields=false).js | 41 + ...015,usedefineforclassfields=false).symbols | 24 + ...s2015,usedefineforclassfields=false).types | 26 + ...et=es2015,usedefineforclassfields=true).js | 41 + ...2015,usedefineforclassfields=true).symbols | 24 + ...es2015,usedefineforclassfields=true).types | 26 + ...t=es2022,usedefineforclassfields=false).js | 29 + ...022,usedefineforclassfields=false).symbols | 24 + ...s2022,usedefineforclassfields=false).types | 26 + ...et=es2022,usedefineforclassfields=true).js | 25 + ...2022,usedefineforclassfields=true).symbols | 24 + ...es2022,usedefineforclassfields=true).types | 26 + ...t=esnext,usedefineforclassfields=false).js | 26 + ...ext,usedefineforclassfields=false).symbols | 24 + ...snext,usedefineforclassfields=false).types | 26 + ...et=esnext,usedefineforclassfields=true).js | 23 + ...next,usedefineforclassfields=true).symbols | 24 + ...esnext,usedefineforclassfields=true).types | 26 + tests/baselines/reference/accessorField8.js | 49 + .../reference/accessorField8.symbols | 37 + .../baselines/reference/accessorField8.types | 37 + .../accessorFieldAllowedModifiers.js | 49 + ...ccessorFieldDisallowedModifiers.errors.txt | 124 ++ .../accessorFieldDisallowedModifiers.js | 66 + .../reference/api/tsserverlibrary.d.ts | 526 +++--- tests/baselines/reference/api/typescript.d.ts | 526 +++--- .../reference/decoratorOnClassProperty13.js | 34 + .../decoratorOnClassProperty13.symbols | 13 + .../decoratorOnClassProperty13.types | 13 + ...ameComputedPropertyName2(target=es2015).js | 2 +- .../reference/privateNameDuplicateField.js | 8 +- ...nfoDisplayPartsClassAutoAccessors.baseline | 1422 +++++++++++++++++ .../accessorField1.ts | 9 + .../accessorField2.ts | 18 + .../accessorField3.ts | 9 + .../accessorField4.ts | 9 + .../accessorField5.ts | 15 + .../accessorField6.ts | 14 + .../accessorField7.ts | 14 + .../accessorField8.ts | 20 + .../accessorFieldAllowedModifiers.ts | 29 + .../accessorFieldDisallowedModifiers.ts | 39 + .../property/decoratorOnClassProperty13.ts | 7 + ...ImplementClassAbstractGettersAndSetters.ts | 5 + .../completionEntryForClassMembers.ts | 4 +- .../completionListInNamedClassExpression.ts | 17 +- ...quickInfoDisplayPartsClassAutoAccessors.ts | 33 + 156 files changed, 6279 insertions(+), 950 deletions(-) create mode 100644 tests/baselines/reference/accessorField1(target=es2015).js create mode 100644 tests/baselines/reference/accessorField1(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField1(target=es2015).types create mode 100644 tests/baselines/reference/accessorField1(target=es2022).js create mode 100644 tests/baselines/reference/accessorField1(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField1(target=es2022).types create mode 100644 tests/baselines/reference/accessorField1(target=es5).errors.txt create mode 100644 tests/baselines/reference/accessorField1(target=es5).symbols create mode 100644 tests/baselines/reference/accessorField1(target=es5).types create mode 100644 tests/baselines/reference/accessorField1(target=esnext).js create mode 100644 tests/baselines/reference/accessorField1(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField1(target=esnext).types create mode 100644 tests/baselines/reference/accessorField2(target=es2015).js create mode 100644 tests/baselines/reference/accessorField2(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField2(target=es2015).types create mode 100644 tests/baselines/reference/accessorField2(target=es2022).js create mode 100644 tests/baselines/reference/accessorField2(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField2(target=es2022).types create mode 100644 tests/baselines/reference/accessorField2(target=esnext).js create mode 100644 tests/baselines/reference/accessorField2(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField2(target=esnext).types create mode 100644 tests/baselines/reference/accessorField3(target=es2015).js create mode 100644 tests/baselines/reference/accessorField3(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField3(target=es2015).types create mode 100644 tests/baselines/reference/accessorField3(target=es2022).js create mode 100644 tests/baselines/reference/accessorField3(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField3(target=es2022).types create mode 100644 tests/baselines/reference/accessorField3(target=es5).errors.txt create mode 100644 tests/baselines/reference/accessorField3(target=es5).symbols create mode 100644 tests/baselines/reference/accessorField3(target=es5).types create mode 100644 tests/baselines/reference/accessorField3(target=esnext).js create mode 100644 tests/baselines/reference/accessorField3(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField3(target=esnext).types create mode 100644 tests/baselines/reference/accessorField4(target=es2015).js create mode 100644 tests/baselines/reference/accessorField4(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField4(target=es2015).types create mode 100644 tests/baselines/reference/accessorField4(target=es2022).js create mode 100644 tests/baselines/reference/accessorField4(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField4(target=es2022).types create mode 100644 tests/baselines/reference/accessorField4(target=es5).errors.txt create mode 100644 tests/baselines/reference/accessorField4(target=es5).symbols create mode 100644 tests/baselines/reference/accessorField4(target=es5).types create mode 100644 tests/baselines/reference/accessorField4(target=esnext).js create mode 100644 tests/baselines/reference/accessorField4(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField4(target=esnext).types create mode 100644 tests/baselines/reference/accessorField5(target=es2015).js create mode 100644 tests/baselines/reference/accessorField5(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField5(target=es2015).types create mode 100644 tests/baselines/reference/accessorField5(target=es2022).js create mode 100644 tests/baselines/reference/accessorField5(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField5(target=es2022).types create mode 100644 tests/baselines/reference/accessorField5(target=es5).errors.txt create mode 100644 tests/baselines/reference/accessorField5(target=es5).symbols create mode 100644 tests/baselines/reference/accessorField5(target=es5).types create mode 100644 tests/baselines/reference/accessorField5(target=esnext).js create mode 100644 tests/baselines/reference/accessorField5(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField5(target=esnext).types create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField8.js create mode 100644 tests/baselines/reference/accessorField8.symbols create mode 100644 tests/baselines/reference/accessorField8.types create mode 100644 tests/baselines/reference/accessorFieldAllowedModifiers.js create mode 100644 tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt create mode 100644 tests/baselines/reference/accessorFieldDisallowedModifiers.js create mode 100644 tests/baselines/reference/decoratorOnClassProperty13.js create mode 100644 tests/baselines/reference/decoratorOnClassProperty13.symbols create mode 100644 tests/baselines/reference/decoratorOnClassProperty13.types create mode 100644 tests/baselines/reference/quickInfoDisplayPartsClassAutoAccessors.baseline create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts create mode 100644 tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts create mode 100644 tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts diff --git a/scripts/eslint/rules/debug-assert.js b/scripts/eslint/rules/debug-assert.js index 5d416afbd2565..7f01a43c9c30b 100644 --- a/scripts/eslint/rules/debug-assert.js +++ b/scripts/eslint/rules/debug-assert.js @@ -46,7 +46,7 @@ module.exports = createRule({ context.report({ messageId: "secondArgumentDebugAssertError", node: message1Node }); } - if (argsLen < 3) { + if (argsLen !== 3) { return; } diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 6ffe3a7ef526e..1e347f9d81e15 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2732,7 +2732,10 @@ namespace ts { } function bindPropertyWorker(node: PropertyDeclaration | PropertySignature) { - return bindPropertyOrMethodOrAccessor(node, SymbolFlags.Property | (node.questionToken ? SymbolFlags.Optional : SymbolFlags.None), SymbolFlags.PropertyExcludes); + const isAutoAccessor = isAutoAccessorPropertyDeclaration(node); + const includes = isAutoAccessor ? SymbolFlags.Accessor : SymbolFlags.Property; + const excludes = isAutoAccessor ? SymbolFlags.AccessorExcludes : SymbolFlags.PropertyExcludes; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? SymbolFlags.Optional : SymbolFlags.None), excludes); } function bindAnonymousTypeWorker(node: TypeLiteralNode | MappedTypeNode | JSDocTypeLiteral) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a457944e027a7..7efa169bd2c3d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9083,7 +9083,7 @@ namespace ts { return getTypeForBindingElement(declaration as BindingElement); } - const isProperty = isPropertyDeclaration(declaration) || isPropertySignature(declaration); + const isProperty = isPropertyDeclaration(declaration) && !hasAccessorModifier(declaration) || isPropertySignature(declaration); const isOptional = includeOptionality && ( isProperty && !!declaration.questionToken || isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || @@ -9831,21 +9831,25 @@ namespace ts { return type; } - function getAnnotatedAccessorTypeNode(accessor: AccessorDeclaration | undefined): TypeNode | undefined { + function getAnnotatedAccessorTypeNode(accessor: AccessorDeclaration | PropertyDeclaration | undefined): TypeNode | undefined { if (accessor) { - if (accessor.kind === SyntaxKind.GetAccessor) { - const getterTypeAnnotation = getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - const setterTypeAnnotation = getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case SyntaxKind.GetAccessor: + const getterTypeAnnotation = getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case SyntaxKind.SetAccessor: + const setterTypeAnnotation = getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case SyntaxKind.PropertyDeclaration: + Debug.assert(hasAccessorModifier(accessor)); + const accessorTypeAnnotation = getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; } - function getAnnotatedAccessorType(accessor: AccessorDeclaration | undefined): Type | undefined { + function getAnnotatedAccessorType(accessor: AccessorDeclaration | PropertyDeclaration | undefined): Type | undefined { const node = getAnnotatedAccessorTypeNode(accessor); return node && getTypeFromTypeNode(node); } @@ -9867,12 +9871,16 @@ namespace ts { } const getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); const setter = getDeclarationOfKind(symbol, SyntaxKind.SetAccessor); + const accessor = tryCast(getDeclarationOfKind(symbol, SyntaxKind.PropertyDeclaration), isAutoAccessorPropertyDeclaration); + // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. let type = getter && isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -9880,6 +9888,9 @@ namespace ts { else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -9889,6 +9900,9 @@ namespace ts { else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -9905,7 +9919,9 @@ namespace ts { if (!pushTypeResolution(symbol, TypeSystemPropertyName.WriteType)) { return errorType; } - const setter = getDeclarationOfKind(symbol, SyntaxKind.SetAccessor); + + const setter = getDeclarationOfKind(symbol, SyntaxKind.SetAccessor) + ?? tryCast(getDeclarationOfKind(symbol, SyntaxKind.PropertyDeclaration), isAutoAccessorPropertyDeclaration); let writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -11063,8 +11079,10 @@ namespace ts { const members = getMembersOfDeclaration(decl); if (members) { for (const member of members) { - if (isStatic === hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic === hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -11078,8 +11096,10 @@ namespace ts { || isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === AssignmentDeclarationKind.ObjectDefinePrototypeProperty || assignmentKind === AssignmentDeclarationKind.Prototype; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -12918,7 +12938,7 @@ namespace ts { } function isOptionalPropertyDeclaration(node: Declaration) { - return isPropertyDeclaration(node) && node.questionToken; + return isPropertyDeclaration(node) && !hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node: Node): node is JSDocPropertyLikeTag { @@ -44183,6 +44203,9 @@ namespace ts { else if (flags & ModifierFlags.Readonly) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } + else if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } else if (flags & ModifierFlags.Async) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } @@ -44204,6 +44227,9 @@ namespace ts { else if (flags & ModifierFlags.Static) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & ModifierFlags.Readonly) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } @@ -44237,6 +44263,9 @@ namespace ts { else if (flags & ModifierFlags.Async) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } + else if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } @@ -44253,6 +44282,23 @@ namespace ts { lastStatic = modifier; break; + case SyntaxKind.AccessorKeyword: + if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & ModifierFlags.Readonly) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & ModifierFlags.Ambient) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== SyntaxKind.PropertyDeclaration) { + return grammarErrorOnNode(modifier, Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + + flags |= ModifierFlags.Accessor; + break; + case SyntaxKind.ReadonlyKeyword: if (flags & ModifierFlags.Readonly) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly"); @@ -44349,6 +44395,9 @@ namespace ts { if (flags & ModifierFlags.Override) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (isNamedDeclaration(node) && node.name.kind === SyntaxKind.PrivateIdentifier) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); @@ -45547,6 +45596,12 @@ namespace ts { if (languageVersion < ScriptTarget.ES2015 && isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < ScriptTarget.ES2015 && isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6cec02b9e1a41..bc71059ac83aa 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -899,6 +899,14 @@ "category": "Error", "code": 1274 }, + "'accessor' modifier can only appear on a property declaration.": { + "category": "Error", + "code": 1275 + }, + "An 'accessor' property cannot be declared optional.": { + "category": "Error", + "code": 1276 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", @@ -7485,5 +7493,9 @@ "'{0}' is automatically exported here.": { "category": "Message", "code": 18044 + }, + "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.": { + "category": "Error", + "code": 18045 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4e571c49a8c8c..750f97f361530 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -903,6 +903,10 @@ namespace ts { let nodeIdToGeneratedName: string[]; // Map of generated names for specific nodes. let autoGeneratedIdToGeneratedName: string[]; // Map of generated names for temp and loop variables. let generatedNames: Set; // Set of names generated by the NameGenerator. + let formattedNameTempFlagsStack: (ESMap | undefined)[]; + let formattedNameTempFlags: ESMap | undefined; + let privateNameTempFlagsStack: TempFlags[]; // Stack of enclosing name generation scopes. + let privateNameTempFlags: TempFlags; // TempFlags for the current name generation scope. let tempFlagsStack: TempFlags[]; // Stack of enclosing name generation scopes. let tempFlags: TempFlags; // TempFlags for the current name generation scope. let reservedNamesStack: Set[]; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -1191,6 +1195,10 @@ namespace ts { nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = TempFlags.Auto; tempFlagsStack = []; tempFlags = TempFlags.Auto; reservedNamesStack = []; @@ -4954,7 +4962,7 @@ namespace ts { } function getTextOfNode(node: Identifier | PrivateIdentifier | LiteralExpression, includeTrivia?: boolean): string { - if (isGeneratedIdentifier(node)) { + if (isGeneratedIdentifier(node) || isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (isStringLiteral(node) && node.textSourceNode) { @@ -4979,7 +4987,7 @@ namespace ts { function getLiteralTextOfNode(node: LiteralLikeNode, neverAsciiEscape: boolean | undefined, jsxAttributeEscape: boolean): string { if (node.kind === SyntaxKind.StringLiteral && (node as StringLiteral).textSourceNode) { const textSourceNode = (node as StringLiteral).textSourceNode!; - if (isIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) { + if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) { const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || (getEmitFlags(node) & EmitFlags.NoAsciiEscaping) ? `"${escapeString(text)}"` : @@ -5006,7 +5014,11 @@ namespace ts { return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = TempFlags.Auto; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = TempFlags.Auto; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } @@ -5018,6 +5030,8 @@ namespace ts { return; } tempFlags = tempFlagsStack.pop()!; + privateNameTempFlags = privateNameTempFlagsStack.pop()!; + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop()!; } @@ -5130,7 +5144,7 @@ namespace ts { function generateNameIfNeeded(name: DeclarationName | undefined) { if (name) { - if (isGeneratedIdentifier(name)) { + if (isGeneratedIdentifier(name) || isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (isBindingPattern(name)) { @@ -5142,11 +5156,11 @@ namespace ts { /** * Generate the text for a generated identifier. */ - function generateName(name: GeneratedIdentifier) { + function generateName(name: GeneratedIdentifier | GeneratedPrivateIdentifier) { if ((name.autoGenerateFlags & GeneratedIdentifierFlags.KindMask) === GeneratedIdentifierFlags.Node) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(getNodeForGeneratedName(name), isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -5156,9 +5170,9 @@ namespace ts { } } - function generateNameCached(node: Node, flags?: GeneratedIdentifierFlags) { + function generateNameCached(node: Node, privateName: boolean, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string) { const nodeId = getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags ?? GeneratedIdentifierFlags.None, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix))); } /** @@ -5194,22 +5208,59 @@ namespace ts { return true; } + function getTempFlags(formattedNameKey: string) { + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return formattedNameTempFlags?.get(formattedNameKey) ?? TempFlags.Auto; + } + } + + function setTempFlags(formattedNameKey: string, flags: TempFlags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags ??= new Map(); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } + /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags: TempFlags, reservedInNestedScopes?: boolean): string { + function makeTempVariableName(flags: TempFlags, reservedInNestedScopes: boolean, privateName: boolean, prefix: string, suffix: string): string { + if (prefix.length > 0 && prefix.charCodeAt(0) === CharacterCodes.hash) { + prefix = prefix.slice(1); + } + + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + const key = formatGeneratedName(privateName, prefix, "", suffix); + let tempFlags = getTempFlags(key); + if (flags && !(tempFlags & flags)) { const name = flags === TempFlags._i ? "_i" : "_n"; - if (isUniqueName(name)) { + const fullName = formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } + while (true) { const count = tempFlags & TempFlags.CountMask; tempFlags++; @@ -5218,11 +5269,13 @@ namespace ts { const name = count < 26 ? "_" + String.fromCharCode(CharacterCodes.a + count) : "_" + (count - 26); - if (isUniqueName(name)) { + const fullName = formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -5235,16 +5288,23 @@ namespace ts { * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName: string, checkFn: (name: string) => boolean = isUniqueName, optimistic?: boolean, scoped?: boolean): string { + function makeUniqueName(baseName: string, checkFn: (name: string) => boolean = isUniqueName, optimistic: boolean, scoped: boolean, privateName: boolean, prefix: string, suffix: string): string { + if (baseName.length > 0 && baseName.charCodeAt(0) === CharacterCodes.hash) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === CharacterCodes.hash) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + const fullName = formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -5253,22 +5313,22 @@ namespace ts { } let i = 1; while (true) { - const generatedName = baseName + i; - if (checkFn(generatedName)) { + const fullName = formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name: string) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** @@ -5277,7 +5337,7 @@ namespace ts { function generateNameForModuleOrEnum(node: ModuleDeclaration | EnumDeclaration) { const name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** @@ -5287,109 +5347,98 @@ namespace ts { const expr = getExternalModuleName(node)!; // TODO: GH#18217 const baseName = isStringLiteral(expr) ? makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node: MethodDeclaration | AccessorDeclaration) { + function generateNameForMethodOrAccessor(node: MethodDeclaration | AccessorDeclaration, privateName: boolean, prefix: string, suffix: string) { if (isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(TempFlags.Auto); + return makeTempVariableName(TempFlags.Auto, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node: Node, flags?: GeneratedIdentifierFlags): string { + function generateNameForNode(node: Node, privateName: boolean, flags: GeneratedIdentifierFlags, prefix: string, suffix: string): string { switch (node.kind) { case SyntaxKind.Identifier: + case SyntaxKind.PrivateIdentifier: return makeUniqueName( getTextOfNode(node as Identifier), isUniqueName, - !!(flags! & GeneratedIdentifierFlags.Optimistic), - !!(flags! & GeneratedIdentifierFlags.ReservedInNestedScopes) + !!(flags & GeneratedIdentifierFlags.Optimistic), + !!(flags & GeneratedIdentifierFlags.ReservedInNestedScopes), + privateName, + prefix, + suffix ); case SyntaxKind.ModuleDeclaration: case SyntaxKind.EnumDeclaration: + Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node as ModuleDeclaration | EnumDeclaration); case SyntaxKind.ImportDeclaration: case SyntaxKind.ExportDeclaration: + Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node as ImportDeclaration | ExportDeclaration); case SyntaxKind.FunctionDeclaration: case SyntaxKind.ClassDeclaration: case SyntaxKind.ExportAssignment: + Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); case SyntaxKind.ClassExpression: + Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); case SyntaxKind.MethodDeclaration: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: - return generateNameForMethodOrAccessor(node as MethodDeclaration | AccessorDeclaration); + return generateNameForMethodOrAccessor(node as MethodDeclaration | AccessorDeclaration, privateName, prefix, suffix); case SyntaxKind.ComputedPropertyName: - return makeTempVariableName(TempFlags.Auto, /*reserveInNestedScopes*/ true); + return makeTempVariableName(TempFlags.Auto, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(TempFlags.Auto); + return makeTempVariableName(TempFlags.Auto, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ - function makeName(name: GeneratedIdentifier) { + function makeName(name: GeneratedIdentifier | GeneratedPrivateIdentifier) { + const prefix = formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + const suffix = formatGeneratedNamePart (name.autoGenerateSuffix); switch (name.autoGenerateFlags & GeneratedIdentifierFlags.KindMask) { case GeneratedIdentifierFlags.Auto: - return makeTempVariableName(TempFlags.Auto, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes)); + return makeTempVariableName(TempFlags.Auto, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes), isPrivateIdentifier(name), prefix, suffix); case GeneratedIdentifierFlags.Loop: - return makeTempVariableName(TempFlags._i, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes)); + Debug.assertNode(name, isIdentifier); + return makeTempVariableName(TempFlags._i, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes), /*privateName*/ false, prefix, suffix); case GeneratedIdentifierFlags.Unique: return makeUniqueName( idText(name), (name.autoGenerateFlags & GeneratedIdentifierFlags.FileLevel) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.Optimistic), - !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes) + !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes), + isPrivateIdentifier(name), + prefix, + suffix ); } - return Debug.fail("Unsupported GeneratedIdentifierKind."); - } - - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name: GeneratedIdentifier) { - const autoGenerateId = name.autoGenerateId; - let node = name as Node; - let original = node.original; - while (original) { - node = original; - - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (isIdentifier(node) - && !!(node.autoGenerateFlags! & GeneratedIdentifierFlags.Node) - && node.autoGenerateId !== autoGenerateId) { - break; - } - - original = node.original; - } - - // otherwise, return the original node for the source; - return node; + return Debug.fail(`Unsupported GeneratedIdentifierKind: ${Debug.formatEnum(name.autoGenerateFlags & GeneratedIdentifierFlags.KindMask, (ts as any).GeneratedIdentifierFlags, /*isFlags*/ true)}.`); } // Comments diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 02e72593f07f7..f8285fe455545 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -60,6 +60,8 @@ namespace ts { createUniqueName, getGeneratedNameForNode, createPrivateIdentifier, + createUniquePrivateName, + getGeneratedPrivateNameForNode, createToken, createSuper, createThis, @@ -819,7 +821,7 @@ namespace ts { } // @api - function createStringLiteralFromNode(sourceNode: PropertyNameLiteral): StringLiteral { + function createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier): StringLiteral { const node = createBaseStringLiteral(getTextOfIdentifierOrLiteral(sourceNode), /*isSingleQuote*/ undefined); node.textSourceNode = sourceNode; return node; @@ -861,10 +863,12 @@ namespace ts { return node; } - function createBaseGeneratedIdentifier(text: string, autoGenerateFlags: GeneratedIdentifierFlags) { + function createBaseGeneratedIdentifier(text: string, autoGenerateFlags: GeneratedIdentifierFlags, prefix: string | GeneratedNamePart | undefined, suffix: string | undefined) { const node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined) as Mutable; node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } @@ -890,10 +894,10 @@ namespace ts { } // @api - function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean): GeneratedIdentifier { + function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean, prefix?: string | GeneratedNamePart, suffix?: string): GeneratedIdentifier { let flags = GeneratedIdentifierFlags.Auto; if (reservedInNestedScopes) flags |= GeneratedIdentifierFlags.ReservedInNestedScopes; - const name = createBaseGeneratedIdentifier("", flags); + const name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -905,35 +909,72 @@ namespace ts { function createLoopVariable(reservedInNestedScopes?: boolean): Identifier { let flags = GeneratedIdentifierFlags.Loop; if (reservedInNestedScopes) flags |= GeneratedIdentifierFlags.ReservedInNestedScopes; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text: string, flags: GeneratedIdentifierFlags = GeneratedIdentifierFlags.None): Identifier { + function createUniqueName(text: string, flags: GeneratedIdentifierFlags = GeneratedIdentifierFlags.None, prefix?: string | GeneratedNamePart, suffix?: string): Identifier { Debug.assert(!(flags & GeneratedIdentifierFlags.KindMask), "Argument out of range: flags"); Debug.assert((flags & (GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel)) !== GeneratedIdentifierFlags.FileLevel, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, GeneratedIdentifierFlags.Unique | flags); + return createBaseGeneratedIdentifier(text, GeneratedIdentifierFlags.Unique | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node: Node | undefined, flags: GeneratedIdentifierFlags = 0): Identifier { + function getGeneratedNameForNode(node: Node | undefined, flags: GeneratedIdentifierFlags = 0, prefix?: string | GeneratedNamePart, suffix?: string): Identifier { Debug.assert(!(flags & GeneratedIdentifierFlags.KindMask), "Argument out of range: flags"); - const name = createBaseGeneratedIdentifier(node && isIdentifier(node) ? idText(node) : "", GeneratedIdentifierFlags.Node | flags); + const text = !node ? "" : + isMemberName(node) ? formatGeneratedName(/*privateName*/ false, prefix, node, suffix, idText) : + `generated@${getNodeId(node)}`; + if (prefix || suffix) flags |= GeneratedIdentifierFlags.Optimistic; + const name = createBaseGeneratedIdentifier(text, GeneratedIdentifierFlags.Node | flags, prefix, suffix); name.original = node; return name; } - // @api - function createPrivateIdentifier(text: string): PrivateIdentifier { - if (!startsWith(text, "#")) Debug.fail("First character of private identifier must be #: " + text); + function createBasePrivateIdentifier(text: string) { const node = baseFactory.createBasePrivateIdentifierNode(SyntaxKind.PrivateIdentifier) as Mutable; node.escapedText = escapeLeadingUnderscores(text); node.transformFlags |= TransformFlags.ContainsClassFields; return node; } + // @api + function createPrivateIdentifier(text: string): PrivateIdentifier { + if (!startsWith(text, "#")) Debug.fail("First character of private identifier must be #: " + text); + return createBasePrivateIdentifier(text); + } + + function createBaseGeneratedPrivateIdentifier(text: string, autoGenerateFlags: GeneratedIdentifierFlags, prefix: string | GeneratedNamePart | undefined, suffix: string | undefined) { + const node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; + return node; + } + + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text?: string, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier { + if (text && !startsWith(text, "#")) Debug.fail("First character of private identifier must be #: " + text); + const autoGenerateFlags = GeneratedIdentifierFlags.ReservedInNestedScopes | + (text ? GeneratedIdentifierFlags.Unique : GeneratedIdentifierFlags.Auto); + return createBaseGeneratedPrivateIdentifier(text ?? "", autoGenerateFlags, prefix, suffix); + } + + // @api + function getGeneratedPrivateNameForNode(node: Node, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier { + const text = isMemberName(node) ? formatGeneratedName(/*privateName*/ true, prefix, node, suffix, idText) : + `#generated@${getNodeId(node)}`; + const flags = prefix || suffix ? GeneratedIdentifierFlags.Optimistic : GeneratedIdentifierFlags.None; + const name = createBaseGeneratedPrivateIdentifier(text, GeneratedIdentifierFlags.Node | flags, prefix, suffix); + name.original = node; + return name; + } + // // Punctuation // @@ -998,6 +1039,9 @@ namespace ts { case SyntaxKind.StaticKeyword: transformFlags = TransformFlags.ContainsES2015; break; + case SyntaxKind.AccessorKeyword: + transformFlags = TransformFlags.ContainsDecorators; + break; case SyntaxKind.ThisKeyword: // 'this' indicates a lexical 'this' transformFlags = TransformFlags.ContainsLexicalThis; @@ -1061,6 +1105,7 @@ namespace ts { if (flags & ModifierFlags.Static) result.push(createModifier(SyntaxKind.StaticKeyword)); if (flags & ModifierFlags.Override) result.push(createModifier(SyntaxKind.OverrideKeyword)); if (flags & ModifierFlags.Readonly) result.push(createModifier(SyntaxKind.ReadonlyKeyword)); + if (flags & ModifierFlags.Accessor) result.push(createModifier(SyntaxKind.AccessorKeyword)); if (flags & ModifierFlags.Async) result.push(createModifier(SyntaxKind.AsyncKeyword)); if (flags & ModifierFlags.In) result.push(createModifier(SyntaxKind.InKeyword)); if (flags & ModifierFlags.Out) result.push(createModifier(SyntaxKind.OutKeyword)); diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index f44c91364081a..a2a558e9079b1 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -139,6 +139,11 @@ namespace ts { return node.kind === SyntaxKind.OverrideKeyword; } + /* @internal */ + export function isAccessorModifier(node: Node): node is AccessorKeyword { + return node.kind === SyntaxKind.AccessorKeyword; + } + /*@internal*/ export function isSuperKeyword(node: Node): node is SuperExpression { return node.kind === SyntaxKind.SuperKeyword; diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index b09f1826efd8d..21422f2bc6fef 100644 --- a/src/compiler/factory/parenthesizerRules.ts +++ b/src/compiler/factory/parenthesizerRules.ts @@ -177,13 +177,15 @@ namespace ts { // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === SyntaxKind.AsteriskToken || binaryOperator === SyntaxKind.BarToken || binaryOperator === SyntaxKind.AmpersandToken - || binaryOperator === SyntaxKind.CaretToken; + || binaryOperator === SyntaxKind.CaretToken + || binaryOperator === SyntaxKind.CommaToken; } /** diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 7cb707a90a53f..7454adac42f56 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -1244,4 +1244,141 @@ namespace ts { if (nodes.length === 0) return nodes; return setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } + + /** + * Gets the node from which a name should be generated. + */ + export function getNodeForGeneratedName(name: GeneratedIdentifier | GeneratedPrivateIdentifier) { + if (name.autoGenerateFlags & GeneratedIdentifierFlags.Node) { + const autoGenerateId = name.autoGenerateId; + let node = name as Node; + let original = node.original; + while (original) { + node = original; + + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (isMemberName(node) + && !!(node.autoGenerateFlags! & GeneratedIdentifierFlags.Node) + && node.autoGenerateId !== autoGenerateId) { + break; + } + + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + + /** + * Formats a prefix or suffix of a generated name. + */ + export function formatGeneratedNamePart(part: string | undefined): string; + /** + * Formats a prefix or suffix of a generated name. If the part is a {@link GeneratedNamePart}, calls {@link generateName} to format the source node. + */ + export function formatGeneratedNamePart(part: string | GeneratedNamePart | undefined, generateName: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string): string; + export function formatGeneratedNamePart(part: string | GeneratedNamePart | undefined, generateName?: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string): string { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName!) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === CharacterCodes.hash ? part.slice(1) : part : + ""; + } + + function formatIdentifier(name: string | Identifier | PrivateIdentifier, generateName?: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, Debug.checkDefined(generateName)); + } + + function formatIdentifierWorker(node: Identifier | PrivateIdentifier, generateName: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string) { + return isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + isGeneratedIdentifier(node) ? generateName(node) : + isPrivateIdentifier(node) ? (node.escapedText as string).slice(1) : + idText(node); + } + + /** + * Formats a generated name. + * @param privateName When `true`, inserts a `#` character at the start of the result. + * @param prefix The prefix (if any) to include before the base name. + * @param baseName The base name for the generated name. + * @param suffix The suffix (if any) to include after the base name. + */ + export function formatGeneratedName(privateName: boolean, prefix: string | undefined, baseName: string, suffix: string | undefined): string; + /** + * Formats a generated name. + * @param privateName When `true`, inserts a `#` character at the start of the result. + * @param prefix The prefix (if any) to include before the base name. + * @param baseName The base name for the generated name. + * @param suffix The suffix (if any) to include after the base name. + * @param generateName Called to format the source node of {@link prefix} when it is a {@link GeneratedNamePart}. + */ + export function formatGeneratedName(privateName: boolean, prefix: string | GeneratedNamePart | undefined, baseName: string | Identifier | PrivateIdentifier, suffix: string | GeneratedNamePart | undefined, generateName: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string): string; + export function formatGeneratedName(privateName: boolean, prefix: string | GeneratedNamePart | undefined, baseName: string | Identifier | PrivateIdentifier, suffix: string | GeneratedNamePart | undefined, generateName?: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string) { + prefix = formatGeneratedNamePart(prefix, generateName!); + suffix = formatGeneratedNamePart(suffix, generateName!); + baseName = formatIdentifier(baseName, generateName); + return `${privateName ? "#" : ""}${prefix}${baseName}${suffix}`; + } + + + /** + * Creates a private backing field for an `accesor` {@link PropertyDeclaration}. + */ + export function createAccessorPropertyBackingField(factory: NodeFactory, node: PropertyDeclaration, modifiers: ModifiersArray | undefined, initializer: Expression | undefined) { + return factory.updatePropertyDeclaration( + node, + modifiers, + factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + initializer + ); + } + + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + export function createAccessorPropertyGetRedirector(factory: NodeFactory, node: PropertyDeclaration, modifiers: ModifiersArray | undefined, name: PropertyName) { + return factory.createGetAccessorDeclaration( + modifiers, + name, + [], + /*type*/ undefined, + factory.createBlock([ + factory.createReturnStatement( + factory.createPropertyAccessExpression( + factory.createThis(), + factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage") + ) + ) + ]) + ); + } + + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + export function createAccessorPropertySetRedirector(factory: NodeFactory, node: PropertyDeclaration, modifiers: ModifiersArray | undefined, name: PropertyName) { + return factory.createSetAccessorDeclaration( + modifiers, + name, + [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, + "value" + )], + factory.createBlock([ + factory.createExpressionStatement( + factory.createAssignment( + factory.createPropertyAccessExpression( + factory.createThis(), + factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage") + ), + factory.createIdentifier("value") + ) + ) + ]) + ); + } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index dbcffe1680ee9..1a9e69692ccbc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2313,6 +2313,7 @@ namespace ts { return canFollowExportModifier(); case SyntaxKind.DefaultKeyword: return nextTokenCanFollowDefaultKeyword(); + case SyntaxKind.AccessorKeyword: case SyntaxKind.StaticKeyword: case SyntaxKind.GetKeyword: case SyntaxKind.SetKeyword: @@ -6613,6 +6614,7 @@ namespace ts { case SyntaxKind.NamespaceKeyword: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case SyntaxKind.AbstractKeyword: + case SyntaxKind.AccessorKeyword: case SyntaxKind.AsyncKeyword: case SyntaxKind.DeclareKeyword: case SyntaxKind.PrivateKeyword: @@ -6705,6 +6707,7 @@ namespace ts { // When these don't start a declaration, they're an identifier in an expression statement return true; + case SyntaxKind.AccessorKeyword: case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: case SyntaxKind.ProtectedKeyword: @@ -6791,6 +6794,7 @@ namespace ts { case SyntaxKind.ProtectedKeyword: case SyntaxKind.PublicKeyword: case SyntaxKind.AbstractKeyword: + case SyntaxKind.AccessorKeyword: case SyntaxKind.StaticKeyword: case SyntaxKind.ReadonlyKeyword: case SyntaxKind.GlobalKeyword: diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 2c71fde33d302..1ebef19e336a2 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2413,7 +2413,9 @@ namespace ts { // Check modifiers of property declaration if (nodes === (parent as PropertyDeclaration).modifiers) { for (const modifier of nodes as NodeArray) { - if (isModifier(modifier) && modifier.kind !== SyntaxKind.StaticKeyword) { + if (isModifier(modifier) + && modifier.kind !== SyntaxKind.StaticKeyword + && modifier.kind !== SyntaxKind.AccessorKeyword) { diagnostics.push(createDiagnosticForNode(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind))); } } @@ -2467,6 +2469,7 @@ namespace ts { case SyntaxKind.StaticKeyword: case SyntaxKind.ExportKeyword: case SyntaxKind.DefaultKeyword: + case SyntaxKind.AccessorKeyword: } } } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 05ae6268d7153..a54389fbb9474 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -80,6 +80,7 @@ namespace ts { /** @internal */ export const textToKeywordObj: MapLike = { abstract: SyntaxKind.AbstractKeyword, + accessor: SyntaxKind.AccessorKeyword, any: SyntaxKind.AnyKeyword, as: SyntaxKind.AsKeyword, asserts: SyntaxKind.AssertsKeyword, diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 13ea666881eaf..96eb05f0b68a8 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -12,11 +12,13 @@ namespace ts { */ ClassStaticThisOrSuperReference = 1 << 1, } + export const enum PrivateIdentifierKind { Field = "f", Method = "m", Accessor = "a" } + interface PrivateIdentifierInfoBase { /** * brandCheckIdentifier can contain: @@ -35,6 +37,7 @@ namespace ts { */ isValid: boolean; } + interface PrivateIdentifierAccessorInfo extends PrivateIdentifierInfoBase { kind: PrivateIdentifierKind.Accessor; /** @@ -46,6 +49,7 @@ namespace ts { */ setterName?: Identifier; } + interface PrivateIdentifierMethodInfo extends PrivateIdentifierInfoBase { kind: PrivateIdentifierKind.Method; /** @@ -53,6 +57,7 @@ namespace ts { */ methodName: Identifier; } + interface PrivateIdentifierInstanceFieldInfo extends PrivateIdentifierInfoBase { kind: PrivateIdentifierKind.Field; isStatic: false; @@ -61,11 +66,12 @@ namespace ts { */ variableName: undefined; } + interface PrivateIdentifierStaticFieldInfo extends PrivateIdentifierInfoBase { kind: PrivateIdentifierKind.Field; isStatic: true; /** - * Contains the variable that will server as the storage for the field. + * Contains the variable that will serve as the storage for the field. */ variableName: Identifier; } @@ -80,7 +86,7 @@ namespace ts { /** * Used for prefixing generated variable names. */ - className: string; + className?: Identifier; /** * Used for brand check on private methods. */ @@ -88,7 +94,11 @@ namespace ts { /** * A mapping of private names to information needed for transformation. */ - identifiers: UnderscoreEscapedMap + identifiers?: UnderscoreEscapedMap; + /** + * A mapping of generated private names to information needed for transformation. + */ + generatedIdentifiers?: ESMap; } interface ClassLexicalEnvironment { @@ -133,6 +143,14 @@ namespace ts { const languageVersion = getEmitScriptTarget(compilerOptions); const useDefineForClassFields = getUseDefineForClassFields(compilerOptions); + // We need to transform class field initializers when not using Define, or when using + // Define and targeting < ES2022. + const shouldTransformInitializers = !useDefineForClassFields || languageVersion < ScriptTarget.ES2022; + + // We need to transform `accessor` fields when targeting < ESNext + const shouldTransformAutoAccessors = languageVersion < ScriptTarget.ESNext; + + // We need to transform private members and class static blocks when targeting < ES2022. const shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < ScriptTarget.ES2022; // We need to transform `this` in a static initializer into a reference to the class @@ -143,6 +161,8 @@ namespace ts { // the es2015 transformation handles those. const shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= ScriptTarget.ES2015; + const shouldTransformAnything = shouldTransformInitializers || shouldTransformAutoAccessors; + const previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; const previousOnEmitNode = context.onEmitNode; @@ -166,6 +186,7 @@ namespace ts { const classLexicalEnvironmentStack: (ClassLexicalEnvironment | undefined)[] = []; const classLexicalEnvironmentMap = new Map(); + let currentClassLexicalEnvironment: ClassLexicalEnvironment | undefined; let currentComputedPropertyNameClassLexicalEnvironment: ClassLexicalEnvironment | undefined; let currentStaticPropertyDeclarationOrStaticBlock: PropertyDeclaration | ClassStaticBlockDeclaration | undefined; @@ -173,78 +194,98 @@ namespace ts { return chainBundle(context, transformSourceFile); function transformSourceFile(node: SourceFile) { - const options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && getEmitScriptTarget(options) >= ScriptTarget.ES2022) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } + const visited = visitEachChild(node, visitor, context); addEmitHelpers(visited, context.readEmitHelpers()); return visited; } + function visitor(node: Node): VisitResult { + return visitorWorker(node, /*valueIsDiscarded*/ false); + } + + function discardedValueVisitor(node: Node): VisitResult { + return visitorWorker(node, /*valueIsDiscarded*/ true); + } + function visitorWorker(node: Node, valueIsDiscarded: boolean): VisitResult { - if (node.transformFlags & TransformFlags.ContainsClassFields) { - switch (node.kind) { - case SyntaxKind.ClassExpression: - case SyntaxKind.ClassDeclaration: - return visitClassLike(node as ClassLikeDeclaration); - case SyntaxKind.PropertyDeclaration: - return visitPropertyDeclaration(node as PropertyDeclaration); - case SyntaxKind.VariableStatement: - return visitVariableStatement(node as VariableStatement); - case SyntaxKind.PrivateIdentifier: - return visitPrivateIdentifier(node as PrivateIdentifier); - case SyntaxKind.ClassStaticBlockDeclaration: - return visitClassStaticBlockDeclaration(node as ClassStaticBlockDeclaration); + switch (node.kind) { + case SyntaxKind.ClassExpression: + case SyntaxKind.ClassDeclaration: + return visitClassLikeDeclaration(node as ClassLikeDeclaration); + } + + if (shouldTransformInitializers) { + if (node.transformFlags & TransformFlags.ContainsClassFields) { + switch (node.kind) { + case SyntaxKind.PropertyDeclaration: + return visitPropertyDeclaration(node as PropertyDeclaration); + case SyntaxKind.VariableStatement: + return visitVariableStatement(node as VariableStatement); + case SyntaxKind.PrivateIdentifier: + return visitPrivateIdentifier(node as PrivateIdentifier); + case SyntaxKind.ClassStaticBlockDeclaration: + return visitClassStaticBlockDeclaration(node as ClassStaticBlockDeclaration); + } + } + + if (node.transformFlags & TransformFlags.ContainsClassFields || + node.transformFlags & TransformFlags.ContainsLexicalSuper && + shouldTransformSuperInStaticInitializers && + currentStaticPropertyDeclarationOrStaticBlock && + currentClassLexicalEnvironment) { + switch (node.kind) { + case SyntaxKind.PrefixUnaryExpression: + case SyntaxKind.PostfixUnaryExpression: + return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, valueIsDiscarded); + case SyntaxKind.BinaryExpression: + return visitBinaryExpression(node as BinaryExpression, valueIsDiscarded); + case SyntaxKind.CallExpression: + return visitCallExpression(node as CallExpression); + case SyntaxKind.TaggedTemplateExpression: + return visitTaggedTemplateExpression(node as TaggedTemplateExpression); + case SyntaxKind.PropertyAccessExpression: + return visitPropertyAccessExpression(node as PropertyAccessExpression); + case SyntaxKind.ElementAccessExpression: + return visitElementAccessExpression(node as ElementAccessExpression); + case SyntaxKind.ExpressionStatement: + return visitExpressionStatement(node as ExpressionStatement); + case SyntaxKind.ForStatement: + return visitForStatement(node as ForStatement); + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.Constructor: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: { + const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = undefined; + const result = visitEachChild(node, visitor, context); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } + } } } - if (node.transformFlags & TransformFlags.ContainsClassFields || - node.transformFlags & TransformFlags.ContainsLexicalSuper && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { + + if (shouldTransformAutoAccessors) { switch (node.kind) { - case SyntaxKind.PrefixUnaryExpression: - case SyntaxKind.PostfixUnaryExpression: - return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, valueIsDiscarded); - case SyntaxKind.BinaryExpression: - return visitBinaryExpression(node as BinaryExpression, valueIsDiscarded); - case SyntaxKind.CallExpression: - return visitCallExpression(node as CallExpression); - case SyntaxKind.TaggedTemplateExpression: - return visitTaggedTemplateExpression(node as TaggedTemplateExpression); - case SyntaxKind.PropertyAccessExpression: - return visitPropertyAccessExpression(node as PropertyAccessExpression); - case SyntaxKind.ElementAccessExpression: - return visitElementAccessExpression(node as ElementAccessExpression); - case SyntaxKind.ExpressionStatement: - return visitExpressionStatement(node as ExpressionStatement); - case SyntaxKind.ForStatement: - return visitForStatement(node as ForStatement); - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.Constructor: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: { - const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - const result = visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; + case SyntaxKind.AccessorKeyword: + return undefined; + } + + if (node.transformFlags & TransformFlags.ContainsClassFields) { + switch (node.kind) { + case SyntaxKind.PropertyDeclaration: + return visitPropertyDeclaration(node as PropertyDeclaration); } } } - return visitEachChild(node, visitor, context); - } - - function discardedValueVisitor(node: Node): VisitResult { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node: Node): VisitResult { - return visitorWorker(node, /*valueIsDiscarded*/ false); + return visitEachChild(node, visitor, context); } function heritageClauseVisitor(node: Node): VisitResult { @@ -257,7 +298,7 @@ namespace ts { return visitor(node); } - function visitorDestructuringTarget(node: Node): VisitResult { + function destructuringTargetVisitor(node: Node): VisitResult { switch (node.kind) { case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.ArrayLiteralExpression: @@ -313,29 +354,48 @@ namespace ts { * @param node The node to visit. */ function classElementVisitor(node: Node): VisitResult { - switch (node.kind) { - case SyntaxKind.Constructor: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; + if (shouldTransformInitializers) { + switch (node.kind) { + case SyntaxKind.Constructor: + // Constructors for classes using class fields are transformed in + // `visitClassDeclaration` or `visitClassExpression`. + return undefined; - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.MethodDeclaration: - return visitMethodOrAccessorDeclaration(node as MethodDeclaration | AccessorDeclaration); + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.MethodDeclaration: + return visitMethodOrAccessorDeclaration(node as MethodDeclaration | AccessorDeclaration); - case SyntaxKind.PropertyDeclaration: - return visitPropertyDeclaration(node as PropertyDeclaration); + case SyntaxKind.PropertyDeclaration: + return visitPropertyDeclaration(node as PropertyDeclaration); - case SyntaxKind.ComputedPropertyName: - return visitComputedPropertyName(node as ComputedPropertyName); + case SyntaxKind.SemicolonClassElement: + return node; + } + } - case SyntaxKind.SemicolonClassElement: - return node; + if (shouldTransformAutoAccessors) { + switch (node.kind) { + case SyntaxKind.PropertyDeclaration: + return visitPropertyDeclaration(node as PropertyDeclaration); + } + } - default: - return visitor(node); + switch (node.kind) { + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = undefined; + const result = visitEachChild(node, classElementVisitor, context); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + case SyntaxKind.ComputedPropertyName: + return visitComputedPropertyName(node as ComputedPropertyName); } + + return visitor(node); } function visitVariableStatement(node: VariableStatement) { @@ -351,18 +411,18 @@ namespace ts { return statement; } - function visitComputedPropertyName(name: ComputedPropertyName) { - let node = visitEachChild(name, visitor, context); + function visitComputedPropertyName(node: ComputedPropertyName) { + let expression = visitNode(node.expression, visitor, isExpression); if (some(pendingExpressions)) { - const expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName( - node, - factory.inlineExpressions(expressions) - ); + if (isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions([...pendingExpressions, expression.expression])); + } + else { + expression = factory.inlineExpressions([...pendingExpressions, expression]); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); } function visitMethodOrAccessorDeclaration(node: MethodDeclaration | AccessorDeclaration) { @@ -385,7 +445,7 @@ namespace ts { factory.createAssignment( functionName, factory.createFunctionExpression( - filter(node.modifiers, (m): m is Modifier => isModifier(m) && !isStaticModifier(m)), + filter(node.modifiers, (m): m is Modifier => isModifier(m) && !isStaticModifier(m) && !isAccessorModifier(m)), node.asteriskToken, functionName, /* typeParameters */ undefined, @@ -420,34 +480,93 @@ namespace ts { } } - function visitPropertyDeclaration(node: PropertyDeclaration) { - Debug.assert(!hasDecorators(node)); + function accessorFieldResultVisitor(node: Node) { + switch (node.kind) { + case SyntaxKind.PropertyDeclaration: + return transformFieldInitializer(node as PropertyDeclaration); + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return classElementVisitor(node); + default: + Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } - if (isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (isStatic(node)) { - // static fields are left as is - return visitEachChild(node, visitor, context); - } + function transformAutoAccessor(node: AutoAccessorPropertyDeclaration): VisitResult { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration( - node, - visitNodes(node.modifiers, visitor, isModifierLike), - node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined - ); - } + Debug.assertEachNode(node.modifiers, isModifier); + + const commentRange = getCommentRange(node); + const sourceMapRange = getSourceMapRange(node); - // leave invalid code untransformed - const info = accessPrivateIdentifier(node.name); - Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + const name = node.name; + let getterName = name; + let setterName = name; + if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression)) { + const temp = factory.createTempVariable(hoistVariableDeclaration); + setSourceMapRange(temp, name.expression); + const expression = visitNode(name.expression, visitor, isExpression); + const assignment = factory.createAssignment(temp, expression); + setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + + const backingField = createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + setOriginalNode(backingField, node); + setEmitFlags(backingField, EmitFlags.NoComments); + setSourceMapRange(backingField, sourceMapRange); + + const getter = createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + setOriginalNode(getter, node); + setCommentRange(getter, commentRange); + setSourceMapRange(getter, sourceMapRange); + + const setter = createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + setOriginalNode(setter, node); + setEmitFlags(setter, EmitFlags.NoComments); + setSourceMapRange(setter, sourceMapRange); + + return visitArray([backingField, getter, setter], accessorFieldResultVisitor, isClassElement); + } + + function transformPrivateFieldInitializer(node: PrivateIdentifierPropertyDeclaration) { + if (!shouldTransformPrivateElementsOrClassStaticBlocks) { + if (isStatic(node)) { + // static fields are left as is + return visitEachChild(node, classElementVisitor, context); } + + // Initializer is elided as the field is initialized in transformConstructor. + return factory.updatePropertyDeclaration( + node, + visitNodes(node.modifiers, visitor, isModifierLike), + node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined + ); + } + + const info = accessPrivateIdentifier(node.name); + Debug.assert(info, "Undeclared private name for property declaration."); + + // leave invalid code untransformed + if (!info.isValid) { + return node; } + } + + function transformPublicFieldInitializer(node: PropertyDeclaration) { // Create a temporary variable to store a computed property name (if necessary). // If it's not inlineable, then we emit an expression after the class which assigns // the property name to the temporary variable. @@ -478,6 +597,30 @@ namespace ts { return undefined; } + function transformFieldInitializer(node: PropertyDeclaration) { + Debug.assert(!hasDecorators(node)); + + if (!shouldTransformInitializers) { + return visitEachChild(node, classElementVisitor, context); + } + + if (isPrivateIdentifierClassElementDeclaration(node)) { + return transformPrivateFieldInitializer(node); + } + + return transformPublicFieldInitializer(node); + } + + function visitPropertyDeclaration(node: PropertyDeclaration) { + // If this is an accessor field, we defer to `transformAccessorField`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + + return transformFieldInitializer(node); + } + function createPrivateIdentifierAccess(info: PrivateIdentifierInfo, receiver: Expression): Expression { return createPrivateIdentifierAccessHelper(info, visitNode(receiver, visitor, isExpression)); } @@ -790,7 +933,7 @@ namespace ts { pendingExpressions = undefined; node = factory.updateBinaryExpression( node, - visitNode(node.left, visitorDestructuringTarget), + visitNode(node.left, destructuringTargetVisitor), node.operatorToken, visitNode(node.right, visitor) ); @@ -939,9 +1082,17 @@ namespace ts { /** * Set up the environment for a class. */ - function visitClassLike(node: ClassLikeDeclaration) { - if (!forEach(node.members, doesClassElementNeedTransform)) { - return visitEachChild(node, visitor, context); + function visitClassLikeDeclaration(node: ClassLikeDeclaration) { + const shouldTransform = shouldTransformInitializers + && node.transformFlags & TransformFlags.ContainsClassFields + && forEach(node.members, doesClassElementNeedTransform); + + if (!shouldTransform) { + const savedPendingExpressions = pendingExpressions; + pendingExpressions = undefined; + const result = visitEachChild(node, visitor, context); + pendingExpressions = savedPendingExpressions; + return result; } const savedPendingExpressions = pendingExpressions; @@ -951,7 +1102,7 @@ namespace ts { if (shouldTransformPrivateElementsOrClassStaticBlocks) { const name = getNameOfDeclaration(node); if (name && isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = idText(name); + getPrivateIdentifierEnvironment().className = name; } const privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); @@ -988,7 +1139,7 @@ namespace ts { } for (const member of node.members) { if (!isStatic(member)) continue; - if (member.name && isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= ClassFacts.NeedsClassConstructorReference; } if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) { @@ -1186,13 +1337,21 @@ namespace ts { // Declare private names. for (const member of node.members) { if (isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + + if (shouldTransformAutoAccessors) { + for (const member of node.members) { + if (isAutoAccessorPropertyDeclaration(member)) { + addPrivateIdentifierToEnvironment(member, factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"), addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } const constructor = transformConstructor(node, isDerivedClass); @@ -1273,7 +1432,7 @@ namespace ts { function transformConstructorBody(node: ClassDeclaration | ClassExpression, constructor: ConstructorDeclaration | undefined, isDerivedClass: boolean) { let properties = getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = filter(properties, property => !!property.initializer || isPrivateIdentifier(property.name)); + properties = filter(properties, property => !!property.initializer || isPrivateIdentifier(property.name) || hasAccessorModifier(property)); } const privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); @@ -1435,9 +1594,10 @@ namespace ts { } const statement = factory.createExpressionStatement(expression); + setOriginalNode(statement, property); + addEmitFlags(statement, getEmitFlags(property) & EmitFlags.NoComments); setSourceMapRange(statement, moveRangePastModifiers(property)); setCommentRange(statement, property); - setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. @@ -1462,9 +1622,10 @@ namespace ts { continue; } startOnNewLine(expression); + setOriginalNode(expression, property); + addEmitFlags(expression, getEmitFlags(property) & EmitFlags.NoComments); setSourceMapRange(expression, moveRangePastModifiers(property)); setCommentRange(expression, property); - setOriginalNode(expression, property); expressions.push(expression); } @@ -1493,9 +1654,13 @@ namespace ts { function transformPropertyWorker(property: PropertyDeclaration, receiver: LeftHandSideExpression) { // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) const emitAssignment = !useDefineForClassFields; - const propertyName = isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + + const propertyName = + hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; @@ -1597,7 +1762,7 @@ namespace ts { * @param methods An array of method declarations. * @param receiver The receiver on which each method should be assigned. */ - function addMethodStatements(statements: Statement[], methods: readonly (MethodDeclaration | AccessorDeclaration)[], receiver: LeftHandSideExpression) { + function addMethodStatements(statements: Statement[], methods: readonly (MethodDeclaration | AccessorDeclaration | AutoAccessorPropertyDeclaration)[], receiver: LeftHandSideExpression) { if (!shouldTransformPrivateElementsOrClassStaticBlocks || !some(methods)) { return; } @@ -1802,99 +1967,61 @@ namespace ts { function getPrivateIdentifierEnvironment() { const lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment ||= { - className: "", - identifiers: new Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }; return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions ??= []; } - function addPrivateIdentifierToEnvironment(node: PrivateClassElementDeclaration) { - const text = getTextOfPropertyName(node.name) as string; - const lex = getClassLexicalEnvironment(); - const { classConstructor } = lex; - - const privateEnv = getPrivateIdentifierEnvironment(); - const { weakSetName } = privateEnv; - - const assignmentExpressions: Expression[] = []; - - const privateName = node.name.escapedText; - const previousInfo = privateEnv.identifiers.get(privateName); - const isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - - if (hasStaticModifier(node)) { - Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (isPropertyDeclaration(node)) { - const variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: PrivateIdentifierKind.Field, - variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid, - }); - } - else if (isMethodDeclaration(node)) { - const functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: PrivateIdentifierKind.Method, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid, - }); - } - else if (isGetAccessorDeclaration(node)) { - const getterName = createHoistedVariableForPrivateName(text + "_get", node); - if (previousInfo?.kind === PrivateIdentifierKind.Accessor && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: PrivateIdentifierKind.Accessor, - getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid, - }); - } - } - else if (isSetAccessorDeclaration(node)) { - const setterName = createHoistedVariableForPrivateName(text + "_set", node); - if (previousInfo?.kind === PrivateIdentifierKind.Accessor && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: PrivateIdentifierKind.Accessor, - getterName: undefined, - setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid, - }); - } - } - else { - Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node: T, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined) { + if (isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (isPropertyDeclaration(node)) { - const weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (isMethodDeclaration(node)) { + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node: PropertyDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined) { + if (isStatic) { + Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + + const variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: PrivateIdentifierKind.Field, + brandCheckIdentifier: lex.classConstructor, + variableName, + isStatic: true, + isValid, + }); + } + else { + const weakMapName = createHoistedVariableForPrivateName(name); + + setPrivateIdentifier(privateEnv, name, { kind: PrivateIdentifierKind.Field, brandCheckIdentifier: weakMapName, - isStatic: false, variableName: undefined, + isStatic: false, isValid, }); - assignmentExpressions.push(factory.createAssignment( + getPendingExpressions().push(factory.createAssignment( weakMapName, factory.createNewExpression( factory.createIdentifier("WeakMap"), @@ -1903,66 +2030,98 @@ namespace ts { ) )); } - else if (isMethodDeclaration(node)) { - Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); + } - privateEnv.identifiers.set(privateName, { - kind: PrivateIdentifierKind.Method, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + function addPrivateIdentifierMethodDeclarationToEnvironment(_node: MethodDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined) { + const methodName = createHoistedVariableForPrivateName(name); + const brandCheckIdentifier = isStatic ? + Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + + setPrivateIdentifier(privateEnv, name, { + kind: PrivateIdentifierKind.Method, + methodName, + brandCheckIdentifier, + isStatic, + isValid, + }); + } + + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node: GetAccessorDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined) { + const getterName = createHoistedVariableForPrivateName(name, "_get"); + const brandCheckIdentifier = isStatic ? + Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + + if (previousInfo?.kind === PrivateIdentifierKind.Accessor && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: PrivateIdentifierKind.Accessor, + getterName, + setterName: undefined, + brandCheckIdentifier, + isStatic, isValid, }); } - else if (isAccessor(node)) { - Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); + } - if (isGetAccessor(node)) { - const getterName = createHoistedVariableForPrivateName(text + "_get", node); + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node: SetAccessorDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined) { + const setterName = createHoistedVariableForPrivateName(name, "_set"); + const brandCheckIdentifier = isStatic ? + Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); - if (previousInfo?.kind === PrivateIdentifierKind.Accessor && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: PrivateIdentifierKind.Accessor, - getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid, - }); - } - } - else { - const setterName = createHoistedVariableForPrivateName(text + "_set", node); - - if (previousInfo?.kind === PrivateIdentifierKind.Accessor && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: PrivateIdentifierKind.Accessor, - getterName: undefined, - setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid, - }); - } - } + if (previousInfo?.kind === PrivateIdentifierKind.Accessor && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; } else { - Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: PrivateIdentifierKind.Accessor, + getterName: undefined, + setterName, + brandCheckIdentifier, + isStatic, + isValid, + }); } + } + + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node: AutoAccessorPropertyDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined) { + const getterName = createHoistedVariableForPrivateName(name, "_get"); + const setterName = createHoistedVariableForPrivateName(name, "_set"); + const brandCheckIdentifier = isStatic ? + Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + + setPrivateIdentifier(privateEnv, name, { + kind: PrivateIdentifierKind.Accessor, + getterName, + setterName, + brandCheckIdentifier, + isStatic, + isValid, + }); + } - getPendingExpressions().push(...assignmentExpressions); + function addPrivateIdentifierToEnvironment(node: T, name: PrivateIdentifier, addDeclaration: (node: T, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined) => void) { + const lex = getClassLexicalEnvironment(); + const privateEnv = getPrivateIdentifierEnvironment(); + const previousInfo = getPrivateIdentifier(privateEnv, name); + const isStatic = hasStaticModifier(node); + const isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } - function createHoistedVariableForClass(name: string, node: PrivateIdentifier | ClassStaticBlockDeclaration): Identifier { + function createHoistedVariableForClass(name: string | PrivateIdentifier | undefined, node: PrivateIdentifier | ClassStaticBlockDeclaration, suffix?: string): Identifier { const { className } = getPrivateIdentifierEnvironment(); - const prefix = className ? `_${className}` : ""; - const identifier = factory.createUniqueName(`${prefix}_${name}`, GeneratedIdentifierFlags.Optimistic); + const prefix: GeneratedNamePart | string = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + const identifier = + typeof name === "object" ? factory.getGeneratedNameForNode(name, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.ReservedInNestedScopes, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, GeneratedIdentifierFlags.Optimistic, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.BlockScopedBindingInLoop) { addBlockScopedVariable(identifier); @@ -1974,13 +2133,34 @@ namespace ts { return identifier; } - function createHoistedVariableForPrivateName(privateName: string, node: PrivateClassElementDeclaration): Identifier { - return createHoistedVariableForClass(privateName.substring(1), node.name); + function createHoistedVariableForPrivateName(name: PrivateIdentifier, suffix?: string): Identifier { + const text = tryGetTextOfPropertyName(name) as string | undefined; + return createHoistedVariableForClass(text?.substring(1) ?? name, name, suffix); } function accessPrivateIdentifier(name: PrivateIdentifier) { + if (isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + + function accessPrivateIdentifierByText(text: __String) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + + function accessGeneratedPrivateIdentifier(name: GeneratedPrivateIdentifier) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, getNodeForGeneratedName(name)); + } + + function accessPrivateIdentifierWorker( + getPrivateIdentifierInfo: (privateEnv: PrivateIdentifierEnvironment, key: K) => PrivateIdentifierInfo | undefined, + privateIdentifierKey: K + ) { if (currentClassLexicalEnvironment?.privateIdentifierEnvironment) { - const info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + const info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -1990,9 +2170,11 @@ namespace ts { if (!env) { continue; } - const info = env.privateIdentifierEnvironment?.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + const info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -2073,7 +2255,7 @@ namespace ts { } } } - return visitNode(node, visitorDestructuringTarget); + return visitNode(node, destructuringTargetVisitor); } function visitObjectAssignmentTarget(node: ObjectLiteralElementLike) { @@ -2119,13 +2301,13 @@ namespace ts { visitNode(node.name, visitor, isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, visitNode(initializer, visitor)) : wrapped : - visitNode(node.initializer, visitorDestructuringTarget, isExpression) + visitNode(node.initializer, destructuringTargetVisitor, isExpression) ); } if (isSpreadAssignment(node)) { return factory.updateSpreadAssignment( node, - wrapped || visitNode(node.expression, visitorDestructuringTarget, isExpression) + wrapped || visitNode(node.expression, destructuringTargetVisitor, isExpression) ); } Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); @@ -2191,6 +2373,31 @@ namespace ts { } function isReservedPrivateName(node: PrivateIdentifier) { - return node.escapedText === "#constructor"; + return !isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + + function getPrivateIdentifier(privateEnv: PrivateIdentifierEnvironment, name: PrivateIdentifier) { + return isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + + function setPrivateIdentifier(privateEnv: PrivateIdentifierEnvironment, name: PrivateIdentifier, info: PrivateIdentifierInfo) { + if (isGeneratedPrivateIdentifier(name)) { + privateEnv.generatedIdentifiers ??= new Map(); + privateEnv.generatedIdentifiers.set(getNodeForGeneratedName(name), info); + } + else { + privateEnv.identifiers ??= new Map(); + privateEnv.identifiers.set(name.escapedText, info); + } + } + + function getPrivateIdentifierInfo(privateEnv: PrivateIdentifierEnvironment, key: __String) { + return privateEnv.identifiers?.get(key); + } + + function getGeneratedPrivateIdentifierInfo(privateEnv: PrivateIdentifierEnvironment, key: Node) { + return privateEnv.generatedIdentifiers?.get(key); } } diff --git a/src/compiler/transformers/legacyDecorators.ts b/src/compiler/transformers/legacyDecorators.ts index 37889e91c00b9..fac91f5f6f584 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -503,7 +503,7 @@ namespace ts { const prefix = getClassMemberPrefix(node, member); const memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !hasSyntacticModifier(member, ModifierFlags.Ambient)); const descriptor = languageVersion > ScriptTarget.ES3 - ? member.kind === SyntaxKind.PropertyDeclaration + ? isPropertyDeclaration(member) && !hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() diff --git a/src/compiler/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index bbe8f165919bf..2c0552ee40c42 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -381,8 +381,8 @@ namespace ts { * * @param member The class element node. */ - export function isNonStaticMethodOrAccessorWithPrivateName(member: ClassElement): member is PrivateIdentifierMethodDeclaration | PrivateIdentifierAccessorDeclaration { - return !isStatic(member) && isMethodOrAccessor(member) && isPrivateIdentifier(member.name); + export function isNonStaticMethodOrAccessorWithPrivateName(member: ClassElement): member is PrivateIdentifierMethodDeclaration | PrivateIdentifierAccessorDeclaration | PrivateIdentifierAutoAccessorPropertyDeclaration { + return !isStatic(member) && (isMethodOrAccessor(member) || isAutoAccessorPropertyDeclaration(member)) && isPrivateIdentifier(member.name); } /** diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2fb40e37d3ff0..bda77e561762d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -159,6 +159,7 @@ namespace ts { YieldKeyword, // Contextual keywords AbstractKeyword, + AccessorKeyword, AsKeyword, AssertsKeyword, AssertKeyword, @@ -550,6 +551,7 @@ namespace ts { export type KeywordSyntaxKind = | SyntaxKind.AbstractKeyword + | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword @@ -634,6 +636,7 @@ namespace ts { export type ModifierSyntaxKind = | SyntaxKind.AbstractKeyword + | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword @@ -817,9 +820,10 @@ namespace ts { Protected = 1 << 4, // Property/Method Static = 1 << 5, // Property/Method Readonly = 1 << 6, // Property/Method - Abstract = 1 << 7, // Class/Method/ConstructSignature - Async = 1 << 8, // Property/Method/Function - Default = 1 << 9, // Function/Class (export default declaration) + Accessor = 1 << 7, // Property + Abstract = 1 << 8, // Class/Method/ConstructSignature + Async = 1 << 9, // Property/Method/Function + Default = 1 << 10, // Function/Class (export default declaration) Const = 1 << 11, // Const enum HasComputedJSDocModifiers = 1 << 12, // Indicates the computed modifier flags include modifiers from JSDoc. @@ -837,7 +841,7 @@ namespace ts { TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const | Override | In | Out, ExportDefault = Export | Default, - All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Async | Default | Const | Deprecated | Override | In | Out | Decorator, + All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Accessor | Async | Default | Const | Deprecated | Override | In | Out | Decorator, Modifier = All & ~Decorator } @@ -1332,6 +1336,7 @@ namespace ts { } export type AbstractKeyword = ModifierToken; + export type AccessorKeyword = ModifierToken; export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; @@ -1351,6 +1356,7 @@ namespace ts { export type Modifier = | AbstractKeyword + | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword @@ -1383,6 +1389,7 @@ namespace ts { | AccessibilityModifier | ReadonlyKeyword | StaticKeyword + | AccessorKeyword ; export type ModifiersArray = NodeArray; @@ -1413,6 +1420,8 @@ namespace ts { readonly originalKeywordKind?: SyntaxKind; // Original syntaxKind which get set so that we can report an error later /*@internal*/ readonly autoGenerateFlags?: GeneratedIdentifierFlags; // Specifies whether to auto-generate the text for an identifier. /*@internal*/ readonly autoGenerateId?: number; // Ensures unique generated identifiers get unique names, but clones get the same name. + /*@internal*/ readonly autoGeneratePrefix?: string | GeneratedNamePart; + /*@internal*/ readonly autoGenerateSuffix?: string; /*@internal*/ generatedImportReference?: ImportSpecifier; // Reference to the generated import specifier this identifier refers to isInJSDocNamespace?: boolean; // if the node is a member in a JSDoc namespace /*@internal*/ typeArguments?: NodeArray; // Only defined on synthesized nodes. Though not syntactically valid, used in emitting diagnostics, quickinfo, and signature help. @@ -1502,8 +1511,16 @@ namespace ts { // escaping not strictly necessary // avoids gotchas in transforms and utils readonly escapedText: __String; + /*@internal*/ readonly autoGenerateFlags?: GeneratedIdentifierFlags; // Specifies whether to auto-generate the text for an identifier. + /*@internal*/ readonly autoGenerateId?: number; // Ensures unique generated identifiers get unique names, but clones get the same name. + /*@internal*/ readonly autoGeneratePrefix?: string | GeneratedNamePart; + /*@internal*/ readonly autoGenerateSuffix?: string; } + /*@internal*/ + export interface GeneratedPrivateIdentifier extends PrivateIdentifier { + autoGenerateFlags: GeneratedIdentifierFlags; + } /* @internal */ // A name that supports late-binding (used in checker) @@ -1627,11 +1644,19 @@ namespace ts { readonly initializer?: Expression; // Optional initializer } + export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { + _autoAccessorBrand: any; + } + /*@internal*/ export interface PrivateIdentifierPropertyDeclaration extends PropertyDeclaration { name: PrivateIdentifier; } /*@internal*/ + export interface PrivateIdentifierAutoAccessorPropertyDeclaration extends AutoAccessorPropertyDeclaration { + name: PrivateIdentifier; + } + /*@internal*/ export interface PrivateIdentifierMethodDeclaration extends MethodDeclaration { name: PrivateIdentifier; } @@ -1648,6 +1673,7 @@ namespace ts { /*@internal*/ export type PrivateClassElementDeclaration = | PrivateIdentifierPropertyDeclaration + | PrivateIdentifierAutoAccessorPropertyDeclaration | PrivateIdentifierMethodDeclaration | PrivateIdentifierGetAccessorDeclaration | PrivateIdentifierSetAccessorDeclaration; @@ -2051,7 +2077,7 @@ namespace ts { export interface StringLiteral extends LiteralExpression, Declaration { readonly kind: SyntaxKind.StringLiteral; - /* @internal */ readonly textSourceNode?: Identifier | StringLiteralLike | NumericLiteral; // Allows a StringLiteral to get its text from another node (used by transforms). + /* @internal */ readonly textSourceNode?: Identifier | StringLiteralLike | NumericLiteral | PrivateIdentifier; // Allows a StringLiteral to get its text from another node (used by transforms). /** Note: this is only set when synthesizing a node, not during parsing. */ /* @internal */ readonly singleQuote?: boolean; } @@ -5287,6 +5313,7 @@ namespace ts { MethodExcludes = Value & ~Method, GetAccessorExcludes = Value & ~SetAccessor, SetAccessorExcludes = Value & ~GetAccessor, + AccessorExcludes = Value & ~Accessor, TypeParameterExcludes = Type & ~TypeParameter, TypeAliasExcludes = Type, AliasExcludes = Alias, @@ -7590,6 +7617,15 @@ namespace ts { convertToAssignmentElementTarget(node: BindingOrAssignmentElementTarget): Expression; } + /* @internal */ + export interface GeneratedNamePart { + /** an additional prefix to insert before the text sourced from `node` */ + prefix?: string; + node: Identifier | PrivateIdentifier; + /** an additional suffix to insert after the text sourced from `node` */ + suffix?: string; + } + export interface NodeFactory { /* @internal */ readonly parenthesizer: ParenthesizerRules; /* @internal */ readonly converters: NodeConverters; @@ -7605,7 +7641,7 @@ namespace ts { createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; /* @internal*/ createStringLiteral(text: string, isSingleQuote?: boolean, hasExtendedUnicodeEscape?: boolean): StringLiteral; // eslint-disable-line @typescript-eslint/unified-signatures - createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; + createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; createRegularExpressionLiteral(text: string): RegularExpressionLiteral; // @@ -7626,6 +7662,7 @@ namespace ts { * setting `EmitFlags.ReuseTempVariableScope` on the nested function itself. */ createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean): Identifier; + /*@internal*/ createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean, prefix?: string | GeneratedNamePart, suffix?: string): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures /** * Create a unique temporary variable for use in a loop. @@ -7637,11 +7674,17 @@ namespace ts { /** Create a unique name based on the supplied text. */ createUniqueName(text: string, flags?: GeneratedIdentifierFlags): Identifier; + /*@internal*/ createUniqueName(text: string, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures /** Create a unique name generated for a node. */ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; + /*@internal*/ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures createPrivateIdentifier(text: string): PrivateIdentifier + createUniquePrivateName(text?: string): PrivateIdentifier; + /*@internal*/ createUniquePrivateName(text?: string, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier; // eslint-disable-line @typescript-eslint/unified-signatures + getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; + /*@internal*/ getGeneratedPrivateNameForNode(node: Node, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier; // eslint-disable-line @typescript-eslint/unified-signatures // // Punctuation @@ -8508,7 +8551,7 @@ namespace ts { (nodes: NodeArray | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; } - export type VisitResult = T | T[] | undefined; + export type VisitResult = T | readonly T[] | undefined; export interface Printer { /** diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index c2ff0ab4fc7b0..792c7d1f5cb3c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -853,6 +853,10 @@ namespace ts { return false; } + export function isAmbientPropertyDeclaration(node: PropertyDeclaration) { + return !!(node.flags & NodeFlags.Ambient) || hasSyntacticModifier(node, ModifierFlags.Ambient); + } + export function isBlockScope(node: Node, parentNode: Node | undefined): boolean { switch (node.kind) { case SyntaxKind.SourceFile: @@ -996,7 +1000,7 @@ namespace ts { switch (name.kind) { case SyntaxKind.Identifier: case SyntaxKind.PrivateIdentifier: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case SyntaxKind.StringLiteral: case SyntaxKind.NumericLiteral: case SyntaxKind.NoSubstitutionTemplateLiteral: @@ -3407,7 +3411,7 @@ namespace ts { return false; } } - export function getTextOfIdentifierOrLiteral(node: PropertyNameLiteral): string { + export function getTextOfIdentifierOrLiteral(node: PropertyNameLiteral | PrivateIdentifier): string { return isMemberName(node) ? idText(node) : node.text; } @@ -4922,6 +4926,10 @@ namespace ts { return hasSyntacticModifier(node, ModifierFlags.Ambient); } + export function hasAccessorModifier(node: Node): boolean { + return hasSyntacticModifier(node, ModifierFlags.Accessor); + } + export function hasEffectiveReadonlyModifier(node: Node): boolean { return hasEffectiveModifier(node, ModifierFlags.Readonly); } @@ -5031,6 +5039,7 @@ namespace ts { case SyntaxKind.ProtectedKeyword: return ModifierFlags.Protected; case SyntaxKind.PrivateKeyword: return ModifierFlags.Private; case SyntaxKind.AbstractKeyword: return ModifierFlags.Abstract; + case SyntaxKind.AccessorKeyword: return ModifierFlags.Accessor; case SyntaxKind.ExportKeyword: return ModifierFlags.Export; case SyntaxKind.DeclareKeyword: return ModifierFlags.Ambient; case SyntaxKind.ConstKeyword: return ModifierFlags.Const; @@ -5045,10 +5054,6 @@ namespace ts { return ModifierFlags.None; } - export function createModifiers(modifierFlags: ModifierFlags): ModifiersArray | undefined { - return modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - export function isLogicalOperator(token: SyntaxKind): boolean { return token === SyntaxKind.BarBarToken || token === SyntaxKind.AmpersandAmpersandToken diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index bc80f301e3ff8..c8b959eb8f87c 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1199,6 +1199,11 @@ namespace ts { return isIdentifier(node) && (node.autoGenerateFlags! & GeneratedIdentifierFlags.KindMask) > GeneratedIdentifierFlags.None; } + /* @internal */ + export function isGeneratedPrivateIdentifier(node: Node): node is GeneratedPrivateIdentifier { + return isPrivateIdentifier(node) && (node.autoGenerateFlags! & GeneratedIdentifierFlags.KindMask) > GeneratedIdentifierFlags.None; + } + // Private Identifiers /*@internal*/ export function isPrivateIdentifierClassElementDeclaration(node: Node): node is PrivateClassElementDeclaration { @@ -1216,6 +1221,7 @@ namespace ts { export function isModifierKind(token: SyntaxKind): token is Modifier["kind"] { switch (token) { case SyntaxKind.AbstractKeyword: + case SyntaxKind.AccessorKeyword: case SyntaxKind.AsyncKeyword: case SyntaxKind.ConstKeyword: case SyntaxKind.DeclareKeyword: @@ -1241,7 +1247,10 @@ namespace ts { /* @internal */ export function isClassMemberModifier(idToken: SyntaxKind): boolean { - return isParameterPropertyModifier(idToken) || idToken === SyntaxKind.StaticKeyword || idToken === SyntaxKind.OverrideKeyword; + return isParameterPropertyModifier(idToken) || + idToken === SyntaxKind.StaticKeyword || + idToken === SyntaxKind.OverrideKeyword || + idToken === SyntaxKind.AccessorKeyword; } export function isModifier(node: Node): node is Modifier { @@ -1349,6 +1358,10 @@ namespace ts { return node && (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor); } + export function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration { + return isPropertyDeclaration(node) && hasAccessorModifier(node); + } + /* @internal */ export function isMethodOrAccessor(node: Node): node is MethodDeclaration | AccessorDeclaration { switch (node.kind) { @@ -1361,6 +1374,19 @@ namespace ts { } } + /* @internal */ + export function isNamedClassElement(node: Node): node is MethodDeclaration | AccessorDeclaration | PropertyDeclaration { + switch (node.kind) { + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.PropertyDeclaration: + return true; + default: + return false; + } + } + // Type members export function isModifierLike(node: Node): node is ModifierLike { diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 02eeee55ad72f..4069b1f86164a 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -44,6 +44,9 @@ namespace ts { return visitedNode as T; } + /* @internal */ + export function visitNodes(nodes: NodeArray, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): NodeArray; + /** * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. * @@ -55,6 +58,9 @@ namespace ts { */ export function visitNodes(nodes: NodeArray, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; + /* @internal */ + export function visitNodes(nodes: NodeArray | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): NodeArray | undefined; + /** * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. * @@ -116,7 +122,14 @@ namespace ts { } /* @internal */ - export function visitArray(nodes: readonly T[] | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): readonly U[] | undefined { + export function visitArray(nodes: T[] | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): U[] | undefined; + /* @internal */ + export function visitArray(nodes: readonly T[] | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): readonly U[] | undefined; + /* @internal */ + export function visitArray(nodes: T[] | undefined, visitor: Visitor, test: (node: Node) => node is T, start?: number, count?: number): T[] | undefined; + /* @internal */ + export function visitArray(nodes: readonly T[] | undefined, visitor: Visitor, test: (node: Node) => node is T, start?: number, count?: number): readonly T[] | undefined; + export function visitArray(nodes: readonly T[] | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number) { if (nodes === undefined) { return nodes; } diff --git a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts index 6b14268806cdf..3bb201d1ec8a2 100644 --- a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts +++ b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts @@ -30,7 +30,7 @@ namespace ts { export const createLoopVariable = Debug.deprecate(factory.createLoopVariable, factoryDeprecation); /** @deprecated Use `factory.createUniqueName` or the factory supplied by your transformation context instead. */ - export const createUniqueName = Debug.deprecate(factory.createUniqueName, factoryDeprecation); + export const createUniqueName: (text: string, flags?: GeneratedIdentifierFlags | undefined) => Identifier = Debug.deprecate(factory.createUniqueName, factoryDeprecation); /** @deprecated Use `factory.createPrivateIdentifier` or the factory supplied by your transformation context instead. */ export const createPrivateIdentifier = Debug.deprecate(factory.createPrivateIdentifier, factoryDeprecation); diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index c43b8f0bc4cdd..4112072d38835 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1271,6 +1271,7 @@ namespace FourSlashInterface { export const classElementKeywords: readonly ExpectedCompletionEntryObject[] = [ "abstract", + "accessor", "async", "constructor", "declare", diff --git a/src/services/classifier.ts b/src/services/classifier.ts index ac15be962ab47..635652610a418 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -320,6 +320,7 @@ namespace ts { case SyntaxKind.SetKeyword: case SyntaxKind.ConstructorKeyword: case SyntaxKind.StaticKeyword: + case SyntaxKind.AccessorKeyword: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. diff --git a/src/services/codefixes/generateAccessors.ts b/src/services/codefixes/generateAccessors.ts index 7486feab0648c..4fe71a352158a 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -29,18 +29,18 @@ namespace ts.codefix { suppressLeadingAndTrailingTrivia(declaration); suppressLeadingAndTrailingTrivia(container); - let accessorModifiers: NodeArray | undefined; + let accessorModifiers: readonly ModifierLike[] | undefined; let fieldModifiers: readonly ModifierLike[] | undefined; if (isClassLike(container)) { const modifierFlags = getEffectiveModifierFlags(declaration); if (isSourceFileJS(file)) { - const modifiers = createModifiers(modifierFlags); + const modifiers = factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (canHaveDecorators(declaration)) { fieldModifiers = concatenate(getDecorators(declaration), fieldModifiers); @@ -146,7 +146,7 @@ namespace ts.codefix { }; } - function generateGetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode | undefined, modifiers: NodeArray | undefined, isStatic: boolean, container: ContainerDeclaration) { + function generateGetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode | undefined, modifiers: readonly ModifierLike[] | undefined, isStatic: boolean, container: ContainerDeclaration) { return factory.createGetAccessorDeclaration( modifiers, accessorName, @@ -160,7 +160,7 @@ namespace ts.codefix { ); } - function generateSetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode | undefined, modifiers: NodeArray | undefined, isStatic: boolean, container: ContainerDeclaration) { + function generateSetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode | undefined, modifiers: readonly ModifierLike[] | undefined, isStatic: boolean, container: ContainerDeclaration) { return factory.createSetAccessorDeclaration( modifiers, accessorName, diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index ba8bd0453dd09..5e26fbb38ab63 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -79,8 +79,16 @@ namespace ts.codefix { * In such cases, we assume the declaration to be a `PropertySignature`. */ const kind = declaration?.kind ?? SyntaxKind.PropertySignature; - const declarationName = getNameOfDeclaration(declaration) as PropertyName; - const visibilityModifier = createVisibilityModifier(declaration ? getEffectiveModifierFlags(declaration) : ModifierFlags.None); + const declarationName = getSynthesizedDeepClone(getNameOfDeclaration(declaration), /*includeTrivia*/ false) as PropertyName; + const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : ModifierFlags.None; + let modifierFlags = + effectiveModifierFlags & ModifierFlags.Public ? ModifierFlags.Public : + effectiveModifierFlags & ModifierFlags.Protected ? ModifierFlags.Protected : + ModifierFlags.None; + if (declaration && isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= ModifierFlags.Accessor; + } + const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); const optional = !!(symbol.flags & SymbolFlags.Optional); const ambient = !!(enclosingDeclaration.flags & NodeFlags.Ambient) || isAmbient; @@ -99,7 +107,7 @@ namespace ts.codefix { } } addClassElement(factory.createPropertyDeclaration( - createModifiers(visibilityModifier), + modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & PreserveOptionalFlags.Property) ? factory.createToken(SyntaxKind.QuestionToken) : undefined, typeNode, @@ -123,7 +131,7 @@ namespace ts.codefix { for (const accessor of orderedAccessors) { if (isGetAccessorDeclaration(accessor)) { addClassElement(factory.createGetAccessorDeclaration( - createModifiers(visibilityModifier), + modifiers, createName(declarationName), emptyArray, createTypeNode(typeNode), @@ -134,7 +142,7 @@ namespace ts.codefix { const parameter = getSetAccessorValueParameter(accessor); const parameterName = parameter && isIdentifier(parameter.name) ? idText(parameter.name) : undefined; addClassElement(factory.createSetAccessorDeclaration( - createModifiers(visibilityModifier), + modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); @@ -160,23 +168,23 @@ namespace ts.codefix { if (declarations.length === 1) { Debug.assert(signatures.length === 1, "One declaration implies one signature"); const signature = signatures[0]; - outputMethod(quotePreference, signature, createModifiers(visibilityModifier), createName(declarationName), createBody(body, quotePreference, ambient)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } for (const signature of signatures) { // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, createModifiers(visibilityModifier), createName(declarationName)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { const signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1] as SignatureDeclaration)!; - outputMethod(quotePreference, signature, createModifiers(visibilityModifier), createName(declarationName), createBody(body, quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & PreserveOptionalFlags.Method), createModifiers(visibilityModifier), quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & PreserveOptionalFlags.Method), modifiers, quotePreference, body)); } } break; @@ -191,10 +199,6 @@ namespace ts.codefix { return getSynthesizedDeepClone(node, /*includeTrivia*/ false); } - function createModifiers(modifier: Modifier | undefined) { - return modifier ? factory.createNodeArray([modifier]) : undefined; - } - function createBody(block: Block | undefined, quotePreference: QuotePreference, ambient?: boolean) { return ambient ? undefined : getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); @@ -644,16 +648,6 @@ namespace ts.codefix { /*multiline*/ true); } - function createVisibilityModifier(flags: ModifierFlags): Modifier | undefined { - if (flags & ModifierFlags.Public) { - return factory.createToken(SyntaxKind.PublicKeyword); - } - else if (flags & ModifierFlags.Protected) { - return factory.createToken(SyntaxKind.ProtectedKeyword); - } - return undefined; - } - export function setJsonCompilerOptionValues( changeTracker: textChanges.ChangeTracker, configFile: TsConfigSourceFile, diff --git a/src/services/completions.ts b/src/services/completions.ts index 36724b760a966..48e1c28bf01de 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -3949,6 +3949,7 @@ namespace ts.Completions { function isClassMemberCompletionKeyword(kind: SyntaxKind) { switch (kind) { case SyntaxKind.AbstractKeyword: + case SyntaxKind.AccessorKeyword: case SyntaxKind.ConstructorKeyword: case SyntaxKind.GetKeyword: case SyntaxKind.SetKeyword: diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 144f97831bb17..9ed9c159cc7ca 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -149,6 +149,7 @@ namespace ts.formatting { "SpaceAfterCertainTypeScriptKeywords", [ SyntaxKind.AbstractKeyword, + SyntaxKind.AccessorKeyword, SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index 44113d901572e..87b5e16f29db9 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -159,7 +159,7 @@ namespace ts.SymbolDisplay { if (symbolKind !== ScriptElementKind.unknown || symbolFlags & SymbolFlags.Class || symbolFlags & SymbolFlags.Alias) { // If symbol is accessor, they are allowed only if location is at declaration identifier of the accessor if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { - const declaration = find(symbol.declarations as ((GetAccessorDeclaration | SetAccessorDeclaration)[]), declaration => declaration.name === location); + const declaration = find(symbol.declarations as ((GetAccessorDeclaration | SetAccessorDeclaration | PropertyDeclaration)[]), declaration => declaration.name === location); if (declaration) { switch(declaration.kind){ case SyntaxKind.GetAccessor: @@ -168,6 +168,9 @@ namespace ts.SymbolDisplay { case SyntaxKind.SetAccessor: symbolKind = ScriptElementKind.memberSetAccessorElement; break; + case SyntaxKind.PropertyDeclaration: + symbolKind = ScriptElementKind.memberAccessorVariableElement; + break; default: Debug.assertNever(declaration); } @@ -509,6 +512,7 @@ namespace ts.SymbolDisplay { } // For properties, variables and local vars: show the type if (symbolKind === ScriptElementKind.memberVariableElement || + symbolKind === ScriptElementKind.memberAccessorVariableElement || symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement || symbolKind === ScriptElementKind.jsxAttribute || diff --git a/src/services/types.ts b/src/services/types.ts index ff3d2ed56bcb4..98de7db46fe90 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1467,6 +1467,9 @@ namespace ts { */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", + /** * class X { constructor() { } } * class X { static { } } diff --git a/tests/baselines/reference/accessorField1(target=es2015).js b/tests/baselines/reference/accessorField1(target=es2015).js new file mode 100644 index 0000000000000..e3a8a5baf03ce --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2015).js @@ -0,0 +1,39 @@ +//// [accessorField1.ts] +class C1 { + accessor a: any; + accessor b = 1; + static accessor c: any; + static accessor d = 2; +} + + +//// [accessorField1.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _a, _C1_a_accessor_storage, _C1_b_accessor_storage, _C1_c_accessor_storage, _C1_d_accessor_storage; +class C1 { + constructor() { + _C1_a_accessor_storage.set(this, void 0); + _C1_b_accessor_storage.set(this, 1); + } + get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } + get b() { return __classPrivateFieldGet(this, _C1_b_accessor_storage, "f"); } + set b(value) { __classPrivateFieldSet(this, _C1_b_accessor_storage, value, "f"); } + static get c() { return __classPrivateFieldGet(this, _a, "f", _C1_c_accessor_storage); } + static set c(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_c_accessor_storage); } + static get d() { return __classPrivateFieldGet(this, _a, "f", _C1_d_accessor_storage); } + static set d(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_d_accessor_storage); } +} +_a = C1, _C1_a_accessor_storage = new WeakMap(), _C1_b_accessor_storage = new WeakMap(); +_C1_c_accessor_storage = { value: void 0 }; +_C1_d_accessor_storage = { value: 2 }; diff --git a/tests/baselines/reference/accessorField1(target=es2015).symbols b/tests/baselines/reference/accessorField1(target=es2015).symbols new file mode 100644 index 0000000000000..28111d6f8fdaf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2015).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=es2015).types b/tests/baselines/reference/accessorField1(target=es2015).types new file mode 100644 index 0000000000000..de41def82af66 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2015).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + accessor b = 1; +>b : number +>1 : 1 + + static accessor c: any; +>c : any + + static accessor d = 2; +>d : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField1(target=es2022).js b/tests/baselines/reference/accessorField1(target=es2022).js new file mode 100644 index 0000000000000..5c481928b48e0 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2022).js @@ -0,0 +1,24 @@ +//// [accessorField1.ts] +class C1 { + accessor a: any; + accessor b = 1; + static accessor c: any; + static accessor d = 2; +} + + +//// [accessorField1.js] +class C1 { + #a_accessor_storage; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } + #b_accessor_storage = 1; + get b() { return this.#b_accessor_storage; } + set b(value) { this.#b_accessor_storage = value; } + static #c_accessor_storage; + static get c() { return this.#c_accessor_storage; } + static set c(value) { this.#c_accessor_storage = value; } + static #d_accessor_storage = 2; + static get d() { return this.#d_accessor_storage; } + static set d(value) { this.#d_accessor_storage = value; } +} diff --git a/tests/baselines/reference/accessorField1(target=es2022).symbols b/tests/baselines/reference/accessorField1(target=es2022).symbols new file mode 100644 index 0000000000000..28111d6f8fdaf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2022).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=es2022).types b/tests/baselines/reference/accessorField1(target=es2022).types new file mode 100644 index 0000000000000..de41def82af66 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2022).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + accessor b = 1; +>b : number +>1 : 1 + + static accessor c: any; +>c : any + + static accessor d = 2; +>d : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField1(target=es5).errors.txt b/tests/baselines/reference/accessorField1(target=es5).errors.txt new file mode 100644 index 0000000000000..c9b2c82112a99 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts (4 errors) ==== + class C1 { + accessor a: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor b = 1; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor c: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor d = 2; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField1(target=es5).symbols b/tests/baselines/reference/accessorField1(target=es5).symbols new file mode 100644 index 0000000000000..28111d6f8fdaf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es5).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=es5).types b/tests/baselines/reference/accessorField1(target=es5).types new file mode 100644 index 0000000000000..de41def82af66 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es5).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + accessor b = 1; +>b : number +>1 : 1 + + static accessor c: any; +>c : any + + static accessor d = 2; +>d : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField1(target=esnext).js b/tests/baselines/reference/accessorField1(target=esnext).js new file mode 100644 index 0000000000000..9d9f7f3db7ccf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=esnext).js @@ -0,0 +1,16 @@ +//// [accessorField1.ts] +class C1 { + accessor a: any; + accessor b = 1; + static accessor c: any; + static accessor d = 2; +} + + +//// [accessorField1.js] +class C1 { + accessor a; + accessor b = 1; + static accessor c; + static accessor d = 2; +} diff --git a/tests/baselines/reference/accessorField1(target=esnext).symbols b/tests/baselines/reference/accessorField1(target=esnext).symbols new file mode 100644 index 0000000000000..28111d6f8fdaf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=esnext).types b/tests/baselines/reference/accessorField1(target=esnext).types new file mode 100644 index 0000000000000..de41def82af66 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=esnext).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + accessor b = 1; +>b : number +>1 : 1 + + static accessor c: any; +>c : any + + static accessor d = 2; +>d : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField2(target=es2015).js b/tests/baselines/reference/accessorField2(target=es2015).js new file mode 100644 index 0000000000000..5697106f48fc4 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2015).js @@ -0,0 +1,48 @@ +//// [accessorField2.ts] +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} + + +//// [accessorField2.js] +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _C1_instances, _a, _C1_a_get, _C1_a_set, _C1_b_get, _C1_b_set, _C1_c_get, _C1_c_set, _C1_d_get, _C1_d_set, _C1_a_accessor_storage, _C1_b_accessor_storage, _C1_c_accessor_storage, _C1_d_accessor_storage; +class C1 { + constructor() { + _C1_instances.add(this); + _C1_a_accessor_storage.set(this, void 0); + _C1_b_accessor_storage.set(this, 1); + __classPrivateFieldSet(this, _C1_instances, 3, "a", _C1_a_set); + __classPrivateFieldSet(this, _C1_instances, 4, "a", _C1_b_set); + } +} +_a = C1, _C1_instances = new WeakSet(), _C1_a_accessor_storage = new WeakMap(), _C1_b_accessor_storage = new WeakMap(), _C1_a_get = function _C1_a_get() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); }, _C1_a_set = function _C1_a_set(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); }, _C1_b_get = function _C1_b_get() { return __classPrivateFieldGet(this, _C1_b_accessor_storage, "f"); }, _C1_b_set = function _C1_b_set(value) { __classPrivateFieldSet(this, _C1_b_accessor_storage, value, "f"); }, _C1_c_get = function _C1_c_get() { return __classPrivateFieldGet(this, _a, "f", _C1_c_accessor_storage); }, _C1_c_set = function _C1_c_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_c_accessor_storage); }, _C1_d_get = function _C1_d_get() { return __classPrivateFieldGet(this, _a, "f", _C1_d_accessor_storage); }, _C1_d_set = function _C1_d_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_d_accessor_storage); }; +_C1_c_accessor_storage = { value: void 0 }; +_C1_d_accessor_storage = { value: 2 }; +(() => { + __classPrivateFieldSet(_a, _a, 5, "a", _C1_c_set); + __classPrivateFieldSet(_a, _a, 6, "a", _C1_d_set); +})(); diff --git a/tests/baselines/reference/accessorField2(target=es2015).symbols b/tests/baselines/reference/accessorField2(target=es2015).symbols new file mode 100644 index 0000000000000..cd33647f39592 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2015).symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + accessor #a: any; +>#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) + + accessor #b = 1; +>#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) + + static accessor #c: any; +>#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) + + static accessor #d = 2; +>#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) + + constructor() { + this.#a = 3; +>this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#b = 4; +>this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } + + static { + this.#c = 5; +>this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#d = 6; +>this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/accessorField2(target=es2015).types b/tests/baselines/reference/accessorField2(target=es2015).types new file mode 100644 index 0000000000000..c440eae8a725f --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2015).types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : C1 + + accessor #a: any; +>#a : any + + accessor #b = 1; +>#b : number +>1 : 1 + + static accessor #c: any; +>#c : any + + static accessor #d = 2; +>#d : number +>2 : 2 + + constructor() { + this.#a = 3; +>this.#a = 3 : 3 +>this.#a : any +>this : this +>3 : 3 + + this.#b = 4; +>this.#b = 4 : 4 +>this.#b : number +>this : this +>4 : 4 + } + + static { + this.#c = 5; +>this.#c = 5 : 5 +>this.#c : any +>this : typeof C1 +>5 : 5 + + this.#d = 6; +>this.#d = 6 : 6 +>this.#d : number +>this : typeof C1 +>6 : 6 + } +} + diff --git a/tests/baselines/reference/accessorField2(target=es2022).js b/tests/baselines/reference/accessorField2(target=es2022).js new file mode 100644 index 0000000000000..00a5a76ab6128 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2022).js @@ -0,0 +1,42 @@ +//// [accessorField2.ts] +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} + + +//// [accessorField2.js] +class C1 { + #a_accessor_storage; + get #a() { return this.#a_accessor_storage; } + set #a(value) { this.#a_accessor_storage = value; } + #b_accessor_storage = 1; + get #b() { return this.#b_accessor_storage; } + set #b(value) { this.#b_accessor_storage = value; } + static #c_accessor_storage; + static get #c() { return this.#c_accessor_storage; } + static set #c(value) { this.#c_accessor_storage = value; } + static #d_accessor_storage = 2; + static get #d() { return this.#d_accessor_storage; } + static set #d(value) { this.#d_accessor_storage = value; } + constructor() { + this.#a = 3; + this.#b = 4; + } + static { + this.#c = 5; + this.#d = 6; + } +} diff --git a/tests/baselines/reference/accessorField2(target=es2022).symbols b/tests/baselines/reference/accessorField2(target=es2022).symbols new file mode 100644 index 0000000000000..cd33647f39592 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2022).symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + accessor #a: any; +>#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) + + accessor #b = 1; +>#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) + + static accessor #c: any; +>#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) + + static accessor #d = 2; +>#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) + + constructor() { + this.#a = 3; +>this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#b = 4; +>this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } + + static { + this.#c = 5; +>this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#d = 6; +>this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/accessorField2(target=es2022).types b/tests/baselines/reference/accessorField2(target=es2022).types new file mode 100644 index 0000000000000..c440eae8a725f --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2022).types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : C1 + + accessor #a: any; +>#a : any + + accessor #b = 1; +>#b : number +>1 : 1 + + static accessor #c: any; +>#c : any + + static accessor #d = 2; +>#d : number +>2 : 2 + + constructor() { + this.#a = 3; +>this.#a = 3 : 3 +>this.#a : any +>this : this +>3 : 3 + + this.#b = 4; +>this.#b = 4 : 4 +>this.#b : number +>this : this +>4 : 4 + } + + static { + this.#c = 5; +>this.#c = 5 : 5 +>this.#c : any +>this : typeof C1 +>5 : 5 + + this.#d = 6; +>this.#d = 6 : 6 +>this.#d : number +>this : typeof C1 +>6 : 6 + } +} + diff --git a/tests/baselines/reference/accessorField2(target=esnext).js b/tests/baselines/reference/accessorField2(target=esnext).js new file mode 100644 index 0000000000000..bcfad4951288a --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=esnext).js @@ -0,0 +1,34 @@ +//// [accessorField2.ts] +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} + + +//// [accessorField2.js] +class C1 { + accessor #a; + accessor #b = 1; + static accessor #c; + static accessor #d = 2; + constructor() { + this.#a = 3; + this.#b = 4; + } + static { + this.#c = 5; + this.#d = 6; + } +} diff --git a/tests/baselines/reference/accessorField2(target=esnext).symbols b/tests/baselines/reference/accessorField2(target=esnext).symbols new file mode 100644 index 0000000000000..cd33647f39592 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=esnext).symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + accessor #a: any; +>#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) + + accessor #b = 1; +>#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) + + static accessor #c: any; +>#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) + + static accessor #d = 2; +>#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) + + constructor() { + this.#a = 3; +>this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#b = 4; +>this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } + + static { + this.#c = 5; +>this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#d = 6; +>this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/accessorField2(target=esnext).types b/tests/baselines/reference/accessorField2(target=esnext).types new file mode 100644 index 0000000000000..c440eae8a725f --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=esnext).types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : C1 + + accessor #a: any; +>#a : any + + accessor #b = 1; +>#b : number +>1 : 1 + + static accessor #c: any; +>#c : any + + static accessor #d = 2; +>#d : number +>2 : 2 + + constructor() { + this.#a = 3; +>this.#a = 3 : 3 +>this.#a : any +>this : this +>3 : 3 + + this.#b = 4; +>this.#b = 4 : 4 +>this.#b : number +>this : this +>4 : 4 + } + + static { + this.#c = 5; +>this.#c = 5 : 5 +>this.#c : any +>this : typeof C1 +>5 : 5 + + this.#d = 6; +>this.#d = 6 : 6 +>this.#d : number +>this : typeof C1 +>6 : 6 + } +} + diff --git a/tests/baselines/reference/accessorField3(target=es2015).js b/tests/baselines/reference/accessorField3(target=es2015).js new file mode 100644 index 0000000000000..302d5fdc600eb --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2015).js @@ -0,0 +1,39 @@ +//// [accessorField3.ts] +class C1 { + accessor "w": any; + accessor "x" = 1; + static accessor "y": any; + static accessor "z" = 2; +} + + +//// [accessorField3.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage; +class C1 { + constructor() { + _C1__a_accessor_storage.set(this, void 0); + _C1__b_accessor_storage.set(this, 1); + } + get "w"() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); } + set "w"(value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); } + get "x"() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); } + set "x"(value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); } + static get "y"() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); } + static set "y"(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); } + static get "z"() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); } + static set "z"(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); } +} +_a = C1, _C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(); +_C1__c_accessor_storage = { value: void 0 }; +_C1__d_accessor_storage = { value: 2 }; diff --git a/tests/baselines/reference/accessorField3(target=es2015).symbols b/tests/baselines/reference/accessorField3(target=es2015).symbols new file mode 100644 index 0000000000000..0312c5a3cd1a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2015).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=es2015).types b/tests/baselines/reference/accessorField3(target=es2015).types new file mode 100644 index 0000000000000..4434ebeda37a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2015).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : C1 + + accessor "w": any; +>"w" : any + + accessor "x" = 1; +>"x" : number +>1 : 1 + + static accessor "y": any; +>"y" : any + + static accessor "z" = 2; +>"z" : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField3(target=es2022).js b/tests/baselines/reference/accessorField3(target=es2022).js new file mode 100644 index 0000000000000..4cb2eed6d7678 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2022).js @@ -0,0 +1,24 @@ +//// [accessorField3.ts] +class C1 { + accessor "w": any; + accessor "x" = 1; + static accessor "y": any; + static accessor "z" = 2; +} + + +//// [accessorField3.js] +class C1 { + #_a_accessor_storage; + get "w"() { return this.#_a_accessor_storage; } + set "w"(value) { this.#_a_accessor_storage = value; } + #_b_accessor_storage = 1; + get "x"() { return this.#_b_accessor_storage; } + set "x"(value) { this.#_b_accessor_storage = value; } + static #_c_accessor_storage; + static get "y"() { return this.#_c_accessor_storage; } + static set "y"(value) { this.#_c_accessor_storage = value; } + static #_d_accessor_storage = 2; + static get "z"() { return this.#_d_accessor_storage; } + static set "z"(value) { this.#_d_accessor_storage = value; } +} diff --git a/tests/baselines/reference/accessorField3(target=es2022).symbols b/tests/baselines/reference/accessorField3(target=es2022).symbols new file mode 100644 index 0000000000000..0312c5a3cd1a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2022).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=es2022).types b/tests/baselines/reference/accessorField3(target=es2022).types new file mode 100644 index 0000000000000..4434ebeda37a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2022).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : C1 + + accessor "w": any; +>"w" : any + + accessor "x" = 1; +>"x" : number +>1 : 1 + + static accessor "y": any; +>"y" : any + + static accessor "z" = 2; +>"z" : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField3(target=es5).errors.txt b/tests/baselines/reference/accessorField3(target=es5).errors.txt new file mode 100644 index 0000000000000..c52b7002bbceb --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts (4 errors) ==== + class C1 { + accessor "w": any; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor "x" = 1; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor "y": any; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor "z" = 2; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField3(target=es5).symbols b/tests/baselines/reference/accessorField3(target=es5).symbols new file mode 100644 index 0000000000000..0312c5a3cd1a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es5).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=es5).types b/tests/baselines/reference/accessorField3(target=es5).types new file mode 100644 index 0000000000000..4434ebeda37a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es5).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : C1 + + accessor "w": any; +>"w" : any + + accessor "x" = 1; +>"x" : number +>1 : 1 + + static accessor "y": any; +>"y" : any + + static accessor "z" = 2; +>"z" : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField3(target=esnext).js b/tests/baselines/reference/accessorField3(target=esnext).js new file mode 100644 index 0000000000000..6535fef4ac5d9 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=esnext).js @@ -0,0 +1,16 @@ +//// [accessorField3.ts] +class C1 { + accessor "w": any; + accessor "x" = 1; + static accessor "y": any; + static accessor "z" = 2; +} + + +//// [accessorField3.js] +class C1 { + accessor "w"; + accessor "x" = 1; + static accessor "y"; + static accessor "z" = 2; +} diff --git a/tests/baselines/reference/accessorField3(target=esnext).symbols b/tests/baselines/reference/accessorField3(target=esnext).symbols new file mode 100644 index 0000000000000..0312c5a3cd1a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=esnext).types b/tests/baselines/reference/accessorField3(target=esnext).types new file mode 100644 index 0000000000000..4434ebeda37a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=esnext).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : C1 + + accessor "w": any; +>"w" : any + + accessor "x" = 1; +>"x" : number +>1 : 1 + + static accessor "y": any; +>"y" : any + + static accessor "z" = 2; +>"z" : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField4(target=es2015).js b/tests/baselines/reference/accessorField4(target=es2015).js new file mode 100644 index 0000000000000..8631dca33e409 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2015).js @@ -0,0 +1,39 @@ +//// [accessorField4.ts] +class C1 { + accessor 0: any; + accessor 1 = 1; + static accessor 2: any; + static accessor 3 = 2; +} + + +//// [accessorField4.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage; +class C1 { + constructor() { + _C1__a_accessor_storage.set(this, void 0); + _C1__b_accessor_storage.set(this, 1); + } + get 0() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); } + set 0(value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); } + get 1() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); } + set 1(value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); } + static get 2() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); } + static set 2(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); } + static get 3() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); } + static set 3(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); } +} +_a = C1, _C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(); +_C1__c_accessor_storage = { value: void 0 }; +_C1__d_accessor_storage = { value: 2 }; diff --git a/tests/baselines/reference/accessorField4(target=es2015).symbols b/tests/baselines/reference/accessorField4(target=es2015).symbols new file mode 100644 index 0000000000000..7720dcdf7d897 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2015).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=es2015).types b/tests/baselines/reference/accessorField4(target=es2015).types new file mode 100644 index 0000000000000..702dc296d9b4c --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2015).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : C1 + + accessor 0: any; +>0 : any + + accessor 1 = 1; +>1 : number +>1 : 1 + + static accessor 2: any; +>2 : any + + static accessor 3 = 2; +>3 : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField4(target=es2022).js b/tests/baselines/reference/accessorField4(target=es2022).js new file mode 100644 index 0000000000000..603b4bd3999b1 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2022).js @@ -0,0 +1,24 @@ +//// [accessorField4.ts] +class C1 { + accessor 0: any; + accessor 1 = 1; + static accessor 2: any; + static accessor 3 = 2; +} + + +//// [accessorField4.js] +class C1 { + #_a_accessor_storage; + get 0() { return this.#_a_accessor_storage; } + set 0(value) { this.#_a_accessor_storage = value; } + #_b_accessor_storage = 1; + get 1() { return this.#_b_accessor_storage; } + set 1(value) { this.#_b_accessor_storage = value; } + static #_c_accessor_storage; + static get 2() { return this.#_c_accessor_storage; } + static set 2(value) { this.#_c_accessor_storage = value; } + static #_d_accessor_storage = 2; + static get 3() { return this.#_d_accessor_storage; } + static set 3(value) { this.#_d_accessor_storage = value; } +} diff --git a/tests/baselines/reference/accessorField4(target=es2022).symbols b/tests/baselines/reference/accessorField4(target=es2022).symbols new file mode 100644 index 0000000000000..7720dcdf7d897 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2022).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=es2022).types b/tests/baselines/reference/accessorField4(target=es2022).types new file mode 100644 index 0000000000000..702dc296d9b4c --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2022).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : C1 + + accessor 0: any; +>0 : any + + accessor 1 = 1; +>1 : number +>1 : 1 + + static accessor 2: any; +>2 : any + + static accessor 3 = 2; +>3 : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField4(target=es5).errors.txt b/tests/baselines/reference/accessorField4(target=es5).errors.txt new file mode 100644 index 0000000000000..47b0e61b4b75a --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts (4 errors) ==== + class C1 { + accessor 0: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor 1 = 1; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor 2: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor 3 = 2; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField4(target=es5).symbols b/tests/baselines/reference/accessorField4(target=es5).symbols new file mode 100644 index 0000000000000..7720dcdf7d897 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es5).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=es5).types b/tests/baselines/reference/accessorField4(target=es5).types new file mode 100644 index 0000000000000..702dc296d9b4c --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es5).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : C1 + + accessor 0: any; +>0 : any + + accessor 1 = 1; +>1 : number +>1 : 1 + + static accessor 2: any; +>2 : any + + static accessor 3 = 2; +>3 : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField4(target=esnext).js b/tests/baselines/reference/accessorField4(target=esnext).js new file mode 100644 index 0000000000000..b0eafbf87f317 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=esnext).js @@ -0,0 +1,16 @@ +//// [accessorField4.ts] +class C1 { + accessor 0: any; + accessor 1 = 1; + static accessor 2: any; + static accessor 3 = 2; +} + + +//// [accessorField4.js] +class C1 { + accessor 0; + accessor 1 = 1; + static accessor 2; + static accessor 3 = 2; +} diff --git a/tests/baselines/reference/accessorField4(target=esnext).symbols b/tests/baselines/reference/accessorField4(target=esnext).symbols new file mode 100644 index 0000000000000..7720dcdf7d897 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=esnext).types b/tests/baselines/reference/accessorField4(target=esnext).types new file mode 100644 index 0000000000000..702dc296d9b4c --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=esnext).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : C1 + + accessor 0: any; +>0 : any + + accessor 1 = 1; +>1 : number +>1 : 1 + + static accessor 2: any; +>2 : any + + static accessor 3 = 2; +>3 : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField5(target=es2015).js b/tests/baselines/reference/accessorField5(target=es2015).js new file mode 100644 index 0000000000000..6e5f0cab385aa --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2015).js @@ -0,0 +1,53 @@ +//// [accessorField5.ts] +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + // @ts-ignore + accessor [f()] = 1; +} + +//// [accessorField5.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage, _C2__e_accessor_storage, _b; +class C1 { + constructor() { + _C1__a_accessor_storage.set(this, void 0); + _C1__b_accessor_storage.set(this, 1); + } + get [(_C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(), "w")]() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); } + set ["w"](value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); } + get ["x"]() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); } + set ["x"](value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); } + static get ["y"]() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); } + static set ["y"](value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); } + static get ["z"]() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); } + static set ["z"](value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); } +} +_a = C1; +_C1__c_accessor_storage = { value: void 0 }; +_C1__d_accessor_storage = { value: 2 }; +class C2 { + constructor() { + // @ts-ignore + _C2__e_accessor_storage.set(this, 1); + } + // @ts-ignore + get [(_C2__e_accessor_storage = new WeakMap(), _b = f(), _b)]() { return __classPrivateFieldGet(this, _C2__e_accessor_storage, "f"); } + set [_b](value) { __classPrivateFieldSet(this, _C2__e_accessor_storage, value, "f"); } +} diff --git a/tests/baselines/reference/accessorField5(target=es2015).symbols b/tests/baselines/reference/accessorField5(target=es2015).symbols new file mode 100644 index 0000000000000..e09a9785dc30f --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2015).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=es2015).types b/tests/baselines/reference/accessorField5(target=es2015).types new file mode 100644 index 0000000000000..60b575def5744 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2015).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : C1 + + accessor ["w"]: any; +>["w"] : any +>"w" : "w" + + accessor ["x"] = 1; +>["x"] : number +>"x" : "x" +>1 : 1 + + static accessor ["y"]: any; +>["y"] : any +>"y" : "y" + + static accessor ["z"] = 2; +>["z"] : number +>"z" : "z" +>2 : 2 +} + +declare var f: any; +>f : any + +class C2 { +>C2 : C2 + + // @ts-ignore + accessor [f()] = 1; +>[f()] : number +>f() : any +>f : any +>1 : 1 +} diff --git a/tests/baselines/reference/accessorField5(target=es2022).js b/tests/baselines/reference/accessorField5(target=es2022).js new file mode 100644 index 0000000000000..2388795f8ac3e --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2022).js @@ -0,0 +1,36 @@ +//// [accessorField5.ts] +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + // @ts-ignore + accessor [f()] = 1; +} + +//// [accessorField5.js] +var _a; +class C1 { + #_a_accessor_storage; + get ["w"]() { return this.#_a_accessor_storage; } + set ["w"](value) { this.#_a_accessor_storage = value; } + #_b_accessor_storage = 1; + get ["x"]() { return this.#_b_accessor_storage; } + set ["x"](value) { this.#_b_accessor_storage = value; } + static #_c_accessor_storage; + static get ["y"]() { return this.#_c_accessor_storage; } + static set ["y"](value) { this.#_c_accessor_storage = value; } + static #_d_accessor_storage = 2; + static get ["z"]() { return this.#_d_accessor_storage; } + static set ["z"](value) { this.#_d_accessor_storage = value; } +} +class C2 { + #_e_accessor_storage = 1; + // @ts-ignore + get [(_a = f(), _a)]() { return this.#_e_accessor_storage; } + set [_a](value) { this.#_e_accessor_storage = value; } +} diff --git a/tests/baselines/reference/accessorField5(target=es2022).symbols b/tests/baselines/reference/accessorField5(target=es2022).symbols new file mode 100644 index 0000000000000..e09a9785dc30f --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2022).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=es2022).types b/tests/baselines/reference/accessorField5(target=es2022).types new file mode 100644 index 0000000000000..60b575def5744 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2022).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : C1 + + accessor ["w"]: any; +>["w"] : any +>"w" : "w" + + accessor ["x"] = 1; +>["x"] : number +>"x" : "x" +>1 : 1 + + static accessor ["y"]: any; +>["y"] : any +>"y" : "y" + + static accessor ["z"] = 2; +>["z"] : number +>"z" : "z" +>2 : 2 +} + +declare var f: any; +>f : any + +class C2 { +>C2 : C2 + + // @ts-ignore + accessor [f()] = 1; +>[f()] : number +>f() : any +>f : any +>1 : 1 +} diff --git a/tests/baselines/reference/accessorField5(target=es5).errors.txt b/tests/baselines/reference/accessorField5(target=es5).errors.txt new file mode 100644 index 0000000000000..52fa176a00b10 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es5).errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts (4 errors) ==== + class C1 { + accessor ["w"]: any; + ~~~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor ["x"] = 1; + ~~~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor ["y"]: any; + ~~~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor ["z"] = 2; + ~~~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + + declare var f: any; + class C2 { + // @ts-ignore + accessor [f()] = 1; + } \ No newline at end of file diff --git a/tests/baselines/reference/accessorField5(target=es5).symbols b/tests/baselines/reference/accessorField5(target=es5).symbols new file mode 100644 index 0000000000000..e09a9785dc30f --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es5).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=es5).types b/tests/baselines/reference/accessorField5(target=es5).types new file mode 100644 index 0000000000000..60b575def5744 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es5).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : C1 + + accessor ["w"]: any; +>["w"] : any +>"w" : "w" + + accessor ["x"] = 1; +>["x"] : number +>"x" : "x" +>1 : 1 + + static accessor ["y"]: any; +>["y"] : any +>"y" : "y" + + static accessor ["z"] = 2; +>["z"] : number +>"z" : "z" +>2 : 2 +} + +declare var f: any; +>f : any + +class C2 { +>C2 : C2 + + // @ts-ignore + accessor [f()] = 1; +>[f()] : number +>f() : any +>f : any +>1 : 1 +} diff --git a/tests/baselines/reference/accessorField5(target=esnext).js b/tests/baselines/reference/accessorField5(target=esnext).js new file mode 100644 index 0000000000000..7c84d37e73c3d --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=esnext).js @@ -0,0 +1,25 @@ +//// [accessorField5.ts] +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + // @ts-ignore + accessor [f()] = 1; +} + +//// [accessorField5.js] +class C1 { + accessor ["w"]; + accessor ["x"] = 1; + static accessor ["y"]; + static accessor ["z"] = 2; +} +class C2 { + // @ts-ignore + accessor [f()] = 1; +} diff --git a/tests/baselines/reference/accessorField5(target=esnext).symbols b/tests/baselines/reference/accessorField5(target=esnext).symbols new file mode 100644 index 0000000000000..e09a9785dc30f --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=esnext).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=esnext).types b/tests/baselines/reference/accessorField5(target=esnext).types new file mode 100644 index 0000000000000..60b575def5744 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=esnext).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : C1 + + accessor ["w"]: any; +>["w"] : any +>"w" : "w" + + accessor ["x"] = 1; +>["x"] : number +>"x" : "x" +>1 : 1 + + static accessor ["y"]: any; +>["y"] : any +>"y" : "y" + + static accessor ["z"] = 2; +>["z"] : number +>"z" : "z" +>2 : 2 +} + +declare var f: any; +>f : any + +class C2 { +>C2 : C2 + + // @ts-ignore + accessor [f()] = 1; +>[f()] : number +>f() : any +>f : any +>1 : 1 +} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..b2afea001fa94 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js @@ -0,0 +1,41 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C1_a_accessor_storage; +class C1 { + get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } +} +_C1_a_accessor_storage = new WeakMap(); +class C2 extends C1 { + constructor() { + super(...arguments); + this.a = 1; + } +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..e217a7d9eb0c6 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js @@ -0,0 +1,49 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C1_a_accessor_storage; +class C1 { + constructor() { + _C1_a_accessor_storage.set(this, void 0); + } + get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } +} +_C1_a_accessor_storage = new WeakMap(); +class C2 extends C1 { + constructor() { + super(...arguments); + Object.defineProperty(this, "a", { + enumerable: true, + configurable: true, + writable: true, + value: 1 + }); + } +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..27f356be65eef --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js @@ -0,0 +1,29 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +class C1 { + #a_accessor_storage; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } +} +class C2 extends C1 { + constructor() { + super(...arguments); + this.a = 1; + } +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..a2816090e4614 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js @@ -0,0 +1,26 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +class C1 { + #a_accessor_storage; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } +} +class C2 extends C1 { + a = 1; +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..e38b062084739 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js @@ -0,0 +1,26 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + this.a = 1; + } +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..e6550dab6f237 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js @@ -0,0 +1,24 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +class C1 { + accessor a; +} +class C2 extends C1 { + a = 1; +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..272f35f30706c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js @@ -0,0 +1,41 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C2_a_accessor_storage; +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + _C2_a_accessor_storage.set(this, 1); + } + get a() { return __classPrivateFieldGet(this, _C2_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C2_a_accessor_storage, value, "f"); } +} +_C2_a_accessor_storage = new WeakMap(); +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..272f35f30706c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js @@ -0,0 +1,41 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C2_a_accessor_storage; +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + _C2_a_accessor_storage.set(this, 1); + } + get a() { return __classPrivateFieldGet(this, _C2_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C2_a_accessor_storage, value, "f"); } +} +_C2_a_accessor_storage = new WeakMap(); +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..ff282b347ece2 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js @@ -0,0 +1,29 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + this.#a_accessor_storage = 1; + } + #a_accessor_storage; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } +} +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..eb3c26be94053 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js @@ -0,0 +1,25 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +class C1 { +} +class C2 extends C1 { + #a_accessor_storage = 1; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } +} +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..d84530fda0c48 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js @@ -0,0 +1,26 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + this.#a_1 = 1; + } +} +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..7951a92f92ba1 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js @@ -0,0 +1,23 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +class C1 { +} +class C2 extends C1 { + accessor a = 1; +} +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField8.js b/tests/baselines/reference/accessorField8.js new file mode 100644 index 0000000000000..b34d65f1f55e4 --- /dev/null +++ b/tests/baselines/reference/accessorField8.js @@ -0,0 +1,49 @@ +//// [accessorField8.ts] +class C1 { + accessor a: any; + static accessor b: any; +} + +declare class C2 { + accessor a: any; + static accessor b: any; +} + +function f() { + class C3 { + accessor a: any; + static accessor b: any; + } + return C3; +} + + +//// [accessorField8.js] +class C1 { + accessor a; + static accessor b; +} +function f() { + class C3 { + accessor a; + static accessor b; + } + return C3; +} + + +//// [accessorField8.d.ts] +declare class C1 { + accessor a: any; + static accessor b: any; +} +declare class C2 { + accessor a: any; + static accessor b: any; +} +declare function f(): { + new (): { + a: any; + }; + b: any; +}; diff --git a/tests/baselines/reference/accessorField8.symbols b/tests/baselines/reference/accessorField8.symbols new file mode 100644 index 0000000000000..77018c3b42ae5 --- /dev/null +++ b/tests/baselines/reference/accessorField8.symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField8.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField8.ts, 0, 10)) + + static accessor b: any; +>b : Symbol(C1.b, Decl(accessorField8.ts, 1, 20)) +} + +declare class C2 { +>C2 : Symbol(C2, Decl(accessorField8.ts, 3, 1)) + + accessor a: any; +>a : Symbol(C2.a, Decl(accessorField8.ts, 5, 18)) + + static accessor b: any; +>b : Symbol(C2.b, Decl(accessorField8.ts, 6, 20)) +} + +function f() { +>f : Symbol(f, Decl(accessorField8.ts, 8, 1)) + + class C3 { +>C3 : Symbol(C3, Decl(accessorField8.ts, 10, 14)) + + accessor a: any; +>a : Symbol(C3.a, Decl(accessorField8.ts, 11, 14)) + + static accessor b: any; +>b : Symbol(C3.b, Decl(accessorField8.ts, 12, 24)) + } + return C3; +>C3 : Symbol(C3, Decl(accessorField8.ts, 10, 14)) +} + diff --git a/tests/baselines/reference/accessorField8.types b/tests/baselines/reference/accessorField8.types new file mode 100644 index 0000000000000..040ad200d7865 --- /dev/null +++ b/tests/baselines/reference/accessorField8.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + static accessor b: any; +>b : any +} + +declare class C2 { +>C2 : C2 + + accessor a: any; +>a : any + + static accessor b: any; +>b : any +} + +function f() { +>f : () => typeof C3 + + class C3 { +>C3 : C3 + + accessor a: any; +>a : any + + static accessor b: any; +>b : any + } + return C3; +>C3 : typeof C3 +} + diff --git a/tests/baselines/reference/accessorFieldAllowedModifiers.js b/tests/baselines/reference/accessorFieldAllowedModifiers.js new file mode 100644 index 0000000000000..fb45e88068f84 --- /dev/null +++ b/tests/baselines/reference/accessorFieldAllowedModifiers.js @@ -0,0 +1,49 @@ +//// [accessorFieldAllowedModifiers.ts] +abstract class C1 { + accessor a: any; + public accessor b: any; + private accessor c: any; + protected accessor d: any; + abstract accessor e: any; + static accessor f: any; + public static accessor g: any; + private static accessor h: any; + protected static accessor i: any; + accessor #j: any; + accessor "k": any; + accessor 108: any; + accessor ["m"]: any; + accessor n!: number; +} + +class C2 extends C1 { + override accessor e: any; + static override accessor i: any; +} + +declare class C3 { + accessor a: any; +} + + + +//// [accessorFieldAllowedModifiers.js] +class C1 { + accessor a; + accessor b; + accessor c; + accessor d; + static accessor f; + static accessor g; + static accessor h; + static accessor i; + accessor #j; + accessor "k"; + accessor 108; + accessor ["m"]; + accessor n; +} +class C2 extends C1 { + accessor e; + static accessor i; +} diff --git a/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt b/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt new file mode 100644 index 0000000000000..0349a5292cab9 --- /dev/null +++ b/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt @@ -0,0 +1,124 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(2,14): error TS1030: 'accessor' modifier already seen. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(3,14): error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(4,13): error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(5,14): error TS1029: 'public' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(6,14): error TS1029: 'private' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(7,14): error TS1029: 'protected' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(8,14): error TS1029: 'abstract' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(9,14): error TS1029: 'static' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(10,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(11,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(12,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(13,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(14,15): error TS1276: An 'accessor' property cannot be declared optional. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(18,14): error TS1029: 'override' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(22,5): error TS1070: 'accessor' modifier cannot appear on a type member. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(25,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(26,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(27,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(28,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(29,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(30,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(31,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(32,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(33,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(33,25): error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(34,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(35,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(36,1): error TS1275: 'accessor' modifier can only appear on a property declaration. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts (28 errors) ==== + abstract class C1 { + accessor accessor a: any; + ~~~~~~~~ +!!! error TS1030: 'accessor' modifier already seen. + readonly accessor b: any; + ~~~~~~~~ +!!! error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. + declare accessor c: any; + ~~~~~~~~ +!!! error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. + accessor public d: any; + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'accessor' modifier. + accessor private e: any; + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'accessor' modifier. + accessor protected f: any; + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'accessor' modifier. + accessor abstract g: any; + ~~~~~~~~ +!!! error TS1029: 'abstract' modifier must precede 'accessor' modifier. + accessor static h: any; + ~~~~~~ +!!! error TS1029: 'static' modifier must precede 'accessor' modifier. + accessor i() {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor get j() { return false; } + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor set k(v: any) {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor constructor() {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor l?: any; + ~ +!!! error TS1276: An 'accessor' property cannot be declared optional. + } + + class C2 extends C1 { + accessor override g: any; + ~~~~~~~~ +!!! error TS1029: 'override' modifier must precede 'accessor' modifier. + } + + interface I1 { + accessor a: number; + ~~~~~~~~ +!!! error TS1070: 'accessor' modifier cannot appear on a type member. + } + + accessor class C3 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor interface I2 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor namespace N1 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor enum E1 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor var V1: any; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor type T1 = never; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor function F1() {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor import "x"; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor import {} from "x"; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + ~~~ +!!! error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + accessor export { V1 }; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor export default V1; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor import N2 = N1; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + \ No newline at end of file diff --git a/tests/baselines/reference/accessorFieldDisallowedModifiers.js b/tests/baselines/reference/accessorFieldDisallowedModifiers.js new file mode 100644 index 0000000000000..efc0082d637ad --- /dev/null +++ b/tests/baselines/reference/accessorFieldDisallowedModifiers.js @@ -0,0 +1,66 @@ +//// [accessorFieldDisallowedModifiers.ts] +abstract class C1 { + accessor accessor a: any; + readonly accessor b: any; + declare accessor c: any; + accessor public d: any; + accessor private e: any; + accessor protected f: any; + accessor abstract g: any; + accessor static h: any; + accessor i() {} + accessor get j() { return false; } + accessor set k(v: any) {} + accessor constructor() {} + accessor l?: any; +} + +class C2 extends C1 { + accessor override g: any; +} + +interface I1 { + accessor a: number; +} + +accessor class C3 {} +accessor interface I2 {} +accessor namespace N1 {} +accessor enum E1 {} +accessor var V1: any; +accessor type T1 = never; +accessor function F1() {} +accessor import "x"; +accessor import {} from "x"; +accessor export { V1 }; +accessor export default V1; +accessor import N2 = N1; + + +//// [accessorFieldDisallowedModifiers.js] +class C1 { + accessor accessor a; + accessor b; + accessor d; + accessor e; + accessor f; + accessor static h; + accessor i() { } + accessor get j() { return false; } + accessor set k(v) { } + constructor() { } + accessor l; +} +class C2 extends C1 { + accessor g; +} +accessor class C3 { +} +accessor var E1; +(function (E1) { +})(E1 || (E1 = {})); +accessor var V1; +accessor function F1() { } +accessor import "x"; +export { V1 }; +export default V1; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2544ef8fc6884..c30eeaecddad7 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -232,239 +232,240 @@ declare namespace ts { StaticKeyword = 124, YieldKeyword = 125, AbstractKeyword = 126, - AsKeyword = 127, - AssertsKeyword = 128, - AssertKeyword = 129, - AnyKeyword = 130, - AsyncKeyword = 131, - AwaitKeyword = 132, - BooleanKeyword = 133, - ConstructorKeyword = 134, - DeclareKeyword = 135, - GetKeyword = 136, - InferKeyword = 137, - IntrinsicKeyword = 138, - IsKeyword = 139, - KeyOfKeyword = 140, - ModuleKeyword = 141, - NamespaceKeyword = 142, - NeverKeyword = 143, - OutKeyword = 144, - ReadonlyKeyword = 145, - RequireKeyword = 146, - NumberKeyword = 147, - ObjectKeyword = 148, - SatisfiesKeyword = 149, - SetKeyword = 150, - StringKeyword = 151, - SymbolKeyword = 152, - TypeKeyword = 153, - UndefinedKeyword = 154, - UniqueKeyword = 155, - UnknownKeyword = 156, - FromKeyword = 157, - GlobalKeyword = 158, - BigIntKeyword = 159, - OverrideKeyword = 160, - OfKeyword = 161, - QualifiedName = 162, - ComputedPropertyName = 163, - TypeParameter = 164, - Parameter = 165, - Decorator = 166, - PropertySignature = 167, - PropertyDeclaration = 168, - MethodSignature = 169, - MethodDeclaration = 170, - ClassStaticBlockDeclaration = 171, - Constructor = 172, - GetAccessor = 173, - SetAccessor = 174, - CallSignature = 175, - ConstructSignature = 176, - IndexSignature = 177, - TypePredicate = 178, - TypeReference = 179, - FunctionType = 180, - ConstructorType = 181, - TypeQuery = 182, - TypeLiteral = 183, - ArrayType = 184, - TupleType = 185, - OptionalType = 186, - RestType = 187, - UnionType = 188, - IntersectionType = 189, - ConditionalType = 190, - InferType = 191, - ParenthesizedType = 192, - ThisType = 193, - TypeOperator = 194, - IndexedAccessType = 195, - MappedType = 196, - LiteralType = 197, - NamedTupleMember = 198, - TemplateLiteralType = 199, - TemplateLiteralTypeSpan = 200, - ImportType = 201, - ObjectBindingPattern = 202, - ArrayBindingPattern = 203, - BindingElement = 204, - ArrayLiteralExpression = 205, - ObjectLiteralExpression = 206, - PropertyAccessExpression = 207, - ElementAccessExpression = 208, - CallExpression = 209, - NewExpression = 210, - TaggedTemplateExpression = 211, - TypeAssertionExpression = 212, - ParenthesizedExpression = 213, - FunctionExpression = 214, - ArrowFunction = 215, - DeleteExpression = 216, - TypeOfExpression = 217, - VoidExpression = 218, - AwaitExpression = 219, - PrefixUnaryExpression = 220, - PostfixUnaryExpression = 221, - BinaryExpression = 222, - ConditionalExpression = 223, - TemplateExpression = 224, - YieldExpression = 225, - SpreadElement = 226, - ClassExpression = 227, - OmittedExpression = 228, - ExpressionWithTypeArguments = 229, - AsExpression = 230, - NonNullExpression = 231, - MetaProperty = 232, - SyntheticExpression = 233, - SatisfiesExpression = 234, - TemplateSpan = 235, - SemicolonClassElement = 236, - Block = 237, - EmptyStatement = 238, - VariableStatement = 239, - ExpressionStatement = 240, - IfStatement = 241, - DoStatement = 242, - WhileStatement = 243, - ForStatement = 244, - ForInStatement = 245, - ForOfStatement = 246, - ContinueStatement = 247, - BreakStatement = 248, - ReturnStatement = 249, - WithStatement = 250, - SwitchStatement = 251, - LabeledStatement = 252, - ThrowStatement = 253, - TryStatement = 254, - DebuggerStatement = 255, - VariableDeclaration = 256, - VariableDeclarationList = 257, - FunctionDeclaration = 258, - ClassDeclaration = 259, - InterfaceDeclaration = 260, - TypeAliasDeclaration = 261, - EnumDeclaration = 262, - ModuleDeclaration = 263, - ModuleBlock = 264, - CaseBlock = 265, - NamespaceExportDeclaration = 266, - ImportEqualsDeclaration = 267, - ImportDeclaration = 268, - ImportClause = 269, - NamespaceImport = 270, - NamedImports = 271, - ImportSpecifier = 272, - ExportAssignment = 273, - ExportDeclaration = 274, - NamedExports = 275, - NamespaceExport = 276, - ExportSpecifier = 277, - MissingDeclaration = 278, - ExternalModuleReference = 279, - JsxElement = 280, - JsxSelfClosingElement = 281, - JsxOpeningElement = 282, - JsxClosingElement = 283, - JsxFragment = 284, - JsxOpeningFragment = 285, - JsxClosingFragment = 286, - JsxAttribute = 287, - JsxAttributes = 288, - JsxSpreadAttribute = 289, - JsxExpression = 290, - CaseClause = 291, - DefaultClause = 292, - HeritageClause = 293, - CatchClause = 294, - AssertClause = 295, - AssertEntry = 296, - ImportTypeAssertionContainer = 297, - PropertyAssignment = 298, - ShorthandPropertyAssignment = 299, - SpreadAssignment = 300, - EnumMember = 301, - UnparsedPrologue = 302, - UnparsedPrepend = 303, - UnparsedText = 304, - UnparsedInternalText = 305, - UnparsedSyntheticReference = 306, - SourceFile = 307, - Bundle = 308, - UnparsedSource = 309, - InputFiles = 310, - JSDocTypeExpression = 311, - JSDocNameReference = 312, - JSDocMemberName = 313, - JSDocAllType = 314, - JSDocUnknownType = 315, - JSDocNullableType = 316, - JSDocNonNullableType = 317, - JSDocOptionalType = 318, - JSDocFunctionType = 319, - JSDocVariadicType = 320, - JSDocNamepathType = 321, - JSDoc = 322, + AccessorKeyword = 127, + AsKeyword = 128, + AssertsKeyword = 129, + AssertKeyword = 130, + AnyKeyword = 131, + AsyncKeyword = 132, + AwaitKeyword = 133, + BooleanKeyword = 134, + ConstructorKeyword = 135, + DeclareKeyword = 136, + GetKeyword = 137, + InferKeyword = 138, + IntrinsicKeyword = 139, + IsKeyword = 140, + KeyOfKeyword = 141, + ModuleKeyword = 142, + NamespaceKeyword = 143, + NeverKeyword = 144, + OutKeyword = 145, + ReadonlyKeyword = 146, + RequireKeyword = 147, + NumberKeyword = 148, + ObjectKeyword = 149, + SatisfiesKeyword = 150, + SetKeyword = 151, + StringKeyword = 152, + SymbolKeyword = 153, + TypeKeyword = 154, + UndefinedKeyword = 155, + UniqueKeyword = 156, + UnknownKeyword = 157, + FromKeyword = 158, + GlobalKeyword = 159, + BigIntKeyword = 160, + OverrideKeyword = 161, + OfKeyword = 162, + QualifiedName = 163, + ComputedPropertyName = 164, + TypeParameter = 165, + Parameter = 166, + Decorator = 167, + PropertySignature = 168, + PropertyDeclaration = 169, + MethodSignature = 170, + MethodDeclaration = 171, + ClassStaticBlockDeclaration = 172, + Constructor = 173, + GetAccessor = 174, + SetAccessor = 175, + CallSignature = 176, + ConstructSignature = 177, + IndexSignature = 178, + TypePredicate = 179, + TypeReference = 180, + FunctionType = 181, + ConstructorType = 182, + TypeQuery = 183, + TypeLiteral = 184, + ArrayType = 185, + TupleType = 186, + OptionalType = 187, + RestType = 188, + UnionType = 189, + IntersectionType = 190, + ConditionalType = 191, + InferType = 192, + ParenthesizedType = 193, + ThisType = 194, + TypeOperator = 195, + IndexedAccessType = 196, + MappedType = 197, + LiteralType = 198, + NamedTupleMember = 199, + TemplateLiteralType = 200, + TemplateLiteralTypeSpan = 201, + ImportType = 202, + ObjectBindingPattern = 203, + ArrayBindingPattern = 204, + BindingElement = 205, + ArrayLiteralExpression = 206, + ObjectLiteralExpression = 207, + PropertyAccessExpression = 208, + ElementAccessExpression = 209, + CallExpression = 210, + NewExpression = 211, + TaggedTemplateExpression = 212, + TypeAssertionExpression = 213, + ParenthesizedExpression = 214, + FunctionExpression = 215, + ArrowFunction = 216, + DeleteExpression = 217, + TypeOfExpression = 218, + VoidExpression = 219, + AwaitExpression = 220, + PrefixUnaryExpression = 221, + PostfixUnaryExpression = 222, + BinaryExpression = 223, + ConditionalExpression = 224, + TemplateExpression = 225, + YieldExpression = 226, + SpreadElement = 227, + ClassExpression = 228, + OmittedExpression = 229, + ExpressionWithTypeArguments = 230, + AsExpression = 231, + NonNullExpression = 232, + MetaProperty = 233, + SyntheticExpression = 234, + SatisfiesExpression = 235, + TemplateSpan = 236, + SemicolonClassElement = 237, + Block = 238, + EmptyStatement = 239, + VariableStatement = 240, + ExpressionStatement = 241, + IfStatement = 242, + DoStatement = 243, + WhileStatement = 244, + ForStatement = 245, + ForInStatement = 246, + ForOfStatement = 247, + ContinueStatement = 248, + BreakStatement = 249, + ReturnStatement = 250, + WithStatement = 251, + SwitchStatement = 252, + LabeledStatement = 253, + ThrowStatement = 254, + TryStatement = 255, + DebuggerStatement = 256, + VariableDeclaration = 257, + VariableDeclarationList = 258, + FunctionDeclaration = 259, + ClassDeclaration = 260, + InterfaceDeclaration = 261, + TypeAliasDeclaration = 262, + EnumDeclaration = 263, + ModuleDeclaration = 264, + ModuleBlock = 265, + CaseBlock = 266, + NamespaceExportDeclaration = 267, + ImportEqualsDeclaration = 268, + ImportDeclaration = 269, + ImportClause = 270, + NamespaceImport = 271, + NamedImports = 272, + ImportSpecifier = 273, + ExportAssignment = 274, + ExportDeclaration = 275, + NamedExports = 276, + NamespaceExport = 277, + ExportSpecifier = 278, + MissingDeclaration = 279, + ExternalModuleReference = 280, + JsxElement = 281, + JsxSelfClosingElement = 282, + JsxOpeningElement = 283, + JsxClosingElement = 284, + JsxFragment = 285, + JsxOpeningFragment = 286, + JsxClosingFragment = 287, + JsxAttribute = 288, + JsxAttributes = 289, + JsxSpreadAttribute = 290, + JsxExpression = 291, + CaseClause = 292, + DefaultClause = 293, + HeritageClause = 294, + CatchClause = 295, + AssertClause = 296, + AssertEntry = 297, + ImportTypeAssertionContainer = 298, + PropertyAssignment = 299, + ShorthandPropertyAssignment = 300, + SpreadAssignment = 301, + EnumMember = 302, + UnparsedPrologue = 303, + UnparsedPrepend = 304, + UnparsedText = 305, + UnparsedInternalText = 306, + UnparsedSyntheticReference = 307, + SourceFile = 308, + Bundle = 309, + UnparsedSource = 310, + InputFiles = 311, + JSDocTypeExpression = 312, + JSDocNameReference = 313, + JSDocMemberName = 314, + JSDocAllType = 315, + JSDocUnknownType = 316, + JSDocNullableType = 317, + JSDocNonNullableType = 318, + JSDocOptionalType = 319, + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + JSDoc = 323, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 322, - JSDocText = 323, - JSDocTypeLiteral = 324, - JSDocSignature = 325, - JSDocLink = 326, - JSDocLinkCode = 327, - JSDocLinkPlain = 328, - JSDocTag = 329, - JSDocAugmentsTag = 330, - JSDocImplementsTag = 331, - JSDocAuthorTag = 332, - JSDocDeprecatedTag = 333, - JSDocClassTag = 334, - JSDocPublicTag = 335, - JSDocPrivateTag = 336, - JSDocProtectedTag = 337, - JSDocReadonlyTag = 338, - JSDocOverrideTag = 339, - JSDocCallbackTag = 340, - JSDocEnumTag = 341, - JSDocParameterTag = 342, - JSDocReturnTag = 343, - JSDocThisTag = 344, - JSDocTypeTag = 345, - JSDocTemplateTag = 346, - JSDocTypedefTag = 347, - JSDocSeeTag = 348, - JSDocPropertyTag = 349, - SyntaxList = 350, - NotEmittedStatement = 351, - PartiallyEmittedExpression = 352, - CommaListExpression = 353, - MergeDeclarationMarker = 354, - EndOfDeclarationMarker = 355, - SyntheticReferenceExpression = 356, - Count = 357, + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, + JSDocSignature = 326, + JSDocLink = 327, + JSDocLinkCode = 328, + JSDocLinkPlain = 329, + JSDocTag = 330, + JSDocAugmentsTag = 331, + JSDocImplementsTag = 332, + JSDocAuthorTag = 333, + JSDocDeprecatedTag = 334, + JSDocClassTag = 335, + JSDocPublicTag = 336, + JSDocPrivateTag = 337, + JSDocProtectedTag = 338, + JSDocReadonlyTag = 339, + JSDocOverrideTag = 340, + JSDocCallbackTag = 341, + JSDocEnumTag = 342, + JSDocParameterTag = 343, + JSDocReturnTag = 344, + JSDocThisTag = 345, + JSDocTypeTag = 346, + JSDocTemplateTag = 347, + JSDocTypedefTag = 348, + JSDocSeeTag = 349, + JSDocPropertyTag = 350, + SyntaxList = 351, + NotEmittedStatement = 352, + PartiallyEmittedExpression = 353, + CommaListExpression = 354, + MergeDeclarationMarker = 355, + EndOfDeclarationMarker = 356, + SyntheticReferenceExpression = 357, + Count = 358, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -472,15 +473,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 161, + LastKeyword = 162, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 178, - LastTypeNode = 201, + FirstTypeNode = 179, + LastTypeNode = 202, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 161, + LastToken = 162, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -489,20 +490,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 239, - LastStatement = 255, - FirstNode = 162, - FirstJSDocNode = 311, - LastJSDocNode = 349, - FirstJSDocTagNode = 329, - LastJSDocTagNode = 349, + FirstStatement = 240, + LastStatement = 256, + FirstNode = 163, + FirstJSDocNode = 312, + LastJSDocNode = 350, + FirstJSDocTagNode = 330, + LastJSDocTagNode = 350, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -547,9 +548,10 @@ declare namespace ts { Protected = 16, Static = 32, Readonly = 64, - Abstract = 128, - Async = 256, - Default = 512, + Accessor = 128, + Abstract = 256, + Async = 512, + Default = 1024, Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, @@ -561,10 +563,10 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 16476, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 116958, - ExportDefault = 513, - All = 257023, - Modifier = 125951 + TypeScriptModifier = 117086, + ExportDefault = 1025, + All = 258047, + Modifier = 126975 } export enum JsxFlags { None = 0, @@ -620,6 +622,7 @@ declare namespace ts { export interface ModifierToken extends KeywordToken { } export type AbstractKeyword = ModifierToken; + export type AccessorKeyword = ModifierToken; export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; @@ -635,11 +638,11 @@ declare namespace ts { export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type ModifierLike = Modifier | Decorator; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; - export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; + export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword; export type ModifiersArray = NodeArray; export enum GeneratedIdentifierFlags { None = 0, @@ -766,6 +769,9 @@ declare namespace ts { readonly type?: TypeNode; readonly initializer?: Expression; } + export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { + _autoAccessorBrand: any; + } export interface ObjectLiteralElement extends NamedDeclaration { _objectLiteralBrand: any; readonly name?: PropertyName; @@ -2570,6 +2576,7 @@ declare namespace ts { MethodExcludes = 103359, GetAccessorExcludes = 46015, SetAccessorExcludes = 78783, + AccessorExcludes = 13247, TypeParameterExcludes = 526824, TypeAliasExcludes = 788968, AliasExcludes = 2097152, @@ -3395,7 +3402,7 @@ declare namespace ts { createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; - createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; + createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; createRegularExpressionLiteral(text: string): RegularExpressionLiteral; createIdentifier(text: string): Identifier; /** @@ -3420,6 +3427,8 @@ declare namespace ts { /** Create a unique name generated for a node. */ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; createPrivateIdentifier(text: string): PrivateIdentifier; + createUniquePrivateName(text?: string): PrivateIdentifier; + getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; createToken(token: SyntaxKind.SuperKeyword): SuperExpression; createToken(token: SyntaxKind.ThisKeyword): ThisExpression; createToken(token: SyntaxKind.NullKeyword): NullLiteral; @@ -3958,7 +3967,7 @@ declare namespace ts { (nodes: NodeArray, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; (nodes: NodeArray | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; } - export type VisitResult = T | T[] | undefined; + export type VisitResult = T | readonly T[] | undefined; export interface Printer { /** * Print a node and its subtree as-is, without any emit transformations. @@ -4525,6 +4534,7 @@ declare namespace ts { function isClassElement(node: Node): node is ClassElement; function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; + function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration; function isModifierLike(node: Node): node is ModifierLike; function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; @@ -6750,6 +6760,8 @@ declare namespace ts { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } @@ -10896,7 +10908,7 @@ declare namespace ts { (text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral; }; /** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */ - const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; + const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; /** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */ const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral; /** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1f2b8230a6e12..847e1301be640 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -232,239 +232,240 @@ declare namespace ts { StaticKeyword = 124, YieldKeyword = 125, AbstractKeyword = 126, - AsKeyword = 127, - AssertsKeyword = 128, - AssertKeyword = 129, - AnyKeyword = 130, - AsyncKeyword = 131, - AwaitKeyword = 132, - BooleanKeyword = 133, - ConstructorKeyword = 134, - DeclareKeyword = 135, - GetKeyword = 136, - InferKeyword = 137, - IntrinsicKeyword = 138, - IsKeyword = 139, - KeyOfKeyword = 140, - ModuleKeyword = 141, - NamespaceKeyword = 142, - NeverKeyword = 143, - OutKeyword = 144, - ReadonlyKeyword = 145, - RequireKeyword = 146, - NumberKeyword = 147, - ObjectKeyword = 148, - SatisfiesKeyword = 149, - SetKeyword = 150, - StringKeyword = 151, - SymbolKeyword = 152, - TypeKeyword = 153, - UndefinedKeyword = 154, - UniqueKeyword = 155, - UnknownKeyword = 156, - FromKeyword = 157, - GlobalKeyword = 158, - BigIntKeyword = 159, - OverrideKeyword = 160, - OfKeyword = 161, - QualifiedName = 162, - ComputedPropertyName = 163, - TypeParameter = 164, - Parameter = 165, - Decorator = 166, - PropertySignature = 167, - PropertyDeclaration = 168, - MethodSignature = 169, - MethodDeclaration = 170, - ClassStaticBlockDeclaration = 171, - Constructor = 172, - GetAccessor = 173, - SetAccessor = 174, - CallSignature = 175, - ConstructSignature = 176, - IndexSignature = 177, - TypePredicate = 178, - TypeReference = 179, - FunctionType = 180, - ConstructorType = 181, - TypeQuery = 182, - TypeLiteral = 183, - ArrayType = 184, - TupleType = 185, - OptionalType = 186, - RestType = 187, - UnionType = 188, - IntersectionType = 189, - ConditionalType = 190, - InferType = 191, - ParenthesizedType = 192, - ThisType = 193, - TypeOperator = 194, - IndexedAccessType = 195, - MappedType = 196, - LiteralType = 197, - NamedTupleMember = 198, - TemplateLiteralType = 199, - TemplateLiteralTypeSpan = 200, - ImportType = 201, - ObjectBindingPattern = 202, - ArrayBindingPattern = 203, - BindingElement = 204, - ArrayLiteralExpression = 205, - ObjectLiteralExpression = 206, - PropertyAccessExpression = 207, - ElementAccessExpression = 208, - CallExpression = 209, - NewExpression = 210, - TaggedTemplateExpression = 211, - TypeAssertionExpression = 212, - ParenthesizedExpression = 213, - FunctionExpression = 214, - ArrowFunction = 215, - DeleteExpression = 216, - TypeOfExpression = 217, - VoidExpression = 218, - AwaitExpression = 219, - PrefixUnaryExpression = 220, - PostfixUnaryExpression = 221, - BinaryExpression = 222, - ConditionalExpression = 223, - TemplateExpression = 224, - YieldExpression = 225, - SpreadElement = 226, - ClassExpression = 227, - OmittedExpression = 228, - ExpressionWithTypeArguments = 229, - AsExpression = 230, - NonNullExpression = 231, - MetaProperty = 232, - SyntheticExpression = 233, - SatisfiesExpression = 234, - TemplateSpan = 235, - SemicolonClassElement = 236, - Block = 237, - EmptyStatement = 238, - VariableStatement = 239, - ExpressionStatement = 240, - IfStatement = 241, - DoStatement = 242, - WhileStatement = 243, - ForStatement = 244, - ForInStatement = 245, - ForOfStatement = 246, - ContinueStatement = 247, - BreakStatement = 248, - ReturnStatement = 249, - WithStatement = 250, - SwitchStatement = 251, - LabeledStatement = 252, - ThrowStatement = 253, - TryStatement = 254, - DebuggerStatement = 255, - VariableDeclaration = 256, - VariableDeclarationList = 257, - FunctionDeclaration = 258, - ClassDeclaration = 259, - InterfaceDeclaration = 260, - TypeAliasDeclaration = 261, - EnumDeclaration = 262, - ModuleDeclaration = 263, - ModuleBlock = 264, - CaseBlock = 265, - NamespaceExportDeclaration = 266, - ImportEqualsDeclaration = 267, - ImportDeclaration = 268, - ImportClause = 269, - NamespaceImport = 270, - NamedImports = 271, - ImportSpecifier = 272, - ExportAssignment = 273, - ExportDeclaration = 274, - NamedExports = 275, - NamespaceExport = 276, - ExportSpecifier = 277, - MissingDeclaration = 278, - ExternalModuleReference = 279, - JsxElement = 280, - JsxSelfClosingElement = 281, - JsxOpeningElement = 282, - JsxClosingElement = 283, - JsxFragment = 284, - JsxOpeningFragment = 285, - JsxClosingFragment = 286, - JsxAttribute = 287, - JsxAttributes = 288, - JsxSpreadAttribute = 289, - JsxExpression = 290, - CaseClause = 291, - DefaultClause = 292, - HeritageClause = 293, - CatchClause = 294, - AssertClause = 295, - AssertEntry = 296, - ImportTypeAssertionContainer = 297, - PropertyAssignment = 298, - ShorthandPropertyAssignment = 299, - SpreadAssignment = 300, - EnumMember = 301, - UnparsedPrologue = 302, - UnparsedPrepend = 303, - UnparsedText = 304, - UnparsedInternalText = 305, - UnparsedSyntheticReference = 306, - SourceFile = 307, - Bundle = 308, - UnparsedSource = 309, - InputFiles = 310, - JSDocTypeExpression = 311, - JSDocNameReference = 312, - JSDocMemberName = 313, - JSDocAllType = 314, - JSDocUnknownType = 315, - JSDocNullableType = 316, - JSDocNonNullableType = 317, - JSDocOptionalType = 318, - JSDocFunctionType = 319, - JSDocVariadicType = 320, - JSDocNamepathType = 321, - JSDoc = 322, + AccessorKeyword = 127, + AsKeyword = 128, + AssertsKeyword = 129, + AssertKeyword = 130, + AnyKeyword = 131, + AsyncKeyword = 132, + AwaitKeyword = 133, + BooleanKeyword = 134, + ConstructorKeyword = 135, + DeclareKeyword = 136, + GetKeyword = 137, + InferKeyword = 138, + IntrinsicKeyword = 139, + IsKeyword = 140, + KeyOfKeyword = 141, + ModuleKeyword = 142, + NamespaceKeyword = 143, + NeverKeyword = 144, + OutKeyword = 145, + ReadonlyKeyword = 146, + RequireKeyword = 147, + NumberKeyword = 148, + ObjectKeyword = 149, + SatisfiesKeyword = 150, + SetKeyword = 151, + StringKeyword = 152, + SymbolKeyword = 153, + TypeKeyword = 154, + UndefinedKeyword = 155, + UniqueKeyword = 156, + UnknownKeyword = 157, + FromKeyword = 158, + GlobalKeyword = 159, + BigIntKeyword = 160, + OverrideKeyword = 161, + OfKeyword = 162, + QualifiedName = 163, + ComputedPropertyName = 164, + TypeParameter = 165, + Parameter = 166, + Decorator = 167, + PropertySignature = 168, + PropertyDeclaration = 169, + MethodSignature = 170, + MethodDeclaration = 171, + ClassStaticBlockDeclaration = 172, + Constructor = 173, + GetAccessor = 174, + SetAccessor = 175, + CallSignature = 176, + ConstructSignature = 177, + IndexSignature = 178, + TypePredicate = 179, + TypeReference = 180, + FunctionType = 181, + ConstructorType = 182, + TypeQuery = 183, + TypeLiteral = 184, + ArrayType = 185, + TupleType = 186, + OptionalType = 187, + RestType = 188, + UnionType = 189, + IntersectionType = 190, + ConditionalType = 191, + InferType = 192, + ParenthesizedType = 193, + ThisType = 194, + TypeOperator = 195, + IndexedAccessType = 196, + MappedType = 197, + LiteralType = 198, + NamedTupleMember = 199, + TemplateLiteralType = 200, + TemplateLiteralTypeSpan = 201, + ImportType = 202, + ObjectBindingPattern = 203, + ArrayBindingPattern = 204, + BindingElement = 205, + ArrayLiteralExpression = 206, + ObjectLiteralExpression = 207, + PropertyAccessExpression = 208, + ElementAccessExpression = 209, + CallExpression = 210, + NewExpression = 211, + TaggedTemplateExpression = 212, + TypeAssertionExpression = 213, + ParenthesizedExpression = 214, + FunctionExpression = 215, + ArrowFunction = 216, + DeleteExpression = 217, + TypeOfExpression = 218, + VoidExpression = 219, + AwaitExpression = 220, + PrefixUnaryExpression = 221, + PostfixUnaryExpression = 222, + BinaryExpression = 223, + ConditionalExpression = 224, + TemplateExpression = 225, + YieldExpression = 226, + SpreadElement = 227, + ClassExpression = 228, + OmittedExpression = 229, + ExpressionWithTypeArguments = 230, + AsExpression = 231, + NonNullExpression = 232, + MetaProperty = 233, + SyntheticExpression = 234, + SatisfiesExpression = 235, + TemplateSpan = 236, + SemicolonClassElement = 237, + Block = 238, + EmptyStatement = 239, + VariableStatement = 240, + ExpressionStatement = 241, + IfStatement = 242, + DoStatement = 243, + WhileStatement = 244, + ForStatement = 245, + ForInStatement = 246, + ForOfStatement = 247, + ContinueStatement = 248, + BreakStatement = 249, + ReturnStatement = 250, + WithStatement = 251, + SwitchStatement = 252, + LabeledStatement = 253, + ThrowStatement = 254, + TryStatement = 255, + DebuggerStatement = 256, + VariableDeclaration = 257, + VariableDeclarationList = 258, + FunctionDeclaration = 259, + ClassDeclaration = 260, + InterfaceDeclaration = 261, + TypeAliasDeclaration = 262, + EnumDeclaration = 263, + ModuleDeclaration = 264, + ModuleBlock = 265, + CaseBlock = 266, + NamespaceExportDeclaration = 267, + ImportEqualsDeclaration = 268, + ImportDeclaration = 269, + ImportClause = 270, + NamespaceImport = 271, + NamedImports = 272, + ImportSpecifier = 273, + ExportAssignment = 274, + ExportDeclaration = 275, + NamedExports = 276, + NamespaceExport = 277, + ExportSpecifier = 278, + MissingDeclaration = 279, + ExternalModuleReference = 280, + JsxElement = 281, + JsxSelfClosingElement = 282, + JsxOpeningElement = 283, + JsxClosingElement = 284, + JsxFragment = 285, + JsxOpeningFragment = 286, + JsxClosingFragment = 287, + JsxAttribute = 288, + JsxAttributes = 289, + JsxSpreadAttribute = 290, + JsxExpression = 291, + CaseClause = 292, + DefaultClause = 293, + HeritageClause = 294, + CatchClause = 295, + AssertClause = 296, + AssertEntry = 297, + ImportTypeAssertionContainer = 298, + PropertyAssignment = 299, + ShorthandPropertyAssignment = 300, + SpreadAssignment = 301, + EnumMember = 302, + UnparsedPrologue = 303, + UnparsedPrepend = 304, + UnparsedText = 305, + UnparsedInternalText = 306, + UnparsedSyntheticReference = 307, + SourceFile = 308, + Bundle = 309, + UnparsedSource = 310, + InputFiles = 311, + JSDocTypeExpression = 312, + JSDocNameReference = 313, + JSDocMemberName = 314, + JSDocAllType = 315, + JSDocUnknownType = 316, + JSDocNullableType = 317, + JSDocNonNullableType = 318, + JSDocOptionalType = 319, + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + JSDoc = 323, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 322, - JSDocText = 323, - JSDocTypeLiteral = 324, - JSDocSignature = 325, - JSDocLink = 326, - JSDocLinkCode = 327, - JSDocLinkPlain = 328, - JSDocTag = 329, - JSDocAugmentsTag = 330, - JSDocImplementsTag = 331, - JSDocAuthorTag = 332, - JSDocDeprecatedTag = 333, - JSDocClassTag = 334, - JSDocPublicTag = 335, - JSDocPrivateTag = 336, - JSDocProtectedTag = 337, - JSDocReadonlyTag = 338, - JSDocOverrideTag = 339, - JSDocCallbackTag = 340, - JSDocEnumTag = 341, - JSDocParameterTag = 342, - JSDocReturnTag = 343, - JSDocThisTag = 344, - JSDocTypeTag = 345, - JSDocTemplateTag = 346, - JSDocTypedefTag = 347, - JSDocSeeTag = 348, - JSDocPropertyTag = 349, - SyntaxList = 350, - NotEmittedStatement = 351, - PartiallyEmittedExpression = 352, - CommaListExpression = 353, - MergeDeclarationMarker = 354, - EndOfDeclarationMarker = 355, - SyntheticReferenceExpression = 356, - Count = 357, + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, + JSDocSignature = 326, + JSDocLink = 327, + JSDocLinkCode = 328, + JSDocLinkPlain = 329, + JSDocTag = 330, + JSDocAugmentsTag = 331, + JSDocImplementsTag = 332, + JSDocAuthorTag = 333, + JSDocDeprecatedTag = 334, + JSDocClassTag = 335, + JSDocPublicTag = 336, + JSDocPrivateTag = 337, + JSDocProtectedTag = 338, + JSDocReadonlyTag = 339, + JSDocOverrideTag = 340, + JSDocCallbackTag = 341, + JSDocEnumTag = 342, + JSDocParameterTag = 343, + JSDocReturnTag = 344, + JSDocThisTag = 345, + JSDocTypeTag = 346, + JSDocTemplateTag = 347, + JSDocTypedefTag = 348, + JSDocSeeTag = 349, + JSDocPropertyTag = 350, + SyntaxList = 351, + NotEmittedStatement = 352, + PartiallyEmittedExpression = 353, + CommaListExpression = 354, + MergeDeclarationMarker = 355, + EndOfDeclarationMarker = 356, + SyntheticReferenceExpression = 357, + Count = 358, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -472,15 +473,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 161, + LastKeyword = 162, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 178, - LastTypeNode = 201, + FirstTypeNode = 179, + LastTypeNode = 202, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 161, + LastToken = 162, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -489,20 +490,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 239, - LastStatement = 255, - FirstNode = 162, - FirstJSDocNode = 311, - LastJSDocNode = 349, - FirstJSDocTagNode = 329, - LastJSDocTagNode = 349, + FirstStatement = 240, + LastStatement = 256, + FirstNode = 163, + FirstJSDocNode = 312, + LastJSDocNode = 350, + FirstJSDocTagNode = 330, + LastJSDocTagNode = 350, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -547,9 +548,10 @@ declare namespace ts { Protected = 16, Static = 32, Readonly = 64, - Abstract = 128, - Async = 256, - Default = 512, + Accessor = 128, + Abstract = 256, + Async = 512, + Default = 1024, Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, @@ -561,10 +563,10 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 16476, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 116958, - ExportDefault = 513, - All = 257023, - Modifier = 125951 + TypeScriptModifier = 117086, + ExportDefault = 1025, + All = 258047, + Modifier = 126975 } export enum JsxFlags { None = 0, @@ -620,6 +622,7 @@ declare namespace ts { export interface ModifierToken extends KeywordToken { } export type AbstractKeyword = ModifierToken; + export type AccessorKeyword = ModifierToken; export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; @@ -635,11 +638,11 @@ declare namespace ts { export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type ModifierLike = Modifier | Decorator; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; - export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; + export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword; export type ModifiersArray = NodeArray; export enum GeneratedIdentifierFlags { None = 0, @@ -766,6 +769,9 @@ declare namespace ts { readonly type?: TypeNode; readonly initializer?: Expression; } + export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { + _autoAccessorBrand: any; + } export interface ObjectLiteralElement extends NamedDeclaration { _objectLiteralBrand: any; readonly name?: PropertyName; @@ -2570,6 +2576,7 @@ declare namespace ts { MethodExcludes = 103359, GetAccessorExcludes = 46015, SetAccessorExcludes = 78783, + AccessorExcludes = 13247, TypeParameterExcludes = 526824, TypeAliasExcludes = 788968, AliasExcludes = 2097152, @@ -3395,7 +3402,7 @@ declare namespace ts { createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; - createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; + createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; createRegularExpressionLiteral(text: string): RegularExpressionLiteral; createIdentifier(text: string): Identifier; /** @@ -3420,6 +3427,8 @@ declare namespace ts { /** Create a unique name generated for a node. */ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; createPrivateIdentifier(text: string): PrivateIdentifier; + createUniquePrivateName(text?: string): PrivateIdentifier; + getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; createToken(token: SyntaxKind.SuperKeyword): SuperExpression; createToken(token: SyntaxKind.ThisKeyword): ThisExpression; createToken(token: SyntaxKind.NullKeyword): NullLiteral; @@ -3958,7 +3967,7 @@ declare namespace ts { (nodes: NodeArray, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; (nodes: NodeArray | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; } - export type VisitResult = T | T[] | undefined; + export type VisitResult = T | readonly T[] | undefined; export interface Printer { /** * Print a node and its subtree as-is, without any emit transformations. @@ -4525,6 +4534,7 @@ declare namespace ts { function isClassElement(node: Node): node is ClassElement; function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; + function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration; function isModifierLike(node: Node): node is ModifierLike; function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; @@ -6750,6 +6760,8 @@ declare namespace ts { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } @@ -7029,7 +7041,7 @@ declare namespace ts { (text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral; }; /** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */ - const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; + const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; /** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */ const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral; /** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/decoratorOnClassProperty13.js b/tests/baselines/reference/decoratorOnClassProperty13.js new file mode 100644 index 0000000000000..c914c6be18cf3 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassProperty13.js @@ -0,0 +1,34 @@ +//// [decoratorOnClassProperty13.ts] +declare function dec(target: any, propertyKey: string): void; + +class C { + @dec accessor prop; +} + +//// [decoratorOnClassProperty13.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C_prop_accessor_storage; +class C { + get prop() { return __classPrivateFieldGet(this, _C_prop_accessor_storage, "f"); } + set prop(value) { __classPrivateFieldSet(this, _C_prop_accessor_storage, value, "f"); } +} +_C_prop_accessor_storage = new WeakMap(); +__decorate([ + dec +], C.prototype, "prop", null); diff --git a/tests/baselines/reference/decoratorOnClassProperty13.symbols b/tests/baselines/reference/decoratorOnClassProperty13.symbols new file mode 100644 index 0000000000000..6dc163ffaed97 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassProperty13.symbols @@ -0,0 +1,13 @@ +=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts === +declare function dec(target: any, propertyKey: string): void; +>dec : Symbol(dec, Decl(decoratorOnClassProperty13.ts, 0, 0)) +>target : Symbol(target, Decl(decoratorOnClassProperty13.ts, 0, 21)) +>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassProperty13.ts, 0, 33)) + +class C { +>C : Symbol(C, Decl(decoratorOnClassProperty13.ts, 0, 61)) + + @dec accessor prop; +>dec : Symbol(dec, Decl(decoratorOnClassProperty13.ts, 0, 0)) +>prop : Symbol(C.prop, Decl(decoratorOnClassProperty13.ts, 2, 9)) +} diff --git a/tests/baselines/reference/decoratorOnClassProperty13.types b/tests/baselines/reference/decoratorOnClassProperty13.types new file mode 100644 index 0000000000000..6a9d7ca61c55e --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassProperty13.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts === +declare function dec(target: any, propertyKey: string): void; +>dec : (target: any, propertyKey: string) => void +>target : any +>propertyKey : string + +class C { +>C : C + + @dec accessor prop; +>dec : (target: any, propertyKey: string) => void +>prop : any +} diff --git a/tests/baselines/reference/privateNameComputedPropertyName2(target=es2015).js b/tests/baselines/reference/privateNameComputedPropertyName2(target=es2015).js index 248d8203636d6..8b84f1973fb88 100644 --- a/tests/baselines/reference/privateNameComputedPropertyName2(target=es2015).js +++ b/tests/baselines/reference/privateNameComputedPropertyName2(target=es2015).js @@ -21,6 +21,6 @@ class A { constructor() { _A_x.set(this, 100); } - [(_A_x = new WeakMap(), (getX = (a) => __classPrivateFieldGet(a, _A_x, "f"), "_"))]() { } + [(_A_x = new WeakMap(), getX = (a) => __classPrivateFieldGet(a, _A_x, "f"), "_")]() { } } console.log(getX(new A)); diff --git a/tests/baselines/reference/privateNameDuplicateField.js b/tests/baselines/reference/privateNameDuplicateField.js index 3b59b74ad8165..1ed7681412e50 100644 --- a/tests/baselines/reference/privateNameDuplicateField.js +++ b/tests/baselines/reference/privateNameDuplicateField.js @@ -557,7 +557,7 @@ function Method() { _d = A_Method_StaticSetter, _A_Method_StaticSetter_instances = new WeakSet(); } function Getter() { - var _A_Getter_Field_instances, _A_Getter_Field_foo_get, _A_Getter_Field_foo, _A_Getter_Method_instances, _A_Getter_Method_foo_get, _A_Getter_Method_foo, _A_Getter_Getter_instances, _A_Getter_Getter_foo_get, _A_Getter_Getter_foo_get_1, _A_Getter_Setter_instances, _A_Getter_Setter_foo_get, _A_Getter_Setter_foo_set, _A_Getter_StaticField_instances, _a, _A_Getter_StaticField_foo_get, _A_Getter_StaticField_foo, _A_Getter_StaticMethod_instances, _b, _A_Getter_StaticMethod_foo_get, _A_Getter_StaticMethod_foo, _A_Getter_StaticGetter_instances, _c, _A_Getter_StaticGetter_foo_get, _A_Getter_StaticGetter_foo_get_1, _A_Getter_StaticSetter_instances, _d, _A_Getter_StaticSetter_foo_get, _A_Getter_StaticSetter_foo_set; + var _A_Getter_Field_instances, _A_Getter_Field_foo_get, _A_Getter_Field_foo, _A_Getter_Method_instances, _A_Getter_Method_foo_get, _A_Getter_Method_foo, _A_Getter_Getter_instances, _A_Getter_Getter_foo_get, _A_Getter_Getter_foo_1_get, _A_Getter_Setter_instances, _A_Getter_Setter_foo_get, _A_Getter_Setter_foo_set, _A_Getter_StaticField_instances, _a, _A_Getter_StaticField_foo_get, _A_Getter_StaticField_foo, _A_Getter_StaticMethod_instances, _b, _A_Getter_StaticMethod_foo_get, _A_Getter_StaticMethod_foo, _A_Getter_StaticGetter_instances, _c, _A_Getter_StaticGetter_foo_get, _A_Getter_StaticGetter_foo_1_get, _A_Getter_StaticSetter_instances, _d, _A_Getter_StaticSetter_foo_get, _A_Getter_StaticSetter_foo_set; // Error class A_Getter_Field { constructor() { @@ -631,7 +631,7 @@ function Getter() { _d = A_Getter_StaticSetter, _A_Getter_StaticSetter_instances = new WeakSet(); } function Setter() { - var _A_Setter_Field_instances, _A_Setter_Field_foo_set, _A_Setter_Field_foo, _A_Setter_Method_instances, _A_Setter_Method_foo_set, _A_Setter_Method_foo, _A_Setter_Getter_instances, _A_Setter_Getter_foo_set, _A_Setter_Getter_foo_get, _A_Setter_Setter_instances, _A_Setter_Setter_foo_set, _A_Setter_Setter_foo_set_1, _A_Setter_StaticField_instances, _a, _A_Setter_StaticField_foo_set, _A_Setter_StaticField_foo, _A_Setter_StaticMethod_instances, _b, _A_Setter_StaticMethod_foo_set, _A_Setter_StaticMethod_foo, _A_Setter_StaticGetter_instances, _c, _A_Setter_StaticGetter_foo_set, _A_Setter_StaticGetter_foo_get, _A_Setter_StaticSetter_instances, _d, _A_Setter_StaticSetter_foo_set, _A_Setter_StaticSetter_foo_set_1; + var _A_Setter_Field_instances, _A_Setter_Field_foo_set, _A_Setter_Field_foo, _A_Setter_Method_instances, _A_Setter_Method_foo_set, _A_Setter_Method_foo, _A_Setter_Getter_instances, _A_Setter_Getter_foo_set, _A_Setter_Getter_foo_get, _A_Setter_Setter_instances, _A_Setter_Setter_foo_set, _A_Setter_Setter_foo_1_set, _A_Setter_StaticField_instances, _a, _A_Setter_StaticField_foo_set, _A_Setter_StaticField_foo, _A_Setter_StaticMethod_instances, _b, _A_Setter_StaticMethod_foo_set, _A_Setter_StaticMethod_foo, _A_Setter_StaticGetter_instances, _c, _A_Setter_StaticGetter_foo_set, _A_Setter_StaticGetter_foo_get, _A_Setter_StaticSetter_instances, _d, _A_Setter_StaticSetter_foo_set, _A_Setter_StaticSetter_foo_1_set; // Error class A_Setter_Field { constructor() { @@ -836,7 +836,7 @@ function StaticMethod() { _h = A_StaticMethod_StaticSetter; } function StaticGetter() { - var _a, _A_StaticGetter_Field_foo_get, _A_StaticGetter_Field_foo, _A_StaticGetter_Method_instances, _b, _A_StaticGetter_Method_foo_get, _A_StaticGetter_Method_foo, _A_StaticGetter_Getter_instances, _c, _A_StaticGetter_Getter_foo_get, _A_StaticGetter_Getter_foo_get_1, _A_StaticGetter_Setter_instances, _d, _A_StaticGetter_Setter_foo_get, _A_StaticGetter_Setter_foo_set, _e, _A_StaticGetter_StaticField_foo_get, _A_StaticGetter_StaticField_foo, _f, _A_StaticGetter_StaticMethod_foo_get, _A_StaticGetter_StaticMethod_foo, _g, _A_StaticGetter_StaticGetter_foo_get, _A_StaticGetter_StaticGetter_foo_get_1, _h, _A_StaticGetter_StaticSetter_foo_get, _A_StaticGetter_StaticSetter_foo_set; + var _a, _A_StaticGetter_Field_foo_get, _A_StaticGetter_Field_foo, _A_StaticGetter_Method_instances, _b, _A_StaticGetter_Method_foo_get, _A_StaticGetter_Method_foo, _A_StaticGetter_Getter_instances, _c, _A_StaticGetter_Getter_foo_get, _A_StaticGetter_Getter_foo_1_get, _A_StaticGetter_Setter_instances, _d, _A_StaticGetter_Setter_foo_get, _A_StaticGetter_Setter_foo_set, _e, _A_StaticGetter_StaticField_foo_get, _A_StaticGetter_StaticField_foo, _f, _A_StaticGetter_StaticMethod_foo_get, _A_StaticGetter_StaticMethod_foo, _g, _A_StaticGetter_StaticGetter_foo_get, _A_StaticGetter_StaticGetter_foo_1_get, _h, _A_StaticGetter_StaticSetter_foo_get, _A_StaticGetter_StaticSetter_foo_set; // Error class A_StaticGetter_Field { constructor() { @@ -897,7 +897,7 @@ function StaticGetter() { _h = A_StaticGetter_StaticSetter, _A_StaticGetter_StaticSetter_foo_get = function _A_StaticGetter_StaticSetter_foo_get() { return ""; }, _A_StaticGetter_StaticSetter_foo_set = function _A_StaticGetter_StaticSetter_foo_set(value) { }; } function StaticSetter() { - var _a, _A_StaticSetter_Field_foo_set, _A_StaticSetter_Field_foo, _A_StaticSetter_Method_instances, _b, _A_StaticSetter_Method_foo_set, _A_StaticSetter_Method_foo, _A_StaticSetter_Getter_instances, _c, _A_StaticSetter_Getter_foo_set, _A_StaticSetter_Getter_foo_get, _A_StaticSetter_Setter_instances, _d, _A_StaticSetter_Setter_foo_set, _A_StaticSetter_Setter_foo_set_1, _e, _A_StaticSetter_StaticField_foo_set, _A_StaticSetter_StaticField_foo, _f, _A_StaticSetter_StaticMethod_foo_set, _A_StaticSetter_StaticMethod_foo, _g, _A_StaticSetter_StaticGetter_foo_set, _A_StaticSetter_StaticGetter_foo_get, _h, _A_StaticSetter_StaticSetter_foo_set, _A_StaticSetter_StaticSetter_foo_set_1; + var _a, _A_StaticSetter_Field_foo_set, _A_StaticSetter_Field_foo, _A_StaticSetter_Method_instances, _b, _A_StaticSetter_Method_foo_set, _A_StaticSetter_Method_foo, _A_StaticSetter_Getter_instances, _c, _A_StaticSetter_Getter_foo_set, _A_StaticSetter_Getter_foo_get, _A_StaticSetter_Setter_instances, _d, _A_StaticSetter_Setter_foo_set, _A_StaticSetter_Setter_foo_1_set, _e, _A_StaticSetter_StaticField_foo_set, _A_StaticSetter_StaticField_foo, _f, _A_StaticSetter_StaticMethod_foo_set, _A_StaticSetter_StaticMethod_foo, _g, _A_StaticSetter_StaticGetter_foo_set, _A_StaticSetter_StaticGetter_foo_get, _h, _A_StaticSetter_StaticSetter_foo_set, _A_StaticSetter_StaticSetter_foo_1_set; // Error class A_StaticSetter_Field { constructor() { diff --git a/tests/baselines/reference/quickInfoDisplayPartsClassAutoAccessors.baseline b/tests/baselines/reference/quickInfoDisplayPartsClassAutoAccessors.baseline new file mode 100644 index 0000000000000..c49934974d56d --- /dev/null +++ b/tests/baselines/reference/quickInfoDisplayPartsClassAutoAccessors.baseline @@ -0,0 +1,1422 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 30, + "name": "1a" + }, + "quickInfo": { + "kind": "accessor", + "kindModifiers": "public", + "textSpan": { + "start": 30, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "accessor", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "publicProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 75, + "name": "2a" + }, + "quickInfo": { + "kind": "accessor", + "kindModifiers": "private", + "textSpan": { + "start": 75, + "length": 15 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "accessor", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "privateProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 123, + "name": "3a" + }, + "quickInfo": { + "kind": "accessor", + "kindModifiers": "protected", + "textSpan": { + "start": 123, + "length": 17 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "accessor", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "protectedProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 170, + "name": "4a" + }, + "quickInfo": { + "kind": "accessor", + "kindModifiers": "static", + "textSpan": { + "start": 170, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "accessor", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "staticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 222, + "name": "5a" + }, + "quickInfo": { + "kind": "accessor", + "kindModifiers": "private,static", + "textSpan": { + "start": 222, + "length": 21 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "accessor", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "privateStaticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 283, + "name": "6a" + }, + "quickInfo": { + "kind": "accessor", + "kindModifiers": "protected,static", + "textSpan": { + "start": 283, + "length": 23 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "accessor", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "protectedStaticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 371, + "name": "1g" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "public", + "textSpan": { + "start": 371, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "publicProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 404, + "name": "2g" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "private", + "textSpan": { + "start": 404, + "length": 15 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "privateProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 438, + "name": "3g" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "protected", + "textSpan": { + "start": 438, + "length": 17 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "protectedProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 471, + "name": "4g" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "static", + "textSpan": { + "start": 471, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "staticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 501, + "name": "5g" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "private,static", + "textSpan": { + "start": 501, + "length": 21 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "privateStaticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 538, + "name": "6g" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "protected,static", + "textSpan": { + "start": 538, + "length": 23 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "protectedStaticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 576, + "name": "1s" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "public", + "textSpan": { + "start": 576, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "publicProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 610, + "name": "2s" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "private", + "textSpan": { + "start": 610, + "length": 15 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "privateProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 645, + "name": "3s" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "protected", + "textSpan": { + "start": 645, + "length": 17 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "protectedProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 679, + "name": "4s" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "static", + "textSpan": { + "start": 679, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "staticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 710, + "name": "5s" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "private,static", + "textSpan": { + "start": 710, + "length": 21 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "privateStaticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 748, + "name": "6s" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "protected,static", + "textSpan": { + "start": 748, + "length": 23 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "protectedStaticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 830, + "name": "7g" + }, + "quickInfo": { + "kind": "var", + "kindModifiers": "", + "textSpan": { + "start": 830, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "cInstance", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 840, + "name": "8g" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "public", + "textSpan": { + "start": 840, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "publicProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 860, + "name": "9g" + }, + "quickInfo": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 860, + "length": 1 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 862, + "name": "10g" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "static", + "textSpan": { + "start": 862, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "staticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 878, + "name": "7s" + }, + "quickInfo": { + "kind": "var", + "kindModifiers": "", + "textSpan": { + "start": 878, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "cInstance", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 888, + "name": "8s" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "public", + "textSpan": { + "start": 888, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "publicProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 908, + "name": "9s" + }, + "quickInfo": { + "kind": "class", + "kindModifiers": "", + "textSpan": { + "start": 908, + "length": 1 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + } + ], + "documentation": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts", + "position": 910, + "name": "10s" + }, + "quickInfo": { + "kind": "property", + "kindModifiers": "static", + "textSpan": { + "start": 910, + "length": 14 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "staticProperty", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [] + } + } +] \ No newline at end of file diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts new file mode 100644 index 0000000000000..177db89c2eddb --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitOnError: true + +class C1 { + accessor a: any; + accessor b = 1; + static accessor c: any; + static accessor d = 2; +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts new file mode 100644 index 0000000000000..790702188cc35 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts @@ -0,0 +1,18 @@ +// @target: esnext, es2022, es2015 + +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts new file mode 100644 index 0000000000000..1c74a8be284c9 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitOnError: true + +class C1 { + accessor "w": any; + accessor "x" = 1; + static accessor "y": any; + static accessor "z" = 2; +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts new file mode 100644 index 0000000000000..fcbf1e6f7bd58 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitOnError: true + +class C1 { + accessor 0: any; + accessor 1 = 1; + static accessor 2: any; + static accessor 3 = 2; +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts new file mode 100644 index 0000000000000..99e5cb140ef73 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts @@ -0,0 +1,15 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitOnError: true + +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + // @ts-ignore + accessor [f()] = 1; +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts new file mode 100644 index 0000000000000..aeb0c28609c25 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts @@ -0,0 +1,14 @@ +// @target: esnext, es2022, es2015 +// @useDefineForClassFields: * + +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts new file mode 100644 index 0000000000000..7993326180d10 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts @@ -0,0 +1,14 @@ +// @target: esnext, es2022, es2015 +// @useDefineForClassFields: * + +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts new file mode 100644 index 0000000000000..8e3a19e4d2b9d --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts @@ -0,0 +1,20 @@ +// @target: esnext +// @declaration: true + +class C1 { + accessor a: any; + static accessor b: any; +} + +declare class C2 { + accessor a: any; + static accessor b: any; +} + +function f() { + class C3 { + accessor a: any; + static accessor b: any; + } + return C3; +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts new file mode 100644 index 0000000000000..0c7bb3d1ad94f --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts @@ -0,0 +1,29 @@ +// @target: esnext +// @noTypesAndSymbols: true + +abstract class C1 { + accessor a: any; + public accessor b: any; + private accessor c: any; + protected accessor d: any; + abstract accessor e: any; + static accessor f: any; + public static accessor g: any; + private static accessor h: any; + protected static accessor i: any; + accessor #j: any; + accessor "k": any; + accessor 108: any; + accessor ["m"]: any; + accessor n!: number; +} + +class C2 extends C1 { + override accessor e: any; + static override accessor i: any; +} + +declare class C3 { + accessor a: any; +} + diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts new file mode 100644 index 0000000000000..44e848c1d7ae9 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts @@ -0,0 +1,39 @@ +// @target: esnext +// @noTypesAndSymbols: true + +abstract class C1 { + accessor accessor a: any; + readonly accessor b: any; + declare accessor c: any; + accessor public d: any; + accessor private e: any; + accessor protected f: any; + accessor abstract g: any; + accessor static h: any; + accessor i() {} + accessor get j() { return false; } + accessor set k(v: any) {} + accessor constructor() {} + accessor l?: any; +} + +class C2 extends C1 { + accessor override g: any; +} + +interface I1 { + accessor a: number; +} + +accessor class C3 {} +accessor interface I2 {} +accessor namespace N1 {} +accessor enum E1 {} +accessor var V1: any; +accessor type T1 = never; +accessor function F1() {} +accessor import "x"; +accessor import {} from "x"; +accessor export { V1 }; +accessor export default V1; +accessor import N2 = N1; diff --git a/tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts b/tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts new file mode 100644 index 0000000000000..2955af4dd771c --- /dev/null +++ b/tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts @@ -0,0 +1,7 @@ +// @target: ES2015 +// @experimentaldecorators: true +declare function dec(target: any, propertyKey: string): void; + +class C { + @dec accessor prop; +} \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassImplementClassAbstractGettersAndSetters.ts b/tests/cases/fourslash/codeFixClassImplementClassAbstractGettersAndSetters.ts index dad3c42964d40..e4981c24ceafc 100644 --- a/tests/cases/fourslash/codeFixClassImplementClassAbstractGettersAndSetters.ts +++ b/tests/cases/fourslash/codeFixClassImplementClassAbstractGettersAndSetters.ts @@ -7,6 +7,8 @@ //// abstract get b(): number; //// //// abstract set c(arg: number | string); +//// +//// abstract accessor d: string; ////} //// ////class C implements A {} @@ -21,6 +23,8 @@ verify.codeFix({ abstract get b(): number; abstract set c(arg: number | string); + + abstract accessor d: string; } class C implements A { @@ -36,5 +40,6 @@ class C implements A { set c(arg: string | number) { throw new Error("Method not implemented."); } + accessor d: string; }`, }); diff --git a/tests/cases/fourslash/completionEntryForClassMembers.ts b/tests/cases/fourslash/completionEntryForClassMembers.ts index 4d691c383abe0..fd148965c55e2 100644 --- a/tests/cases/fourslash/completionEntryForClassMembers.ts +++ b/tests/cases/fourslash/completionEntryForClassMembers.ts @@ -146,9 +146,7 @@ verify.completions( "classThatStartedWritingIdentifierAfterPrivateModifier", "classThatStartedWritingIdentifierAfterPrivateStaticModifier", ], - unsorted: ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set", "override"].map( - name => ({ name, sortText: completion.SortText.GlobalsOrKeywords }) - ), + unsorted: completion.classElementKeywords, isNewIdentifierLocation: true, }, { diff --git a/tests/cases/fourslash/completionListInNamedClassExpression.ts b/tests/cases/fourslash/completionListInNamedClassExpression.ts index 1a3068e9d0360..98658ee6888f4 100644 --- a/tests/cases/fourslash/completionListInNamedClassExpression.ts +++ b/tests/cases/fourslash/completionListInNamedClassExpression.ts @@ -11,22 +11,7 @@ verify.completions( { marker: "0", includes: { name: "myClass", text: "(local class) myClass", kind: "local class" } }, { marker: "1", - exact: [ - "abstract", - "async", - "constructor", - "declare", - "get", - "override", - "private", - "protected", - "public", - "readonly", - "set", - "static", - ].map( - name => ({ name, sortText: completion.SortText.GlobalsOrKeywords }) - ), + exact: completion.classElementKeywords, isNewIdentifierLocation: true, } ); diff --git a/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts b/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts new file mode 100644 index 0000000000000..619169e8b3a17 --- /dev/null +++ b/tests/cases/fourslash/quickInfoDisplayPartsClassAutoAccessors.ts @@ -0,0 +1,33 @@ +/// + +////class c { +//// public accessor /*1a*/publicProperty: string; +//// private accessor /*2a*/privateProperty: string; +//// protected accessor /*3a*/protectedProperty: string; +//// static accessor /*4a*/staticProperty: string; +//// private static accessor /*5a*/privateStaticProperty: string; +//// protected static accessor /*6a*/protectedStaticProperty: string; +//// method() { +//// var x: string; +//// x = this./*1g*/publicProperty; +//// x = this./*2g*/privateProperty; +//// x = this./*3g*/protectedProperty; +//// x = c./*4g*/staticProperty; +//// x = c./*5g*/privateStaticProperty; +//// x = c./*6g*/protectedStaticProperty; +//// this./*1s*/publicProperty = ""; +//// this./*2s*/privateProperty = ""; +//// this./*3s*/protectedProperty = ""; +//// c./*4s*/staticProperty = ""; +//// c./*5s*/privateStaticProperty = ""; +//// c./*6s*/protectedStaticProperty = ""; +//// } +////} +////var cInstance = new c(); +////var y: string; +////y = /*7g*/cInstance./*8g*/publicProperty; +////y = /*9g*/c./*10g*/staticProperty; +/////*7s*/cInstance./*8s*/publicProperty = y; +/////*9s*/c./*10s*/staticProperty = y; + +verify.baselineQuickInfo(); \ No newline at end of file From 34da680ceb00d3e563373469ac2330eaca6071f8 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 9 Aug 2022 12:13:22 -0400 Subject: [PATCH 02/51] Add tests, ensure accessors are initialized in ctor --- src/compiler/checker.ts | 4 +- src/compiler/transformers/classFields.ts | 41 +++--- src/testRunner/tsconfig.json | 1 + .../unittests/evaluation/autoAccessors.ts | 113 ++++++++++++++++ .../accessorField1(target=es2015).symbols | 17 --- .../accessorField1(target=es2022).symbols | 17 --- .../accessorField1(target=es5).errors.txt | 22 ---- .../accessorField1(target=es5).symbols | 17 --- .../accessorField1(target=esnext).symbols | 17 --- .../accessorField2(target=es2015).symbols | 37 ------ .../accessorField2(target=es2022).symbols | 37 ------ .../accessorField2(target=esnext).symbols | 37 ------ .../accessorField3(target=es2015).symbols | 17 --- .../accessorField3(target=es2022).symbols | 17 --- .../accessorField3(target=es5).errors.txt | 22 ---- .../accessorField3(target=es5).symbols | 17 --- .../accessorField3(target=esnext).symbols | 17 --- .../accessorField4(target=es2015).symbols | 17 --- .../accessorField4(target=es2022).symbols | 17 --- .../accessorField4(target=es5).errors.txt | 22 ---- .../accessorField4(target=es5).symbols | 17 --- .../accessorField4(target=esnext).symbols | 17 --- .../accessorField5(target=es2015).symbols | 32 ----- .../accessorField5(target=es2022).symbols | 32 ----- .../accessorField5(target=es5).symbols | 32 ----- .../accessorField5(target=esnext).symbols | 32 ----- ...015,usedefineforclassfields=false).symbols | 27 ---- ...2015,usedefineforclassfields=true).symbols | 27 ---- ...022,usedefineforclassfields=false).symbols | 27 ---- ...2022,usedefineforclassfields=true).symbols | 27 ---- ...,usedefineforclassfields=false).errors.txt | 18 --- ...ext,usedefineforclassfields=false).symbols | 27 ---- ...snext,usedefineforclassfields=false).types | 28 ---- ...t,usedefineforclassfields=true).errors.txt | 18 --- ...next,usedefineforclassfields=true).symbols | 27 ---- ...esnext,usedefineforclassfields=true).types | 28 ---- ...015,usedefineforclassfields=false).symbols | 24 ---- ...2015,usedefineforclassfields=true).symbols | 24 ---- ...022,usedefineforclassfields=false).symbols | 24 ---- ...2022,usedefineforclassfields=true).symbols | 24 ---- ...ext,usedefineforclassfields=false).symbols | 24 ---- ...snext,usedefineforclassfields=false).types | 26 ---- ...next,usedefineforclassfields=true).symbols | 24 ---- ...esnext,usedefineforclassfields=true).types | 26 ---- .../reference/accessorField8.symbols | 37 ------ ...ccessorFieldDisallowedModifiers.errors.txt | 124 ------------------ ...15).js => autoAccessor1(target=es2015).js} | 4 +- .../autoAccessor1(target=es2015).symbols | 17 +++ ...pes => autoAccessor1(target=es2015).types} | 2 +- ...22).js => autoAccessor1(target=es2022).js} | 4 +- .../autoAccessor1(target=es2022).symbols | 17 +++ ...pes => autoAccessor1(target=es2022).types} | 2 +- .../autoAccessor1(target=es5).errors.txt | 22 ++++ .../autoAccessor1(target=es5).symbols | 17 +++ ....types => autoAccessor1(target=es5).types} | 2 +- ...xt).js => autoAccessor1(target=esnext).js} | 4 +- .../autoAccessor1(target=esnext).symbols | 17 +++ ...pes => autoAccessor1(target=esnext).types} | 2 +- ...15).js => autoAccessor2(target=es2015).js} | 4 +- .../autoAccessor2(target=es2015).symbols | 37 ++++++ ...pes => autoAccessor2(target=es2015).types} | 2 +- ...22).js => autoAccessor2(target=es2022).js} | 4 +- .../autoAccessor2(target=es2022).symbols | 37 ++++++ ...pes => autoAccessor2(target=es2022).types} | 2 +- ...xt).js => autoAccessor2(target=esnext).js} | 4 +- .../autoAccessor2(target=esnext).symbols | 37 ++++++ ...pes => autoAccessor2(target=esnext).types} | 2 +- ...15).js => autoAccessor3(target=es2015).js} | 4 +- .../autoAccessor3(target=es2015).symbols | 17 +++ ...pes => autoAccessor3(target=es2015).types} | 2 +- ...22).js => autoAccessor3(target=es2022).js} | 4 +- .../autoAccessor3(target=es2022).symbols | 17 +++ ...pes => autoAccessor3(target=es2022).types} | 2 +- .../autoAccessor3(target=es5).errors.txt | 22 ++++ .../autoAccessor3(target=es5).symbols | 17 +++ ....types => autoAccessor3(target=es5).types} | 2 +- ...xt).js => autoAccessor3(target=esnext).js} | 4 +- .../autoAccessor3(target=esnext).symbols | 17 +++ ...pes => autoAccessor3(target=esnext).types} | 2 +- ...15).js => autoAccessor4(target=es2015).js} | 4 +- .../autoAccessor4(target=es2015).symbols | 17 +++ ...pes => autoAccessor4(target=es2015).types} | 2 +- ...22).js => autoAccessor4(target=es2022).js} | 4 +- .../autoAccessor4(target=es2022).symbols | 17 +++ ...pes => autoAccessor4(target=es2022).types} | 2 +- .../autoAccessor4(target=es5).errors.txt | 22 ++++ .../autoAccessor4(target=es5).symbols | 17 +++ ....types => autoAccessor4(target=es5).types} | 2 +- ...xt).js => autoAccessor4(target=esnext).js} | 4 +- .../autoAccessor4(target=esnext).symbols | 17 +++ ...pes => autoAccessor4(target=esnext).types} | 2 +- ...15).js => autoAccessor5(target=es2015).js} | 4 +- .../autoAccessor5(target=es2015).symbols | 32 +++++ ...pes => autoAccessor5(target=es2015).types} | 2 +- ...22).js => autoAccessor5(target=es2022).js} | 4 +- .../autoAccessor5(target=es2022).symbols | 32 +++++ ...pes => autoAccessor5(target=es2022).types} | 2 +- ...t => autoAccessor5(target=es5).errors.txt} | 10 +- .../autoAccessor5(target=es5).symbols | 32 +++++ ....types => autoAccessor5(target=es5).types} | 2 +- ...xt).js => autoAccessor5(target=esnext).js} | 4 +- .../autoAccessor5(target=esnext).symbols | 32 +++++ ...pes => autoAccessor5(target=esnext).types} | 2 +- ...usedefineforclassfields=false).errors.txt} | 4 +- ...=es2015,usedefineforclassfields=false).js} | 7 +- ...015,usedefineforclassfields=false).symbols | 27 ++++ ...2015,usedefineforclassfields=false).types} | 2 +- ...,usedefineforclassfields=true).errors.txt} | 4 +- ...t=es2015,usedefineforclassfields=true).js} | 4 +- ...2015,usedefineforclassfields=true).symbols | 27 ++++ ...s2015,usedefineforclassfields=true).types} | 2 +- ...usedefineforclassfields=false).errors.txt} | 4 +- ...=es2022,usedefineforclassfields=false).js} | 4 +- ...022,usedefineforclassfields=false).symbols | 27 ++++ ...2022,usedefineforclassfields=false).types} | 2 +- ...,usedefineforclassfields=true).errors.txt} | 4 +- ...t=es2022,usedefineforclassfields=true).js} | 4 +- ...2022,usedefineforclassfields=true).symbols | 27 ++++ ...s2022,usedefineforclassfields=true).types} | 2 +- ...,usedefineforclassfields=false).errors.txt | 18 +++ ...=esnext,usedefineforclassfields=false).js} | 4 +- ...ext,usedefineforclassfields=false).symbols | 27 ++++ ...snext,usedefineforclassfields=false).types | 28 ++++ ...t,usedefineforclassfields=true).errors.txt | 18 +++ ...t=esnext,usedefineforclassfields=true).js} | 4 +- ...next,usedefineforclassfields=true).symbols | 27 ++++ ...esnext,usedefineforclassfields=true).types | 28 ++++ ...=es2015,usedefineforclassfields=false).js} | 4 +- ...015,usedefineforclassfields=false).symbols | 24 ++++ ...2015,usedefineforclassfields=false).types} | 2 +- ...t=es2015,usedefineforclassfields=true).js} | 4 +- ...2015,usedefineforclassfields=true).symbols | 24 ++++ ...s2015,usedefineforclassfields=true).types} | 2 +- ...=es2022,usedefineforclassfields=false).js} | 4 +- ...022,usedefineforclassfields=false).symbols | 24 ++++ ...2022,usedefineforclassfields=false).types} | 2 +- ...t=es2022,usedefineforclassfields=true).js} | 4 +- ...2022,usedefineforclassfields=true).symbols | 24 ++++ ...s2022,usedefineforclassfields=true).types} | 2 +- ...=esnext,usedefineforclassfields=false).js} | 4 +- ...ext,usedefineforclassfields=false).symbols | 24 ++++ ...snext,usedefineforclassfields=false).types | 26 ++++ ...t=esnext,usedefineforclassfields=true).js} | 4 +- ...next,usedefineforclassfields=true).symbols | 24 ++++ ...esnext,usedefineforclassfields=true).types | 26 ++++ .../{accessorField8.js => autoAccessor8.js} | 6 +- .../baselines/reference/autoAccessor8.symbols | 37 ++++++ ...cessorField8.types => autoAccessor8.types} | 2 +- ...ers.js => autoAccessorAllowedModifiers.js} | 4 +- ...autoAccessorDisallowedModifiers.errors.txt | 124 ++++++++++++++++++ ....js => autoAccessorDisallowedModifiers.js} | 4 +- ...mentalDecorators(target=es2015).errors.txt | 27 ++++ ...orExperimentalDecorators(target=es2015).js | 64 +++++++++ ...erimentalDecorators(target=es2015).symbols | 41 ++++++ ...xperimentalDecorators(target=es2015).types | 39 ++++++ ...mentalDecorators(target=es2022).errors.txt | 27 ++++ ...orExperimentalDecorators(target=es2022).js | 49 +++++++ ...erimentalDecorators(target=es2022).symbols | 41 ++++++ ...xperimentalDecorators(target=es2022).types | 39 ++++++ ...mentalDecorators(target=esnext).errors.txt | 27 ++++ ...orExperimentalDecorators(target=esnext).js | 41 ++++++ ...erimentalDecorators(target=esnext).symbols | 41 ++++++ ...xperimentalDecorators(target=esnext).types | 39 ++++++ .../reference/decoratorOnClassProperty13.js | 5 +- .../decoratorOnClassProperty13.symbols | 6 +- .../decoratorOnClassProperty13.types | 7 +- .../reference/privateNameDuplicateField.js | 6 - .../{accessorField1.ts => autoAccessor1.ts} | 0 .../{accessorField2.ts => autoAccessor2.ts} | 0 .../{accessorField3.ts => autoAccessor3.ts} | 0 .../{accessorField4.ts => autoAccessor4.ts} | 0 .../{accessorField5.ts => autoAccessor5.ts} | 0 .../{accessorField6.ts => autoAccessor6.ts} | 0 .../{accessorField7.ts => autoAccessor7.ts} | 0 .../{accessorField8.ts => autoAccessor8.ts} | 0 ...ers.ts => autoAccessorAllowedModifiers.ts} | 0 ....ts => autoAccessorDisallowedModifiers.ts} | 0 .../autoAccessorExperimentalDecorators.ts | 20 +++ .../property/decoratorOnClassProperty13.ts | 2 +- 179 files changed, 1874 insertions(+), 1253 deletions(-) create mode 100644 src/testRunner/unittests/evaluation/autoAccessors.ts delete mode 100644 tests/baselines/reference/accessorField1(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField1(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField1(target=es5).errors.txt delete mode 100644 tests/baselines/reference/accessorField1(target=es5).symbols delete mode 100644 tests/baselines/reference/accessorField1(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField2(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField2(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField2(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField3(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField3(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField3(target=es5).errors.txt delete mode 100644 tests/baselines/reference/accessorField3(target=es5).symbols delete mode 100644 tests/baselines/reference/accessorField3(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField4(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField4(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField4(target=es5).errors.txt delete mode 100644 tests/baselines/reference/accessorField4(target=es5).symbols delete mode 100644 tests/baselines/reference/accessorField4(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField5(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField5(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField5(target=es5).symbols delete mode 100644 tests/baselines/reference/accessorField5(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types delete mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types delete mode 100644 tests/baselines/reference/accessorField8.symbols delete mode 100644 tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt rename tests/baselines/reference/{accessorField1(target=es2015).js => autoAccessor1(target=es2015).js} (96%) create mode 100644 tests/baselines/reference/autoAccessor1(target=es2015).symbols rename tests/baselines/reference/{accessorField1(target=es5).types => autoAccessor1(target=es2015).types} (85%) rename tests/baselines/reference/{accessorField1(target=es2022).js => autoAccessor1(target=es2022).js} (91%) create mode 100644 tests/baselines/reference/autoAccessor1(target=es2022).symbols rename tests/baselines/reference/{accessorField1(target=esnext).types => autoAccessor1(target=es2022).types} (85%) create mode 100644 tests/baselines/reference/autoAccessor1(target=es5).errors.txt create mode 100644 tests/baselines/reference/autoAccessor1(target=es5).symbols rename tests/baselines/reference/{accessorField1(target=es2015).types => autoAccessor1(target=es5).types} (85%) rename tests/baselines/reference/{accessorField1(target=esnext).js => autoAccessor1(target=esnext).js} (77%) create mode 100644 tests/baselines/reference/autoAccessor1(target=esnext).symbols rename tests/baselines/reference/{accessorField1(target=es2022).types => autoAccessor1(target=esnext).types} (85%) rename tests/baselines/reference/{accessorField2(target=es2015).js => autoAccessor2(target=es2015).js} (97%) create mode 100644 tests/baselines/reference/autoAccessor2(target=es2015).symbols rename tests/baselines/reference/{accessorField2(target=es2015).types => autoAccessor2(target=es2015).types} (89%) rename tests/baselines/reference/{accessorField2(target=es2022).js => autoAccessor2(target=es2022).js} (92%) create mode 100644 tests/baselines/reference/autoAccessor2(target=es2022).symbols rename tests/baselines/reference/{accessorField2(target=es2022).types => autoAccessor2(target=es2022).types} (89%) rename tests/baselines/reference/{accessorField2(target=esnext).js => autoAccessor2(target=esnext).js} (87%) create mode 100644 tests/baselines/reference/autoAccessor2(target=esnext).symbols rename tests/baselines/reference/{accessorField2(target=esnext).types => autoAccessor2(target=esnext).types} (89%) rename tests/baselines/reference/{accessorField3(target=es2015).js => autoAccessor3(target=es2015).js} (96%) create mode 100644 tests/baselines/reference/autoAccessor3(target=es2015).symbols rename tests/baselines/reference/{accessorField3(target=es5).types => autoAccessor3(target=es2015).types} (86%) rename tests/baselines/reference/{accessorField3(target=es2022).js => autoAccessor3(target=es2022).js} (91%) create mode 100644 tests/baselines/reference/autoAccessor3(target=es2022).symbols rename tests/baselines/reference/{accessorField3(target=es2015).types => autoAccessor3(target=es2022).types} (86%) create mode 100644 tests/baselines/reference/autoAccessor3(target=es5).errors.txt create mode 100644 tests/baselines/reference/autoAccessor3(target=es5).symbols rename tests/baselines/reference/{accessorField3(target=esnext).types => autoAccessor3(target=es5).types} (86%) rename tests/baselines/reference/{accessorField3(target=esnext).js => autoAccessor3(target=esnext).js} (79%) create mode 100644 tests/baselines/reference/autoAccessor3(target=esnext).symbols rename tests/baselines/reference/{accessorField3(target=es2022).types => autoAccessor3(target=esnext).types} (86%) rename tests/baselines/reference/{accessorField4(target=es2015).js => autoAccessor4(target=es2015).js} (96%) create mode 100644 tests/baselines/reference/autoAccessor4(target=es2015).symbols rename tests/baselines/reference/{accessorField4(target=es5).types => autoAccessor4(target=es2015).types} (85%) rename tests/baselines/reference/{accessorField4(target=es2022).js => autoAccessor4(target=es2022).js} (91%) create mode 100644 tests/baselines/reference/autoAccessor4(target=es2022).symbols rename tests/baselines/reference/{accessorField4(target=es2015).types => autoAccessor4(target=es2022).types} (85%) create mode 100644 tests/baselines/reference/autoAccessor4(target=es5).errors.txt create mode 100644 tests/baselines/reference/autoAccessor4(target=es5).symbols rename tests/baselines/reference/{accessorField4(target=esnext).types => autoAccessor4(target=es5).types} (85%) rename tests/baselines/reference/{accessorField4(target=esnext).js => autoAccessor4(target=esnext).js} (77%) create mode 100644 tests/baselines/reference/autoAccessor4(target=esnext).symbols rename tests/baselines/reference/{accessorField4(target=es2022).types => autoAccessor4(target=esnext).types} (85%) rename tests/baselines/reference/{accessorField5(target=es2015).js => autoAccessor5(target=es2015).js} (96%) create mode 100644 tests/baselines/reference/autoAccessor5(target=es2015).symbols rename tests/baselines/reference/{accessorField5(target=es5).types => autoAccessor5(target=es2015).types} (88%) rename tests/baselines/reference/{accessorField5(target=es2022).js => autoAccessor5(target=es2022).js} (93%) create mode 100644 tests/baselines/reference/autoAccessor5(target=es2022).symbols rename tests/baselines/reference/{accessorField5(target=es2015).types => autoAccessor5(target=es2022).types} (88%) rename tests/baselines/reference/{accessorField5(target=es5).errors.txt => autoAccessor5(target=es5).errors.txt} (51%) create mode 100644 tests/baselines/reference/autoAccessor5(target=es5).symbols rename tests/baselines/reference/{accessorField5(target=esnext).types => autoAccessor5(target=es5).types} (88%) rename tests/baselines/reference/{accessorField5(target=esnext).js => autoAccessor5(target=esnext).js} (85%) create mode 100644 tests/baselines/reference/autoAccessor5(target=esnext).symbols rename tests/baselines/reference/{accessorField5(target=es2022).types => autoAccessor5(target=esnext).types} (88%) rename tests/baselines/reference/{accessorField6(target=es2015,usedefineforclassfields=false).errors.txt => autoAccessor6(target=es2015,usedefineforclassfields=false).errors.txt} (59%) rename tests/baselines/reference/{accessorField6(target=es2015,usedefineforclassfields=false).js => autoAccessor6(target=es2015,usedefineforclassfields=false).js} (91%) create mode 100644 tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).symbols rename tests/baselines/reference/{accessorField6(target=es2015,usedefineforclassfields=false).types => autoAccessor6(target=es2015,usedefineforclassfields=false).types} (86%) rename tests/baselines/reference/{accessorField6(target=es2015,usedefineforclassfields=true).errors.txt => autoAccessor6(target=es2015,usedefineforclassfields=true).errors.txt} (59%) rename tests/baselines/reference/{accessorField6(target=es2015,usedefineforclassfields=true).js => autoAccessor6(target=es2015,usedefineforclassfields=true).js} (95%) create mode 100644 tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).symbols rename tests/baselines/reference/{accessorField6(target=es2015,usedefineforclassfields=true).types => autoAccessor6(target=es2015,usedefineforclassfields=true).types} (86%) rename tests/baselines/reference/{accessorField6(target=es2022,usedefineforclassfields=false).errors.txt => autoAccessor6(target=es2022,usedefineforclassfields=false).errors.txt} (59%) rename tests/baselines/reference/{accessorField6(target=es2022,usedefineforclassfields=false).js => autoAccessor6(target=es2022,usedefineforclassfields=false).js} (86%) create mode 100644 tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).symbols rename tests/baselines/reference/{accessorField6(target=es2022,usedefineforclassfields=false).types => autoAccessor6(target=es2022,usedefineforclassfields=false).types} (86%) rename tests/baselines/reference/{accessorField6(target=es2022,usedefineforclassfields=true).errors.txt => autoAccessor6(target=es2022,usedefineforclassfields=true).errors.txt} (59%) rename tests/baselines/reference/{accessorField6(target=es2022,usedefineforclassfields=true).js => autoAccessor6(target=es2022,usedefineforclassfields=true).js} (84%) create mode 100644 tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).symbols rename tests/baselines/reference/{accessorField6(target=es2022,usedefineforclassfields=true).types => autoAccessor6(target=es2022,usedefineforclassfields=true).types} (86%) create mode 100644 tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).errors.txt rename tests/baselines/reference/{accessorField6(target=esnext,usedefineforclassfields=false).js => autoAccessor6(target=esnext,usedefineforclassfields=false).js} (82%) create mode 100644 tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).errors.txt rename tests/baselines/reference/{accessorField6(target=esnext,usedefineforclassfields=true).js => autoAccessor6(target=esnext,usedefineforclassfields=true).js} (79%) create mode 100644 tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).types rename tests/baselines/reference/{accessorField7(target=es2015,usedefineforclassfields=true).js => autoAccessor7(target=es2015,usedefineforclassfields=false).js} (95%) create mode 100644 tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).symbols rename tests/baselines/reference/{accessorField7(target=es2015,usedefineforclassfields=false).types => autoAccessor7(target=es2015,usedefineforclassfields=false).types} (86%) rename tests/baselines/reference/{accessorField7(target=es2015,usedefineforclassfields=false).js => autoAccessor7(target=es2015,usedefineforclassfields=true).js} (95%) create mode 100644 tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).symbols rename tests/baselines/reference/{accessorField7(target=es2015,usedefineforclassfields=true).types => autoAccessor7(target=es2015,usedefineforclassfields=true).types} (86%) rename tests/baselines/reference/{accessorField7(target=es2022,usedefineforclassfields=false).js => autoAccessor7(target=es2022,usedefineforclassfields=false).js} (87%) create mode 100644 tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).symbols rename tests/baselines/reference/{accessorField7(target=es2022,usedefineforclassfields=false).types => autoAccessor7(target=es2022,usedefineforclassfields=false).types} (86%) rename tests/baselines/reference/{accessorField7(target=es2022,usedefineforclassfields=true).js => autoAccessor7(target=es2022,usedefineforclassfields=true).js} (85%) create mode 100644 tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).symbols rename tests/baselines/reference/{accessorField7(target=es2022,usedefineforclassfields=true).types => autoAccessor7(target=es2022,usedefineforclassfields=true).types} (86%) rename tests/baselines/reference/{accessorField7(target=esnext,usedefineforclassfields=false).js => autoAccessor7(target=esnext,usedefineforclassfields=false).js} (82%) create mode 100644 tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).types rename tests/baselines/reference/{accessorField7(target=esnext,usedefineforclassfields=true).js => autoAccessor7(target=esnext,usedefineforclassfields=true).js} (80%) create mode 100644 tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).types rename tests/baselines/reference/{accessorField8.js => autoAccessor8.js} (84%) create mode 100644 tests/baselines/reference/autoAccessor8.symbols rename tests/baselines/reference/{accessorField8.types => autoAccessor8.types} (88%) rename tests/baselines/reference/{accessorFieldAllowedModifiers.js => autoAccessorAllowedModifiers.js} (89%) create mode 100644 tests/baselines/reference/autoAccessorDisallowedModifiers.errors.txt rename tests/baselines/reference/{accessorFieldDisallowedModifiers.js => autoAccessorDisallowedModifiers.js} (91%) create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).errors.txt create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).js create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).symbols create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).types create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).errors.txt create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).js create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).symbols create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).types create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).errors.txt create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).js create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).symbols create mode 100644 tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).types rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorField1.ts => autoAccessor1.ts} (100%) rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorField2.ts => autoAccessor2.ts} (100%) rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorField3.ts => autoAccessor3.ts} (100%) rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorField4.ts => autoAccessor4.ts} (100%) rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorField5.ts => autoAccessor5.ts} (100%) rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorField6.ts => autoAccessor6.ts} (100%) rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorField7.ts => autoAccessor7.ts} (100%) rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorField8.ts => autoAccessor8.ts} (100%) rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorFieldAllowedModifiers.ts => autoAccessorAllowedModifiers.ts} (100%) rename tests/cases/conformance/classes/propertyMemberDeclarations/{accessorFieldDisallowedModifiers.ts => autoAccessorDisallowedModifiers.ts} (100%) create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7efa169bd2c3d..1f4d1c93f003a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -30773,7 +30773,7 @@ namespace ts { // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - const hasPropDesc = parent.kind !== SyntaxKind.PropertyDeclaration && languageVersion !== ScriptTarget.ES3; + const hasPropDesc = languageVersion !== ScriptTarget.ES3 && (!isPropertyDeclaration(parent) || hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent as ClassElement)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent as ClassElement)), @@ -30792,7 +30792,7 @@ namespace ts { case SyntaxKind.ClassExpression: return 1; case SyntaxKind.PropertyDeclaration: - return 2; + return hasAccessorModifier(node.parent) ? 3 : 2; case SyntaxKind.MethodDeclaration: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 96eb05f0b68a8..d225cd8f2239b 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -145,7 +145,8 @@ namespace ts { // We need to transform class field initializers when not using Define, or when using // Define and targeting < ES2022. - const shouldTransformInitializers = !useDefineForClassFields || languageVersion < ScriptTarget.ES2022; + const shouldTransformInitializersUsingSet = !useDefineForClassFields || languageVersion < ScriptTarget.ES2022; + const shouldTransformInitializersUsingDefine = useDefineForClassFields || languageVersion < ScriptTarget.ES2022; // We need to transform `accessor` fields when targeting < ESNext const shouldTransformAutoAccessors = languageVersion < ScriptTarget.ESNext; @@ -161,7 +162,7 @@ namespace ts { // the es2015 transformation handles those. const shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= ScriptTarget.ES2015; - const shouldTransformAnything = shouldTransformInitializers || shouldTransformAutoAccessors; + const shouldTransformAnything = shouldTransformInitializersUsingSet || shouldTransformAutoAccessors; const previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; @@ -218,7 +219,7 @@ namespace ts { return visitClassLikeDeclaration(node as ClassLikeDeclaration); } - if (shouldTransformInitializers) { + if (shouldTransformInitializersUsingSet) { if (node.transformFlags & TransformFlags.ContainsClassFields) { switch (node.kind) { case SyntaxKind.PropertyDeclaration: @@ -354,7 +355,7 @@ namespace ts { * @param node The node to visit. */ function classElementVisitor(node: Node): VisitResult { - if (shouldTransformInitializers) { + if (shouldTransformInitializersUsingSet) { switch (node.kind) { case SyntaxKind.Constructor: // Constructors for classes using class fields are transformed in @@ -600,7 +601,7 @@ namespace ts { function transformFieldInitializer(node: PropertyDeclaration) { Debug.assert(!hasDecorators(node)); - if (!shouldTransformInitializers) { + if (!shouldTransformInitializersUsingSet) { return visitEachChild(node, classElementVisitor, context); } @@ -1083,7 +1084,7 @@ namespace ts { * Set up the environment for a class. */ function visitClassLikeDeclaration(node: ClassLikeDeclaration) { - const shouldTransform = shouldTransformInitializers + const shouldTransform = shouldTransformInitializersUsingSet && node.transformFlags & TransformFlags.ContainsClassFields && forEach(node.members, doesClassElementNeedTransform); @@ -1392,28 +1393,28 @@ namespace ts { } function isClassElementThatRequiresConstructorStatement(member: ClassElement) { - if (isStatic(member) || hasSyntacticModifier(getOriginalNode(member), ModifierFlags.Abstract)) { + if (isStatic(member) || hasAbstractModifier(getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < ScriptTarget.ES2022; - } - return isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifierClassElementDeclaration(member); + + return shouldTransformInitializersUsingDefine && isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && isAutoAccessorPropertyDeclaration(member); } function transformConstructor(node: ClassDeclaration | ClassExpression, isDerivedClass: boolean) { const constructor = visitNode(getFirstConstructorWithBody(node), visitor, isConstructorDeclaration); - const elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!some(elements)) { + if (!some(node.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + const parameters = visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); const body = transformConstructorBody(node, constructor, isDerivedClass); if (!body) { return undefined; } + return startOnNewLine( setOriginalNode( setTextRange( @@ -1544,13 +1545,21 @@ namespace ts { statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + + const multiLine = constructor?.body && constructor.body.statements.length >= statements.length ? + constructor.body.multiLine ?? statements.length > 0 : + statements.length > 0; + return setTextRange( factory.createBlock( setTextRange( factory.createNodeArray(statements), /*location*/ constructor ? constructor.body!.statements : node.members ), - /*multiLine*/ true + multiLine ), /*location*/ constructor ? constructor.body : undefined ); diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 8af0757080b1c..b7c699fcea611 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -89,6 +89,7 @@ "unittests/evaluation/arraySpread.ts", "unittests/evaluation/asyncArrow.ts", "unittests/evaluation/asyncGenerator.ts", + "unittests/evaluation/autoAccessors.ts", "unittests/evaluation/awaiter.ts", "unittests/evaluation/destructuring.ts", "unittests/evaluation/externalModules.ts", diff --git a/src/testRunner/unittests/evaluation/autoAccessors.ts b/src/testRunner/unittests/evaluation/autoAccessors.ts new file mode 100644 index 0000000000000..0873cd061e7f7 --- /dev/null +++ b/src/testRunner/unittests/evaluation/autoAccessors.ts @@ -0,0 +1,113 @@ +describe("unittests:: evaluation:: autoAccessors", () => { + const editions = [ + { name: "es2022", target: ts.ScriptTarget.ES2022 }, + { name: "es2015", target: ts.ScriptTarget.ES2015 }, + ]; + for (const { name, target } of editions) { + describe(name, () => { + it("generates accessor pair", async () => { + const { C } = evaluator.evaluateTypeScript(` + export class C { + accessor x; + } + `, { target }); + + const desc = Object.getOwnPropertyDescriptor(C.prototype, "x"); + assert.isDefined(desc); + assert.isFunction(desc!.get); + assert.isFunction(desc!.set); + }); + + it("storage is private", async () => { + const { C } = evaluator.evaluateTypeScript(` + export class C { + accessor x; + } + `, { target }); + + const desc = Object.getOwnPropertyDescriptor(C.prototype, "x"); + const obj = Object.create(C.prototype); + assert.throws(() => desc!.get!.call(obj), /private/); + }); + + it("getter and setter wrap same field", async () => { + const { C } = evaluator.evaluateTypeScript(` + export class C { + accessor x; + } + `, { target }); + const obj = new C(); + obj.x = 1; + assert.equal(obj.x, 1); + + obj.x = 2; + assert.equal(obj.x, 2); + }); + + it("supports initializer", async () => { + const { C } = evaluator.evaluateTypeScript(` + export class C { + accessor x = 1; + } + `, { target }); + const obj = new C(); + assert.equal(obj.x, 1); + }); + + it("legacy decorator can intercept getter/setter", async () => { + const { actions, C } = evaluator.evaluateTypeScript(` + function dec(target, key, descriptor) { + const { get, set } = descriptor; + actions.push({ kind: "decorate", target, key }); + descriptor.get = function() { + actions.push({ kind: "get", this: this }); + return get.call(this); + }; + descriptor.set = function(value) { + actions.push({ kind: "set", this: this, value }); + set.call(this, value); + }; + } + export const actions = []; + export class C { + @dec + accessor x; + } + `, { target, experimentalDecorators: true }); + + assert.deepEqual(actions, [ + { kind: "decorate", target: C.prototype, key: "x" } + ]); + const obj = new C(); + obj.x = 1; + assert.equal(obj.x, 1); + assert.deepEqual(actions, [ + { kind: "decorate", target: C.prototype, key: "x" }, + { kind: "set", this: obj, value: 1 }, + { kind: "get", this: obj }, + ]); + }); + + it("legacy decorator cannot intercept initializer", async () => { + const { actions, C } = evaluator.evaluateTypeScript(` + function dec(target, key, descriptor) { + const { get, set } = descriptor; + descriptor.set = function(value) { + actions.push({ kind: "set", this: this, value }); + set.call(this, value); + }; + } + export const actions = []; + export class C { + @dec + accessor x = 1; + } + `, { target, experimentalDecorators: true }); + + const obj = new C(); + assert.equal(obj.x, 1); + assert.deepEqual(actions, []); + }); + }); + } +}); \ No newline at end of file diff --git a/tests/baselines/reference/accessorField1(target=es2015).symbols b/tests/baselines/reference/accessorField1(target=es2015).symbols deleted file mode 100644 index 28111d6f8fdaf..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es2015).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) - - accessor b = 1; ->b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) - - static accessor c: any; ->c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) - - static accessor d = 2; ->d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField1(target=es2022).symbols b/tests/baselines/reference/accessorField1(target=es2022).symbols deleted file mode 100644 index 28111d6f8fdaf..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es2022).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) - - accessor b = 1; ->b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) - - static accessor c: any; ->c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) - - static accessor d = 2; ->d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField1(target=es5).errors.txt b/tests/baselines/reference/accessorField1(target=es5).errors.txt deleted file mode 100644 index c9b2c82112a99..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es5).errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts (4 errors) ==== - class C1 { - accessor a: any; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - accessor b = 1; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor c: any; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor d = 2; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField1(target=es5).symbols b/tests/baselines/reference/accessorField1(target=es5).symbols deleted file mode 100644 index 28111d6f8fdaf..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es5).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) - - accessor b = 1; ->b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) - - static accessor c: any; ->c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) - - static accessor d = 2; ->d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField1(target=esnext).symbols b/tests/baselines/reference/accessorField1(target=esnext).symbols deleted file mode 100644 index 28111d6f8fdaf..0000000000000 --- a/tests/baselines/reference/accessorField1(target=esnext).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) - - accessor b = 1; ->b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) - - static accessor c: any; ->c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) - - static accessor d = 2; ->d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField2(target=es2015).symbols b/tests/baselines/reference/accessorField2(target=es2015).symbols deleted file mode 100644 index cd33647f39592..0000000000000 --- a/tests/baselines/reference/accessorField2(target=es2015).symbols +++ /dev/null @@ -1,37 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - accessor #a: any; ->#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) - - accessor #b = 1; ->#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) - - static accessor #c: any; ->#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) - - static accessor #d = 2; ->#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) - - constructor() { - this.#a = 3; ->this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#b = 4; ->this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } - - static { - this.#c = 5; ->this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#d = 6; ->this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } -} - diff --git a/tests/baselines/reference/accessorField2(target=es2022).symbols b/tests/baselines/reference/accessorField2(target=es2022).symbols deleted file mode 100644 index cd33647f39592..0000000000000 --- a/tests/baselines/reference/accessorField2(target=es2022).symbols +++ /dev/null @@ -1,37 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - accessor #a: any; ->#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) - - accessor #b = 1; ->#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) - - static accessor #c: any; ->#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) - - static accessor #d = 2; ->#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) - - constructor() { - this.#a = 3; ->this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#b = 4; ->this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } - - static { - this.#c = 5; ->this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#d = 6; ->this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } -} - diff --git a/tests/baselines/reference/accessorField2(target=esnext).symbols b/tests/baselines/reference/accessorField2(target=esnext).symbols deleted file mode 100644 index cd33647f39592..0000000000000 --- a/tests/baselines/reference/accessorField2(target=esnext).symbols +++ /dev/null @@ -1,37 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - accessor #a: any; ->#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) - - accessor #b = 1; ->#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) - - static accessor #c: any; ->#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) - - static accessor #d = 2; ->#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) - - constructor() { - this.#a = 3; ->this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#b = 4; ->this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } - - static { - this.#c = 5; ->this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#d = 6; ->this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } -} - diff --git a/tests/baselines/reference/accessorField3(target=es2015).symbols b/tests/baselines/reference/accessorField3(target=es2015).symbols deleted file mode 100644 index 0312c5a3cd1a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es2015).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) - - accessor "w": any; ->"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) - - accessor "x" = 1; ->"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) - - static accessor "y": any; ->"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) - - static accessor "z" = 2; ->"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) -} - diff --git a/tests/baselines/reference/accessorField3(target=es2022).symbols b/tests/baselines/reference/accessorField3(target=es2022).symbols deleted file mode 100644 index 0312c5a3cd1a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es2022).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) - - accessor "w": any; ->"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) - - accessor "x" = 1; ->"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) - - static accessor "y": any; ->"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) - - static accessor "z" = 2; ->"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) -} - diff --git a/tests/baselines/reference/accessorField3(target=es5).errors.txt b/tests/baselines/reference/accessorField3(target=es5).errors.txt deleted file mode 100644 index c52b7002bbceb..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es5).errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts (4 errors) ==== - class C1 { - accessor "w": any; - ~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - accessor "x" = 1; - ~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor "y": any; - ~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor "z" = 2; - ~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField3(target=es5).symbols b/tests/baselines/reference/accessorField3(target=es5).symbols deleted file mode 100644 index 0312c5a3cd1a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es5).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) - - accessor "w": any; ->"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) - - accessor "x" = 1; ->"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) - - static accessor "y": any; ->"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) - - static accessor "z" = 2; ->"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) -} - diff --git a/tests/baselines/reference/accessorField3(target=esnext).symbols b/tests/baselines/reference/accessorField3(target=esnext).symbols deleted file mode 100644 index 0312c5a3cd1a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=esnext).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) - - accessor "w": any; ->"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) - - accessor "x" = 1; ->"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) - - static accessor "y": any; ->"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) - - static accessor "z" = 2; ->"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) -} - diff --git a/tests/baselines/reference/accessorField4(target=es2015).symbols b/tests/baselines/reference/accessorField4(target=es2015).symbols deleted file mode 100644 index 7720dcdf7d897..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es2015).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) - - accessor 0: any; ->0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) - - accessor 1 = 1; ->1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) - - static accessor 2: any; ->2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) - - static accessor 3 = 2; ->3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField4(target=es2022).symbols b/tests/baselines/reference/accessorField4(target=es2022).symbols deleted file mode 100644 index 7720dcdf7d897..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es2022).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) - - accessor 0: any; ->0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) - - accessor 1 = 1; ->1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) - - static accessor 2: any; ->2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) - - static accessor 3 = 2; ->3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField4(target=es5).errors.txt b/tests/baselines/reference/accessorField4(target=es5).errors.txt deleted file mode 100644 index 47b0e61b4b75a..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es5).errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts (4 errors) ==== - class C1 { - accessor 0: any; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - accessor 1 = 1; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor 2: any; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor 3 = 2; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField4(target=es5).symbols b/tests/baselines/reference/accessorField4(target=es5).symbols deleted file mode 100644 index 7720dcdf7d897..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es5).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) - - accessor 0: any; ->0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) - - accessor 1 = 1; ->1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) - - static accessor 2: any; ->2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) - - static accessor 3 = 2; ->3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField4(target=esnext).symbols b/tests/baselines/reference/accessorField4(target=esnext).symbols deleted file mode 100644 index 7720dcdf7d897..0000000000000 --- a/tests/baselines/reference/accessorField4(target=esnext).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) - - accessor 0: any; ->0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) - - accessor 1 = 1; ->1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) - - static accessor 2: any; ->2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) - - static accessor 3 = 2; ->3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField5(target=es2015).symbols b/tests/baselines/reference/accessorField5(target=es2015).symbols deleted file mode 100644 index e09a9785dc30f..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es2015).symbols +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) - - accessor ["w"]: any; ->["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) ->"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) - - accessor ["x"] = 1; ->["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) ->"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) - - static accessor ["y"]: any; ->["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) ->"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) - - static accessor ["z"] = 2; ->["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) ->"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) -} - -declare var f: any; ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) - -class C2 { ->C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) - - // @ts-ignore - accessor [f()] = 1; ->[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) -} diff --git a/tests/baselines/reference/accessorField5(target=es2022).symbols b/tests/baselines/reference/accessorField5(target=es2022).symbols deleted file mode 100644 index e09a9785dc30f..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es2022).symbols +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) - - accessor ["w"]: any; ->["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) ->"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) - - accessor ["x"] = 1; ->["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) ->"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) - - static accessor ["y"]: any; ->["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) ->"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) - - static accessor ["z"] = 2; ->["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) ->"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) -} - -declare var f: any; ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) - -class C2 { ->C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) - - // @ts-ignore - accessor [f()] = 1; ->[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) -} diff --git a/tests/baselines/reference/accessorField5(target=es5).symbols b/tests/baselines/reference/accessorField5(target=es5).symbols deleted file mode 100644 index e09a9785dc30f..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es5).symbols +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) - - accessor ["w"]: any; ->["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) ->"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) - - accessor ["x"] = 1; ->["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) ->"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) - - static accessor ["y"]: any; ->["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) ->"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) - - static accessor ["z"] = 2; ->["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) ->"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) -} - -declare var f: any; ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) - -class C2 { ->C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) - - // @ts-ignore - accessor [f()] = 1; ->[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) -} diff --git a/tests/baselines/reference/accessorField5(target=esnext).symbols b/tests/baselines/reference/accessorField5(target=esnext).symbols deleted file mode 100644 index e09a9785dc30f..0000000000000 --- a/tests/baselines/reference/accessorField5(target=esnext).symbols +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) - - accessor ["w"]: any; ->["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) ->"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) - - accessor ["x"] = 1; ->["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) ->"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) - - static accessor ["y"]: any; ->["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) ->"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) - - static accessor ["z"] = 2; ->["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) ->"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) -} - -declare var f: any; ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) - -class C2 { ->C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) - - // @ts-ignore - accessor [f()] = 1; ->[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) -} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt deleted file mode 100644 index 4a63914155538..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== - class C1 { - accessor a: any; - } - - class C2 extends C1 { - a = 1; - ~ -!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - } - - class C3 extends C1 { - get a() { return super.a; } - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types deleted file mode 100644 index a6b9efded46a1..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types +++ /dev/null @@ -1,28 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return super.a; } ->a : any ->super.a : any ->super : C1 ->a : any -} - diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt deleted file mode 100644 index 4a63914155538..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== - class C1 { - accessor a: any; - } - - class C2 extends C1 { - a = 1; - ~ -!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - } - - class C3 extends C1 { - get a() { return super.a; } - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types deleted file mode 100644 index a6b9efded46a1..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types +++ /dev/null @@ -1,28 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return super.a; } ->a : any ->super.a : any ->super : C1 ->a : any -} - diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types deleted file mode 100644 index a103af877051c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : C1 - - abstract accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - accessor a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return 1; } ->a : number ->1 : 1 -} - diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types deleted file mode 100644 index a103af877051c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : C1 - - abstract accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - accessor a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return 1; } ->a : number ->1 : 1 -} - diff --git a/tests/baselines/reference/accessorField8.symbols b/tests/baselines/reference/accessorField8.symbols deleted file mode 100644 index 77018c3b42ae5..0000000000000 --- a/tests/baselines/reference/accessorField8.symbols +++ /dev/null @@ -1,37 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField8.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField8.ts, 0, 10)) - - static accessor b: any; ->b : Symbol(C1.b, Decl(accessorField8.ts, 1, 20)) -} - -declare class C2 { ->C2 : Symbol(C2, Decl(accessorField8.ts, 3, 1)) - - accessor a: any; ->a : Symbol(C2.a, Decl(accessorField8.ts, 5, 18)) - - static accessor b: any; ->b : Symbol(C2.b, Decl(accessorField8.ts, 6, 20)) -} - -function f() { ->f : Symbol(f, Decl(accessorField8.ts, 8, 1)) - - class C3 { ->C3 : Symbol(C3, Decl(accessorField8.ts, 10, 14)) - - accessor a: any; ->a : Symbol(C3.a, Decl(accessorField8.ts, 11, 14)) - - static accessor b: any; ->b : Symbol(C3.b, Decl(accessorField8.ts, 12, 24)) - } - return C3; ->C3 : Symbol(C3, Decl(accessorField8.ts, 10, 14)) -} - diff --git a/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt b/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt deleted file mode 100644 index 0349a5292cab9..0000000000000 --- a/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt +++ /dev/null @@ -1,124 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(2,14): error TS1030: 'accessor' modifier already seen. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(3,14): error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(4,13): error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(5,14): error TS1029: 'public' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(6,14): error TS1029: 'private' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(7,14): error TS1029: 'protected' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(8,14): error TS1029: 'abstract' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(9,14): error TS1029: 'static' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(10,5): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(11,5): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(12,5): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(13,5): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(14,15): error TS1276: An 'accessor' property cannot be declared optional. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(18,14): error TS1029: 'override' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(22,5): error TS1070: 'accessor' modifier cannot appear on a type member. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(25,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(26,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(27,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(28,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(29,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(30,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(31,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(32,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(33,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(33,25): error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(34,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(35,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(36,1): error TS1275: 'accessor' modifier can only appear on a property declaration. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts (28 errors) ==== - abstract class C1 { - accessor accessor a: any; - ~~~~~~~~ -!!! error TS1030: 'accessor' modifier already seen. - readonly accessor b: any; - ~~~~~~~~ -!!! error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. - declare accessor c: any; - ~~~~~~~~ -!!! error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. - accessor public d: any; - ~~~~~~ -!!! error TS1029: 'public' modifier must precede 'accessor' modifier. - accessor private e: any; - ~~~~~~~ -!!! error TS1029: 'private' modifier must precede 'accessor' modifier. - accessor protected f: any; - ~~~~~~~~~ -!!! error TS1029: 'protected' modifier must precede 'accessor' modifier. - accessor abstract g: any; - ~~~~~~~~ -!!! error TS1029: 'abstract' modifier must precede 'accessor' modifier. - accessor static h: any; - ~~~~~~ -!!! error TS1029: 'static' modifier must precede 'accessor' modifier. - accessor i() {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor get j() { return false; } - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor set k(v: any) {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor constructor() {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor l?: any; - ~ -!!! error TS1276: An 'accessor' property cannot be declared optional. - } - - class C2 extends C1 { - accessor override g: any; - ~~~~~~~~ -!!! error TS1029: 'override' modifier must precede 'accessor' modifier. - } - - interface I1 { - accessor a: number; - ~~~~~~~~ -!!! error TS1070: 'accessor' modifier cannot appear on a type member. - } - - accessor class C3 {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor interface I2 {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor namespace N1 {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor enum E1 {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor var V1: any; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor type T1 = never; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor function F1() {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor import "x"; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor import {} from "x"; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - ~~~ -!!! error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? - accessor export { V1 }; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor export default V1; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor import N2 = N1; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField1(target=es2015).js b/tests/baselines/reference/autoAccessor1(target=es2015).js similarity index 96% rename from tests/baselines/reference/accessorField1(target=es2015).js rename to tests/baselines/reference/autoAccessor1(target=es2015).js index e3a8a5baf03ce..5749b5605673f 100644 --- a/tests/baselines/reference/accessorField1(target=es2015).js +++ b/tests/baselines/reference/autoAccessor1(target=es2015).js @@ -1,4 +1,4 @@ -//// [accessorField1.ts] +//// [autoAccessor1.ts] class C1 { accessor a: any; accessor b = 1; @@ -7,7 +7,7 @@ class C1 { } -//// [accessorField1.js] +//// [autoAccessor1.js] var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); diff --git a/tests/baselines/reference/autoAccessor1(target=es2015).symbols b/tests/baselines/reference/autoAccessor1(target=es2015).symbols new file mode 100644 index 0000000000000..cc534d5d543f9 --- /dev/null +++ b/tests/baselines/reference/autoAccessor1(target=es2015).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(autoAccessor1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(autoAccessor1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(autoAccessor1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=es5).types b/tests/baselines/reference/autoAccessor1(target=es2015).types similarity index 85% rename from tests/baselines/reference/accessorField1(target=es5).types rename to tests/baselines/reference/autoAccessor1(target=es2015).types index de41def82af66..2f31df539b8fa 100644 --- a/tests/baselines/reference/accessorField1(target=es5).types +++ b/tests/baselines/reference/autoAccessor1(target=es2015).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField1(target=es2022).js b/tests/baselines/reference/autoAccessor1(target=es2022).js similarity index 91% rename from tests/baselines/reference/accessorField1(target=es2022).js rename to tests/baselines/reference/autoAccessor1(target=es2022).js index 5c481928b48e0..4b93d2f205dae 100644 --- a/tests/baselines/reference/accessorField1(target=es2022).js +++ b/tests/baselines/reference/autoAccessor1(target=es2022).js @@ -1,4 +1,4 @@ -//// [accessorField1.ts] +//// [autoAccessor1.ts] class C1 { accessor a: any; accessor b = 1; @@ -7,7 +7,7 @@ class C1 { } -//// [accessorField1.js] +//// [autoAccessor1.js] class C1 { #a_accessor_storage; get a() { return this.#a_accessor_storage; } diff --git a/tests/baselines/reference/autoAccessor1(target=es2022).symbols b/tests/baselines/reference/autoAccessor1(target=es2022).symbols new file mode 100644 index 0000000000000..cc534d5d543f9 --- /dev/null +++ b/tests/baselines/reference/autoAccessor1(target=es2022).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(autoAccessor1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(autoAccessor1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(autoAccessor1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=esnext).types b/tests/baselines/reference/autoAccessor1(target=es2022).types similarity index 85% rename from tests/baselines/reference/accessorField1(target=esnext).types rename to tests/baselines/reference/autoAccessor1(target=es2022).types index de41def82af66..2f31df539b8fa 100644 --- a/tests/baselines/reference/accessorField1(target=esnext).types +++ b/tests/baselines/reference/autoAccessor1(target=es2022).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/autoAccessor1(target=es5).errors.txt b/tests/baselines/reference/autoAccessor1(target=es5).errors.txt new file mode 100644 index 0000000000000..aa03e0e14d00c --- /dev/null +++ b/tests/baselines/reference/autoAccessor1(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts (4 errors) ==== + class C1 { + accessor a: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor b = 1; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor c: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor d = 2; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessor1(target=es5).symbols b/tests/baselines/reference/autoAccessor1(target=es5).symbols new file mode 100644 index 0000000000000..cc534d5d543f9 --- /dev/null +++ b/tests/baselines/reference/autoAccessor1(target=es5).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(autoAccessor1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(autoAccessor1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(autoAccessor1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=es2015).types b/tests/baselines/reference/autoAccessor1(target=es5).types similarity index 85% rename from tests/baselines/reference/accessorField1(target=es2015).types rename to tests/baselines/reference/autoAccessor1(target=es5).types index de41def82af66..2f31df539b8fa 100644 --- a/tests/baselines/reference/accessorField1(target=es2015).types +++ b/tests/baselines/reference/autoAccessor1(target=es5).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField1(target=esnext).js b/tests/baselines/reference/autoAccessor1(target=esnext).js similarity index 77% rename from tests/baselines/reference/accessorField1(target=esnext).js rename to tests/baselines/reference/autoAccessor1(target=esnext).js index 9d9f7f3db7ccf..312758e2aa9f9 100644 --- a/tests/baselines/reference/accessorField1(target=esnext).js +++ b/tests/baselines/reference/autoAccessor1(target=esnext).js @@ -1,4 +1,4 @@ -//// [accessorField1.ts] +//// [autoAccessor1.ts] class C1 { accessor a: any; accessor b = 1; @@ -7,7 +7,7 @@ class C1 { } -//// [accessorField1.js] +//// [autoAccessor1.js] class C1 { accessor a; accessor b = 1; diff --git a/tests/baselines/reference/autoAccessor1(target=esnext).symbols b/tests/baselines/reference/autoAccessor1(target=esnext).symbols new file mode 100644 index 0000000000000..cc534d5d543f9 --- /dev/null +++ b/tests/baselines/reference/autoAccessor1(target=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(autoAccessor1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(autoAccessor1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(autoAccessor1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=es2022).types b/tests/baselines/reference/autoAccessor1(target=esnext).types similarity index 85% rename from tests/baselines/reference/accessorField1(target=es2022).types rename to tests/baselines/reference/autoAccessor1(target=esnext).types index de41def82af66..2f31df539b8fa 100644 --- a/tests/baselines/reference/accessorField1(target=es2022).types +++ b/tests/baselines/reference/autoAccessor1(target=esnext).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField2(target=es2015).js b/tests/baselines/reference/autoAccessor2(target=es2015).js similarity index 97% rename from tests/baselines/reference/accessorField2(target=es2015).js rename to tests/baselines/reference/autoAccessor2(target=es2015).js index 5697106f48fc4..30000e27805dd 100644 --- a/tests/baselines/reference/accessorField2(target=es2015).js +++ b/tests/baselines/reference/autoAccessor2(target=es2015).js @@ -1,4 +1,4 @@ -//// [accessorField2.ts] +//// [autoAccessor2.ts] class C1 { accessor #a: any; accessor #b = 1; @@ -17,7 +17,7 @@ class C1 { } -//// [accessorField2.js] +//// [autoAccessor2.js] var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); diff --git a/tests/baselines/reference/autoAccessor2(target=es2015).symbols b/tests/baselines/reference/autoAccessor2(target=es2015).symbols new file mode 100644 index 0000000000000..24e0c62880c3c --- /dev/null +++ b/tests/baselines/reference/autoAccessor2(target=es2015).symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + + accessor #a: any; +>#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10)) + + accessor #b = 1; +>#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21)) + + static accessor #c: any; +>#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20)) + + static accessor #d = 2; +>#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28)) + + constructor() { + this.#a = 3; +>this.#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + + this.#b = 4; +>this.#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + } + + static { + this.#c = 5; +>this.#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + + this.#d = 6; +>this.#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/accessorField2(target=es2015).types b/tests/baselines/reference/autoAccessor2(target=es2015).types similarity index 89% rename from tests/baselines/reference/accessorField2(target=es2015).types rename to tests/baselines/reference/autoAccessor2(target=es2015).types index c440eae8a725f..0bff019ef3707 100644 --- a/tests/baselines/reference/accessorField2(target=es2015).types +++ b/tests/baselines/reference/autoAccessor2(target=es2015).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField2(target=es2022).js b/tests/baselines/reference/autoAccessor2(target=es2022).js similarity index 92% rename from tests/baselines/reference/accessorField2(target=es2022).js rename to tests/baselines/reference/autoAccessor2(target=es2022).js index 00a5a76ab6128..7c847b3334ac9 100644 --- a/tests/baselines/reference/accessorField2(target=es2022).js +++ b/tests/baselines/reference/autoAccessor2(target=es2022).js @@ -1,4 +1,4 @@ -//// [accessorField2.ts] +//// [autoAccessor2.ts] class C1 { accessor #a: any; accessor #b = 1; @@ -17,7 +17,7 @@ class C1 { } -//// [accessorField2.js] +//// [autoAccessor2.js] class C1 { #a_accessor_storage; get #a() { return this.#a_accessor_storage; } diff --git a/tests/baselines/reference/autoAccessor2(target=es2022).symbols b/tests/baselines/reference/autoAccessor2(target=es2022).symbols new file mode 100644 index 0000000000000..24e0c62880c3c --- /dev/null +++ b/tests/baselines/reference/autoAccessor2(target=es2022).symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + + accessor #a: any; +>#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10)) + + accessor #b = 1; +>#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21)) + + static accessor #c: any; +>#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20)) + + static accessor #d = 2; +>#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28)) + + constructor() { + this.#a = 3; +>this.#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + + this.#b = 4; +>this.#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + } + + static { + this.#c = 5; +>this.#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + + this.#d = 6; +>this.#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/accessorField2(target=es2022).types b/tests/baselines/reference/autoAccessor2(target=es2022).types similarity index 89% rename from tests/baselines/reference/accessorField2(target=es2022).types rename to tests/baselines/reference/autoAccessor2(target=es2022).types index c440eae8a725f..0bff019ef3707 100644 --- a/tests/baselines/reference/accessorField2(target=es2022).types +++ b/tests/baselines/reference/autoAccessor2(target=es2022).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField2(target=esnext).js b/tests/baselines/reference/autoAccessor2(target=esnext).js similarity index 87% rename from tests/baselines/reference/accessorField2(target=esnext).js rename to tests/baselines/reference/autoAccessor2(target=esnext).js index bcfad4951288a..f184c001cd366 100644 --- a/tests/baselines/reference/accessorField2(target=esnext).js +++ b/tests/baselines/reference/autoAccessor2(target=esnext).js @@ -1,4 +1,4 @@ -//// [accessorField2.ts] +//// [autoAccessor2.ts] class C1 { accessor #a: any; accessor #b = 1; @@ -17,7 +17,7 @@ class C1 { } -//// [accessorField2.js] +//// [autoAccessor2.js] class C1 { accessor #a; accessor #b = 1; diff --git a/tests/baselines/reference/autoAccessor2(target=esnext).symbols b/tests/baselines/reference/autoAccessor2(target=esnext).symbols new file mode 100644 index 0000000000000..24e0c62880c3c --- /dev/null +++ b/tests/baselines/reference/autoAccessor2(target=esnext).symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + + accessor #a: any; +>#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10)) + + accessor #b = 1; +>#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21)) + + static accessor #c: any; +>#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20)) + + static accessor #d = 2; +>#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28)) + + constructor() { + this.#a = 3; +>this.#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + + this.#b = 4; +>this.#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + } + + static { + this.#c = 5; +>this.#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + + this.#d = 6; +>this.#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28)) +>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/accessorField2(target=esnext).types b/tests/baselines/reference/autoAccessor2(target=esnext).types similarity index 89% rename from tests/baselines/reference/accessorField2(target=esnext).types rename to tests/baselines/reference/autoAccessor2(target=esnext).types index c440eae8a725f..0bff019ef3707 100644 --- a/tests/baselines/reference/accessorField2(target=esnext).types +++ b/tests/baselines/reference/autoAccessor2(target=esnext).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField3(target=es2015).js b/tests/baselines/reference/autoAccessor3(target=es2015).js similarity index 96% rename from tests/baselines/reference/accessorField3(target=es2015).js rename to tests/baselines/reference/autoAccessor3(target=es2015).js index 302d5fdc600eb..c2bebd8dc6109 100644 --- a/tests/baselines/reference/accessorField3(target=es2015).js +++ b/tests/baselines/reference/autoAccessor3(target=es2015).js @@ -1,4 +1,4 @@ -//// [accessorField3.ts] +//// [autoAccessor3.ts] class C1 { accessor "w": any; accessor "x" = 1; @@ -7,7 +7,7 @@ class C1 { } -//// [accessorField3.js] +//// [autoAccessor3.js] var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); diff --git a/tests/baselines/reference/autoAccessor3(target=es2015).symbols b/tests/baselines/reference/autoAccessor3(target=es2015).symbols new file mode 100644 index 0000000000000..9cf05f23a9e4d --- /dev/null +++ b/tests/baselines/reference/autoAccessor3(target=es2015).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(autoAccessor3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(autoAccessor3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(autoAccessor3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(autoAccessor3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=es5).types b/tests/baselines/reference/autoAccessor3(target=es2015).types similarity index 86% rename from tests/baselines/reference/accessorField3(target=es5).types rename to tests/baselines/reference/autoAccessor3(target=es2015).types index 4434ebeda37a4..dec77973d0cd6 100644 --- a/tests/baselines/reference/accessorField3(target=es5).types +++ b/tests/baselines/reference/autoAccessor3(target=es2015).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField3(target=es2022).js b/tests/baselines/reference/autoAccessor3(target=es2022).js similarity index 91% rename from tests/baselines/reference/accessorField3(target=es2022).js rename to tests/baselines/reference/autoAccessor3(target=es2022).js index 4cb2eed6d7678..20453ef464fba 100644 --- a/tests/baselines/reference/accessorField3(target=es2022).js +++ b/tests/baselines/reference/autoAccessor3(target=es2022).js @@ -1,4 +1,4 @@ -//// [accessorField3.ts] +//// [autoAccessor3.ts] class C1 { accessor "w": any; accessor "x" = 1; @@ -7,7 +7,7 @@ class C1 { } -//// [accessorField3.js] +//// [autoAccessor3.js] class C1 { #_a_accessor_storage; get "w"() { return this.#_a_accessor_storage; } diff --git a/tests/baselines/reference/autoAccessor3(target=es2022).symbols b/tests/baselines/reference/autoAccessor3(target=es2022).symbols new file mode 100644 index 0000000000000..9cf05f23a9e4d --- /dev/null +++ b/tests/baselines/reference/autoAccessor3(target=es2022).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(autoAccessor3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(autoAccessor3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(autoAccessor3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(autoAccessor3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=es2015).types b/tests/baselines/reference/autoAccessor3(target=es2022).types similarity index 86% rename from tests/baselines/reference/accessorField3(target=es2015).types rename to tests/baselines/reference/autoAccessor3(target=es2022).types index 4434ebeda37a4..dec77973d0cd6 100644 --- a/tests/baselines/reference/accessorField3(target=es2015).types +++ b/tests/baselines/reference/autoAccessor3(target=es2022).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/autoAccessor3(target=es5).errors.txt b/tests/baselines/reference/autoAccessor3(target=es5).errors.txt new file mode 100644 index 0000000000000..deea9cec64f11 --- /dev/null +++ b/tests/baselines/reference/autoAccessor3(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts (4 errors) ==== + class C1 { + accessor "w": any; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor "x" = 1; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor "y": any; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor "z" = 2; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessor3(target=es5).symbols b/tests/baselines/reference/autoAccessor3(target=es5).symbols new file mode 100644 index 0000000000000..9cf05f23a9e4d --- /dev/null +++ b/tests/baselines/reference/autoAccessor3(target=es5).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(autoAccessor3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(autoAccessor3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(autoAccessor3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(autoAccessor3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=esnext).types b/tests/baselines/reference/autoAccessor3(target=es5).types similarity index 86% rename from tests/baselines/reference/accessorField3(target=esnext).types rename to tests/baselines/reference/autoAccessor3(target=es5).types index 4434ebeda37a4..dec77973d0cd6 100644 --- a/tests/baselines/reference/accessorField3(target=esnext).types +++ b/tests/baselines/reference/autoAccessor3(target=es5).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField3(target=esnext).js b/tests/baselines/reference/autoAccessor3(target=esnext).js similarity index 79% rename from tests/baselines/reference/accessorField3(target=esnext).js rename to tests/baselines/reference/autoAccessor3(target=esnext).js index 6535fef4ac5d9..cad23cf54be1e 100644 --- a/tests/baselines/reference/accessorField3(target=esnext).js +++ b/tests/baselines/reference/autoAccessor3(target=esnext).js @@ -1,4 +1,4 @@ -//// [accessorField3.ts] +//// [autoAccessor3.ts] class C1 { accessor "w": any; accessor "x" = 1; @@ -7,7 +7,7 @@ class C1 { } -//// [accessorField3.js] +//// [autoAccessor3.js] class C1 { accessor "w"; accessor "x" = 1; diff --git a/tests/baselines/reference/autoAccessor3(target=esnext).symbols b/tests/baselines/reference/autoAccessor3(target=esnext).symbols new file mode 100644 index 0000000000000..9cf05f23a9e4d --- /dev/null +++ b/tests/baselines/reference/autoAccessor3(target=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(autoAccessor3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(autoAccessor3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(autoAccessor3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(autoAccessor3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=es2022).types b/tests/baselines/reference/autoAccessor3(target=esnext).types similarity index 86% rename from tests/baselines/reference/accessorField3(target=es2022).types rename to tests/baselines/reference/autoAccessor3(target=esnext).types index 4434ebeda37a4..dec77973d0cd6 100644 --- a/tests/baselines/reference/accessorField3(target=es2022).types +++ b/tests/baselines/reference/autoAccessor3(target=esnext).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField4(target=es2015).js b/tests/baselines/reference/autoAccessor4(target=es2015).js similarity index 96% rename from tests/baselines/reference/accessorField4(target=es2015).js rename to tests/baselines/reference/autoAccessor4(target=es2015).js index 8631dca33e409..d529342e8d96d 100644 --- a/tests/baselines/reference/accessorField4(target=es2015).js +++ b/tests/baselines/reference/autoAccessor4(target=es2015).js @@ -1,4 +1,4 @@ -//// [accessorField4.ts] +//// [autoAccessor4.ts] class C1 { accessor 0: any; accessor 1 = 1; @@ -7,7 +7,7 @@ class C1 { } -//// [accessorField4.js] +//// [autoAccessor4.js] var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); diff --git a/tests/baselines/reference/autoAccessor4(target=es2015).symbols b/tests/baselines/reference/autoAccessor4(target=es2015).symbols new file mode 100644 index 0000000000000..8452d711bfc0f --- /dev/null +++ b/tests/baselines/reference/autoAccessor4(target=es2015).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(autoAccessor4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(autoAccessor4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(autoAccessor4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(autoAccessor4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=es5).types b/tests/baselines/reference/autoAccessor4(target=es2015).types similarity index 85% rename from tests/baselines/reference/accessorField4(target=es5).types rename to tests/baselines/reference/autoAccessor4(target=es2015).types index 702dc296d9b4c..d77c24d296b02 100644 --- a/tests/baselines/reference/accessorField4(target=es5).types +++ b/tests/baselines/reference/autoAccessor4(target=es2015).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField4(target=es2022).js b/tests/baselines/reference/autoAccessor4(target=es2022).js similarity index 91% rename from tests/baselines/reference/accessorField4(target=es2022).js rename to tests/baselines/reference/autoAccessor4(target=es2022).js index 603b4bd3999b1..5f5cf868637c6 100644 --- a/tests/baselines/reference/accessorField4(target=es2022).js +++ b/tests/baselines/reference/autoAccessor4(target=es2022).js @@ -1,4 +1,4 @@ -//// [accessorField4.ts] +//// [autoAccessor4.ts] class C1 { accessor 0: any; accessor 1 = 1; @@ -7,7 +7,7 @@ class C1 { } -//// [accessorField4.js] +//// [autoAccessor4.js] class C1 { #_a_accessor_storage; get 0() { return this.#_a_accessor_storage; } diff --git a/tests/baselines/reference/autoAccessor4(target=es2022).symbols b/tests/baselines/reference/autoAccessor4(target=es2022).symbols new file mode 100644 index 0000000000000..8452d711bfc0f --- /dev/null +++ b/tests/baselines/reference/autoAccessor4(target=es2022).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(autoAccessor4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(autoAccessor4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(autoAccessor4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(autoAccessor4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=es2015).types b/tests/baselines/reference/autoAccessor4(target=es2022).types similarity index 85% rename from tests/baselines/reference/accessorField4(target=es2015).types rename to tests/baselines/reference/autoAccessor4(target=es2022).types index 702dc296d9b4c..d77c24d296b02 100644 --- a/tests/baselines/reference/accessorField4(target=es2015).types +++ b/tests/baselines/reference/autoAccessor4(target=es2022).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/autoAccessor4(target=es5).errors.txt b/tests/baselines/reference/autoAccessor4(target=es5).errors.txt new file mode 100644 index 0000000000000..d53f1d01f0131 --- /dev/null +++ b/tests/baselines/reference/autoAccessor4(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts (4 errors) ==== + class C1 { + accessor 0: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor 1 = 1; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor 2: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor 3 = 2; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessor4(target=es5).symbols b/tests/baselines/reference/autoAccessor4(target=es5).symbols new file mode 100644 index 0000000000000..8452d711bfc0f --- /dev/null +++ b/tests/baselines/reference/autoAccessor4(target=es5).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(autoAccessor4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(autoAccessor4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(autoAccessor4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(autoAccessor4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=esnext).types b/tests/baselines/reference/autoAccessor4(target=es5).types similarity index 85% rename from tests/baselines/reference/accessorField4(target=esnext).types rename to tests/baselines/reference/autoAccessor4(target=es5).types index 702dc296d9b4c..d77c24d296b02 100644 --- a/tests/baselines/reference/accessorField4(target=esnext).types +++ b/tests/baselines/reference/autoAccessor4(target=es5).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField4(target=esnext).js b/tests/baselines/reference/autoAccessor4(target=esnext).js similarity index 77% rename from tests/baselines/reference/accessorField4(target=esnext).js rename to tests/baselines/reference/autoAccessor4(target=esnext).js index b0eafbf87f317..431d6dee3ef5a 100644 --- a/tests/baselines/reference/accessorField4(target=esnext).js +++ b/tests/baselines/reference/autoAccessor4(target=esnext).js @@ -1,4 +1,4 @@ -//// [accessorField4.ts] +//// [autoAccessor4.ts] class C1 { accessor 0: any; accessor 1 = 1; @@ -7,7 +7,7 @@ class C1 { } -//// [accessorField4.js] +//// [autoAccessor4.js] class C1 { accessor 0; accessor 1 = 1; diff --git a/tests/baselines/reference/autoAccessor4(target=esnext).symbols b/tests/baselines/reference/autoAccessor4(target=esnext).symbols new file mode 100644 index 0000000000000..8452d711bfc0f --- /dev/null +++ b/tests/baselines/reference/autoAccessor4(target=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(autoAccessor4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(autoAccessor4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(autoAccessor4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(autoAccessor4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=es2022).types b/tests/baselines/reference/autoAccessor4(target=esnext).types similarity index 85% rename from tests/baselines/reference/accessorField4(target=es2022).types rename to tests/baselines/reference/autoAccessor4(target=esnext).types index 702dc296d9b4c..d77c24d296b02 100644 --- a/tests/baselines/reference/accessorField4(target=es2022).types +++ b/tests/baselines/reference/autoAccessor4(target=esnext).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField5(target=es2015).js b/tests/baselines/reference/autoAccessor5(target=es2015).js similarity index 96% rename from tests/baselines/reference/accessorField5(target=es2015).js rename to tests/baselines/reference/autoAccessor5(target=es2015).js index 6e5f0cab385aa..4463eca1f379c 100644 --- a/tests/baselines/reference/accessorField5(target=es2015).js +++ b/tests/baselines/reference/autoAccessor5(target=es2015).js @@ -1,4 +1,4 @@ -//// [accessorField5.ts] +//// [autoAccessor5.ts] class C1 { accessor ["w"]: any; accessor ["x"] = 1; @@ -12,7 +12,7 @@ class C2 { accessor [f()] = 1; } -//// [accessorField5.js] +//// [autoAccessor5.js] var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); diff --git a/tests/baselines/reference/autoAccessor5(target=es2015).symbols b/tests/baselines/reference/autoAccessor5(target=es2015).symbols new file mode 100644 index 0000000000000..9c75146d06733 --- /dev/null +++ b/tests/baselines/reference/autoAccessor5(target=es2015).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10)) +>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=es5).types b/tests/baselines/reference/autoAccessor5(target=es2015).types similarity index 88% rename from tests/baselines/reference/accessorField5(target=es5).types rename to tests/baselines/reference/autoAccessor5(target=es2015).types index 60b575def5744..5711fae50f537 100644 --- a/tests/baselines/reference/accessorField5(target=es5).types +++ b/tests/baselines/reference/autoAccessor5(target=es2015).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField5(target=es2022).js b/tests/baselines/reference/autoAccessor5(target=es2022).js similarity index 93% rename from tests/baselines/reference/accessorField5(target=es2022).js rename to tests/baselines/reference/autoAccessor5(target=es2022).js index 2388795f8ac3e..e150d27e30ea5 100644 --- a/tests/baselines/reference/accessorField5(target=es2022).js +++ b/tests/baselines/reference/autoAccessor5(target=es2022).js @@ -1,4 +1,4 @@ -//// [accessorField5.ts] +//// [autoAccessor5.ts] class C1 { accessor ["w"]: any; accessor ["x"] = 1; @@ -12,7 +12,7 @@ class C2 { accessor [f()] = 1; } -//// [accessorField5.js] +//// [autoAccessor5.js] var _a; class C1 { #_a_accessor_storage; diff --git a/tests/baselines/reference/autoAccessor5(target=es2022).symbols b/tests/baselines/reference/autoAccessor5(target=es2022).symbols new file mode 100644 index 0000000000000..9c75146d06733 --- /dev/null +++ b/tests/baselines/reference/autoAccessor5(target=es2022).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10)) +>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=es2015).types b/tests/baselines/reference/autoAccessor5(target=es2022).types similarity index 88% rename from tests/baselines/reference/accessorField5(target=es2015).types rename to tests/baselines/reference/autoAccessor5(target=es2022).types index 60b575def5744..5711fae50f537 100644 --- a/tests/baselines/reference/accessorField5(target=es2015).types +++ b/tests/baselines/reference/autoAccessor5(target=es2022).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField5(target=es5).errors.txt b/tests/baselines/reference/autoAccessor5(target=es5).errors.txt similarity index 51% rename from tests/baselines/reference/accessorField5(target=es5).errors.txt rename to tests/baselines/reference/autoAccessor5(target=es5).errors.txt index 52fa176a00b10..a6181fcefa876 100644 --- a/tests/baselines/reference/accessorField5(target=es5).errors.txt +++ b/tests/baselines/reference/autoAccessor5(target=es5).errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts (4 errors) ==== +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (4 errors) ==== class C1 { accessor ["w"]: any; ~~~~~ diff --git a/tests/baselines/reference/autoAccessor5(target=es5).symbols b/tests/baselines/reference/autoAccessor5(target=es5).symbols new file mode 100644 index 0000000000000..9c75146d06733 --- /dev/null +++ b/tests/baselines/reference/autoAccessor5(target=es5).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10)) +>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=esnext).types b/tests/baselines/reference/autoAccessor5(target=es5).types similarity index 88% rename from tests/baselines/reference/accessorField5(target=esnext).types rename to tests/baselines/reference/autoAccessor5(target=es5).types index 60b575def5744..5711fae50f537 100644 --- a/tests/baselines/reference/accessorField5(target=esnext).types +++ b/tests/baselines/reference/autoAccessor5(target=es5).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField5(target=esnext).js b/tests/baselines/reference/autoAccessor5(target=esnext).js similarity index 85% rename from tests/baselines/reference/accessorField5(target=esnext).js rename to tests/baselines/reference/autoAccessor5(target=esnext).js index 7c84d37e73c3d..c5485ce42ba15 100644 --- a/tests/baselines/reference/accessorField5(target=esnext).js +++ b/tests/baselines/reference/autoAccessor5(target=esnext).js @@ -1,4 +1,4 @@ -//// [accessorField5.ts] +//// [autoAccessor5.ts] class C1 { accessor ["w"]: any; accessor ["x"] = 1; @@ -12,7 +12,7 @@ class C2 { accessor [f()] = 1; } -//// [accessorField5.js] +//// [autoAccessor5.js] class C1 { accessor ["w"]; accessor ["x"] = 1; diff --git a/tests/baselines/reference/autoAccessor5(target=esnext).symbols b/tests/baselines/reference/autoAccessor5(target=esnext).symbols new file mode 100644 index 0000000000000..9c75146d06733 --- /dev/null +++ b/tests/baselines/reference/autoAccessor5(target=esnext).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10)) +>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=es2022).types b/tests/baselines/reference/autoAccessor5(target=esnext).types similarity index 88% rename from tests/baselines/reference/accessorField5(target=es2022).types rename to tests/baselines/reference/autoAccessor5(target=esnext).types index 60b575def5744..5711fae50f537 100644 --- a/tests/baselines/reference/accessorField5(target=es2022).types +++ b/tests/baselines/reference/autoAccessor5(target=esnext).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).errors.txt similarity index 59% rename from tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt rename to tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).errors.txt index 4a63914155538..e8867ac42e138 100644 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt +++ b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts (1 errors) ==== class C1 { accessor a: any; } diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).js similarity index 91% rename from tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js rename to tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).js index b2afea001fa94..0868215c3fe0c 100644 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js +++ b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).js @@ -1,4 +1,4 @@ -//// [accessorField6.ts] +//// [autoAccessor6.ts] class C1 { accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField6.js] +//// [autoAccessor6.js] var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); @@ -26,6 +26,9 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function ( }; var _C1_a_accessor_storage; class C1 { + constructor() { + _C1_a_accessor_storage.set(this, void 0); + } get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } } diff --git a/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..81d3591d79d78 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(autoAccessor6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(autoAccessor6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +>super : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).types similarity index 86% rename from tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types rename to tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).types index a6b9efded46a1..e93c302e46076 100644 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types +++ b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=false).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).errors.txt similarity index 59% rename from tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt rename to tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).errors.txt index 4a63914155538..e8867ac42e138 100644 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt +++ b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts (1 errors) ==== class C1 { accessor a: any; } diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).js similarity index 95% rename from tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js rename to tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).js index e217a7d9eb0c6..54ab76c1b4a48 100644 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js +++ b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).js @@ -1,4 +1,4 @@ -//// [accessorField6.ts] +//// [autoAccessor6.ts] class C1 { accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField6.js] +//// [autoAccessor6.js] var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); diff --git a/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..81d3591d79d78 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(autoAccessor6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(autoAccessor6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +>super : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).types similarity index 86% rename from tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types rename to tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).types index a6b9efded46a1..e93c302e46076 100644 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types +++ b/tests/baselines/reference/autoAccessor6(target=es2015,usedefineforclassfields=true).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).errors.txt similarity index 59% rename from tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt rename to tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).errors.txt index 4a63914155538..e8867ac42e138 100644 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt +++ b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts (1 errors) ==== class C1 { accessor a: any; } diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).js similarity index 86% rename from tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js rename to tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).js index 27f356be65eef..26181ea85fe31 100644 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js +++ b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).js @@ -1,4 +1,4 @@ -//// [accessorField6.ts] +//// [autoAccessor6.ts] class C1 { accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField6.js] +//// [autoAccessor6.js] class C1 { #a_accessor_storage; get a() { return this.#a_accessor_storage; } diff --git a/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..81d3591d79d78 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(autoAccessor6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(autoAccessor6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +>super : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).types similarity index 86% rename from tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types rename to tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).types index a6b9efded46a1..e93c302e46076 100644 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types +++ b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=false).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).errors.txt similarity index 59% rename from tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt rename to tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).errors.txt index 4a63914155538..e8867ac42e138 100644 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt +++ b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts (1 errors) ==== class C1 { accessor a: any; } diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).js similarity index 84% rename from tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js rename to tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).js index a2816090e4614..8092e0db5ae42 100644 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js +++ b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).js @@ -1,4 +1,4 @@ -//// [accessorField6.ts] +//// [autoAccessor6.ts] class C1 { accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField6.js] +//// [autoAccessor6.js] class C1 { #a_accessor_storage; get a() { return this.#a_accessor_storage; } diff --git a/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..81d3591d79d78 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(autoAccessor6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(autoAccessor6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +>super : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).types similarity index 86% rename from tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types rename to tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).types index a6b9efded46a1..e93c302e46076 100644 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types +++ b/tests/baselines/reference/autoAccessor6(target=es2022,usedefineforclassfields=true).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).errors.txt new file mode 100644 index 0000000000000..e8867ac42e138 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).js similarity index 82% rename from tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js rename to tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).js index e38b062084739..9dfddc101abc6 100644 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js +++ b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).js @@ -1,4 +1,4 @@ -//// [accessorField6.ts] +//// [autoAccessor6.ts] class C1 { accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField6.js] +//// [autoAccessor6.js] class C1 { } class C2 extends C1 { diff --git a/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..81d3591d79d78 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(autoAccessor6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(autoAccessor6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +>super : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..e93c302e46076 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=false).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).errors.txt new file mode 100644 index 0000000000000..e8867ac42e138 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).js similarity index 79% rename from tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js rename to tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).js index e6550dab6f237..47d8e6c085d18 100644 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js +++ b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).js @@ -1,4 +1,4 @@ -//// [accessorField6.ts] +//// [autoAccessor6.ts] class C1 { accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField6.js] +//// [autoAccessor6.js] class C1 { accessor a; } diff --git a/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..81d3591d79d78 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(autoAccessor6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(autoAccessor6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +>super : Symbol(C1, Decl(autoAccessor6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..e93c302e46076 --- /dev/null +++ b/tests/baselines/reference/autoAccessor6(target=esnext,usedefineforclassfields=true).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).js similarity index 95% rename from tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js rename to tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).js index 272f35f30706c..1c1661a1f77f3 100644 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js +++ b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).js @@ -1,4 +1,4 @@ -//// [accessorField7.ts] +//// [autoAccessor7.ts] abstract class C1 { abstract accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField7.js] +//// [autoAccessor7.js] var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); diff --git a/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..4e4fd71011864 --- /dev/null +++ b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(autoAccessor7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(autoAccessor7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).types similarity index 86% rename from tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types rename to tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).types index a103af877051c..e64536a22b8b2 100644 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types +++ b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=false).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === abstract class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).js similarity index 95% rename from tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js rename to tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).js index 272f35f30706c..1c1661a1f77f3 100644 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js +++ b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).js @@ -1,4 +1,4 @@ -//// [accessorField7.ts] +//// [autoAccessor7.ts] abstract class C1 { abstract accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField7.js] +//// [autoAccessor7.js] var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); diff --git a/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..4e4fd71011864 --- /dev/null +++ b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(autoAccessor7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(autoAccessor7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).types similarity index 86% rename from tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types rename to tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).types index a103af877051c..e64536a22b8b2 100644 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types +++ b/tests/baselines/reference/autoAccessor7(target=es2015,usedefineforclassfields=true).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === abstract class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).js similarity index 87% rename from tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js rename to tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).js index ff282b347ece2..403aaa048a18e 100644 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js +++ b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).js @@ -1,4 +1,4 @@ -//// [accessorField7.ts] +//// [autoAccessor7.ts] abstract class C1 { abstract accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField7.js] +//// [autoAccessor7.js] class C1 { } class C2 extends C1 { diff --git a/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..4e4fd71011864 --- /dev/null +++ b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(autoAccessor7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(autoAccessor7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).types similarity index 86% rename from tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types rename to tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).types index a103af877051c..e64536a22b8b2 100644 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types +++ b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=false).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === abstract class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).js similarity index 85% rename from tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js rename to tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).js index eb3c26be94053..29f5e54f4080d 100644 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js +++ b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).js @@ -1,4 +1,4 @@ -//// [accessorField7.ts] +//// [autoAccessor7.ts] abstract class C1 { abstract accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField7.js] +//// [autoAccessor7.js] class C1 { } class C2 extends C1 { diff --git a/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..4e4fd71011864 --- /dev/null +++ b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(autoAccessor7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(autoAccessor7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).types similarity index 86% rename from tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types rename to tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).types index a103af877051c..e64536a22b8b2 100644 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types +++ b/tests/baselines/reference/autoAccessor7(target=es2022,usedefineforclassfields=true).types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === abstract class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).js similarity index 82% rename from tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js rename to tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).js index d84530fda0c48..2b8e93b75f8d5 100644 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js +++ b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).js @@ -1,4 +1,4 @@ -//// [accessorField7.ts] +//// [autoAccessor7.ts] abstract class C1 { abstract accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField7.js] +//// [autoAccessor7.js] class C1 { } class C2 extends C1 { diff --git a/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..4e4fd71011864 --- /dev/null +++ b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(autoAccessor7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(autoAccessor7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..e64536a22b8b2 --- /dev/null +++ b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=false).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).js similarity index 80% rename from tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js rename to tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).js index 7951a92f92ba1..7d3989d8cbd58 100644 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js +++ b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).js @@ -1,4 +1,4 @@ -//// [accessorField7.ts] +//// [autoAccessor7.ts] abstract class C1 { abstract accessor a: any; } @@ -12,7 +12,7 @@ class C3 extends C1 { } -//// [accessorField7.js] +//// [autoAccessor7.js] class C1 { } class C2 extends C1 { diff --git a/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..4e4fd71011864 --- /dev/null +++ b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(autoAccessor7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(autoAccessor7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(autoAccessor7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(autoAccessor7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(autoAccessor7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..e64536a22b8b2 --- /dev/null +++ b/tests/baselines/reference/autoAccessor7(target=esnext,usedefineforclassfields=true).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField8.js b/tests/baselines/reference/autoAccessor8.js similarity index 84% rename from tests/baselines/reference/accessorField8.js rename to tests/baselines/reference/autoAccessor8.js index b34d65f1f55e4..3e553dc952ee0 100644 --- a/tests/baselines/reference/accessorField8.js +++ b/tests/baselines/reference/autoAccessor8.js @@ -1,4 +1,4 @@ -//// [accessorField8.ts] +//// [autoAccessor8.ts] class C1 { accessor a: any; static accessor b: any; @@ -18,7 +18,7 @@ function f() { } -//// [accessorField8.js] +//// [autoAccessor8.js] class C1 { accessor a; static accessor b; @@ -32,7 +32,7 @@ function f() { } -//// [accessorField8.d.ts] +//// [autoAccessor8.d.ts] declare class C1 { accessor a: any; static accessor b: any; diff --git a/tests/baselines/reference/autoAccessor8.symbols b/tests/baselines/reference/autoAccessor8.symbols new file mode 100644 index 0000000000000..70179862f1f91 --- /dev/null +++ b/tests/baselines/reference/autoAccessor8.symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor8.ts === +class C1 { +>C1 : Symbol(C1, Decl(autoAccessor8.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessor8.ts, 0, 10)) + + static accessor b: any; +>b : Symbol(C1.b, Decl(autoAccessor8.ts, 1, 20)) +} + +declare class C2 { +>C2 : Symbol(C2, Decl(autoAccessor8.ts, 3, 1)) + + accessor a: any; +>a : Symbol(C2.a, Decl(autoAccessor8.ts, 5, 18)) + + static accessor b: any; +>b : Symbol(C2.b, Decl(autoAccessor8.ts, 6, 20)) +} + +function f() { +>f : Symbol(f, Decl(autoAccessor8.ts, 8, 1)) + + class C3 { +>C3 : Symbol(C3, Decl(autoAccessor8.ts, 10, 14)) + + accessor a: any; +>a : Symbol(C3.a, Decl(autoAccessor8.ts, 11, 14)) + + static accessor b: any; +>b : Symbol(C3.b, Decl(autoAccessor8.ts, 12, 24)) + } + return C3; +>C3 : Symbol(C3, Decl(autoAccessor8.ts, 10, 14)) +} + diff --git a/tests/baselines/reference/accessorField8.types b/tests/baselines/reference/autoAccessor8.types similarity index 88% rename from tests/baselines/reference/accessorField8.types rename to tests/baselines/reference/autoAccessor8.types index 040ad200d7865..39cd36ed09342 100644 --- a/tests/baselines/reference/accessorField8.types +++ b/tests/baselines/reference/autoAccessor8.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts === +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor8.ts === class C1 { >C1 : C1 diff --git a/tests/baselines/reference/accessorFieldAllowedModifiers.js b/tests/baselines/reference/autoAccessorAllowedModifiers.js similarity index 89% rename from tests/baselines/reference/accessorFieldAllowedModifiers.js rename to tests/baselines/reference/autoAccessorAllowedModifiers.js index fb45e88068f84..3e91d75670421 100644 --- a/tests/baselines/reference/accessorFieldAllowedModifiers.js +++ b/tests/baselines/reference/autoAccessorAllowedModifiers.js @@ -1,4 +1,4 @@ -//// [accessorFieldAllowedModifiers.ts] +//// [autoAccessorAllowedModifiers.ts] abstract class C1 { accessor a: any; public accessor b: any; @@ -27,7 +27,7 @@ declare class C3 { -//// [accessorFieldAllowedModifiers.js] +//// [autoAccessorAllowedModifiers.js] class C1 { accessor a; accessor b; diff --git a/tests/baselines/reference/autoAccessorDisallowedModifiers.errors.txt b/tests/baselines/reference/autoAccessorDisallowedModifiers.errors.txt new file mode 100644 index 0000000000000..d816b65516d5a --- /dev/null +++ b/tests/baselines/reference/autoAccessorDisallowedModifiers.errors.txt @@ -0,0 +1,124 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(2,14): error TS1030: 'accessor' modifier already seen. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(3,14): error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(4,13): error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(5,14): error TS1029: 'public' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(6,14): error TS1029: 'private' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(7,14): error TS1029: 'protected' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(8,14): error TS1029: 'abstract' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(9,14): error TS1029: 'static' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(10,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(11,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(12,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(13,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(14,15): error TS1276: An 'accessor' property cannot be declared optional. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(18,14): error TS1029: 'override' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(22,5): error TS1070: 'accessor' modifier cannot appear on a type member. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(25,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(26,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(27,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(28,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(29,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(30,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(31,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(32,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(33,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(33,25): error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(34,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(35,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts(36,1): error TS1275: 'accessor' modifier can only appear on a property declaration. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts (28 errors) ==== + abstract class C1 { + accessor accessor a: any; + ~~~~~~~~ +!!! error TS1030: 'accessor' modifier already seen. + readonly accessor b: any; + ~~~~~~~~ +!!! error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. + declare accessor c: any; + ~~~~~~~~ +!!! error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. + accessor public d: any; + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'accessor' modifier. + accessor private e: any; + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'accessor' modifier. + accessor protected f: any; + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'accessor' modifier. + accessor abstract g: any; + ~~~~~~~~ +!!! error TS1029: 'abstract' modifier must precede 'accessor' modifier. + accessor static h: any; + ~~~~~~ +!!! error TS1029: 'static' modifier must precede 'accessor' modifier. + accessor i() {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor get j() { return false; } + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor set k(v: any) {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor constructor() {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor l?: any; + ~ +!!! error TS1276: An 'accessor' property cannot be declared optional. + } + + class C2 extends C1 { + accessor override g: any; + ~~~~~~~~ +!!! error TS1029: 'override' modifier must precede 'accessor' modifier. + } + + interface I1 { + accessor a: number; + ~~~~~~~~ +!!! error TS1070: 'accessor' modifier cannot appear on a type member. + } + + accessor class C3 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor interface I2 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor namespace N1 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor enum E1 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor var V1: any; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor type T1 = never; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor function F1() {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor import "x"; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor import {} from "x"; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + ~~~ +!!! error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + accessor export { V1 }; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor export default V1; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor import N2 = N1; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + \ No newline at end of file diff --git a/tests/baselines/reference/accessorFieldDisallowedModifiers.js b/tests/baselines/reference/autoAccessorDisallowedModifiers.js similarity index 91% rename from tests/baselines/reference/accessorFieldDisallowedModifiers.js rename to tests/baselines/reference/autoAccessorDisallowedModifiers.js index efc0082d637ad..83fcb6a3ff2ff 100644 --- a/tests/baselines/reference/accessorFieldDisallowedModifiers.js +++ b/tests/baselines/reference/autoAccessorDisallowedModifiers.js @@ -1,4 +1,4 @@ -//// [accessorFieldDisallowedModifiers.ts] +//// [autoAccessorDisallowedModifiers.ts] abstract class C1 { accessor accessor a: any; readonly accessor b: any; @@ -37,7 +37,7 @@ accessor export default V1; accessor import N2 = N1; -//// [accessorFieldDisallowedModifiers.js] +//// [autoAccessorDisallowedModifiers.js] class C1 { accessor accessor a; accessor b; diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).errors.txt b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).errors.txt new file mode 100644 index 0000000000000..059790cbfde3c --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts(12,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts(15,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts (2 errors) ==== + declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; + + class C1 { + @dec + accessor a: any; + + @dec + static accessor b: any; + } + + class C2 { + @dec + ~ +!!! error TS1206: Decorators are not valid here. + accessor #a: any; + + @dec + ~ +!!! error TS1206: Decorators are not valid here. + static accessor #b: any; + } + \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).js b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).js new file mode 100644 index 0000000000000..2a9c980122cf8 --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).js @@ -0,0 +1,64 @@ +//// [autoAccessorExperimentalDecorators.ts] +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; + +class C1 { + @dec + accessor a: any; + + @dec + static accessor b: any; +} + +class C2 { + @dec + accessor #a: any; + + @dec + static accessor #b: any; +} + + +//// [autoAccessorExperimentalDecorators.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _a, _C1_a_accessor_storage, _C1_b_accessor_storage, _C2_instances, _b, _C2_a_get, _C2_a_set, _C2_b_get, _C2_b_set, _C2_a_1_accessor_storage, _C2_b_1_accessor_storage; +class C1 { + constructor() { + _C1_a_accessor_storage.set(this, void 0); + } + get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } + static get b() { return __classPrivateFieldGet(this, _a, "f", _C1_b_accessor_storage); } + static set b(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_b_accessor_storage); } +} +_a = C1, _C1_a_accessor_storage = new WeakMap(); +_C1_b_accessor_storage = { value: void 0 }; +__decorate([ + dec +], C1.prototype, "a", null); +__decorate([ + dec +], C1, "b", null); +class C2 { + constructor() { + _C2_instances.add(this); + _C2_a_1_accessor_storage.set(this, void 0); + } +} +_b = C2, _C2_instances = new WeakSet(), _C2_a_1_accessor_storage = new WeakMap(), _C2_a_get = function _C2_a_get() { return __classPrivateFieldGet(this, _C2_a_1_accessor_storage, "f"); }, _C2_a_set = function _C2_a_set(value) { __classPrivateFieldSet(this, _C2_a_1_accessor_storage, value, "f"); }, _C2_b_get = function _C2_b_get() { return __classPrivateFieldGet(this, _b, "f", _C2_b_1_accessor_storage); }, _C2_b_set = function _C2_b_set(value) { __classPrivateFieldSet(this, _b, value, "f", _C2_b_1_accessor_storage); }; +_C2_b_1_accessor_storage = { value: void 0 }; diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).symbols b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).symbols new file mode 100644 index 0000000000000..361d8a357c257 --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).symbols @@ -0,0 +1,41 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts === +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) +>target : Symbol(target, Decl(autoAccessorExperimentalDecorators.ts, 0, 18)) +>key : Symbol(key, Decl(autoAccessorExperimentalDecorators.ts, 0, 30)) +>PropertyKey : Symbol(PropertyKey, Decl(lib.es5.d.ts, --, --)) +>desc : Symbol(desc, Decl(autoAccessorExperimentalDecorators.ts, 0, 48)) +>PropertyDescriptor : Symbol(PropertyDescriptor, Decl(lib.es5.d.ts, --, --)) + +class C1 { +>C1 : Symbol(C1, Decl(autoAccessorExperimentalDecorators.ts, 0, 83)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessorExperimentalDecorators.ts, 2, 10)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + static accessor b: any; +>b : Symbol(C1.b, Decl(autoAccessorExperimentalDecorators.ts, 4, 20)) +} + +class C2 { +>C2 : Symbol(C2, Decl(autoAccessorExperimentalDecorators.ts, 8, 1)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + accessor #a: any; +>#a : Symbol(C2.#a, Decl(autoAccessorExperimentalDecorators.ts, 10, 10)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + static accessor #b: any; +>#b : Symbol(C2.#b, Decl(autoAccessorExperimentalDecorators.ts, 12, 21)) +} + diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).types b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).types new file mode 100644 index 0000000000000..3ddf3b2cce215 --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2015).types @@ -0,0 +1,39 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts === +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void +>target : any +>key : PropertyKey +>desc : PropertyDescriptor + +class C1 { +>C1 : C1 + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + accessor a: any; +>a : any + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + static accessor b: any; +>b : any +} + +class C2 { +>C2 : C2 + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + accessor #a: any; +>#a : any + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + static accessor #b: any; +>#b : any +} + diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).errors.txt b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).errors.txt new file mode 100644 index 0000000000000..059790cbfde3c --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts(12,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts(15,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts (2 errors) ==== + declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; + + class C1 { + @dec + accessor a: any; + + @dec + static accessor b: any; + } + + class C2 { + @dec + ~ +!!! error TS1206: Decorators are not valid here. + accessor #a: any; + + @dec + ~ +!!! error TS1206: Decorators are not valid here. + static accessor #b: any; + } + \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).js b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).js new file mode 100644 index 0000000000000..2b1543d3047e7 --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).js @@ -0,0 +1,49 @@ +//// [autoAccessorExperimentalDecorators.ts] +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; + +class C1 { + @dec + accessor a: any; + + @dec + static accessor b: any; +} + +class C2 { + @dec + accessor #a: any; + + @dec + static accessor #b: any; +} + + +//// [autoAccessorExperimentalDecorators.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +class C1 { + #a_accessor_storage; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } + static #b_accessor_storage; + static get b() { return this.#b_accessor_storage; } + static set b(value) { this.#b_accessor_storage = value; } +} +__decorate([ + dec +], C1.prototype, "a", null); +__decorate([ + dec +], C1, "b", null); +class C2 { + #a_1_accessor_storage; + get #a() { return this.#a_1_accessor_storage; } + set #a(value) { this.#a_1_accessor_storage = value; } + static #b_1_accessor_storage; + static get #b() { return this.#b_1_accessor_storage; } + static set #b(value) { this.#b_1_accessor_storage = value; } +} diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).symbols b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).symbols new file mode 100644 index 0000000000000..361d8a357c257 --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).symbols @@ -0,0 +1,41 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts === +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) +>target : Symbol(target, Decl(autoAccessorExperimentalDecorators.ts, 0, 18)) +>key : Symbol(key, Decl(autoAccessorExperimentalDecorators.ts, 0, 30)) +>PropertyKey : Symbol(PropertyKey, Decl(lib.es5.d.ts, --, --)) +>desc : Symbol(desc, Decl(autoAccessorExperimentalDecorators.ts, 0, 48)) +>PropertyDescriptor : Symbol(PropertyDescriptor, Decl(lib.es5.d.ts, --, --)) + +class C1 { +>C1 : Symbol(C1, Decl(autoAccessorExperimentalDecorators.ts, 0, 83)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessorExperimentalDecorators.ts, 2, 10)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + static accessor b: any; +>b : Symbol(C1.b, Decl(autoAccessorExperimentalDecorators.ts, 4, 20)) +} + +class C2 { +>C2 : Symbol(C2, Decl(autoAccessorExperimentalDecorators.ts, 8, 1)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + accessor #a: any; +>#a : Symbol(C2.#a, Decl(autoAccessorExperimentalDecorators.ts, 10, 10)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + static accessor #b: any; +>#b : Symbol(C2.#b, Decl(autoAccessorExperimentalDecorators.ts, 12, 21)) +} + diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).types b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).types new file mode 100644 index 0000000000000..3ddf3b2cce215 --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=es2022).types @@ -0,0 +1,39 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts === +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void +>target : any +>key : PropertyKey +>desc : PropertyDescriptor + +class C1 { +>C1 : C1 + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + accessor a: any; +>a : any + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + static accessor b: any; +>b : any +} + +class C2 { +>C2 : C2 + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + accessor #a: any; +>#a : any + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + static accessor #b: any; +>#b : any +} + diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).errors.txt b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).errors.txt new file mode 100644 index 0000000000000..059790cbfde3c --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts(12,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts(15,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts (2 errors) ==== + declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; + + class C1 { + @dec + accessor a: any; + + @dec + static accessor b: any; + } + + class C2 { + @dec + ~ +!!! error TS1206: Decorators are not valid here. + accessor #a: any; + + @dec + ~ +!!! error TS1206: Decorators are not valid here. + static accessor #b: any; + } + \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).js b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).js new file mode 100644 index 0000000000000..20f3b3d513711 --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).js @@ -0,0 +1,41 @@ +//// [autoAccessorExperimentalDecorators.ts] +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; + +class C1 { + @dec + accessor a: any; + + @dec + static accessor b: any; +} + +class C2 { + @dec + accessor #a: any; + + @dec + static accessor #b: any; +} + + +//// [autoAccessorExperimentalDecorators.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +class C1 { + accessor a; + static accessor b; +} +__decorate([ + dec +], C1.prototype, "a", null); +__decorate([ + dec +], C1, "b", null); +class C2 { + accessor #a; + static accessor #b; +} diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).symbols b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).symbols new file mode 100644 index 0000000000000..361d8a357c257 --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).symbols @@ -0,0 +1,41 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts === +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) +>target : Symbol(target, Decl(autoAccessorExperimentalDecorators.ts, 0, 18)) +>key : Symbol(key, Decl(autoAccessorExperimentalDecorators.ts, 0, 30)) +>PropertyKey : Symbol(PropertyKey, Decl(lib.es5.d.ts, --, --)) +>desc : Symbol(desc, Decl(autoAccessorExperimentalDecorators.ts, 0, 48)) +>PropertyDescriptor : Symbol(PropertyDescriptor, Decl(lib.es5.d.ts, --, --)) + +class C1 { +>C1 : Symbol(C1, Decl(autoAccessorExperimentalDecorators.ts, 0, 83)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + accessor a: any; +>a : Symbol(C1.a, Decl(autoAccessorExperimentalDecorators.ts, 2, 10)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + static accessor b: any; +>b : Symbol(C1.b, Decl(autoAccessorExperimentalDecorators.ts, 4, 20)) +} + +class C2 { +>C2 : Symbol(C2, Decl(autoAccessorExperimentalDecorators.ts, 8, 1)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + accessor #a: any; +>#a : Symbol(C2.#a, Decl(autoAccessorExperimentalDecorators.ts, 10, 10)) + + @dec +>dec : Symbol(dec, Decl(autoAccessorExperimentalDecorators.ts, 0, 11)) + + static accessor #b: any; +>#b : Symbol(C2.#b, Decl(autoAccessorExperimentalDecorators.ts, 12, 21)) +} + diff --git a/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).types b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).types new file mode 100644 index 0000000000000..3ddf3b2cce215 --- /dev/null +++ b/tests/baselines/reference/autoAccessorExperimentalDecorators(target=esnext).types @@ -0,0 +1,39 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts === +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void +>target : any +>key : PropertyKey +>desc : PropertyDescriptor + +class C1 { +>C1 : C1 + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + accessor a: any; +>a : any + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + static accessor b: any; +>b : any +} + +class C2 { +>C2 : C2 + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + accessor #a: any; +>#a : any + + @dec +>dec : (target: any, key: PropertyKey, desc: PropertyDescriptor) => void + + static accessor #b: any; +>#b : any +} + diff --git a/tests/baselines/reference/decoratorOnClassProperty13.js b/tests/baselines/reference/decoratorOnClassProperty13.js index c914c6be18cf3..3ce4ead68fa39 100644 --- a/tests/baselines/reference/decoratorOnClassProperty13.js +++ b/tests/baselines/reference/decoratorOnClassProperty13.js @@ -1,5 +1,5 @@ //// [decoratorOnClassProperty13.ts] -declare function dec(target: any, propertyKey: string): void; +declare function dec(target: any, propertyKey: string, desc: PropertyDescriptor): void; class C { @dec accessor prop; @@ -25,6 +25,9 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function ( }; var _C_prop_accessor_storage; class C { + constructor() { + _C_prop_accessor_storage.set(this, void 0); + } get prop() { return __classPrivateFieldGet(this, _C_prop_accessor_storage, "f"); } set prop(value) { __classPrivateFieldSet(this, _C_prop_accessor_storage, value, "f"); } } diff --git a/tests/baselines/reference/decoratorOnClassProperty13.symbols b/tests/baselines/reference/decoratorOnClassProperty13.symbols index 6dc163ffaed97..cc9d96096bb57 100644 --- a/tests/baselines/reference/decoratorOnClassProperty13.symbols +++ b/tests/baselines/reference/decoratorOnClassProperty13.symbols @@ -1,11 +1,13 @@ === tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts === -declare function dec(target: any, propertyKey: string): void; +declare function dec(target: any, propertyKey: string, desc: PropertyDescriptor): void; >dec : Symbol(dec, Decl(decoratorOnClassProperty13.ts, 0, 0)) >target : Symbol(target, Decl(decoratorOnClassProperty13.ts, 0, 21)) >propertyKey : Symbol(propertyKey, Decl(decoratorOnClassProperty13.ts, 0, 33)) +>desc : Symbol(desc, Decl(decoratorOnClassProperty13.ts, 0, 54)) +>PropertyDescriptor : Symbol(PropertyDescriptor, Decl(lib.es5.d.ts, --, --)) class C { ->C : Symbol(C, Decl(decoratorOnClassProperty13.ts, 0, 61)) +>C : Symbol(C, Decl(decoratorOnClassProperty13.ts, 0, 87)) @dec accessor prop; >dec : Symbol(dec, Decl(decoratorOnClassProperty13.ts, 0, 0)) diff --git a/tests/baselines/reference/decoratorOnClassProperty13.types b/tests/baselines/reference/decoratorOnClassProperty13.types index 6a9d7ca61c55e..ed061c458fdbc 100644 --- a/tests/baselines/reference/decoratorOnClassProperty13.types +++ b/tests/baselines/reference/decoratorOnClassProperty13.types @@ -1,13 +1,14 @@ === tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts === -declare function dec(target: any, propertyKey: string): void; ->dec : (target: any, propertyKey: string) => void +declare function dec(target: any, propertyKey: string, desc: PropertyDescriptor): void; +>dec : (target: any, propertyKey: string, desc: PropertyDescriptor) => void >target : any >propertyKey : string +>desc : PropertyDescriptor class C { >C : C @dec accessor prop; ->dec : (target: any, propertyKey: string) => void +>dec : (target: any, propertyKey: string, desc: PropertyDescriptor) => void >prop : any } diff --git a/tests/baselines/reference/privateNameDuplicateField.js b/tests/baselines/reference/privateNameDuplicateField.js index 1ed7681412e50..7070236925786 100644 --- a/tests/baselines/reference/privateNameDuplicateField.js +++ b/tests/baselines/reference/privateNameDuplicateField.js @@ -456,24 +456,18 @@ function Field() { _A_Field_StaticField_foo_1 = { value: "foo" }; // Error class A_Field_StaticMethod { - constructor() { - } #foo = "foo"; static #foo() { } } _b = A_Field_StaticMethod, _A_Field_StaticMethod_foo = new WeakMap(); // Error class A_Field_StaticGetter { - constructor() { - } #foo = "foo"; static get #foo() { return ""; } } _c = A_Field_StaticGetter, _A_Field_StaticGetter_foo = new WeakMap(); // Error class A_Field_StaticSetter { - constructor() { - } #foo = "foo"; static set #foo(value) { } } diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor7.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor8.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor8.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorAllowedModifiers.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorAllowedModifiers.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts similarity index 100% rename from tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts rename to tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorDisallowedModifiers.ts diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts new file mode 100644 index 0000000000000..525beec0d4b33 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessorExperimentalDecorators.ts @@ -0,0 +1,20 @@ +// @target: esnext, es2022, es2015 +// @experimentalDecorators: true + +declare var dec: (target: any, key: PropertyKey, desc: PropertyDescriptor) => void; + +class C1 { + @dec + accessor a: any; + + @dec + static accessor b: any; +} + +class C2 { + @dec + accessor #a: any; + + @dec + static accessor #b: any; +} diff --git a/tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts b/tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts index 2955af4dd771c..95977876681ac 100644 --- a/tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts +++ b/tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts @@ -1,6 +1,6 @@ // @target: ES2015 // @experimentaldecorators: true -declare function dec(target: any, propertyKey: string): void; +declare function dec(target: any, propertyKey: string, desc: PropertyDescriptor): void; class C { @dec accessor prop; From 02405ec1a35b57ac44cb9fadf7552687fa8f548e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 1 Sep 2022 19:23:06 -0400 Subject: [PATCH 03/51] classFields cleanup and PR feedback --- src/compiler/factory/nodeFactory.ts | 2 +- src/compiler/factory/utilities.ts | 2 +- src/compiler/transformers/classFields.ts | 827 ++++++++++-------- .../reference/autoAccessor2(target=es2015).js | 10 +- .../autoAccessor5(target=es2015).errors.txt | 17 + .../reference/autoAccessor5(target=es2015).js | 3 - .../autoAccessor5(target=es2015).symbols | 1 - .../autoAccessor5(target=es2015).types | 1 - .../autoAccessor5(target=es2022).errors.txt | 17 + .../reference/autoAccessor5(target=es2022).js | 2 - .../autoAccessor5(target=es2022).symbols | 1 - .../autoAccessor5(target=es2022).types | 1 - .../autoAccessor5(target=es5).errors.txt | 6 +- .../reference/autoAccessor5(target=es5).js | 81 ++ .../autoAccessor5(target=es5).symbols | 1 - .../reference/autoAccessor5(target=es5).types | 1 - .../autoAccessor5(target=esnext).errors.txt | 17 + .../reference/autoAccessor5(target=esnext).js | 2 - .../autoAccessor5(target=esnext).symbols | 1 - .../autoAccessor5(target=esnext).types | 1 - .../completionsOverridingMethod15.baseline | 12 + .../completionsOverridingMethod16.baseline | 12 + .../reference/controlFlowPrivateClassField.js | 4 +- .../reference/privateIdentifierChain.1.js | 8 +- ...FieldDestructuredBinding(target=es2015).js | 12 +- .../reference/privateNameMethodAssignment.js | 2 +- ...rivateNameNestedClassAccessorsShadowing.js | 2 +- .../privateNameNestedClassMethodShadowing.js | 2 +- ...FieldDestructuredBinding(target=es2015).js | 12 +- ...FieldDestructuredBinding(target=es2022).js | 14 +- ...FieldDestructuredBinding(target=esnext).js | 14 +- .../privateNameStaticMethodAssignment.js | 2 +- ...eStaticsAndStaticMethods(target=es2022).js | 14 +- ...eStaticsAndStaticMethods(target=esnext).js | 14 +- .../privateNamesAndGenericClasses-2.js | 10 +- .../privateNamesAndMethods(target=es2022).js | 14 +- .../privateNamesAndMethods(target=esnext).js | 14 +- ...ateNamesAndStaticMethods(target=es2022).js | 14 +- ...ateNamesAndStaticMethods(target=esnext).js | 14 +- ...eOfThisInStaticMembers12(target=es2022).js | 17 +- ...eOfThisInStaticMembers12(target=esnext).js | 17 +- .../autoAccessor5.ts | 2 - 42 files changed, 750 insertions(+), 470 deletions(-) create mode 100644 tests/baselines/reference/autoAccessor5(target=es2015).errors.txt create mode 100644 tests/baselines/reference/autoAccessor5(target=es2022).errors.txt create mode 100644 tests/baselines/reference/autoAccessor5(target=es5).js create mode 100644 tests/baselines/reference/autoAccessor5(target=esnext).errors.txt diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index f8285fe455545..9d7a2fce604d5 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1040,7 +1040,7 @@ namespace ts { transformFlags = TransformFlags.ContainsES2015; break; case SyntaxKind.AccessorKeyword: - transformFlags = TransformFlags.ContainsDecorators; + transformFlags = TransformFlags.ContainsClassFields; break; case SyntaxKind.ThisKeyword: // 'this' indicates a lexical 'this' diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 7454adac42f56..6c7f02c240f2e 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -1323,7 +1323,7 @@ namespace ts { /** - * Creates a private backing field for an `accesor` {@link PropertyDeclaration}. + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. */ export function createAccessorPropertyBackingField(factory: NodeFactory, node: PropertyDeclaration, modifiers: ModifiersArray | undefined, initializer: Expression | undefined) { return factory.updatePropertyDeclaration( diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index d225cd8f2239b..3ae7696d7c96e 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -143,29 +143,35 @@ namespace ts { const languageVersion = getEmitScriptTarget(compilerOptions); const useDefineForClassFields = getUseDefineForClassFields(compilerOptions); - // We need to transform class field initializers when not using Define, or when using - // Define and targeting < ES2022. - const shouldTransformInitializersUsingSet = !useDefineForClassFields || languageVersion < ScriptTarget.ES2022; - const shouldTransformInitializersUsingDefine = useDefineForClassFields || languageVersion < ScriptTarget.ES2022; + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + const shouldTransformInitializersUsingSet = !useDefineForClassFields; - // We need to transform `accessor` fields when targeting < ESNext - const shouldTransformAutoAccessors = languageVersion < ScriptTarget.ESNext; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + const shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < ScriptTarget.ES2022; + const shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; - // We need to transform private members and class static blocks when targeting < ES2022. + // We need to transform private members and class static blocks when target < ES2022. const shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < ScriptTarget.ES2022; + // We need to transform `accessor` fields when target < ESNext + const shouldTransformAutoAccessors = languageVersion < ScriptTarget.ESNext; + // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. const shouldTransformThisInStaticInitializers = languageVersion < ScriptTarget.ES2022; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. const shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= ScriptTarget.ES2015; - const shouldTransformAnything = shouldTransformInitializersUsingSet || shouldTransformAutoAccessors; + const shouldTransformAnything = + shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; const previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; + const previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; @@ -189,6 +195,7 @@ namespace ts { const classLexicalEnvironmentMap = new Map(); let currentClassLexicalEnvironment: ClassLexicalEnvironment | undefined; + let currentClassContainer: ClassLikeDeclaration | undefined; let currentComputedPropertyNameClassLexicalEnvironment: ClassLexicalEnvironment | undefined; let currentStaticPropertyDeclarationOrStaticBlock: PropertyDeclaration | ClassStaticBlockDeclaration | undefined; @@ -205,101 +212,98 @@ namespace ts { } function visitor(node: Node): VisitResult { - return visitorWorker(node, /*valueIsDiscarded*/ false); - } - - function discardedValueVisitor(node: Node): VisitResult { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } + if (!(node.transformFlags & TransformFlags.ContainsClassFields) && + !(node.transformFlags & TransformFlags.ContainsLexicalThisOrSuper)) { + return node; + } - function visitorWorker(node: Node, valueIsDiscarded: boolean): VisitResult { switch (node.kind) { - case SyntaxKind.ClassExpression: + case SyntaxKind.AccessorKeyword: + return shouldTransformAutoAccessors ? undefined : node; case SyntaxKind.ClassDeclaration: - return visitClassLikeDeclaration(node as ClassLikeDeclaration); - } - - if (shouldTransformInitializersUsingSet) { - if (node.transformFlags & TransformFlags.ContainsClassFields) { - switch (node.kind) { - case SyntaxKind.PropertyDeclaration: - return visitPropertyDeclaration(node as PropertyDeclaration); - case SyntaxKind.VariableStatement: - return visitVariableStatement(node as VariableStatement); - case SyntaxKind.PrivateIdentifier: - return visitPrivateIdentifier(node as PrivateIdentifier); - case SyntaxKind.ClassStaticBlockDeclaration: - return visitClassStaticBlockDeclaration(node as ClassStaticBlockDeclaration); - } - } - - if (node.transformFlags & TransformFlags.ContainsClassFields || - node.transformFlags & TransformFlags.ContainsLexicalSuper && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case SyntaxKind.PrefixUnaryExpression: - case SyntaxKind.PostfixUnaryExpression: - return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, valueIsDiscarded); - case SyntaxKind.BinaryExpression: - return visitBinaryExpression(node as BinaryExpression, valueIsDiscarded); - case SyntaxKind.CallExpression: - return visitCallExpression(node as CallExpression); - case SyntaxKind.TaggedTemplateExpression: - return visitTaggedTemplateExpression(node as TaggedTemplateExpression); - case SyntaxKind.PropertyAccessExpression: - return visitPropertyAccessExpression(node as PropertyAccessExpression); - case SyntaxKind.ElementAccessExpression: - return visitElementAccessExpression(node as ElementAccessExpression); - case SyntaxKind.ExpressionStatement: - return visitExpressionStatement(node as ExpressionStatement); - case SyntaxKind.ForStatement: - return visitForStatement(node as ForStatement); - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.Constructor: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: { - const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - const result = visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } - } + return visitClassDeclaration(node as ClassDeclaration); + case SyntaxKind.ClassExpression: + return visitClassExpression(node as ClassExpression); + case SyntaxKind.ClassStaticBlockDeclaration: + return visitClassStaticBlockDeclaration(node as ClassStaticBlockDeclaration); + case SyntaxKind.PropertyDeclaration: + return visitPropertyDeclaration(node as PropertyDeclaration); + case SyntaxKind.VariableStatement: + return visitVariableStatement(node as VariableStatement); + case SyntaxKind.PrivateIdentifier: + return visitPrivateIdentifier(node as PrivateIdentifier); + case SyntaxKind.PropertyAccessExpression: + return visitPropertyAccessExpression(node as PropertyAccessExpression); + case SyntaxKind.ElementAccessExpression: + return visitElementAccessExpression(node as ElementAccessExpression); + case SyntaxKind.PrefixUnaryExpression: + case SyntaxKind.PostfixUnaryExpression: + return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, /*valueIsDiscarded*/ false); + case SyntaxKind.BinaryExpression: + return visitBinaryExpression(node as BinaryExpression, /*valueIsDiscarded*/ false); + case SyntaxKind.CallExpression: + return visitCallExpression(node as CallExpression); + case SyntaxKind.ExpressionStatement: + return visitExpressionStatement(node as ExpressionStatement); + case SyntaxKind.TaggedTemplateExpression: + return visitTaggedTemplateExpression(node as TaggedTemplateExpression); + case SyntaxKind.ForStatement: + return visitForStatement(node as ForStatement); + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.Constructor: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, + fallbackVisitor, + node + ); } + default: + return fallbackVisitor(node); } + } - if (shouldTransformAutoAccessors) { - switch (node.kind) { - case SyntaxKind.AccessorKeyword: - return undefined; - } + function fallbackVisitor(node: Node) { + return visitEachChild(node, visitor, context); + } - if (node.transformFlags & TransformFlags.ContainsClassFields) { - switch (node.kind) { - case SyntaxKind.PropertyDeclaration: - return visitPropertyDeclaration(node as PropertyDeclaration); - } - } + /** + * Visits a node in an expression whose result is discarded. + */ + function discardedValueVisitor(node: Node): VisitResult { + switch (node.kind) { + case SyntaxKind.PrefixUnaryExpression: + case SyntaxKind.PostfixUnaryExpression: + return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, /*valueIsDiscarded*/ true); + case SyntaxKind.BinaryExpression: + return visitBinaryExpression(node as BinaryExpression, /*valueIsDiscarded*/ true); + default: + return visitor(node); } - - return visitEachChild(node, visitor, context); } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node: Node): VisitResult { switch (node.kind) { case SyntaxKind.HeritageClause: return visitEachChild(node, heritageClauseVisitor, context); case SyntaxKind.ExpressionWithTypeArguments: - return visitExpressionWithTypeArguments(node as ExpressionWithTypeArguments); + return visitExpressionWithTypeArgumentsInHeritageClause(node as ExpressionWithTypeArguments); + default: + return visitor(node); } - return visitor(node); } - function destructuringTargetVisitor(node: Node): VisitResult { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node: Node): VisitResult { switch (node.kind) { case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.ArrayLiteralExpression: @@ -309,6 +313,50 @@ namespace ts { } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node: Node): VisitResult { + switch (node.kind) { + case SyntaxKind.Constructor: + return visitConstructorDeclaration(node as ConstructorDeclaration); + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.MethodDeclaration: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, + visitMethodOrAccessorDeclaration, + node as MethodDeclaration | AccessorDeclaration); + case SyntaxKind.PropertyDeclaration: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, + visitPropertyDeclaration, + node as PropertyDeclaration); + case SyntaxKind.ComputedPropertyName: + return visitComputedPropertyName(node as ComputedPropertyName); + case SyntaxKind.SemicolonClassElement: + return node; + default: + return visitor(node); + } + } + + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node: Node) { + switch (node.kind) { + case SyntaxKind.PropertyDeclaration: + return transformFieldInitializer(node as PropertyDeclaration); + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return classElementVisitor(node); + default: + Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } + /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -325,17 +373,18 @@ namespace ts { return setOriginalNode(factory.createIdentifier(""), node); } + type PrivateIdentifierInExpression = BinaryExpression & { readonly left: PrivateIdentifier, readonly token: InKeyword }; + + function isPrivateIdentifierInExpression(node: BinaryExpression): node is PrivateIdentifierInExpression { + return isPrivateIdentifier(node.left) + && node.operatorToken.kind === SyntaxKind.InKeyword; + } + /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node: BinaryExpression) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - const privId = node.left; - Debug.assertNode(privId, isPrivateIdentifier); - Debug.assert(node.operatorToken.kind === SyntaxKind.InKeyword); - const info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node: PrivateIdentifierInExpression) { + const info = accessPrivateIdentifier(node.left); if (info) { const receiver = visitNode(node.right, visitor, isExpression); @@ -349,56 +398,6 @@ namespace ts { return visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node: Node): VisitResult { - if (shouldTransformInitializersUsingSet) { - switch (node.kind) { - case SyntaxKind.Constructor: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.MethodDeclaration: - return visitMethodOrAccessorDeclaration(node as MethodDeclaration | AccessorDeclaration); - - case SyntaxKind.PropertyDeclaration: - return visitPropertyDeclaration(node as PropertyDeclaration); - - case SyntaxKind.SemicolonClassElement: - return node; - } - } - - if (shouldTransformAutoAccessors) { - switch (node.kind) { - case SyntaxKind.PropertyDeclaration: - return visitPropertyDeclaration(node as PropertyDeclaration); - } - } - - switch (node.kind) { - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - const result = visitEachChild(node, classElementVisitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - case SyntaxKind.ComputedPropertyName: - return visitComputedPropertyName(node as ComputedPropertyName); - } - - return visitor(node); - } - function visitVariableStatement(node: VariableStatement) { const savedPendingStatements = pendingStatements; pendingStatements = []; @@ -426,6 +425,13 @@ namespace ts { return factory.updateComputedPropertyName(node, expression); } + function visitConstructorDeclaration(node: ConstructorDeclaration) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); + } + function visitMethodOrAccessorDeclaration(node: MethodDeclaration | AccessorDeclaration) { Debug.assert(!hasDecorators(node)); @@ -450,9 +456,9 @@ namespace ts { node.asteriskToken, functionName, /* typeParameters */ undefined, - visitParameterList(node.parameters, classElementVisitor, context), + visitParameterList(node.parameters, visitor, context), /* type */ undefined, - visitFunctionBody(node.body!, classElementVisitor, context) + visitFunctionBody(node.body!, visitor, context) ) ) ); @@ -462,6 +468,18 @@ namespace ts { return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + current: ClassStaticBlockDeclaration | PropertyDeclaration | undefined, + visitor: (arg: T) => U, + arg: T, + ) { + const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + const result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } + function getHoistedFunctionName(node: MethodDeclaration | AccessorDeclaration) { Debug.assert(isPrivateIdentifier(node.name)); const info = accessPrivateIdentifier(node.name); @@ -481,19 +499,6 @@ namespace ts { } } - function accessorFieldResultVisitor(node: Node) { - switch (node.kind) { - case SyntaxKind.PropertyDeclaration: - return transformFieldInitializer(node as PropertyDeclaration); - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - return classElementVisitor(node); - default: - Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); - break; - } - } - function transformAutoAccessor(node: AutoAccessorPropertyDeclaration): VisitResult { // transforms: // accessor x = 1; @@ -541,13 +546,20 @@ namespace ts { } function transformPrivateFieldInitializer(node: PrivateIdentifierPropertyDeclaration) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (isStatic(node)) { - // static fields are left as is - return visitEachChild(node, classElementVisitor, context); - } + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. + const info = accessPrivateIdentifier(node.name); + Debug.assert(info, "Undeclared private name for property declaration."); + + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } - // Initializer is elided as the field is initialized in transformConstructor. + if (shouldTransformInitializersUsingSet && !isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. return factory.updatePropertyDeclaration( node, visitNodes(node.modifiers, visitor, isModifierLike), @@ -558,62 +570,54 @@ namespace ts { ); } - const info = accessPrivateIdentifier(node.name); - Debug.assert(info, "Undeclared private name for property declaration."); - - // leave invalid code untransformed - if (!info.isValid) { - return node; - } + return visitEachChild(node, visitor, context); } function transformPublicFieldInitializer(node: PropertyDeclaration) { - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - const expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); - } - - if (isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - const initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - const staticBlock = factory.createClassStaticBlockDeclaration( - factory.createBlock([initializerStatement]) - ); + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + + const expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); + } - setOriginalNode(staticBlock, node); - setCommentRange(staticBlock, node); + if (isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + const initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + const staticBlock = factory.createClassStaticBlockDeclaration( + factory.createBlock([initializerStatement]) + ); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - setCommentRange(initializerStatement, { pos: -1, end: -1 }); - setSyntheticLeadingComments(initializerStatement, undefined); - setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + setOriginalNode(staticBlock, node); + setCommentRange(staticBlock, node); + + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + setCommentRange(initializerStatement, { pos: -1, end: -1 }); + setSyntheticLeadingComments(initializerStatement, undefined); + setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + + return undefined; } - return undefined; + return visitEachChild(node, classElementVisitor, context); } function transformFieldInitializer(node: PropertyDeclaration) { - Debug.assert(!hasDecorators(node)); - - if (!shouldTransformInitializersUsingSet) { - return visitEachChild(node, classElementVisitor, context); - } - - if (isPrivateIdentifierClassElementDeclaration(node)) { - return transformPrivateFieldInitializer(node); - } - - return transformPublicFieldInitializer(node); + Debug.assert(!hasDecorators(node), "Decorators should already have been transformed and elided."); + return isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); } function visitPropertyDeclaration(node: PropertyDeclaration) { - // If this is an accessor field, we defer to `transformAccessorField`. That function + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function // will in turn call `transformFieldInitializer` as needed. if (shouldTransformAutoAccessors && isAutoAccessorPropertyDeclaration(node)) { return transformAutoAccessor(node); @@ -719,9 +723,11 @@ namespace ts { } function visitPreOrPostfixUnaryExpression(node: PrefixUnaryExpression | PostfixUnaryExpression, valueIsDiscarded: boolean) { - if (node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken) { + if (node.operator === SyntaxKind.PlusPlusToken || + node.operator === SyntaxKind.MinusMinusToken) { const operand = skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierPropertyAccessExpression(operand)) { let info: PrivateIdentifierInfo | undefined; if (info = accessPrivateIdentifier(operand.name)) { const receiver = visitNode(operand.expression, visitor, isExpression); @@ -830,7 +836,10 @@ namespace ts { } function visitCallExpression(node: CallExpression) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() + // Transform call expressions of private names to properly bind the `this` parameter. const { thisArg, target } = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion); if (isCallChain(node)) { @@ -854,6 +863,8 @@ namespace ts { isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment?.classConstructor) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` const invocation = factory.createFunctionCallCall( @@ -870,7 +881,8 @@ namespace ts { } function visitTaggedTemplateExpression(node: TaggedTemplateExpression) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. const { thisArg, target } = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion); return factory.updateTaggedTemplateExpression( @@ -914,11 +926,12 @@ namespace ts { } startLexicalEnvironment(); - const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - let statements = visitNodes(node.body.statements, visitor, isStatement); + let statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + node, + statements => visitNodes(statements, visitor, isStatement), + node.body.statements + ); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; const iife = factory.createImmediatelyInvokedArrowFunction(statements); setOriginalNode(iife, node); @@ -930,11 +943,14 @@ namespace ts { function visitBinaryExpression(node: BinaryExpression, valueIsDiscarded: boolean) { if (isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) const savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; node = factory.updateBinaryExpression( node, - visitNode(node.left, destructuringTargetVisitor), + visitNode(node.left, assignmentTargetVisitor), node.operatorToken, visitNode(node.right, visitor) ); @@ -945,7 +961,9 @@ namespace ts { return expr; } if (isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... const info = accessPrivateIdentifier(node.left.name); if (info) { return setTextRange( @@ -961,6 +979,10 @@ namespace ts { isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... const { classConstructor, superClassReference, facts } = currentClassLexicalEnvironment; if (facts & ClassFacts.ClassWasDecorated) { return factory.updateBinaryExpression( @@ -1028,8 +1050,10 @@ namespace ts { } } } - if (node.operatorToken.kind === SyntaxKind.InKeyword && isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return visitEachChild(node, visitor, context); } @@ -1080,54 +1104,6 @@ namespace ts { } } - /** - * Set up the environment for a class. - */ - function visitClassLikeDeclaration(node: ClassLikeDeclaration) { - const shouldTransform = shouldTransformInitializersUsingSet - && node.transformFlags & TransformFlags.ContainsClassFields - && forEach(node.members, doesClassElementNeedTransform); - - if (!shouldTransform) { - const savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - const result = visitEachChild(node, visitor, context); - pendingExpressions = savedPendingExpressions; - return result; - } - - const savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - const name = getNameOfDeclaration(node); - if (name && isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = name; - } - - const privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass( - "instances", - privateInstanceMethodsAndAccessors[0].name - ); - } - } - - const result = isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - - function doesClassElementNeedTransform(node: ClassElement) { - return isPropertyDeclaration(node) || isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && isPrivateIdentifier(node.name)); - } - function getPrivateInstanceMethodsAndAccessors(node: ClassLikeDeclaration) { return filter(node.members, isNonStaticMethodOrAccessorWithPrivateName); } @@ -1160,7 +1136,7 @@ namespace ts { return facts; } - function visitExpressionWithTypeArguments(node: ExpressionWithTypeArguments) { + function visitExpressionWithTypeArgumentsInHeritageClause(node: ExpressionWithTypeArguments) { const facts = currentClassLexicalEnvironment?.facts || ClassFacts.None; if (facts & ClassFacts.NeedsClassSuperReference) { const temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -1177,15 +1153,50 @@ namespace ts { return visitEachChild(node, visitor, context); } - function visitClassDeclaration(node: ClassDeclaration) { + function visitInNewClassLexicalEnvironment(node: T, visitor: (node: T, facts: ClassFacts) => U) { + const savedCurrentClassContainer = currentClassContainer; + const savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + const name = getNameOfDeclaration(node); + if (name && isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + + const privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass( + "instances", + privateInstanceMethodsAndAccessors[0].name + ); + } + } + const facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; } + if (facts & ClassFacts.NeedsSubstitutionForThisInClassStaticField) { enableSubstitutionForClassStaticThisOrSuperReference(); } + const result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + + } + + function visitClassDeclaration(node: ClassDeclaration) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + + function visitClassDeclarationInNewClassLexicalEnvironment(node: ClassDeclaration, facts: ClassFacts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. let pendingClassReferenceAssignment: BinaryExpression | undefined; @@ -1195,19 +1206,24 @@ namespace ts { pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - const extendsClauseElement = getEffectiveBaseTypeNode(node); - const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== SyntaxKind.NullKeyword); + const modifiers = visitNodes(node.modifiers, visitor, isModifierLike); + const heritageClauses = visitNodes(node.heritageClauses, heritageClauseVisitor, isHeritageClause); + const { members, prologue } = transformClassMembers(node); + const classDecl = factory.updateClassDeclaration( + node, + modifiers, + node.name, + /*typeParameters*/ undefined, + heritageClauses, + members + ); - const statements: Statement[] = [ - factory.updateClassDeclaration( - node, - node.modifiers, - node.name, - /*typeParameters*/ undefined, - visitNodes(node.heritageClauses, heritageClauseVisitor, isHeritageClause), - transformClassMembers(node, isDerivedClass) - ) - ]; + const statements: Statement[] = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); @@ -1218,30 +1234,27 @@ namespace ts { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - const staticProperties = getStaticPropertiesAndClassStaticBlock(node); - if (some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + const staticProperties = getStaticPropertiesAndClassStaticBlock(node); + if (some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node: ClassExpression): Expression { - const facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - - if (facts & ClassFacts.NeedsSubstitutionForThisInClassStaticField) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node: ClassExpression, facts: ClassFacts): Expression { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -1253,9 +1266,6 @@ namespace ts { const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node); - const extendsClauseElement = getEffectiveBaseTypeNode(node); - const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== SyntaxKind.NullKeyword); - const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithConstructorReference; let temp: Identifier | undefined; function createClassTempVar() { @@ -1270,16 +1280,32 @@ namespace ts { getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } + const modifiers = visitNodes(node.modifiers, visitor, isModifierLike); + const heritageClauses = visitNodes(node.heritageClauses, heritageClauseVisitor, isHeritageClause); + const { members, prologue } = transformClassMembers(node); const classExpression = factory.updateClassExpression( node, - visitNodes(node.modifiers, visitor, isModifierLike), + modifiers, node.name, /*typeParameters*/ undefined, - visitNodes(node.heritageClauses, heritageClauseVisitor, isHeritageClause), - transformClassMembers(node, isDerivedClass) + heritageClauses, + members ); - const hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && some(staticPropertiesOrClassStaticBlocks, p => isClassStaticBlockDeclaration(p) || !!p.initializer || isPrivateIdentifier(p.name)); + const expressions: Expression[] = []; + if (prologue) { + expressions.push(prologue); + } + + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + const hasTransformableStatics = + shouldTransformPrivateElementsOrClassStaticBlocks && + some(staticPropertiesOrClassStaticBlocks, node => + isClassStaticBlockDeclaration(node) || + isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && isInitializedProperty(node)); + if (hasTransformableStatics || some(pendingExpressions)) { if (isDecoratedClassDeclaration) { Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -1292,13 +1318,20 @@ namespace ts { if (pendingStatements && some(staticPropertiesOrClassStaticBlocks)) { addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } + if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push( + startOnNewLine(factory.createAssignment(temp, classExpression)), + startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + startOnNewLine(classExpression); + } } - return classExpression; } else { - const expressions: Expression[] = []; temp ||= createClassTempVar(); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -1316,64 +1349,96 @@ namespace ts { addRange(expressions, map(pendingExpressions, startOnNewLine)); addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(startOnNewLine(temp)); - - return factory.inlineExpressions(expressions); + } + } + else { + expressions.push(classExpression); + if (prologue) { + startOnNewLine(classExpression); } } - return classExpression; + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return visitEachChild(node, classElementVisitor, context); + return visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node: ClassDeclaration | ClassExpression, isDerivedClass: boolean) { - const members: ClassElement[] = []; + function transformClassMembers(node: ClassDeclaration | ClassExpression) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (const member of node.members) { if (isPrivateIdentifierClassElementDeclaration(member)) { addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } - if (some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } - if (shouldTransformAutoAccessors) { for (const member of node.members) { if (isAutoAccessorPropertyDeclaration(member)) { - addPrivateIdentifierToEnvironment(member, factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"), addPrivateIdentifierPropertyDeclarationToEnvironment); + const storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); } } } } - const constructor = transformConstructor(node, isDerivedClass); - const visitedMembers = visitNodes(node.members, classElementVisitor, isClassElement); + let members = visitNodes(node.members, classElementVisitor, isClassElement); - if (constructor) { - members.push(constructor); + // Create a synthetic constructor if necessary + let syntheticConstructor: ConstructorDeclaration | undefined; + if (!some(members, isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + let prologue: Expression | undefined; + + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + let syntheticStaticBlock: ClassStaticBlockDeclaration | undefined; if (!shouldTransformPrivateElementsOrClassStaticBlocks && some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration( - factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]) - )); + let statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & TransformFlags.ContainsLexicalThisOrSuper) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + const temp = factory.createTempVariable(hoistVariableDeclaration); + const arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, + factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + + const block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - addRange(members, visitedMembers); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + let membersArray: ClassElement[] | undefined; + membersArray = append(membersArray, syntheticConstructor); + membersArray = append(membersArray, syntheticStaticBlock); + membersArray = addRange(membersArray, members); + members = setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } - return setTextRange(factory.createNodeArray(members), /*location*/ node.members); + return { members, prologue }; } function createBrandCheckWeakSetForPrivateMethods() { @@ -1403,16 +1468,23 @@ namespace ts { shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node: ClassDeclaration | ClassExpression, isDerivedClass: boolean) { - const constructor = visitNode(getFirstConstructorWithBody(node), visitor, isConstructorDeclaration); - if (!some(node.members, isClassElementThatRequiresConstructorStatement)) { + function transformConstructor(constructor: ConstructorDeclaration | undefined, container: ClassDeclaration | ClassExpression) { + constructor = visitNode(constructor, visitor, isConstructorDeclaration); + if (!some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + const extendsClauseElement = getEffectiveBaseTypeNode(container); + const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== SyntaxKind.NullKeyword); const parameters = visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - const body = transformConstructorBody(node, constructor, isDerivedClass); + const body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + + if (constructor) { + Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return startOnNewLine( @@ -1423,7 +1495,7 @@ namespace ts { parameters ?? [], body ), - constructor || node + constructor || container ), constructor ) @@ -1988,7 +2060,15 @@ namespace ts { return pendingExpressions ??= []; } - function addPrivateIdentifierClassElementToEnvironment(node: T, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined) { + function addPrivateIdentifierClassElementToEnvironment( + node: PropertyDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration, + name: PrivateIdentifier, + lex: ClassLexicalEnvironment, + privateEnv: PrivateIdentifierEnvironment, + isStatic: boolean, + isValid: boolean, + previousInfo: PrivateIdentifierInfo | undefined + ) { if (isAutoAccessorPropertyDeclaration(node)) { addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } @@ -2006,7 +2086,15 @@ namespace ts { } } - function addPrivateIdentifierPropertyDeclarationToEnvironment(_node: PropertyDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined) { + function addPrivateIdentifierPropertyDeclarationToEnvironment( + _node: PropertyDeclaration, + name: PrivateIdentifier, + lex: ClassLexicalEnvironment, + privateEnv: PrivateIdentifierEnvironment, + isStatic: boolean, + isValid: boolean, + _previousInfo: PrivateIdentifierInfo | undefined + ) { if (isStatic) { Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); @@ -2041,7 +2129,15 @@ namespace ts { } } - function addPrivateIdentifierMethodDeclarationToEnvironment(_node: MethodDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined) { + function addPrivateIdentifierMethodDeclarationToEnvironment( + _node: MethodDeclaration, + name: PrivateIdentifier, + lex: ClassLexicalEnvironment, + privateEnv: PrivateIdentifierEnvironment, + isStatic: boolean, + isValid: boolean, + _previousInfo: PrivateIdentifierInfo | undefined + ) { const methodName = createHoistedVariableForPrivateName(name); const brandCheckIdentifier = isStatic ? Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : @@ -2056,7 +2152,15 @@ namespace ts { }); } - function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node: GetAccessorDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined) { + function addPrivateIdentifierGetAccessorDeclarationToEnvironment( + _node: GetAccessorDeclaration, + name: PrivateIdentifier, + lex: ClassLexicalEnvironment, + privateEnv: PrivateIdentifierEnvironment, + isStatic: boolean, + isValid: boolean, + previousInfo: PrivateIdentifierInfo | undefined + ) { const getterName = createHoistedVariableForPrivateName(name, "_get"); const brandCheckIdentifier = isStatic ? Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : @@ -2077,7 +2181,15 @@ namespace ts { } } - function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node: SetAccessorDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined) { + function addPrivateIdentifierSetAccessorDeclarationToEnvironment( + _node: SetAccessorDeclaration, + name: PrivateIdentifier, + lex: ClassLexicalEnvironment, + privateEnv: PrivateIdentifierEnvironment, + isStatic: boolean, + isValid: boolean, + previousInfo: PrivateIdentifierInfo | undefined + ) { const setterName = createHoistedVariableForPrivateName(name, "_set"); const brandCheckIdentifier = isStatic ? Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : @@ -2098,7 +2210,15 @@ namespace ts { } } - function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node: AutoAccessorPropertyDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined) { + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment( + _node: AutoAccessorPropertyDeclaration, + name: PrivateIdentifier, + lex: ClassLexicalEnvironment, + privateEnv: PrivateIdentifierEnvironment, + isStatic: boolean, + isValid: boolean, + _previousInfo: PrivateIdentifierInfo | undefined + ) { const getterName = createHoistedVariableForPrivateName(name, "_get"); const setterName = createHoistedVariableForPrivateName(name, "_set"); const brandCheckIdentifier = isStatic ? @@ -2115,7 +2235,19 @@ namespace ts { }); } - function addPrivateIdentifierToEnvironment(node: T, name: PrivateIdentifier, addDeclaration: (node: T, name: PrivateIdentifier, lex: ClassLexicalEnvironment, privateEnv: PrivateIdentifierEnvironment, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined) => void) { + function addPrivateIdentifierToEnvironment( + node: T, + name: PrivateIdentifier, + addDeclaration: ( + node: T, + name: PrivateIdentifier, + lex: ClassLexicalEnvironment, + privateEnv: PrivateIdentifierEnvironment, + isStatic: boolean, + isValid: boolean, + previousInfo: PrivateIdentifierInfo | undefined + ) => void + ) { const lex = getClassLexicalEnvironment(); const privateEnv = getPrivateIdentifierEnvironment(); const previousInfo = getPrivateIdentifier(privateEnv, name); @@ -2147,6 +2279,11 @@ namespace ts { return createHoistedVariableForClass(text?.substring(1) ?? name, name, suffix); } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ function accessPrivateIdentifier(name: PrivateIdentifier) { if (isGeneratedPrivateIdentifier(name)) { return accessGeneratedPrivateIdentifier(name); @@ -2264,7 +2401,7 @@ namespace ts { } } } - return visitNode(node, destructuringTargetVisitor); + return visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node: ObjectLiteralElementLike) { @@ -2310,13 +2447,13 @@ namespace ts { visitNode(node.name, visitor, isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, visitNode(initializer, visitor)) : wrapped : - visitNode(node.initializer, destructuringTargetVisitor, isExpression) + visitNode(node.initializer, assignmentTargetVisitor, isExpression) ); } if (isSpreadAssignment(node)) { return factory.updateSpreadAssignment( node, - wrapped || visitNode(node.expression, destructuringTargetVisitor, isExpression) + wrapped || visitNode(node.expression, assignmentTargetVisitor, isExpression) ); } Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); diff --git a/tests/baselines/reference/autoAccessor2(target=es2015).js b/tests/baselines/reference/autoAccessor2(target=es2015).js index 30000e27805dd..7b4cb28008e9e 100644 --- a/tests/baselines/reference/autoAccessor2(target=es2015).js +++ b/tests/baselines/reference/autoAccessor2(target=es2015).js @@ -18,17 +18,17 @@ class C1 { //// [autoAccessor2.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; var _C1_instances, _a, _C1_a_get, _C1_a_set, _C1_b_get, _C1_b_set, _C1_c_get, _C1_c_set, _C1_d_get, _C1_d_set, _C1_a_accessor_storage, _C1_b_accessor_storage, _C1_c_accessor_storage, _C1_d_accessor_storage; class C1 { constructor() { diff --git a/tests/baselines/reference/autoAccessor5(target=es2015).errors.txt b/tests/baselines/reference/autoAccessor5(target=es2015).errors.txt new file mode 100644 index 0000000000000..453fd4b6f7fe1 --- /dev/null +++ b/tests/baselines/reference/autoAccessor5(target=es2015).errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(10,14): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (1 errors) ==== + class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; + } + + declare var f: any; + class C2 { + accessor [f()] = 1; + ~~~~~ +!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + } \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessor5(target=es2015).js b/tests/baselines/reference/autoAccessor5(target=es2015).js index 4463eca1f379c..a7394e4d18c8a 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2015).js +++ b/tests/baselines/reference/autoAccessor5(target=es2015).js @@ -8,7 +8,6 @@ class C1 { declare var f: any; class C2 { - // @ts-ignore accessor [f()] = 1; } @@ -44,10 +43,8 @@ _C1__c_accessor_storage = { value: void 0 }; _C1__d_accessor_storage = { value: 2 }; class C2 { constructor() { - // @ts-ignore _C2__e_accessor_storage.set(this, 1); } - // @ts-ignore get [(_C2__e_accessor_storage = new WeakMap(), _b = f(), _b)]() { return __classPrivateFieldGet(this, _C2__e_accessor_storage, "f"); } set [_b](value) { __classPrivateFieldSet(this, _C2__e_accessor_storage, value, "f"); } } diff --git a/tests/baselines/reference/autoAccessor5(target=es2015).symbols b/tests/baselines/reference/autoAccessor5(target=es2015).symbols index 9c75146d06733..71d59a6ef2281 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2015).symbols +++ b/tests/baselines/reference/autoAccessor5(target=es2015).symbols @@ -25,7 +25,6 @@ declare var f: any; class C2 { >C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19)) - // @ts-ignore accessor [f()] = 1; >[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10)) >f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) diff --git a/tests/baselines/reference/autoAccessor5(target=es2015).types b/tests/baselines/reference/autoAccessor5(target=es2015).types index 5711fae50f537..48b48c552dcf4 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2015).types +++ b/tests/baselines/reference/autoAccessor5(target=es2015).types @@ -27,7 +27,6 @@ declare var f: any; class C2 { >C2 : C2 - // @ts-ignore accessor [f()] = 1; >[f()] : number >f() : any diff --git a/tests/baselines/reference/autoAccessor5(target=es2022).errors.txt b/tests/baselines/reference/autoAccessor5(target=es2022).errors.txt new file mode 100644 index 0000000000000..453fd4b6f7fe1 --- /dev/null +++ b/tests/baselines/reference/autoAccessor5(target=es2022).errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(10,14): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (1 errors) ==== + class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; + } + + declare var f: any; + class C2 { + accessor [f()] = 1; + ~~~~~ +!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + } \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessor5(target=es2022).js b/tests/baselines/reference/autoAccessor5(target=es2022).js index e150d27e30ea5..f5022161cea00 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2022).js +++ b/tests/baselines/reference/autoAccessor5(target=es2022).js @@ -8,7 +8,6 @@ class C1 { declare var f: any; class C2 { - // @ts-ignore accessor [f()] = 1; } @@ -30,7 +29,6 @@ class C1 { } class C2 { #_e_accessor_storage = 1; - // @ts-ignore get [(_a = f(), _a)]() { return this.#_e_accessor_storage; } set [_a](value) { this.#_e_accessor_storage = value; } } diff --git a/tests/baselines/reference/autoAccessor5(target=es2022).symbols b/tests/baselines/reference/autoAccessor5(target=es2022).symbols index 9c75146d06733..71d59a6ef2281 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2022).symbols +++ b/tests/baselines/reference/autoAccessor5(target=es2022).symbols @@ -25,7 +25,6 @@ declare var f: any; class C2 { >C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19)) - // @ts-ignore accessor [f()] = 1; >[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10)) >f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) diff --git a/tests/baselines/reference/autoAccessor5(target=es2022).types b/tests/baselines/reference/autoAccessor5(target=es2022).types index 5711fae50f537..48b48c552dcf4 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2022).types +++ b/tests/baselines/reference/autoAccessor5(target=es2022).types @@ -27,7 +27,6 @@ declare var f: any; class C2 { >C2 : C2 - // @ts-ignore accessor [f()] = 1; >[f()] : number >f() : any diff --git a/tests/baselines/reference/autoAccessor5(target=es5).errors.txt b/tests/baselines/reference/autoAccessor5(target=es5).errors.txt index a6181fcefa876..a2290861f4db0 100644 --- a/tests/baselines/reference/autoAccessor5(target=es5).errors.txt +++ b/tests/baselines/reference/autoAccessor5(target=es5).errors.txt @@ -2,9 +2,10 @@ tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(2,14 tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(10,14): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. -==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (4 errors) ==== +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (5 errors) ==== class C1 { accessor ["w"]: any; ~~~~~ @@ -22,6 +23,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(5,21 declare var f: any; class C2 { - // @ts-ignore accessor [f()] = 1; + ~~~~~ +!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. } \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessor5(target=es5).js b/tests/baselines/reference/autoAccessor5(target=es5).js new file mode 100644 index 0000000000000..093dceb5fbd26 --- /dev/null +++ b/tests/baselines/reference/autoAccessor5(target=es5).js @@ -0,0 +1,81 @@ +//// [autoAccessor5.ts] +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + accessor [f()] = 1; +} + +//// [autoAccessor5.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C2__a_accessor_storage, _a; +var C1 = /** @class */ (function () { + function C1() { + _C1__b_accessor_storage.set(this, void 0); + _C1__c_accessor_storage.set(this, 1); + } + Object.defineProperty(C1.prototype, (_C1__b_accessor_storage = new WeakMap(), _C1__c_accessor_storage = new WeakMap(), "w"), { + get: function () { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C1.prototype, "w", { + set: function (value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C1.prototype, "x", { + get: function () { return __classPrivateFieldGet(this, _C1__c_accessor_storage, "f"); }, + set: function (value) { __classPrivateFieldSet(this, _C1__c_accessor_storage, value, "f"); }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C1, "y", { + get: function () { return __classPrivateFieldGet(this, _b, "f", _C1__d_accessor_storage); }, + set: function (value) { __classPrivateFieldSet(this, _b, value, "f", _C1__d_accessor_storage); }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C1, "z", { + get: function () { return __classPrivateFieldGet(this, _b, "f", _C1__e_accessor_storage); }, + set: function (value) { __classPrivateFieldSet(this, _b, value, "f", _C1__e_accessor_storage); }, + enumerable: false, + configurable: true + }); + var _b, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage, _C1__e_accessor_storage; + _b = C1; + _C1__d_accessor_storage = { value: void 0 }; + _C1__e_accessor_storage = { value: 2 }; + return C1; +}()); +var C2 = /** @class */ (function () { + function C2() { + _C2__a_accessor_storage.set(this, 1); + } + Object.defineProperty(C2.prototype, (_C2__a_accessor_storage = new WeakMap(), _a = f(), _a), { + get: function () { return __classPrivateFieldGet(this, _C2__a_accessor_storage, "f"); }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C2.prototype, _a, { + set: function (value) { __classPrivateFieldSet(this, _C2__a_accessor_storage, value, "f"); }, + enumerable: false, + configurable: true + }); + return C2; +}()); diff --git a/tests/baselines/reference/autoAccessor5(target=es5).symbols b/tests/baselines/reference/autoAccessor5(target=es5).symbols index 9c75146d06733..71d59a6ef2281 100644 --- a/tests/baselines/reference/autoAccessor5(target=es5).symbols +++ b/tests/baselines/reference/autoAccessor5(target=es5).symbols @@ -25,7 +25,6 @@ declare var f: any; class C2 { >C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19)) - // @ts-ignore accessor [f()] = 1; >[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10)) >f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) diff --git a/tests/baselines/reference/autoAccessor5(target=es5).types b/tests/baselines/reference/autoAccessor5(target=es5).types index 5711fae50f537..48b48c552dcf4 100644 --- a/tests/baselines/reference/autoAccessor5(target=es5).types +++ b/tests/baselines/reference/autoAccessor5(target=es5).types @@ -27,7 +27,6 @@ declare var f: any; class C2 { >C2 : C2 - // @ts-ignore accessor [f()] = 1; >[f()] : number >f() : any diff --git a/tests/baselines/reference/autoAccessor5(target=esnext).errors.txt b/tests/baselines/reference/autoAccessor5(target=esnext).errors.txt new file mode 100644 index 0000000000000..453fd4b6f7fe1 --- /dev/null +++ b/tests/baselines/reference/autoAccessor5(target=esnext).errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(10,14): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (1 errors) ==== + class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; + } + + declare var f: any; + class C2 { + accessor [f()] = 1; + ~~~~~ +!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + } \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessor5(target=esnext).js b/tests/baselines/reference/autoAccessor5(target=esnext).js index c5485ce42ba15..d7620567c7b76 100644 --- a/tests/baselines/reference/autoAccessor5(target=esnext).js +++ b/tests/baselines/reference/autoAccessor5(target=esnext).js @@ -8,7 +8,6 @@ class C1 { declare var f: any; class C2 { - // @ts-ignore accessor [f()] = 1; } @@ -20,6 +19,5 @@ class C1 { static accessor ["z"] = 2; } class C2 { - // @ts-ignore accessor [f()] = 1; } diff --git a/tests/baselines/reference/autoAccessor5(target=esnext).symbols b/tests/baselines/reference/autoAccessor5(target=esnext).symbols index 9c75146d06733..71d59a6ef2281 100644 --- a/tests/baselines/reference/autoAccessor5(target=esnext).symbols +++ b/tests/baselines/reference/autoAccessor5(target=esnext).symbols @@ -25,7 +25,6 @@ declare var f: any; class C2 { >C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19)) - // @ts-ignore accessor [f()] = 1; >[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10)) >f : Symbol(f, Decl(autoAccessor5.ts, 7, 11)) diff --git a/tests/baselines/reference/autoAccessor5(target=esnext).types b/tests/baselines/reference/autoAccessor5(target=esnext).types index 5711fae50f537..48b48c552dcf4 100644 --- a/tests/baselines/reference/autoAccessor5(target=esnext).types +++ b/tests/baselines/reference/autoAccessor5(target=esnext).types @@ -27,7 +27,6 @@ declare var f: any; class C2 { >C2 : C2 - // @ts-ignore accessor [f()] = 1; >[f()] : number >f() : any diff --git a/tests/baselines/reference/completionsOverridingMethod15.baseline b/tests/baselines/reference/completionsOverridingMethod15.baseline index 16f78ebae8115..4c594a35f3527 100644 --- a/tests/baselines/reference/completionsOverridingMethod15.baseline +++ b/tests/baselines/reference/completionsOverridingMethod15.baseline @@ -23,6 +23,18 @@ } ] }, + { + "name": "accessor", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "accessor", + "kind": "keyword" + } + ] + }, { "name": "async", "kind": "keyword", diff --git a/tests/baselines/reference/completionsOverridingMethod16.baseline b/tests/baselines/reference/completionsOverridingMethod16.baseline index ec29be4e1004b..9bfad8e55a321 100644 --- a/tests/baselines/reference/completionsOverridingMethod16.baseline +++ b/tests/baselines/reference/completionsOverridingMethod16.baseline @@ -23,6 +23,18 @@ } ] }, + { + "name": "accessor", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "accessor", + "kind": "keyword" + } + ] + }, { "name": "async", "kind": "keyword", diff --git a/tests/baselines/reference/controlFlowPrivateClassField.js b/tests/baselines/reference/controlFlowPrivateClassField.js index 0ec517e098d14..0057757653ff3 100644 --- a/tests/baselines/reference/controlFlowPrivateClassField.js +++ b/tests/baselines/reference/controlFlowPrivateClassField.js @@ -29,19 +29,19 @@ class Example2 { //// [controlFlowPrivateClassField.js] "use strict"; class Example { + #test; constructor(test) { this.#test = test; } - #test; get test() { return this.#test; } } class Example2 { + #test; constructor(test) { this.#test = test; } - #test; get test() { if (this.#test) { return this.#test; diff --git a/tests/baselines/reference/privateIdentifierChain.1.js b/tests/baselines/reference/privateIdentifierChain.1.js index 9ce965e2fe9f7..ff73beb38ca96 100644 --- a/tests/baselines/reference/privateIdentifierChain.1.js +++ b/tests/baselines/reference/privateIdentifierChain.1.js @@ -16,13 +16,13 @@ class A { //// [privateIdentifierChain.1.js] "use strict"; class A { + #b; + getA() { + return new A(); + } constructor() { this?.#b; // Error this?.a.#b; // Error this?.getA().#b; // Error } - #b; - getA() { - return new A(); - } } diff --git a/tests/baselines/reference/privateNameFieldDestructuredBinding(target=es2015).js b/tests/baselines/reference/privateNameFieldDestructuredBinding(target=es2015).js index e81cf2550e0a0..0f0cf8fdb6f0b 100644 --- a/tests/baselines/reference/privateNameFieldDestructuredBinding(target=es2015).js +++ b/tests/baselines/reference/privateNameFieldDestructuredBinding(target=es2015).js @@ -33,6 +33,12 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function ( }; var _A_field; class A { + testObject() { + return { x: 10, y: 6 }; + } + testArray() { + return [10, 11]; + } constructor() { var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; _A_field.set(this, 1); @@ -46,12 +52,6 @@ class A { _k = this, [({ set value(_m) { __classPrivateFieldSet(_k, _A_field, _m, "f"); } }).value = 2] = []; _l = this.otherObject, [({ set value(_m) { __classPrivateFieldSet(_l, _A_field, _m, "f"); } }).value = 2] = []; } - testObject() { - return { x: 10, y: 6 }; - } - testArray() { - return [10, 11]; - } static test(_a) { [({ set value(_b) { __classPrivateFieldSet(_a, _A_field, _b, "f"); } }).value] = [2]; } diff --git a/tests/baselines/reference/privateNameMethodAssignment.js b/tests/baselines/reference/privateNameMethodAssignment.js index 08b4bb806bd1b..1533668f7c7f1 100644 --- a/tests/baselines/reference/privateNameMethodAssignment.js +++ b/tests/baselines/reference/privateNameMethodAssignment.js @@ -26,6 +26,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function ( }; var _A3_instances, _A3_method; class A3 { + ; constructor(a, b) { var _a, _b, _c; _A3_instances.add(this); @@ -36,6 +37,5 @@ class A3 { let x = __classPrivateFieldGet(this, _A3_instances, "m", _A3_method); __classPrivateFieldSet(_b = b, _A3_instances, (_c = __classPrivateFieldGet(_b, _A3_instances, "m", _A3_method), _c++, _c), "m"); //Error, not writable } - ; } _A3_instances = new WeakSet(), _A3_method = function _A3_method() { }; diff --git a/tests/baselines/reference/privateNameNestedClassAccessorsShadowing.js b/tests/baselines/reference/privateNameNestedClassAccessorsShadowing.js index 05e47e8bc5337..e735e0309fb0d 100644 --- a/tests/baselines/reference/privateNameNestedClassAccessorsShadowing.js +++ b/tests/baselines/reference/privateNameNestedClassAccessorsShadowing.js @@ -23,6 +23,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function ( }; var _Base_instances, _Base_x_get; class Base { + ; constructor() { var _Derived_instances, _Derived_x_get; _Base_instances.add(this); @@ -40,6 +41,5 @@ class Base { } _Derived_instances = new WeakSet(), _Derived_x_get = function _Derived_x_get() { return 1; }; } - ; } _Base_instances = new WeakSet(), _Base_x_get = function _Base_x_get() { return 1; }; diff --git a/tests/baselines/reference/privateNameNestedClassMethodShadowing.js b/tests/baselines/reference/privateNameNestedClassMethodShadowing.js index df19ceac68b07..af9943b99d7f3 100644 --- a/tests/baselines/reference/privateNameNestedClassMethodShadowing.js +++ b/tests/baselines/reference/privateNameNestedClassMethodShadowing.js @@ -23,6 +23,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function ( }; var _Base_instances, _Base_x; class Base { + ; constructor() { var _Derived_instances, _Derived_x; _Base_instances.add(this); @@ -40,6 +41,5 @@ class Base { } _Derived_instances = new WeakSet(), _Derived_x = function _Derived_x() { }; } - ; } _Base_instances = new WeakSet(), _Base_x = function _Base_x() { }; diff --git a/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=es2015).js b/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=es2015).js index f5ddbe3a7856a..943b099162020 100644 --- a/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=es2015).js +++ b/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=es2015).js @@ -33,6 +33,12 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function ( }; var _b, _A_field; class A { + testObject() { + return { x: 10, y: 6 }; + } + testArray() { + return [10, 11]; + } constructor() { var _c; this.otherClass = A; @@ -45,12 +51,6 @@ class A { [({ set value(_b) { __classPrivateFieldSet(A, _b, _b, "f", _A_field); } }).value = 2] = []; _c = this.otherClass, [({ set value(_b) { __classPrivateFieldSet(_c, _b, _b, "f", _A_field); } }).value = 2] = []; } - testObject() { - return { x: 10, y: 6 }; - } - testArray() { - return [10, 11]; - } static test(_a) { [({ set value(_c) { __classPrivateFieldSet(_a, _b, _c, "f", _A_field); } }).value] = [2]; } diff --git a/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=es2022).js b/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=es2022).js index 69b4fff34e2bf..7b1829df27204 100644 --- a/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=es2022).js +++ b/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=es2022).js @@ -26,6 +26,13 @@ class A { //// [privateNameStaticFieldDestructuredBinding.js] class A { + static #field = 1; + testObject() { + return { x: 10, y: 6 }; + } + testArray() { + return [10, 11]; + } constructor() { this.otherClass = A; let y; @@ -37,13 +44,6 @@ class A { [A.#field = 2] = []; [this.otherClass.#field = 2] = []; } - static #field = 1; - testObject() { - return { x: 10, y: 6 }; - } - testArray() { - return [10, 11]; - } static test(_a) { [_a.#field] = [2]; } diff --git a/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=esnext).js b/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=esnext).js index 69b4fff34e2bf..7b1829df27204 100644 --- a/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=esnext).js +++ b/tests/baselines/reference/privateNameStaticFieldDestructuredBinding(target=esnext).js @@ -26,6 +26,13 @@ class A { //// [privateNameStaticFieldDestructuredBinding.js] class A { + static #field = 1; + testObject() { + return { x: 10, y: 6 }; + } + testArray() { + return [10, 11]; + } constructor() { this.otherClass = A; let y; @@ -37,13 +44,6 @@ class A { [A.#field = 2] = []; [this.otherClass.#field = 2] = []; } - static #field = 1; - testObject() { - return { x: 10, y: 6 }; - } - testArray() { - return [10, 11]; - } static test(_a) { [_a.#field] = [2]; } diff --git a/tests/baselines/reference/privateNameStaticMethodAssignment.js b/tests/baselines/reference/privateNameStaticMethodAssignment.js index aad92bf3205b6..eaaeca788c308 100644 --- a/tests/baselines/reference/privateNameStaticMethodAssignment.js +++ b/tests/baselines/reference/privateNameStaticMethodAssignment.js @@ -26,6 +26,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function ( }; var _a, _A3_method; class A3 { + ; constructor(a, b) { var _b, _c; __classPrivateFieldSet(A3, _a, () => { }, "m"); // Error, not writable @@ -35,6 +36,5 @@ class A3 { let x = __classPrivateFieldGet(A3, _a, "m", _A3_method); __classPrivateFieldSet(_b = b, _a, (_c = __classPrivateFieldGet(_b, _a, "m", _A3_method), _c++, _c), "m"); //Error, not writable } - ; } _a = A3, _A3_method = function _A3_method() { }; diff --git a/tests/baselines/reference/privateNameStaticsAndStaticMethods(target=es2022).js b/tests/baselines/reference/privateNameStaticsAndStaticMethods(target=es2022).js index 971fb06aeb4e0..720176995905f 100644 --- a/tests/baselines/reference/privateNameStaticsAndStaticMethods(target=es2022).js +++ b/tests/baselines/reference/privateNameStaticsAndStaticMethods(target=es2022).js @@ -33,13 +33,6 @@ class B extends A { //// [privateNameStaticsAndStaticMethods.js] "use strict"; class A { - constructor() { - A.#foo(30); - A.#bar(30); - A.#bar(30); - A.#quux = A.#quux + 1; - A.#quux++; - } static #foo(a) { } static async #bar(a) { } static async *#baz(a) { @@ -52,6 +45,13 @@ class A { static set #quux(val) { this.#_quux = val; } + constructor() { + A.#foo(30); + A.#bar(30); + A.#bar(30); + A.#quux = A.#quux + 1; + A.#quux++; + } } class B extends A { static #foo(a) { } diff --git a/tests/baselines/reference/privateNameStaticsAndStaticMethods(target=esnext).js b/tests/baselines/reference/privateNameStaticsAndStaticMethods(target=esnext).js index 971fb06aeb4e0..720176995905f 100644 --- a/tests/baselines/reference/privateNameStaticsAndStaticMethods(target=esnext).js +++ b/tests/baselines/reference/privateNameStaticsAndStaticMethods(target=esnext).js @@ -33,13 +33,6 @@ class B extends A { //// [privateNameStaticsAndStaticMethods.js] "use strict"; class A { - constructor() { - A.#foo(30); - A.#bar(30); - A.#bar(30); - A.#quux = A.#quux + 1; - A.#quux++; - } static #foo(a) { } static async #bar(a) { } static async *#baz(a) { @@ -52,6 +45,13 @@ class A { static set #quux(val) { this.#_quux = val; } + constructor() { + A.#foo(30); + A.#bar(30); + A.#bar(30); + A.#quux = A.#quux + 1; + A.#quux++; + } } class B extends A { static #foo(a) { } diff --git a/tests/baselines/reference/privateNamesAndGenericClasses-2.js b/tests/baselines/reference/privateNamesAndGenericClasses-2.js index 8e0d5c27c5619..2162584cf22f9 100644 --- a/tests/baselines/reference/privateNamesAndGenericClasses-2.js +++ b/tests/baselines/reference/privateNamesAndGenericClasses-2.js @@ -29,17 +29,17 @@ b = a; // Error //// [privateNamesAndGenericClasses-2.js] "use strict"; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; var _C_instances, _C_foo, _C_bar; class C { constructor(t) { diff --git a/tests/baselines/reference/privateNamesAndMethods(target=es2022).js b/tests/baselines/reference/privateNamesAndMethods(target=es2022).js index 5041d2a69d232..007e5810e6be1 100644 --- a/tests/baselines/reference/privateNamesAndMethods(target=es2022).js +++ b/tests/baselines/reference/privateNamesAndMethods(target=es2022).js @@ -32,13 +32,6 @@ class B extends A { //// [privateNamesAndMethods.js] class A { - constructor() { - this.#foo(30); - this.#bar(30); - this.#baz(30); - this.#quux = this.#quux + 1; - this.#quux++; - } #foo(a) { } async #bar(a) { } async *#baz(a) { @@ -51,6 +44,13 @@ class A { set #quux(val) { this.#_quux = val; } + constructor() { + this.#foo(30); + this.#bar(30); + this.#baz(30); + this.#quux = this.#quux + 1; + this.#quux++; + } } class B extends A { #foo(a) { } diff --git a/tests/baselines/reference/privateNamesAndMethods(target=esnext).js b/tests/baselines/reference/privateNamesAndMethods(target=esnext).js index 5041d2a69d232..007e5810e6be1 100644 --- a/tests/baselines/reference/privateNamesAndMethods(target=esnext).js +++ b/tests/baselines/reference/privateNamesAndMethods(target=esnext).js @@ -32,13 +32,6 @@ class B extends A { //// [privateNamesAndMethods.js] class A { - constructor() { - this.#foo(30); - this.#bar(30); - this.#baz(30); - this.#quux = this.#quux + 1; - this.#quux++; - } #foo(a) { } async #bar(a) { } async *#baz(a) { @@ -51,6 +44,13 @@ class A { set #quux(val) { this.#_quux = val; } + constructor() { + this.#foo(30); + this.#bar(30); + this.#baz(30); + this.#quux = this.#quux + 1; + this.#quux++; + } } class B extends A { #foo(a) { } diff --git a/tests/baselines/reference/privateNamesAndStaticMethods(target=es2022).js b/tests/baselines/reference/privateNamesAndStaticMethods(target=es2022).js index 7ec1ea5b8cc6f..ca2c039123d6b 100644 --- a/tests/baselines/reference/privateNamesAndStaticMethods(target=es2022).js +++ b/tests/baselines/reference/privateNamesAndStaticMethods(target=es2022).js @@ -33,13 +33,6 @@ class B extends A { //// [privateNamesAndStaticMethods.js] "use strict"; class A { - constructor() { - A.#foo(30); - A.#bar(30); - A.#bar(30); - A.#quux = A.#quux + 1; - A.#quux++; - } static #foo(a) { } static async #bar(a) { } static async *#baz(a) { @@ -52,6 +45,13 @@ class A { static set #quux(val) { this.#_quux = val; } + constructor() { + A.#foo(30); + A.#bar(30); + A.#bar(30); + A.#quux = A.#quux + 1; + A.#quux++; + } } class B extends A { static #foo(a) { } diff --git a/tests/baselines/reference/privateNamesAndStaticMethods(target=esnext).js b/tests/baselines/reference/privateNamesAndStaticMethods(target=esnext).js index 7ec1ea5b8cc6f..ca2c039123d6b 100644 --- a/tests/baselines/reference/privateNamesAndStaticMethods(target=esnext).js +++ b/tests/baselines/reference/privateNamesAndStaticMethods(target=esnext).js @@ -33,13 +33,6 @@ class B extends A { //// [privateNamesAndStaticMethods.js] "use strict"; class A { - constructor() { - A.#foo(30); - A.#bar(30); - A.#bar(30); - A.#quux = A.#quux + 1; - A.#quux++; - } static #foo(a) { } static async #bar(a) { } static async *#baz(a) { @@ -52,6 +45,13 @@ class A { static set #quux(val) { this.#_quux = val; } + constructor() { + A.#foo(30); + A.#bar(30); + A.#bar(30); + A.#quux = A.#quux + 1; + A.#quux++; + } } class B extends A { static #foo(a) { } diff --git a/tests/baselines/reference/typeOfThisInStaticMembers12(target=es2022).js b/tests/baselines/reference/typeOfThisInStaticMembers12(target=es2022).js index 4072197b7007d..61a0be489d18b 100644 --- a/tests/baselines/reference/typeOfThisInStaticMembers12(target=es2022).js +++ b/tests/baselines/reference/typeOfThisInStaticMembers12(target=es2022).js @@ -9,14 +9,15 @@ class C { //// [typeOfThisInStaticMembers12.js] -var _a, _b; +var _a, _b, _c; class C { static { this.c = "foo"; } - static { this.bar = class Inner { - constructor() { - this[_b] = 123; - } - static { _a = this.c, _b = this.c; } - static { this[_a] = 123; } - }; } + static { this.bar = (_c = () => { _a = this.c, _b = this.c; }, + class Inner { + constructor() { + this[_b] = 123; + } + static { _c(); } + static { this[_a] = 123; } + }); } } diff --git a/tests/baselines/reference/typeOfThisInStaticMembers12(target=esnext).js b/tests/baselines/reference/typeOfThisInStaticMembers12(target=esnext).js index 4072197b7007d..61a0be489d18b 100644 --- a/tests/baselines/reference/typeOfThisInStaticMembers12(target=esnext).js +++ b/tests/baselines/reference/typeOfThisInStaticMembers12(target=esnext).js @@ -9,14 +9,15 @@ class C { //// [typeOfThisInStaticMembers12.js] -var _a, _b; +var _a, _b, _c; class C { static { this.c = "foo"; } - static { this.bar = class Inner { - constructor() { - this[_b] = 123; - } - static { _a = this.c, _b = this.c; } - static { this[_a] = 123; } - }; } + static { this.bar = (_c = () => { _a = this.c, _b = this.c; }, + class Inner { + constructor() { + this[_b] = 123; + } + static { _c(); } + static { this[_a] = 123; } + }); } } diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts index 99e5cb140ef73..dbbb949a3e34f 100644 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts @@ -1,5 +1,4 @@ // @target: esnext, es2022, es2015, es5 -// @noEmitOnError: true class C1 { accessor ["w"]: any; @@ -10,6 +9,5 @@ class C1 { declare var f: any; class C2 { - // @ts-ignore accessor [f()] = 1; } \ No newline at end of file From 9d1176a5f2bf1844041b65d35504be24d4399602 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 27 Jun 2022 18:10:04 -0700 Subject: [PATCH 04/51] Support for auto-accessor fields --- .../accessorField1(target=es2015).js | 39 ++++++ .../accessorField1(target=es2015).symbols | 17 +++ .../accessorField1(target=es2015).types | 19 +++ .../accessorField1(target=es2022).js | 24 ++++ .../accessorField1(target=es2022).symbols | 17 +++ .../accessorField1(target=es2022).types | 19 +++ .../accessorField1(target=es5).errors.txt | 22 ++++ .../accessorField1(target=es5).symbols | 17 +++ .../accessorField1(target=es5).types | 19 +++ .../accessorField1(target=esnext).js | 16 +++ .../accessorField1(target=esnext).symbols | 17 +++ .../accessorField1(target=esnext).types | 19 +++ .../accessorField2(target=es2015).js | 48 +++++++ .../accessorField2(target=es2015).symbols | 37 ++++++ .../accessorField2(target=es2015).types | 47 +++++++ .../accessorField2(target=es2022).js | 42 ++++++ .../accessorField2(target=es2022).symbols | 37 ++++++ .../accessorField2(target=es2022).types | 47 +++++++ .../accessorField2(target=esnext).js | 34 +++++ .../accessorField2(target=esnext).symbols | 37 ++++++ .../accessorField2(target=esnext).types | 47 +++++++ .../accessorField3(target=es2015).js | 39 ++++++ .../accessorField3(target=es2015).symbols | 17 +++ .../accessorField3(target=es2015).types | 19 +++ .../accessorField3(target=es2022).js | 24 ++++ .../accessorField3(target=es2022).symbols | 17 +++ .../accessorField3(target=es2022).types | 19 +++ .../accessorField3(target=es5).errors.txt | 22 ++++ .../accessorField3(target=es5).symbols | 17 +++ .../accessorField3(target=es5).types | 19 +++ .../accessorField3(target=esnext).js | 16 +++ .../accessorField3(target=esnext).symbols | 17 +++ .../accessorField3(target=esnext).types | 19 +++ .../accessorField4(target=es2015).js | 39 ++++++ .../accessorField4(target=es2015).symbols | 17 +++ .../accessorField4(target=es2015).types | 19 +++ .../accessorField4(target=es2022).js | 24 ++++ .../accessorField4(target=es2022).symbols | 17 +++ .../accessorField4(target=es2022).types | 19 +++ .../accessorField4(target=es5).errors.txt | 22 ++++ .../accessorField4(target=es5).symbols | 17 +++ .../accessorField4(target=es5).types | 19 +++ .../accessorField4(target=esnext).js | 16 +++ .../accessorField4(target=esnext).symbols | 17 +++ .../accessorField4(target=esnext).types | 19 +++ .../accessorField5(target=es2015).js | 53 ++++++++ .../accessorField5(target=es2015).symbols | 32 +++++ .../accessorField5(target=es2015).types | 36 +++++ .../accessorField5(target=es2022).js | 36 +++++ .../accessorField5(target=es2022).symbols | 32 +++++ .../accessorField5(target=es2022).types | 36 +++++ .../accessorField5(target=es5).errors.txt | 27 ++++ .../accessorField5(target=es5).symbols | 32 +++++ .../accessorField5(target=es5).types | 36 +++++ .../accessorField5(target=esnext).js | 25 ++++ .../accessorField5(target=esnext).symbols | 32 +++++ .../accessorField5(target=esnext).types | 36 +++++ ...,usedefineforclassfields=false).errors.txt | 18 +++ ...t=es2015,usedefineforclassfields=false).js | 41 ++++++ ...015,usedefineforclassfields=false).symbols | 27 ++++ ...s2015,usedefineforclassfields=false).types | 28 ++++ ...5,usedefineforclassfields=true).errors.txt | 18 +++ ...et=es2015,usedefineforclassfields=true).js | 49 +++++++ ...2015,usedefineforclassfields=true).symbols | 27 ++++ ...es2015,usedefineforclassfields=true).types | 28 ++++ ...,usedefineforclassfields=false).errors.txt | 18 +++ ...t=es2022,usedefineforclassfields=false).js | 29 ++++ ...022,usedefineforclassfields=false).symbols | 27 ++++ ...s2022,usedefineforclassfields=false).types | 28 ++++ ...2,usedefineforclassfields=true).errors.txt | 18 +++ ...et=es2022,usedefineforclassfields=true).js | 26 ++++ ...2022,usedefineforclassfields=true).symbols | 27 ++++ ...es2022,usedefineforclassfields=true).types | 28 ++++ ...,usedefineforclassfields=false).errors.txt | 18 +++ ...t=esnext,usedefineforclassfields=false).js | 26 ++++ ...ext,usedefineforclassfields=false).symbols | 27 ++++ ...snext,usedefineforclassfields=false).types | 28 ++++ ...t,usedefineforclassfields=true).errors.txt | 18 +++ ...et=esnext,usedefineforclassfields=true).js | 24 ++++ ...next,usedefineforclassfields=true).symbols | 27 ++++ ...esnext,usedefineforclassfields=true).types | 28 ++++ ...t=es2015,usedefineforclassfields=false).js | 41 ++++++ ...015,usedefineforclassfields=false).symbols | 24 ++++ ...s2015,usedefineforclassfields=false).types | 26 ++++ ...et=es2015,usedefineforclassfields=true).js | 41 ++++++ ...2015,usedefineforclassfields=true).symbols | 24 ++++ ...es2015,usedefineforclassfields=true).types | 26 ++++ ...t=es2022,usedefineforclassfields=false).js | 29 ++++ ...022,usedefineforclassfields=false).symbols | 24 ++++ ...s2022,usedefineforclassfields=false).types | 26 ++++ ...et=es2022,usedefineforclassfields=true).js | 25 ++++ ...2022,usedefineforclassfields=true).symbols | 24 ++++ ...es2022,usedefineforclassfields=true).types | 26 ++++ ...t=esnext,usedefineforclassfields=false).js | 26 ++++ ...ext,usedefineforclassfields=false).symbols | 24 ++++ ...snext,usedefineforclassfields=false).types | 26 ++++ ...et=esnext,usedefineforclassfields=true).js | 23 ++++ ...next,usedefineforclassfields=true).symbols | 24 ++++ ...esnext,usedefineforclassfields=true).types | 26 ++++ tests/baselines/reference/accessorField8.js | 49 +++++++ .../reference/accessorField8.symbols | 37 ++++++ .../baselines/reference/accessorField8.types | 37 ++++++ .../accessorFieldAllowedModifiers.js | 49 +++++++ ...ccessorFieldDisallowedModifiers.errors.txt | 124 ++++++++++++++++++ .../accessorFieldDisallowedModifiers.js | 66 ++++++++++ .../reference/decoratorOnClassProperty13.js | 8 +- .../accessorField1.ts | 9 ++ .../accessorField2.ts | 18 +++ .../accessorField3.ts | 9 ++ .../accessorField4.ts | 9 ++ .../accessorField5.ts | 15 +++ .../accessorField6.ts | 14 ++ .../accessorField7.ts | 14 ++ .../accessorField8.ts | 20 +++ .../accessorFieldAllowedModifiers.ts | 29 ++++ .../accessorFieldDisallowedModifiers.ts | 39 ++++++ 116 files changed, 3184 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/accessorField1(target=es2015).js create mode 100644 tests/baselines/reference/accessorField1(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField1(target=es2015).types create mode 100644 tests/baselines/reference/accessorField1(target=es2022).js create mode 100644 tests/baselines/reference/accessorField1(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField1(target=es2022).types create mode 100644 tests/baselines/reference/accessorField1(target=es5).errors.txt create mode 100644 tests/baselines/reference/accessorField1(target=es5).symbols create mode 100644 tests/baselines/reference/accessorField1(target=es5).types create mode 100644 tests/baselines/reference/accessorField1(target=esnext).js create mode 100644 tests/baselines/reference/accessorField1(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField1(target=esnext).types create mode 100644 tests/baselines/reference/accessorField2(target=es2015).js create mode 100644 tests/baselines/reference/accessorField2(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField2(target=es2015).types create mode 100644 tests/baselines/reference/accessorField2(target=es2022).js create mode 100644 tests/baselines/reference/accessorField2(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField2(target=es2022).types create mode 100644 tests/baselines/reference/accessorField2(target=esnext).js create mode 100644 tests/baselines/reference/accessorField2(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField2(target=esnext).types create mode 100644 tests/baselines/reference/accessorField3(target=es2015).js create mode 100644 tests/baselines/reference/accessorField3(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField3(target=es2015).types create mode 100644 tests/baselines/reference/accessorField3(target=es2022).js create mode 100644 tests/baselines/reference/accessorField3(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField3(target=es2022).types create mode 100644 tests/baselines/reference/accessorField3(target=es5).errors.txt create mode 100644 tests/baselines/reference/accessorField3(target=es5).symbols create mode 100644 tests/baselines/reference/accessorField3(target=es5).types create mode 100644 tests/baselines/reference/accessorField3(target=esnext).js create mode 100644 tests/baselines/reference/accessorField3(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField3(target=esnext).types create mode 100644 tests/baselines/reference/accessorField4(target=es2015).js create mode 100644 tests/baselines/reference/accessorField4(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField4(target=es2015).types create mode 100644 tests/baselines/reference/accessorField4(target=es2022).js create mode 100644 tests/baselines/reference/accessorField4(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField4(target=es2022).types create mode 100644 tests/baselines/reference/accessorField4(target=es5).errors.txt create mode 100644 tests/baselines/reference/accessorField4(target=es5).symbols create mode 100644 tests/baselines/reference/accessorField4(target=es5).types create mode 100644 tests/baselines/reference/accessorField4(target=esnext).js create mode 100644 tests/baselines/reference/accessorField4(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField4(target=esnext).types create mode 100644 tests/baselines/reference/accessorField5(target=es2015).js create mode 100644 tests/baselines/reference/accessorField5(target=es2015).symbols create mode 100644 tests/baselines/reference/accessorField5(target=es2015).types create mode 100644 tests/baselines/reference/accessorField5(target=es2022).js create mode 100644 tests/baselines/reference/accessorField5(target=es2022).symbols create mode 100644 tests/baselines/reference/accessorField5(target=es2022).types create mode 100644 tests/baselines/reference/accessorField5(target=es5).errors.txt create mode 100644 tests/baselines/reference/accessorField5(target=es5).symbols create mode 100644 tests/baselines/reference/accessorField5(target=es5).types create mode 100644 tests/baselines/reference/accessorField5(target=esnext).js create mode 100644 tests/baselines/reference/accessorField5(target=esnext).symbols create mode 100644 tests/baselines/reference/accessorField5(target=esnext).types create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols create mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types create mode 100644 tests/baselines/reference/accessorField8.js create mode 100644 tests/baselines/reference/accessorField8.symbols create mode 100644 tests/baselines/reference/accessorField8.types create mode 100644 tests/baselines/reference/accessorFieldAllowedModifiers.js create mode 100644 tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt create mode 100644 tests/baselines/reference/accessorFieldDisallowedModifiers.js create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts diff --git a/tests/baselines/reference/accessorField1(target=es2015).js b/tests/baselines/reference/accessorField1(target=es2015).js new file mode 100644 index 0000000000000..e3a8a5baf03ce --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2015).js @@ -0,0 +1,39 @@ +//// [accessorField1.ts] +class C1 { + accessor a: any; + accessor b = 1; + static accessor c: any; + static accessor d = 2; +} + + +//// [accessorField1.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _a, _C1_a_accessor_storage, _C1_b_accessor_storage, _C1_c_accessor_storage, _C1_d_accessor_storage; +class C1 { + constructor() { + _C1_a_accessor_storage.set(this, void 0); + _C1_b_accessor_storage.set(this, 1); + } + get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } + get b() { return __classPrivateFieldGet(this, _C1_b_accessor_storage, "f"); } + set b(value) { __classPrivateFieldSet(this, _C1_b_accessor_storage, value, "f"); } + static get c() { return __classPrivateFieldGet(this, _a, "f", _C1_c_accessor_storage); } + static set c(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_c_accessor_storage); } + static get d() { return __classPrivateFieldGet(this, _a, "f", _C1_d_accessor_storage); } + static set d(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_d_accessor_storage); } +} +_a = C1, _C1_a_accessor_storage = new WeakMap(), _C1_b_accessor_storage = new WeakMap(); +_C1_c_accessor_storage = { value: void 0 }; +_C1_d_accessor_storage = { value: 2 }; diff --git a/tests/baselines/reference/accessorField1(target=es2015).symbols b/tests/baselines/reference/accessorField1(target=es2015).symbols new file mode 100644 index 0000000000000..28111d6f8fdaf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2015).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=es2015).types b/tests/baselines/reference/accessorField1(target=es2015).types new file mode 100644 index 0000000000000..de41def82af66 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2015).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + accessor b = 1; +>b : number +>1 : 1 + + static accessor c: any; +>c : any + + static accessor d = 2; +>d : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField1(target=es2022).js b/tests/baselines/reference/accessorField1(target=es2022).js new file mode 100644 index 0000000000000..5c481928b48e0 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2022).js @@ -0,0 +1,24 @@ +//// [accessorField1.ts] +class C1 { + accessor a: any; + accessor b = 1; + static accessor c: any; + static accessor d = 2; +} + + +//// [accessorField1.js] +class C1 { + #a_accessor_storage; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } + #b_accessor_storage = 1; + get b() { return this.#b_accessor_storage; } + set b(value) { this.#b_accessor_storage = value; } + static #c_accessor_storage; + static get c() { return this.#c_accessor_storage; } + static set c(value) { this.#c_accessor_storage = value; } + static #d_accessor_storage = 2; + static get d() { return this.#d_accessor_storage; } + static set d(value) { this.#d_accessor_storage = value; } +} diff --git a/tests/baselines/reference/accessorField1(target=es2022).symbols b/tests/baselines/reference/accessorField1(target=es2022).symbols new file mode 100644 index 0000000000000..28111d6f8fdaf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2022).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=es2022).types b/tests/baselines/reference/accessorField1(target=es2022).types new file mode 100644 index 0000000000000..de41def82af66 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es2022).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + accessor b = 1; +>b : number +>1 : 1 + + static accessor c: any; +>c : any + + static accessor d = 2; +>d : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField1(target=es5).errors.txt b/tests/baselines/reference/accessorField1(target=es5).errors.txt new file mode 100644 index 0000000000000..c9b2c82112a99 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts (4 errors) ==== + class C1 { + accessor a: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor b = 1; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor c: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor d = 2; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField1(target=es5).symbols b/tests/baselines/reference/accessorField1(target=es5).symbols new file mode 100644 index 0000000000000..28111d6f8fdaf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es5).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=es5).types b/tests/baselines/reference/accessorField1(target=es5).types new file mode 100644 index 0000000000000..de41def82af66 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=es5).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + accessor b = 1; +>b : number +>1 : 1 + + static accessor c: any; +>c : any + + static accessor d = 2; +>d : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField1(target=esnext).js b/tests/baselines/reference/accessorField1(target=esnext).js new file mode 100644 index 0000000000000..9d9f7f3db7ccf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=esnext).js @@ -0,0 +1,16 @@ +//// [accessorField1.ts] +class C1 { + accessor a: any; + accessor b = 1; + static accessor c: any; + static accessor d = 2; +} + + +//// [accessorField1.js] +class C1 { + accessor a; + accessor b = 1; + static accessor c; + static accessor d = 2; +} diff --git a/tests/baselines/reference/accessorField1(target=esnext).symbols b/tests/baselines/reference/accessorField1(target=esnext).symbols new file mode 100644 index 0000000000000..28111d6f8fdaf --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) + + accessor b = 1; +>b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) + + static accessor c: any; +>c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) + + static accessor d = 2; +>d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField1(target=esnext).types b/tests/baselines/reference/accessorField1(target=esnext).types new file mode 100644 index 0000000000000..de41def82af66 --- /dev/null +++ b/tests/baselines/reference/accessorField1(target=esnext).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + accessor b = 1; +>b : number +>1 : 1 + + static accessor c: any; +>c : any + + static accessor d = 2; +>d : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField2(target=es2015).js b/tests/baselines/reference/accessorField2(target=es2015).js new file mode 100644 index 0000000000000..5697106f48fc4 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2015).js @@ -0,0 +1,48 @@ +//// [accessorField2.ts] +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} + + +//// [accessorField2.js] +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _C1_instances, _a, _C1_a_get, _C1_a_set, _C1_b_get, _C1_b_set, _C1_c_get, _C1_c_set, _C1_d_get, _C1_d_set, _C1_a_accessor_storage, _C1_b_accessor_storage, _C1_c_accessor_storage, _C1_d_accessor_storage; +class C1 { + constructor() { + _C1_instances.add(this); + _C1_a_accessor_storage.set(this, void 0); + _C1_b_accessor_storage.set(this, 1); + __classPrivateFieldSet(this, _C1_instances, 3, "a", _C1_a_set); + __classPrivateFieldSet(this, _C1_instances, 4, "a", _C1_b_set); + } +} +_a = C1, _C1_instances = new WeakSet(), _C1_a_accessor_storage = new WeakMap(), _C1_b_accessor_storage = new WeakMap(), _C1_a_get = function _C1_a_get() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); }, _C1_a_set = function _C1_a_set(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); }, _C1_b_get = function _C1_b_get() { return __classPrivateFieldGet(this, _C1_b_accessor_storage, "f"); }, _C1_b_set = function _C1_b_set(value) { __classPrivateFieldSet(this, _C1_b_accessor_storage, value, "f"); }, _C1_c_get = function _C1_c_get() { return __classPrivateFieldGet(this, _a, "f", _C1_c_accessor_storage); }, _C1_c_set = function _C1_c_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_c_accessor_storage); }, _C1_d_get = function _C1_d_get() { return __classPrivateFieldGet(this, _a, "f", _C1_d_accessor_storage); }, _C1_d_set = function _C1_d_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_d_accessor_storage); }; +_C1_c_accessor_storage = { value: void 0 }; +_C1_d_accessor_storage = { value: 2 }; +(() => { + __classPrivateFieldSet(_a, _a, 5, "a", _C1_c_set); + __classPrivateFieldSet(_a, _a, 6, "a", _C1_d_set); +})(); diff --git a/tests/baselines/reference/accessorField2(target=es2015).symbols b/tests/baselines/reference/accessorField2(target=es2015).symbols new file mode 100644 index 0000000000000..cd33647f39592 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2015).symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + accessor #a: any; +>#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) + + accessor #b = 1; +>#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) + + static accessor #c: any; +>#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) + + static accessor #d = 2; +>#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) + + constructor() { + this.#a = 3; +>this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#b = 4; +>this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } + + static { + this.#c = 5; +>this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#d = 6; +>this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/accessorField2(target=es2015).types b/tests/baselines/reference/accessorField2(target=es2015).types new file mode 100644 index 0000000000000..c440eae8a725f --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2015).types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : C1 + + accessor #a: any; +>#a : any + + accessor #b = 1; +>#b : number +>1 : 1 + + static accessor #c: any; +>#c : any + + static accessor #d = 2; +>#d : number +>2 : 2 + + constructor() { + this.#a = 3; +>this.#a = 3 : 3 +>this.#a : any +>this : this +>3 : 3 + + this.#b = 4; +>this.#b = 4 : 4 +>this.#b : number +>this : this +>4 : 4 + } + + static { + this.#c = 5; +>this.#c = 5 : 5 +>this.#c : any +>this : typeof C1 +>5 : 5 + + this.#d = 6; +>this.#d = 6 : 6 +>this.#d : number +>this : typeof C1 +>6 : 6 + } +} + diff --git a/tests/baselines/reference/accessorField2(target=es2022).js b/tests/baselines/reference/accessorField2(target=es2022).js new file mode 100644 index 0000000000000..00a5a76ab6128 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2022).js @@ -0,0 +1,42 @@ +//// [accessorField2.ts] +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} + + +//// [accessorField2.js] +class C1 { + #a_accessor_storage; + get #a() { return this.#a_accessor_storage; } + set #a(value) { this.#a_accessor_storage = value; } + #b_accessor_storage = 1; + get #b() { return this.#b_accessor_storage; } + set #b(value) { this.#b_accessor_storage = value; } + static #c_accessor_storage; + static get #c() { return this.#c_accessor_storage; } + static set #c(value) { this.#c_accessor_storage = value; } + static #d_accessor_storage = 2; + static get #d() { return this.#d_accessor_storage; } + static set #d(value) { this.#d_accessor_storage = value; } + constructor() { + this.#a = 3; + this.#b = 4; + } + static { + this.#c = 5; + this.#d = 6; + } +} diff --git a/tests/baselines/reference/accessorField2(target=es2022).symbols b/tests/baselines/reference/accessorField2(target=es2022).symbols new file mode 100644 index 0000000000000..cd33647f39592 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2022).symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + accessor #a: any; +>#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) + + accessor #b = 1; +>#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) + + static accessor #c: any; +>#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) + + static accessor #d = 2; +>#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) + + constructor() { + this.#a = 3; +>this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#b = 4; +>this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } + + static { + this.#c = 5; +>this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#d = 6; +>this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/accessorField2(target=es2022).types b/tests/baselines/reference/accessorField2(target=es2022).types new file mode 100644 index 0000000000000..c440eae8a725f --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=es2022).types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : C1 + + accessor #a: any; +>#a : any + + accessor #b = 1; +>#b : number +>1 : 1 + + static accessor #c: any; +>#c : any + + static accessor #d = 2; +>#d : number +>2 : 2 + + constructor() { + this.#a = 3; +>this.#a = 3 : 3 +>this.#a : any +>this : this +>3 : 3 + + this.#b = 4; +>this.#b = 4 : 4 +>this.#b : number +>this : this +>4 : 4 + } + + static { + this.#c = 5; +>this.#c = 5 : 5 +>this.#c : any +>this : typeof C1 +>5 : 5 + + this.#d = 6; +>this.#d = 6 : 6 +>this.#d : number +>this : typeof C1 +>6 : 6 + } +} + diff --git a/tests/baselines/reference/accessorField2(target=esnext).js b/tests/baselines/reference/accessorField2(target=esnext).js new file mode 100644 index 0000000000000..bcfad4951288a --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=esnext).js @@ -0,0 +1,34 @@ +//// [accessorField2.ts] +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} + + +//// [accessorField2.js] +class C1 { + accessor #a; + accessor #b = 1; + static accessor #c; + static accessor #d = 2; + constructor() { + this.#a = 3; + this.#b = 4; + } + static { + this.#c = 5; + this.#d = 6; + } +} diff --git a/tests/baselines/reference/accessorField2(target=esnext).symbols b/tests/baselines/reference/accessorField2(target=esnext).symbols new file mode 100644 index 0000000000000..cd33647f39592 --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=esnext).symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + accessor #a: any; +>#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) + + accessor #b = 1; +>#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) + + static accessor #c: any; +>#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) + + static accessor #d = 2; +>#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) + + constructor() { + this.#a = 3; +>this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#b = 4; +>this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } + + static { + this.#c = 5; +>this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + + this.#d = 6; +>this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) +>this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/accessorField2(target=esnext).types b/tests/baselines/reference/accessorField2(target=esnext).types new file mode 100644 index 0000000000000..c440eae8a725f --- /dev/null +++ b/tests/baselines/reference/accessorField2(target=esnext).types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === +class C1 { +>C1 : C1 + + accessor #a: any; +>#a : any + + accessor #b = 1; +>#b : number +>1 : 1 + + static accessor #c: any; +>#c : any + + static accessor #d = 2; +>#d : number +>2 : 2 + + constructor() { + this.#a = 3; +>this.#a = 3 : 3 +>this.#a : any +>this : this +>3 : 3 + + this.#b = 4; +>this.#b = 4 : 4 +>this.#b : number +>this : this +>4 : 4 + } + + static { + this.#c = 5; +>this.#c = 5 : 5 +>this.#c : any +>this : typeof C1 +>5 : 5 + + this.#d = 6; +>this.#d = 6 : 6 +>this.#d : number +>this : typeof C1 +>6 : 6 + } +} + diff --git a/tests/baselines/reference/accessorField3(target=es2015).js b/tests/baselines/reference/accessorField3(target=es2015).js new file mode 100644 index 0000000000000..302d5fdc600eb --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2015).js @@ -0,0 +1,39 @@ +//// [accessorField3.ts] +class C1 { + accessor "w": any; + accessor "x" = 1; + static accessor "y": any; + static accessor "z" = 2; +} + + +//// [accessorField3.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage; +class C1 { + constructor() { + _C1__a_accessor_storage.set(this, void 0); + _C1__b_accessor_storage.set(this, 1); + } + get "w"() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); } + set "w"(value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); } + get "x"() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); } + set "x"(value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); } + static get "y"() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); } + static set "y"(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); } + static get "z"() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); } + static set "z"(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); } +} +_a = C1, _C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(); +_C1__c_accessor_storage = { value: void 0 }; +_C1__d_accessor_storage = { value: 2 }; diff --git a/tests/baselines/reference/accessorField3(target=es2015).symbols b/tests/baselines/reference/accessorField3(target=es2015).symbols new file mode 100644 index 0000000000000..0312c5a3cd1a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2015).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=es2015).types b/tests/baselines/reference/accessorField3(target=es2015).types new file mode 100644 index 0000000000000..4434ebeda37a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2015).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : C1 + + accessor "w": any; +>"w" : any + + accessor "x" = 1; +>"x" : number +>1 : 1 + + static accessor "y": any; +>"y" : any + + static accessor "z" = 2; +>"z" : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField3(target=es2022).js b/tests/baselines/reference/accessorField3(target=es2022).js new file mode 100644 index 0000000000000..4cb2eed6d7678 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2022).js @@ -0,0 +1,24 @@ +//// [accessorField3.ts] +class C1 { + accessor "w": any; + accessor "x" = 1; + static accessor "y": any; + static accessor "z" = 2; +} + + +//// [accessorField3.js] +class C1 { + #_a_accessor_storage; + get "w"() { return this.#_a_accessor_storage; } + set "w"(value) { this.#_a_accessor_storage = value; } + #_b_accessor_storage = 1; + get "x"() { return this.#_b_accessor_storage; } + set "x"(value) { this.#_b_accessor_storage = value; } + static #_c_accessor_storage; + static get "y"() { return this.#_c_accessor_storage; } + static set "y"(value) { this.#_c_accessor_storage = value; } + static #_d_accessor_storage = 2; + static get "z"() { return this.#_d_accessor_storage; } + static set "z"(value) { this.#_d_accessor_storage = value; } +} diff --git a/tests/baselines/reference/accessorField3(target=es2022).symbols b/tests/baselines/reference/accessorField3(target=es2022).symbols new file mode 100644 index 0000000000000..0312c5a3cd1a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2022).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=es2022).types b/tests/baselines/reference/accessorField3(target=es2022).types new file mode 100644 index 0000000000000..4434ebeda37a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es2022).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : C1 + + accessor "w": any; +>"w" : any + + accessor "x" = 1; +>"x" : number +>1 : 1 + + static accessor "y": any; +>"y" : any + + static accessor "z" = 2; +>"z" : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField3(target=es5).errors.txt b/tests/baselines/reference/accessorField3(target=es5).errors.txt new file mode 100644 index 0000000000000..c52b7002bbceb --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts (4 errors) ==== + class C1 { + accessor "w": any; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor "x" = 1; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor "y": any; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor "z" = 2; + ~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField3(target=es5).symbols b/tests/baselines/reference/accessorField3(target=es5).symbols new file mode 100644 index 0000000000000..0312c5a3cd1a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es5).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=es5).types b/tests/baselines/reference/accessorField3(target=es5).types new file mode 100644 index 0000000000000..4434ebeda37a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=es5).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : C1 + + accessor "w": any; +>"w" : any + + accessor "x" = 1; +>"x" : number +>1 : 1 + + static accessor "y": any; +>"y" : any + + static accessor "z" = 2; +>"z" : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField3(target=esnext).js b/tests/baselines/reference/accessorField3(target=esnext).js new file mode 100644 index 0000000000000..6535fef4ac5d9 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=esnext).js @@ -0,0 +1,16 @@ +//// [accessorField3.ts] +class C1 { + accessor "w": any; + accessor "x" = 1; + static accessor "y": any; + static accessor "z" = 2; +} + + +//// [accessorField3.js] +class C1 { + accessor "w"; + accessor "x" = 1; + static accessor "y"; + static accessor "z" = 2; +} diff --git a/tests/baselines/reference/accessorField3(target=esnext).symbols b/tests/baselines/reference/accessorField3(target=esnext).symbols new file mode 100644 index 0000000000000..0312c5a3cd1a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) + + accessor "w": any; +>"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) + + accessor "x" = 1; +>"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) + + static accessor "y": any; +>"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) + + static accessor "z" = 2; +>"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) +} + diff --git a/tests/baselines/reference/accessorField3(target=esnext).types b/tests/baselines/reference/accessorField3(target=esnext).types new file mode 100644 index 0000000000000..4434ebeda37a4 --- /dev/null +++ b/tests/baselines/reference/accessorField3(target=esnext).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === +class C1 { +>C1 : C1 + + accessor "w": any; +>"w" : any + + accessor "x" = 1; +>"x" : number +>1 : 1 + + static accessor "y": any; +>"y" : any + + static accessor "z" = 2; +>"z" : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField4(target=es2015).js b/tests/baselines/reference/accessorField4(target=es2015).js new file mode 100644 index 0000000000000..8631dca33e409 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2015).js @@ -0,0 +1,39 @@ +//// [accessorField4.ts] +class C1 { + accessor 0: any; + accessor 1 = 1; + static accessor 2: any; + static accessor 3 = 2; +} + + +//// [accessorField4.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage; +class C1 { + constructor() { + _C1__a_accessor_storage.set(this, void 0); + _C1__b_accessor_storage.set(this, 1); + } + get 0() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); } + set 0(value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); } + get 1() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); } + set 1(value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); } + static get 2() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); } + static set 2(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); } + static get 3() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); } + static set 3(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); } +} +_a = C1, _C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(); +_C1__c_accessor_storage = { value: void 0 }; +_C1__d_accessor_storage = { value: 2 }; diff --git a/tests/baselines/reference/accessorField4(target=es2015).symbols b/tests/baselines/reference/accessorField4(target=es2015).symbols new file mode 100644 index 0000000000000..7720dcdf7d897 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2015).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=es2015).types b/tests/baselines/reference/accessorField4(target=es2015).types new file mode 100644 index 0000000000000..702dc296d9b4c --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2015).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : C1 + + accessor 0: any; +>0 : any + + accessor 1 = 1; +>1 : number +>1 : 1 + + static accessor 2: any; +>2 : any + + static accessor 3 = 2; +>3 : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField4(target=es2022).js b/tests/baselines/reference/accessorField4(target=es2022).js new file mode 100644 index 0000000000000..603b4bd3999b1 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2022).js @@ -0,0 +1,24 @@ +//// [accessorField4.ts] +class C1 { + accessor 0: any; + accessor 1 = 1; + static accessor 2: any; + static accessor 3 = 2; +} + + +//// [accessorField4.js] +class C1 { + #_a_accessor_storage; + get 0() { return this.#_a_accessor_storage; } + set 0(value) { this.#_a_accessor_storage = value; } + #_b_accessor_storage = 1; + get 1() { return this.#_b_accessor_storage; } + set 1(value) { this.#_b_accessor_storage = value; } + static #_c_accessor_storage; + static get 2() { return this.#_c_accessor_storage; } + static set 2(value) { this.#_c_accessor_storage = value; } + static #_d_accessor_storage = 2; + static get 3() { return this.#_d_accessor_storage; } + static set 3(value) { this.#_d_accessor_storage = value; } +} diff --git a/tests/baselines/reference/accessorField4(target=es2022).symbols b/tests/baselines/reference/accessorField4(target=es2022).symbols new file mode 100644 index 0000000000000..7720dcdf7d897 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2022).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=es2022).types b/tests/baselines/reference/accessorField4(target=es2022).types new file mode 100644 index 0000000000000..702dc296d9b4c --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es2022).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : C1 + + accessor 0: any; +>0 : any + + accessor 1 = 1; +>1 : number +>1 : 1 + + static accessor 2: any; +>2 : any + + static accessor 3 = 2; +>3 : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField4(target=es5).errors.txt b/tests/baselines/reference/accessorField4(target=es5).errors.txt new file mode 100644 index 0000000000000..47b0e61b4b75a --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts (4 errors) ==== + class C1 { + accessor 0: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor 1 = 1; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor 2: any; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor 3 = 2; + ~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField4(target=es5).symbols b/tests/baselines/reference/accessorField4(target=es5).symbols new file mode 100644 index 0000000000000..7720dcdf7d897 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es5).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=es5).types b/tests/baselines/reference/accessorField4(target=es5).types new file mode 100644 index 0000000000000..702dc296d9b4c --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=es5).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : C1 + + accessor 0: any; +>0 : any + + accessor 1 = 1; +>1 : number +>1 : 1 + + static accessor 2: any; +>2 : any + + static accessor 3 = 2; +>3 : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField4(target=esnext).js b/tests/baselines/reference/accessorField4(target=esnext).js new file mode 100644 index 0000000000000..b0eafbf87f317 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=esnext).js @@ -0,0 +1,16 @@ +//// [accessorField4.ts] +class C1 { + accessor 0: any; + accessor 1 = 1; + static accessor 2: any; + static accessor 3 = 2; +} + + +//// [accessorField4.js] +class C1 { + accessor 0; + accessor 1 = 1; + static accessor 2; + static accessor 3 = 2; +} diff --git a/tests/baselines/reference/accessorField4(target=esnext).symbols b/tests/baselines/reference/accessorField4(target=esnext).symbols new file mode 100644 index 0000000000000..7720dcdf7d897 --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) + + accessor 0: any; +>0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) + + accessor 1 = 1; +>1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) + + static accessor 2: any; +>2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) + + static accessor 3 = 2; +>3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) +} + diff --git a/tests/baselines/reference/accessorField4(target=esnext).types b/tests/baselines/reference/accessorField4(target=esnext).types new file mode 100644 index 0000000000000..702dc296d9b4c --- /dev/null +++ b/tests/baselines/reference/accessorField4(target=esnext).types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === +class C1 { +>C1 : C1 + + accessor 0: any; +>0 : any + + accessor 1 = 1; +>1 : number +>1 : 1 + + static accessor 2: any; +>2 : any + + static accessor 3 = 2; +>3 : number +>2 : 2 +} + diff --git a/tests/baselines/reference/accessorField5(target=es2015).js b/tests/baselines/reference/accessorField5(target=es2015).js new file mode 100644 index 0000000000000..6e5f0cab385aa --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2015).js @@ -0,0 +1,53 @@ +//// [accessorField5.ts] +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + // @ts-ignore + accessor [f()] = 1; +} + +//// [accessorField5.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage, _C2__e_accessor_storage, _b; +class C1 { + constructor() { + _C1__a_accessor_storage.set(this, void 0); + _C1__b_accessor_storage.set(this, 1); + } + get [(_C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(), "w")]() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); } + set ["w"](value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); } + get ["x"]() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); } + set ["x"](value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); } + static get ["y"]() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); } + static set ["y"](value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); } + static get ["z"]() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); } + static set ["z"](value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); } +} +_a = C1; +_C1__c_accessor_storage = { value: void 0 }; +_C1__d_accessor_storage = { value: 2 }; +class C2 { + constructor() { + // @ts-ignore + _C2__e_accessor_storage.set(this, 1); + } + // @ts-ignore + get [(_C2__e_accessor_storage = new WeakMap(), _b = f(), _b)]() { return __classPrivateFieldGet(this, _C2__e_accessor_storage, "f"); } + set [_b](value) { __classPrivateFieldSet(this, _C2__e_accessor_storage, value, "f"); } +} diff --git a/tests/baselines/reference/accessorField5(target=es2015).symbols b/tests/baselines/reference/accessorField5(target=es2015).symbols new file mode 100644 index 0000000000000..e09a9785dc30f --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2015).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=es2015).types b/tests/baselines/reference/accessorField5(target=es2015).types new file mode 100644 index 0000000000000..60b575def5744 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2015).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : C1 + + accessor ["w"]: any; +>["w"] : any +>"w" : "w" + + accessor ["x"] = 1; +>["x"] : number +>"x" : "x" +>1 : 1 + + static accessor ["y"]: any; +>["y"] : any +>"y" : "y" + + static accessor ["z"] = 2; +>["z"] : number +>"z" : "z" +>2 : 2 +} + +declare var f: any; +>f : any + +class C2 { +>C2 : C2 + + // @ts-ignore + accessor [f()] = 1; +>[f()] : number +>f() : any +>f : any +>1 : 1 +} diff --git a/tests/baselines/reference/accessorField5(target=es2022).js b/tests/baselines/reference/accessorField5(target=es2022).js new file mode 100644 index 0000000000000..2388795f8ac3e --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2022).js @@ -0,0 +1,36 @@ +//// [accessorField5.ts] +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + // @ts-ignore + accessor [f()] = 1; +} + +//// [accessorField5.js] +var _a; +class C1 { + #_a_accessor_storage; + get ["w"]() { return this.#_a_accessor_storage; } + set ["w"](value) { this.#_a_accessor_storage = value; } + #_b_accessor_storage = 1; + get ["x"]() { return this.#_b_accessor_storage; } + set ["x"](value) { this.#_b_accessor_storage = value; } + static #_c_accessor_storage; + static get ["y"]() { return this.#_c_accessor_storage; } + static set ["y"](value) { this.#_c_accessor_storage = value; } + static #_d_accessor_storage = 2; + static get ["z"]() { return this.#_d_accessor_storage; } + static set ["z"](value) { this.#_d_accessor_storage = value; } +} +class C2 { + #_e_accessor_storage = 1; + // @ts-ignore + get [(_a = f(), _a)]() { return this.#_e_accessor_storage; } + set [_a](value) { this.#_e_accessor_storage = value; } +} diff --git a/tests/baselines/reference/accessorField5(target=es2022).symbols b/tests/baselines/reference/accessorField5(target=es2022).symbols new file mode 100644 index 0000000000000..e09a9785dc30f --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2022).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=es2022).types b/tests/baselines/reference/accessorField5(target=es2022).types new file mode 100644 index 0000000000000..60b575def5744 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es2022).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : C1 + + accessor ["w"]: any; +>["w"] : any +>"w" : "w" + + accessor ["x"] = 1; +>["x"] : number +>"x" : "x" +>1 : 1 + + static accessor ["y"]: any; +>["y"] : any +>"y" : "y" + + static accessor ["z"] = 2; +>["z"] : number +>"z" : "z" +>2 : 2 +} + +declare var f: any; +>f : any + +class C2 { +>C2 : C2 + + // @ts-ignore + accessor [f()] = 1; +>[f()] : number +>f() : any +>f : any +>1 : 1 +} diff --git a/tests/baselines/reference/accessorField5(target=es5).errors.txt b/tests/baselines/reference/accessorField5(target=es5).errors.txt new file mode 100644 index 0000000000000..52fa176a00b10 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es5).errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts (4 errors) ==== + class C1 { + accessor ["w"]: any; + ~~~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + accessor ["x"] = 1; + ~~~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor ["y"]: any; + ~~~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + static accessor ["z"] = 2; + ~~~~~ +!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. + } + + declare var f: any; + class C2 { + // @ts-ignore + accessor [f()] = 1; + } \ No newline at end of file diff --git a/tests/baselines/reference/accessorField5(target=es5).symbols b/tests/baselines/reference/accessorField5(target=es5).symbols new file mode 100644 index 0000000000000..e09a9785dc30f --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es5).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=es5).types b/tests/baselines/reference/accessorField5(target=es5).types new file mode 100644 index 0000000000000..60b575def5744 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=es5).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : C1 + + accessor ["w"]: any; +>["w"] : any +>"w" : "w" + + accessor ["x"] = 1; +>["x"] : number +>"x" : "x" +>1 : 1 + + static accessor ["y"]: any; +>["y"] : any +>"y" : "y" + + static accessor ["z"] = 2; +>["z"] : number +>"z" : "z" +>2 : 2 +} + +declare var f: any; +>f : any + +class C2 { +>C2 : C2 + + // @ts-ignore + accessor [f()] = 1; +>[f()] : number +>f() : any +>f : any +>1 : 1 +} diff --git a/tests/baselines/reference/accessorField5(target=esnext).js b/tests/baselines/reference/accessorField5(target=esnext).js new file mode 100644 index 0000000000000..7c84d37e73c3d --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=esnext).js @@ -0,0 +1,25 @@ +//// [accessorField5.ts] +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + // @ts-ignore + accessor [f()] = 1; +} + +//// [accessorField5.js] +class C1 { + accessor ["w"]; + accessor ["x"] = 1; + static accessor ["y"]; + static accessor ["z"] = 2; +} +class C2 { + // @ts-ignore + accessor [f()] = 1; +} diff --git a/tests/baselines/reference/accessorField5(target=esnext).symbols b/tests/baselines/reference/accessorField5(target=esnext).symbols new file mode 100644 index 0000000000000..e09a9785dc30f --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=esnext).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) + + accessor ["w"]: any; +>["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) +>"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) + + accessor ["x"] = 1; +>["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) +>"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) + + static accessor ["y"]: any; +>["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) +>"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) + + static accessor ["z"] = 2; +>["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +>"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) +} + +declare var f: any; +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) + +class C2 { +>C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) + + // @ts-ignore + accessor [f()] = 1; +>[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) +>f : Symbol(f, Decl(accessorField5.ts, 7, 11)) +} diff --git a/tests/baselines/reference/accessorField5(target=esnext).types b/tests/baselines/reference/accessorField5(target=esnext).types new file mode 100644 index 0000000000000..60b575def5744 --- /dev/null +++ b/tests/baselines/reference/accessorField5(target=esnext).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === +class C1 { +>C1 : C1 + + accessor ["w"]: any; +>["w"] : any +>"w" : "w" + + accessor ["x"] = 1; +>["x"] : number +>"x" : "x" +>1 : 1 + + static accessor ["y"]: any; +>["y"] : any +>"y" : "y" + + static accessor ["z"] = 2; +>["z"] : number +>"z" : "z" +>2 : 2 +} + +declare var f: any; +>f : any + +class C2 { +>C2 : C2 + + // @ts-ignore + accessor [f()] = 1; +>[f()] : number +>f() : any +>f : any +>1 : 1 +} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..b2afea001fa94 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js @@ -0,0 +1,41 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C1_a_accessor_storage; +class C1 { + get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } +} +_C1_a_accessor_storage = new WeakMap(); +class C2 extends C1 { + constructor() { + super(...arguments); + this.a = 1; + } +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..e217a7d9eb0c6 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js @@ -0,0 +1,49 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C1_a_accessor_storage; +class C1 { + constructor() { + _C1_a_accessor_storage.set(this, void 0); + } + get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } +} +_C1_a_accessor_storage = new WeakMap(); +class C2 extends C1 { + constructor() { + super(...arguments); + Object.defineProperty(this, "a", { + enumerable: true, + configurable: true, + writable: true, + value: 1 + }); + } +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..27f356be65eef --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js @@ -0,0 +1,29 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +class C1 { + #a_accessor_storage; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } +} +class C2 extends C1 { + constructor() { + super(...arguments); + this.a = 1; + } +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..a2816090e4614 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js @@ -0,0 +1,26 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +class C1 { + #a_accessor_storage; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } +} +class C2 extends C1 { + a = 1; +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..e38b062084739 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js @@ -0,0 +1,26 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + this.a = 1; + } +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt new file mode 100644 index 0000000000000..4a63914155538 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== + class C1 { + accessor a: any; + } + + class C2 extends C1 { + a = 1; + ~ +!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. + } + + class C3 extends C1 { + get a() { return super.a; } + } + \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..e6550dab6f237 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js @@ -0,0 +1,24 @@ +//// [accessorField6.ts] +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} + + +//// [accessorField6.js] +class C1 { + accessor a; +} +class C2 extends C1 { + a = 1; +} +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..5b0d798ba80d5 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + a = 1; +>a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) + + get a() { return super.a; } +>a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) +>super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +>super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) +>a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) +} + diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a6b9efded46a1 --- /dev/null +++ b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return super.a; } +>a : any +>super.a : any +>super : C1 +>a : any +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..272f35f30706c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js @@ -0,0 +1,41 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C2_a_accessor_storage; +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + _C2_a_accessor_storage.set(this, 1); + } + get a() { return __classPrivateFieldGet(this, _C2_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C2_a_accessor_storage, value, "f"); } +} +_C2_a_accessor_storage = new WeakMap(); +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..272f35f30706c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js @@ -0,0 +1,41 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _C2_a_accessor_storage; +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + _C2_a_accessor_storage.set(this, 1); + } + get a() { return __classPrivateFieldGet(this, _C2_a_accessor_storage, "f"); } + set a(value) { __classPrivateFieldSet(this, _C2_a_accessor_storage, value, "f"); } +} +_C2_a_accessor_storage = new WeakMap(); +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..ff282b347ece2 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js @@ -0,0 +1,29 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + this.#a_accessor_storage = 1; + } + #a_accessor_storage; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } +} +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..eb3c26be94053 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js @@ -0,0 +1,25 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +class C1 { +} +class C2 extends C1 { + #a_accessor_storage = 1; + get a() { return this.#a_accessor_storage; } + set a(value) { this.#a_accessor_storage = value; } +} +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..d84530fda0c48 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js @@ -0,0 +1,26 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +class C1 { +} +class C2 extends C1 { + constructor() { + super(...arguments); + this.#a_1 = 1; + } +} +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..7951a92f92ba1 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js @@ -0,0 +1,23 @@ +//// [accessorField7.ts] +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} + + +//// [accessorField7.js] +class C1 { +} +class C2 extends C1 { + accessor a = 1; +} +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols new file mode 100644 index 0000000000000..a0bed37bd9bb9 --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols @@ -0,0 +1,24 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + abstract accessor a: any; +>a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) +} + +class C2 extends C1 { +>C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + accessor a = 1; +>a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) +} + +class C3 extends C1 { +>C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) +>C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) + + get a() { return 1; } +>a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) +} + diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types new file mode 100644 index 0000000000000..a103af877051c --- /dev/null +++ b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === +abstract class C1 { +>C1 : C1 + + abstract accessor a: any; +>a : any +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + accessor a = 1; +>a : number +>1 : 1 +} + +class C3 extends C1 { +>C3 : C3 +>C1 : C1 + + get a() { return 1; } +>a : number +>1 : 1 +} + diff --git a/tests/baselines/reference/accessorField8.js b/tests/baselines/reference/accessorField8.js new file mode 100644 index 0000000000000..b34d65f1f55e4 --- /dev/null +++ b/tests/baselines/reference/accessorField8.js @@ -0,0 +1,49 @@ +//// [accessorField8.ts] +class C1 { + accessor a: any; + static accessor b: any; +} + +declare class C2 { + accessor a: any; + static accessor b: any; +} + +function f() { + class C3 { + accessor a: any; + static accessor b: any; + } + return C3; +} + + +//// [accessorField8.js] +class C1 { + accessor a; + static accessor b; +} +function f() { + class C3 { + accessor a; + static accessor b; + } + return C3; +} + + +//// [accessorField8.d.ts] +declare class C1 { + accessor a: any; + static accessor b: any; +} +declare class C2 { + accessor a: any; + static accessor b: any; +} +declare function f(): { + new (): { + a: any; + }; + b: any; +}; diff --git a/tests/baselines/reference/accessorField8.symbols b/tests/baselines/reference/accessorField8.symbols new file mode 100644 index 0000000000000..77018c3b42ae5 --- /dev/null +++ b/tests/baselines/reference/accessorField8.symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts === +class C1 { +>C1 : Symbol(C1, Decl(accessorField8.ts, 0, 0)) + + accessor a: any; +>a : Symbol(C1.a, Decl(accessorField8.ts, 0, 10)) + + static accessor b: any; +>b : Symbol(C1.b, Decl(accessorField8.ts, 1, 20)) +} + +declare class C2 { +>C2 : Symbol(C2, Decl(accessorField8.ts, 3, 1)) + + accessor a: any; +>a : Symbol(C2.a, Decl(accessorField8.ts, 5, 18)) + + static accessor b: any; +>b : Symbol(C2.b, Decl(accessorField8.ts, 6, 20)) +} + +function f() { +>f : Symbol(f, Decl(accessorField8.ts, 8, 1)) + + class C3 { +>C3 : Symbol(C3, Decl(accessorField8.ts, 10, 14)) + + accessor a: any; +>a : Symbol(C3.a, Decl(accessorField8.ts, 11, 14)) + + static accessor b: any; +>b : Symbol(C3.b, Decl(accessorField8.ts, 12, 24)) + } + return C3; +>C3 : Symbol(C3, Decl(accessorField8.ts, 10, 14)) +} + diff --git a/tests/baselines/reference/accessorField8.types b/tests/baselines/reference/accessorField8.types new file mode 100644 index 0000000000000..040ad200d7865 --- /dev/null +++ b/tests/baselines/reference/accessorField8.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts === +class C1 { +>C1 : C1 + + accessor a: any; +>a : any + + static accessor b: any; +>b : any +} + +declare class C2 { +>C2 : C2 + + accessor a: any; +>a : any + + static accessor b: any; +>b : any +} + +function f() { +>f : () => typeof C3 + + class C3 { +>C3 : C3 + + accessor a: any; +>a : any + + static accessor b: any; +>b : any + } + return C3; +>C3 : typeof C3 +} + diff --git a/tests/baselines/reference/accessorFieldAllowedModifiers.js b/tests/baselines/reference/accessorFieldAllowedModifiers.js new file mode 100644 index 0000000000000..fb45e88068f84 --- /dev/null +++ b/tests/baselines/reference/accessorFieldAllowedModifiers.js @@ -0,0 +1,49 @@ +//// [accessorFieldAllowedModifiers.ts] +abstract class C1 { + accessor a: any; + public accessor b: any; + private accessor c: any; + protected accessor d: any; + abstract accessor e: any; + static accessor f: any; + public static accessor g: any; + private static accessor h: any; + protected static accessor i: any; + accessor #j: any; + accessor "k": any; + accessor 108: any; + accessor ["m"]: any; + accessor n!: number; +} + +class C2 extends C1 { + override accessor e: any; + static override accessor i: any; +} + +declare class C3 { + accessor a: any; +} + + + +//// [accessorFieldAllowedModifiers.js] +class C1 { + accessor a; + accessor b; + accessor c; + accessor d; + static accessor f; + static accessor g; + static accessor h; + static accessor i; + accessor #j; + accessor "k"; + accessor 108; + accessor ["m"]; + accessor n; +} +class C2 extends C1 { + accessor e; + static accessor i; +} diff --git a/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt b/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt new file mode 100644 index 0000000000000..0349a5292cab9 --- /dev/null +++ b/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt @@ -0,0 +1,124 @@ +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(2,14): error TS1030: 'accessor' modifier already seen. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(3,14): error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(4,13): error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(5,14): error TS1029: 'public' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(6,14): error TS1029: 'private' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(7,14): error TS1029: 'protected' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(8,14): error TS1029: 'abstract' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(9,14): error TS1029: 'static' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(10,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(11,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(12,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(13,5): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(14,15): error TS1276: An 'accessor' property cannot be declared optional. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(18,14): error TS1029: 'override' modifier must precede 'accessor' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(22,5): error TS1070: 'accessor' modifier cannot appear on a type member. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(25,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(26,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(27,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(28,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(29,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(30,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(31,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(32,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(33,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(33,25): error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(34,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(35,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(36,1): error TS1275: 'accessor' modifier can only appear on a property declaration. + + +==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts (28 errors) ==== + abstract class C1 { + accessor accessor a: any; + ~~~~~~~~ +!!! error TS1030: 'accessor' modifier already seen. + readonly accessor b: any; + ~~~~~~~~ +!!! error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. + declare accessor c: any; + ~~~~~~~~ +!!! error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. + accessor public d: any; + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'accessor' modifier. + accessor private e: any; + ~~~~~~~ +!!! error TS1029: 'private' modifier must precede 'accessor' modifier. + accessor protected f: any; + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'accessor' modifier. + accessor abstract g: any; + ~~~~~~~~ +!!! error TS1029: 'abstract' modifier must precede 'accessor' modifier. + accessor static h: any; + ~~~~~~ +!!! error TS1029: 'static' modifier must precede 'accessor' modifier. + accessor i() {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor get j() { return false; } + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor set k(v: any) {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor constructor() {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor l?: any; + ~ +!!! error TS1276: An 'accessor' property cannot be declared optional. + } + + class C2 extends C1 { + accessor override g: any; + ~~~~~~~~ +!!! error TS1029: 'override' modifier must precede 'accessor' modifier. + } + + interface I1 { + accessor a: number; + ~~~~~~~~ +!!! error TS1070: 'accessor' modifier cannot appear on a type member. + } + + accessor class C3 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor interface I2 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor namespace N1 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor enum E1 {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor var V1: any; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor type T1 = never; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor function F1() {} + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor import "x"; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor import {} from "x"; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + ~~~ +!!! error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + accessor export { V1 }; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor export default V1; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + accessor import N2 = N1; + ~~~~~~~~ +!!! error TS1275: 'accessor' modifier can only appear on a property declaration. + \ No newline at end of file diff --git a/tests/baselines/reference/accessorFieldDisallowedModifiers.js b/tests/baselines/reference/accessorFieldDisallowedModifiers.js new file mode 100644 index 0000000000000..efc0082d637ad --- /dev/null +++ b/tests/baselines/reference/accessorFieldDisallowedModifiers.js @@ -0,0 +1,66 @@ +//// [accessorFieldDisallowedModifiers.ts] +abstract class C1 { + accessor accessor a: any; + readonly accessor b: any; + declare accessor c: any; + accessor public d: any; + accessor private e: any; + accessor protected f: any; + accessor abstract g: any; + accessor static h: any; + accessor i() {} + accessor get j() { return false; } + accessor set k(v: any) {} + accessor constructor() {} + accessor l?: any; +} + +class C2 extends C1 { + accessor override g: any; +} + +interface I1 { + accessor a: number; +} + +accessor class C3 {} +accessor interface I2 {} +accessor namespace N1 {} +accessor enum E1 {} +accessor var V1: any; +accessor type T1 = never; +accessor function F1() {} +accessor import "x"; +accessor import {} from "x"; +accessor export { V1 }; +accessor export default V1; +accessor import N2 = N1; + + +//// [accessorFieldDisallowedModifiers.js] +class C1 { + accessor accessor a; + accessor b; + accessor d; + accessor e; + accessor f; + accessor static h; + accessor i() { } + accessor get j() { return false; } + accessor set k(v) { } + constructor() { } + accessor l; +} +class C2 extends C1 { + accessor g; +} +accessor class C3 { +} +accessor var E1; +(function (E1) { +})(E1 || (E1 = {})); +accessor var V1; +accessor function F1() { } +accessor import "x"; +export { V1 }; +export default V1; diff --git a/tests/baselines/reference/decoratorOnClassProperty13.js b/tests/baselines/reference/decoratorOnClassProperty13.js index 3ce4ead68fa39..ec6d69e73971b 100644 --- a/tests/baselines/reference/decoratorOnClassProperty13.js +++ b/tests/baselines/reference/decoratorOnClassProperty13.js @@ -1,8 +1,8 @@ //// [decoratorOnClassProperty13.ts] -declare function dec(target: any, propertyKey: string, desc: PropertyDescriptor): void; - -class C { - @dec accessor prop; +declare function dec(target: any, propertyKey: string, desc: PropertyDescriptor): void; + +class C { + @dec accessor prop; } //// [decoratorOnClassProperty13.js] diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts new file mode 100644 index 0000000000000..177db89c2eddb --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitOnError: true + +class C1 { + accessor a: any; + accessor b = 1; + static accessor c: any; + static accessor d = 2; +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts new file mode 100644 index 0000000000000..790702188cc35 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts @@ -0,0 +1,18 @@ +// @target: esnext, es2022, es2015 + +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts new file mode 100644 index 0000000000000..1c74a8be284c9 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitOnError: true + +class C1 { + accessor "w": any; + accessor "x" = 1; + static accessor "y": any; + static accessor "z" = 2; +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts new file mode 100644 index 0000000000000..fcbf1e6f7bd58 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitOnError: true + +class C1 { + accessor 0: any; + accessor 1 = 1; + static accessor 2: any; + static accessor 3 = 2; +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts new file mode 100644 index 0000000000000..99e5cb140ef73 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts @@ -0,0 +1,15 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitOnError: true + +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + // @ts-ignore + accessor [f()] = 1; +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts new file mode 100644 index 0000000000000..aeb0c28609c25 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts @@ -0,0 +1,14 @@ +// @target: esnext, es2022, es2015 +// @useDefineForClassFields: * + +class C1 { + accessor a: any; +} + +class C2 extends C1 { + a = 1; +} + +class C3 extends C1 { + get a() { return super.a; } +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts new file mode 100644 index 0000000000000..7993326180d10 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts @@ -0,0 +1,14 @@ +// @target: esnext, es2022, es2015 +// @useDefineForClassFields: * + +abstract class C1 { + abstract accessor a: any; +} + +class C2 extends C1 { + accessor a = 1; +} + +class C3 extends C1 { + get a() { return 1; } +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts new file mode 100644 index 0000000000000..8e3a19e4d2b9d --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts @@ -0,0 +1,20 @@ +// @target: esnext +// @declaration: true + +class C1 { + accessor a: any; + static accessor b: any; +} + +declare class C2 { + accessor a: any; + static accessor b: any; +} + +function f() { + class C3 { + accessor a: any; + static accessor b: any; + } + return C3; +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts new file mode 100644 index 0000000000000..0c7bb3d1ad94f --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts @@ -0,0 +1,29 @@ +// @target: esnext +// @noTypesAndSymbols: true + +abstract class C1 { + accessor a: any; + public accessor b: any; + private accessor c: any; + protected accessor d: any; + abstract accessor e: any; + static accessor f: any; + public static accessor g: any; + private static accessor h: any; + protected static accessor i: any; + accessor #j: any; + accessor "k": any; + accessor 108: any; + accessor ["m"]: any; + accessor n!: number; +} + +class C2 extends C1 { + override accessor e: any; + static override accessor i: any; +} + +declare class C3 { + accessor a: any; +} + diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts new file mode 100644 index 0000000000000..44e848c1d7ae9 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts @@ -0,0 +1,39 @@ +// @target: esnext +// @noTypesAndSymbols: true + +abstract class C1 { + accessor accessor a: any; + readonly accessor b: any; + declare accessor c: any; + accessor public d: any; + accessor private e: any; + accessor protected f: any; + accessor abstract g: any; + accessor static h: any; + accessor i() {} + accessor get j() { return false; } + accessor set k(v: any) {} + accessor constructor() {} + accessor l?: any; +} + +class C2 extends C1 { + accessor override g: any; +} + +interface I1 { + accessor a: number; +} + +accessor class C3 {} +accessor interface I2 {} +accessor namespace N1 {} +accessor enum E1 {} +accessor var V1: any; +accessor type T1 = never; +accessor function F1() {} +accessor import "x"; +accessor import {} from "x"; +accessor export { V1 }; +accessor export default V1; +accessor import N2 = N1; From b853cb7324c31e67b4bae1a6748786d08b76ec82 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 9 Aug 2022 12:13:22 -0400 Subject: [PATCH 05/51] Add tests, ensure accessors are initialized in ctor --- .../accessorField1(target=es2015).js | 39 ------ .../accessorField1(target=es2015).symbols | 17 --- .../accessorField1(target=es2015).types | 19 --- .../accessorField1(target=es2022).js | 24 ---- .../accessorField1(target=es2022).symbols | 17 --- .../accessorField1(target=es2022).types | 19 --- .../accessorField1(target=es5).errors.txt | 22 ---- .../accessorField1(target=es5).symbols | 17 --- .../accessorField1(target=es5).types | 19 --- .../accessorField1(target=esnext).js | 16 --- .../accessorField1(target=esnext).symbols | 17 --- .../accessorField1(target=esnext).types | 19 --- .../accessorField2(target=es2015).js | 48 ------- .../accessorField2(target=es2015).symbols | 37 ------ .../accessorField2(target=es2015).types | 47 ------- .../accessorField2(target=es2022).js | 42 ------ .../accessorField2(target=es2022).symbols | 37 ------ .../accessorField2(target=es2022).types | 47 ------- .../accessorField2(target=esnext).js | 34 ----- .../accessorField2(target=esnext).symbols | 37 ------ .../accessorField2(target=esnext).types | 47 ------- .../accessorField3(target=es2015).js | 39 ------ .../accessorField3(target=es2015).symbols | 17 --- .../accessorField3(target=es2015).types | 19 --- .../accessorField3(target=es2022).js | 24 ---- .../accessorField3(target=es2022).symbols | 17 --- .../accessorField3(target=es2022).types | 19 --- .../accessorField3(target=es5).errors.txt | 22 ---- .../accessorField3(target=es5).symbols | 17 --- .../accessorField3(target=es5).types | 19 --- .../accessorField3(target=esnext).js | 16 --- .../accessorField3(target=esnext).symbols | 17 --- .../accessorField3(target=esnext).types | 19 --- .../accessorField4(target=es2015).js | 39 ------ .../accessorField4(target=es2015).symbols | 17 --- .../accessorField4(target=es2015).types | 19 --- .../accessorField4(target=es2022).js | 24 ---- .../accessorField4(target=es2022).symbols | 17 --- .../accessorField4(target=es2022).types | 19 --- .../accessorField4(target=es5).errors.txt | 22 ---- .../accessorField4(target=es5).symbols | 17 --- .../accessorField4(target=es5).types | 19 --- .../accessorField4(target=esnext).js | 16 --- .../accessorField4(target=esnext).symbols | 17 --- .../accessorField4(target=esnext).types | 19 --- .../accessorField5(target=es2015).js | 53 -------- .../accessorField5(target=es2015).symbols | 32 ----- .../accessorField5(target=es2015).types | 36 ----- .../accessorField5(target=es2022).js | 36 ----- .../accessorField5(target=es2022).symbols | 32 ----- .../accessorField5(target=es2022).types | 36 ----- .../accessorField5(target=es5).errors.txt | 27 ---- .../accessorField5(target=es5).symbols | 32 ----- .../accessorField5(target=es5).types | 36 ----- .../accessorField5(target=esnext).js | 25 ---- .../accessorField5(target=esnext).symbols | 32 ----- .../accessorField5(target=esnext).types | 36 ----- ...,usedefineforclassfields=false).errors.txt | 18 --- ...t=es2015,usedefineforclassfields=false).js | 41 ------ ...015,usedefineforclassfields=false).symbols | 27 ---- ...s2015,usedefineforclassfields=false).types | 28 ---- ...5,usedefineforclassfields=true).errors.txt | 18 --- ...et=es2015,usedefineforclassfields=true).js | 49 ------- ...2015,usedefineforclassfields=true).symbols | 27 ---- ...es2015,usedefineforclassfields=true).types | 28 ---- ...,usedefineforclassfields=false).errors.txt | 18 --- ...t=es2022,usedefineforclassfields=false).js | 29 ---- ...022,usedefineforclassfields=false).symbols | 27 ---- ...s2022,usedefineforclassfields=false).types | 28 ---- ...2,usedefineforclassfields=true).errors.txt | 18 --- ...et=es2022,usedefineforclassfields=true).js | 26 ---- ...2022,usedefineforclassfields=true).symbols | 27 ---- ...es2022,usedefineforclassfields=true).types | 28 ---- ...,usedefineforclassfields=false).errors.txt | 18 --- ...t=esnext,usedefineforclassfields=false).js | 26 ---- ...ext,usedefineforclassfields=false).symbols | 27 ---- ...snext,usedefineforclassfields=false).types | 28 ---- ...t,usedefineforclassfields=true).errors.txt | 18 --- ...et=esnext,usedefineforclassfields=true).js | 24 ---- ...next,usedefineforclassfields=true).symbols | 27 ---- ...esnext,usedefineforclassfields=true).types | 28 ---- ...t=es2015,usedefineforclassfields=false).js | 41 ------ ...015,usedefineforclassfields=false).symbols | 24 ---- ...s2015,usedefineforclassfields=false).types | 26 ---- ...et=es2015,usedefineforclassfields=true).js | 41 ------ ...2015,usedefineforclassfields=true).symbols | 24 ---- ...es2015,usedefineforclassfields=true).types | 26 ---- ...t=es2022,usedefineforclassfields=false).js | 29 ---- ...022,usedefineforclassfields=false).symbols | 24 ---- ...s2022,usedefineforclassfields=false).types | 26 ---- ...et=es2022,usedefineforclassfields=true).js | 25 ---- ...2022,usedefineforclassfields=true).symbols | 24 ---- ...es2022,usedefineforclassfields=true).types | 26 ---- ...t=esnext,usedefineforclassfields=false).js | 26 ---- ...ext,usedefineforclassfields=false).symbols | 24 ---- ...snext,usedefineforclassfields=false).types | 26 ---- ...et=esnext,usedefineforclassfields=true).js | 23 ---- ...next,usedefineforclassfields=true).symbols | 24 ---- ...esnext,usedefineforclassfields=true).types | 26 ---- tests/baselines/reference/accessorField8.js | 49 ------- .../reference/accessorField8.symbols | 37 ------ .../baselines/reference/accessorField8.types | 37 ------ .../accessorFieldAllowedModifiers.js | 49 ------- ...ccessorFieldDisallowedModifiers.errors.txt | 124 ------------------ .../accessorFieldDisallowedModifiers.js | 66 ---------- .../reference/autoAccessor2(target=es2015).js | 32 ++--- .../reference/autoAccessor5(target=es2015).js | 20 +-- .../reference/autoAccessor5(target=es2022).js | 20 +-- .../reference/autoAccessor5(target=esnext).js | 20 +-- .../accessorField1.ts | 9 -- .../accessorField2.ts | 18 --- .../accessorField3.ts | 9 -- .../accessorField4.ts | 9 -- .../accessorField5.ts | 15 --- .../accessorField6.ts | 14 -- .../accessorField7.ts | 14 -- .../accessorField8.ts | 20 --- .../accessorFieldAllowedModifiers.ts | 29 ---- .../accessorFieldDisallowedModifiers.ts | 39 ------ 119 files changed, 46 insertions(+), 3226 deletions(-) delete mode 100644 tests/baselines/reference/accessorField1(target=es2015).js delete mode 100644 tests/baselines/reference/accessorField1(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField1(target=es2015).types delete mode 100644 tests/baselines/reference/accessorField1(target=es2022).js delete mode 100644 tests/baselines/reference/accessorField1(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField1(target=es2022).types delete mode 100644 tests/baselines/reference/accessorField1(target=es5).errors.txt delete mode 100644 tests/baselines/reference/accessorField1(target=es5).symbols delete mode 100644 tests/baselines/reference/accessorField1(target=es5).types delete mode 100644 tests/baselines/reference/accessorField1(target=esnext).js delete mode 100644 tests/baselines/reference/accessorField1(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField1(target=esnext).types delete mode 100644 tests/baselines/reference/accessorField2(target=es2015).js delete mode 100644 tests/baselines/reference/accessorField2(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField2(target=es2015).types delete mode 100644 tests/baselines/reference/accessorField2(target=es2022).js delete mode 100644 tests/baselines/reference/accessorField2(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField2(target=es2022).types delete mode 100644 tests/baselines/reference/accessorField2(target=esnext).js delete mode 100644 tests/baselines/reference/accessorField2(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField2(target=esnext).types delete mode 100644 tests/baselines/reference/accessorField3(target=es2015).js delete mode 100644 tests/baselines/reference/accessorField3(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField3(target=es2015).types delete mode 100644 tests/baselines/reference/accessorField3(target=es2022).js delete mode 100644 tests/baselines/reference/accessorField3(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField3(target=es2022).types delete mode 100644 tests/baselines/reference/accessorField3(target=es5).errors.txt delete mode 100644 tests/baselines/reference/accessorField3(target=es5).symbols delete mode 100644 tests/baselines/reference/accessorField3(target=es5).types delete mode 100644 tests/baselines/reference/accessorField3(target=esnext).js delete mode 100644 tests/baselines/reference/accessorField3(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField3(target=esnext).types delete mode 100644 tests/baselines/reference/accessorField4(target=es2015).js delete mode 100644 tests/baselines/reference/accessorField4(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField4(target=es2015).types delete mode 100644 tests/baselines/reference/accessorField4(target=es2022).js delete mode 100644 tests/baselines/reference/accessorField4(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField4(target=es2022).types delete mode 100644 tests/baselines/reference/accessorField4(target=es5).errors.txt delete mode 100644 tests/baselines/reference/accessorField4(target=es5).symbols delete mode 100644 tests/baselines/reference/accessorField4(target=es5).types delete mode 100644 tests/baselines/reference/accessorField4(target=esnext).js delete mode 100644 tests/baselines/reference/accessorField4(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField4(target=esnext).types delete mode 100644 tests/baselines/reference/accessorField5(target=es2015).js delete mode 100644 tests/baselines/reference/accessorField5(target=es2015).symbols delete mode 100644 tests/baselines/reference/accessorField5(target=es2015).types delete mode 100644 tests/baselines/reference/accessorField5(target=es2022).js delete mode 100644 tests/baselines/reference/accessorField5(target=es2022).symbols delete mode 100644 tests/baselines/reference/accessorField5(target=es2022).types delete mode 100644 tests/baselines/reference/accessorField5(target=es5).errors.txt delete mode 100644 tests/baselines/reference/accessorField5(target=es5).symbols delete mode 100644 tests/baselines/reference/accessorField5(target=es5).types delete mode 100644 tests/baselines/reference/accessorField5(target=esnext).js delete mode 100644 tests/baselines/reference/accessorField5(target=esnext).symbols delete mode 100644 tests/baselines/reference/accessorField5(target=esnext).types delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types delete mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js delete mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types delete mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js delete mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types delete mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js delete mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types delete mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js delete mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols delete mode 100644 tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types delete mode 100644 tests/baselines/reference/accessorField8.js delete mode 100644 tests/baselines/reference/accessorField8.symbols delete mode 100644 tests/baselines/reference/accessorField8.types delete mode 100644 tests/baselines/reference/accessorFieldAllowedModifiers.js delete mode 100644 tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt delete mode 100644 tests/baselines/reference/accessorFieldDisallowedModifiers.js delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts delete mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts diff --git a/tests/baselines/reference/accessorField1(target=es2015).js b/tests/baselines/reference/accessorField1(target=es2015).js deleted file mode 100644 index e3a8a5baf03ce..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es2015).js +++ /dev/null @@ -1,39 +0,0 @@ -//// [accessorField1.ts] -class C1 { - accessor a: any; - accessor b = 1; - static accessor c: any; - static accessor d = 2; -} - - -//// [accessorField1.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var _a, _C1_a_accessor_storage, _C1_b_accessor_storage, _C1_c_accessor_storage, _C1_d_accessor_storage; -class C1 { - constructor() { - _C1_a_accessor_storage.set(this, void 0); - _C1_b_accessor_storage.set(this, 1); - } - get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } - set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } - get b() { return __classPrivateFieldGet(this, _C1_b_accessor_storage, "f"); } - set b(value) { __classPrivateFieldSet(this, _C1_b_accessor_storage, value, "f"); } - static get c() { return __classPrivateFieldGet(this, _a, "f", _C1_c_accessor_storage); } - static set c(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_c_accessor_storage); } - static get d() { return __classPrivateFieldGet(this, _a, "f", _C1_d_accessor_storage); } - static set d(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_d_accessor_storage); } -} -_a = C1, _C1_a_accessor_storage = new WeakMap(), _C1_b_accessor_storage = new WeakMap(); -_C1_c_accessor_storage = { value: void 0 }; -_C1_d_accessor_storage = { value: 2 }; diff --git a/tests/baselines/reference/accessorField1(target=es2015).symbols b/tests/baselines/reference/accessorField1(target=es2015).symbols deleted file mode 100644 index 28111d6f8fdaf..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es2015).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) - - accessor b = 1; ->b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) - - static accessor c: any; ->c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) - - static accessor d = 2; ->d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField1(target=es2015).types b/tests/baselines/reference/accessorField1(target=es2015).types deleted file mode 100644 index de41def82af66..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es2015).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any - - accessor b = 1; ->b : number ->1 : 1 - - static accessor c: any; ->c : any - - static accessor d = 2; ->d : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField1(target=es2022).js b/tests/baselines/reference/accessorField1(target=es2022).js deleted file mode 100644 index 5c481928b48e0..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es2022).js +++ /dev/null @@ -1,24 +0,0 @@ -//// [accessorField1.ts] -class C1 { - accessor a: any; - accessor b = 1; - static accessor c: any; - static accessor d = 2; -} - - -//// [accessorField1.js] -class C1 { - #a_accessor_storage; - get a() { return this.#a_accessor_storage; } - set a(value) { this.#a_accessor_storage = value; } - #b_accessor_storage = 1; - get b() { return this.#b_accessor_storage; } - set b(value) { this.#b_accessor_storage = value; } - static #c_accessor_storage; - static get c() { return this.#c_accessor_storage; } - static set c(value) { this.#c_accessor_storage = value; } - static #d_accessor_storage = 2; - static get d() { return this.#d_accessor_storage; } - static set d(value) { this.#d_accessor_storage = value; } -} diff --git a/tests/baselines/reference/accessorField1(target=es2022).symbols b/tests/baselines/reference/accessorField1(target=es2022).symbols deleted file mode 100644 index 28111d6f8fdaf..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es2022).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) - - accessor b = 1; ->b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) - - static accessor c: any; ->c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) - - static accessor d = 2; ->d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField1(target=es2022).types b/tests/baselines/reference/accessorField1(target=es2022).types deleted file mode 100644 index de41def82af66..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es2022).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any - - accessor b = 1; ->b : number ->1 : 1 - - static accessor c: any; ->c : any - - static accessor d = 2; ->d : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField1(target=es5).errors.txt b/tests/baselines/reference/accessorField1(target=es5).errors.txt deleted file mode 100644 index c9b2c82112a99..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es5).errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts (4 errors) ==== - class C1 { - accessor a: any; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - accessor b = 1; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor c: any; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor d = 2; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField1(target=es5).symbols b/tests/baselines/reference/accessorField1(target=es5).symbols deleted file mode 100644 index 28111d6f8fdaf..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es5).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) - - accessor b = 1; ->b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) - - static accessor c: any; ->c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) - - static accessor d = 2; ->d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField1(target=es5).types b/tests/baselines/reference/accessorField1(target=es5).types deleted file mode 100644 index de41def82af66..0000000000000 --- a/tests/baselines/reference/accessorField1(target=es5).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any - - accessor b = 1; ->b : number ->1 : 1 - - static accessor c: any; ->c : any - - static accessor d = 2; ->d : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField1(target=esnext).js b/tests/baselines/reference/accessorField1(target=esnext).js deleted file mode 100644 index 9d9f7f3db7ccf..0000000000000 --- a/tests/baselines/reference/accessorField1(target=esnext).js +++ /dev/null @@ -1,16 +0,0 @@ -//// [accessorField1.ts] -class C1 { - accessor a: any; - accessor b = 1; - static accessor c: any; - static accessor d = 2; -} - - -//// [accessorField1.js] -class C1 { - accessor a; - accessor b = 1; - static accessor c; - static accessor d = 2; -} diff --git a/tests/baselines/reference/accessorField1(target=esnext).symbols b/tests/baselines/reference/accessorField1(target=esnext).symbols deleted file mode 100644 index 28111d6f8fdaf..0000000000000 --- a/tests/baselines/reference/accessorField1(target=esnext).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField1.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField1.ts, 0, 10)) - - accessor b = 1; ->b : Symbol(C1.b, Decl(accessorField1.ts, 1, 20)) - - static accessor c: any; ->c : Symbol(C1.c, Decl(accessorField1.ts, 2, 19)) - - static accessor d = 2; ->d : Symbol(C1.d, Decl(accessorField1.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField1(target=esnext).types b/tests/baselines/reference/accessorField1(target=esnext).types deleted file mode 100644 index de41def82af66..0000000000000 --- a/tests/baselines/reference/accessorField1(target=esnext).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any - - accessor b = 1; ->b : number ->1 : 1 - - static accessor c: any; ->c : any - - static accessor d = 2; ->d : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField2(target=es2015).js b/tests/baselines/reference/accessorField2(target=es2015).js deleted file mode 100644 index 5697106f48fc4..0000000000000 --- a/tests/baselines/reference/accessorField2(target=es2015).js +++ /dev/null @@ -1,48 +0,0 @@ -//// [accessorField2.ts] -class C1 { - accessor #a: any; - accessor #b = 1; - static accessor #c: any; - static accessor #d = 2; - - constructor() { - this.#a = 3; - this.#b = 4; - } - - static { - this.#c = 5; - this.#d = 6; - } -} - - -//// [accessorField2.js] -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var _C1_instances, _a, _C1_a_get, _C1_a_set, _C1_b_get, _C1_b_set, _C1_c_get, _C1_c_set, _C1_d_get, _C1_d_set, _C1_a_accessor_storage, _C1_b_accessor_storage, _C1_c_accessor_storage, _C1_d_accessor_storage; -class C1 { - constructor() { - _C1_instances.add(this); - _C1_a_accessor_storage.set(this, void 0); - _C1_b_accessor_storage.set(this, 1); - __classPrivateFieldSet(this, _C1_instances, 3, "a", _C1_a_set); - __classPrivateFieldSet(this, _C1_instances, 4, "a", _C1_b_set); - } -} -_a = C1, _C1_instances = new WeakSet(), _C1_a_accessor_storage = new WeakMap(), _C1_b_accessor_storage = new WeakMap(), _C1_a_get = function _C1_a_get() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); }, _C1_a_set = function _C1_a_set(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); }, _C1_b_get = function _C1_b_get() { return __classPrivateFieldGet(this, _C1_b_accessor_storage, "f"); }, _C1_b_set = function _C1_b_set(value) { __classPrivateFieldSet(this, _C1_b_accessor_storage, value, "f"); }, _C1_c_get = function _C1_c_get() { return __classPrivateFieldGet(this, _a, "f", _C1_c_accessor_storage); }, _C1_c_set = function _C1_c_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_c_accessor_storage); }, _C1_d_get = function _C1_d_get() { return __classPrivateFieldGet(this, _a, "f", _C1_d_accessor_storage); }, _C1_d_set = function _C1_d_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_d_accessor_storage); }; -_C1_c_accessor_storage = { value: void 0 }; -_C1_d_accessor_storage = { value: 2 }; -(() => { - __classPrivateFieldSet(_a, _a, 5, "a", _C1_c_set); - __classPrivateFieldSet(_a, _a, 6, "a", _C1_d_set); -})(); diff --git a/tests/baselines/reference/accessorField2(target=es2015).symbols b/tests/baselines/reference/accessorField2(target=es2015).symbols deleted file mode 100644 index cd33647f39592..0000000000000 --- a/tests/baselines/reference/accessorField2(target=es2015).symbols +++ /dev/null @@ -1,37 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - accessor #a: any; ->#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) - - accessor #b = 1; ->#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) - - static accessor #c: any; ->#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) - - static accessor #d = 2; ->#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) - - constructor() { - this.#a = 3; ->this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#b = 4; ->this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } - - static { - this.#c = 5; ->this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#d = 6; ->this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } -} - diff --git a/tests/baselines/reference/accessorField2(target=es2015).types b/tests/baselines/reference/accessorField2(target=es2015).types deleted file mode 100644 index c440eae8a725f..0000000000000 --- a/tests/baselines/reference/accessorField2(target=es2015).types +++ /dev/null @@ -1,47 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === -class C1 { ->C1 : C1 - - accessor #a: any; ->#a : any - - accessor #b = 1; ->#b : number ->1 : 1 - - static accessor #c: any; ->#c : any - - static accessor #d = 2; ->#d : number ->2 : 2 - - constructor() { - this.#a = 3; ->this.#a = 3 : 3 ->this.#a : any ->this : this ->3 : 3 - - this.#b = 4; ->this.#b = 4 : 4 ->this.#b : number ->this : this ->4 : 4 - } - - static { - this.#c = 5; ->this.#c = 5 : 5 ->this.#c : any ->this : typeof C1 ->5 : 5 - - this.#d = 6; ->this.#d = 6 : 6 ->this.#d : number ->this : typeof C1 ->6 : 6 - } -} - diff --git a/tests/baselines/reference/accessorField2(target=es2022).js b/tests/baselines/reference/accessorField2(target=es2022).js deleted file mode 100644 index 00a5a76ab6128..0000000000000 --- a/tests/baselines/reference/accessorField2(target=es2022).js +++ /dev/null @@ -1,42 +0,0 @@ -//// [accessorField2.ts] -class C1 { - accessor #a: any; - accessor #b = 1; - static accessor #c: any; - static accessor #d = 2; - - constructor() { - this.#a = 3; - this.#b = 4; - } - - static { - this.#c = 5; - this.#d = 6; - } -} - - -//// [accessorField2.js] -class C1 { - #a_accessor_storage; - get #a() { return this.#a_accessor_storage; } - set #a(value) { this.#a_accessor_storage = value; } - #b_accessor_storage = 1; - get #b() { return this.#b_accessor_storage; } - set #b(value) { this.#b_accessor_storage = value; } - static #c_accessor_storage; - static get #c() { return this.#c_accessor_storage; } - static set #c(value) { this.#c_accessor_storage = value; } - static #d_accessor_storage = 2; - static get #d() { return this.#d_accessor_storage; } - static set #d(value) { this.#d_accessor_storage = value; } - constructor() { - this.#a = 3; - this.#b = 4; - } - static { - this.#c = 5; - this.#d = 6; - } -} diff --git a/tests/baselines/reference/accessorField2(target=es2022).symbols b/tests/baselines/reference/accessorField2(target=es2022).symbols deleted file mode 100644 index cd33647f39592..0000000000000 --- a/tests/baselines/reference/accessorField2(target=es2022).symbols +++ /dev/null @@ -1,37 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - accessor #a: any; ->#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) - - accessor #b = 1; ->#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) - - static accessor #c: any; ->#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) - - static accessor #d = 2; ->#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) - - constructor() { - this.#a = 3; ->this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#b = 4; ->this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } - - static { - this.#c = 5; ->this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#d = 6; ->this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } -} - diff --git a/tests/baselines/reference/accessorField2(target=es2022).types b/tests/baselines/reference/accessorField2(target=es2022).types deleted file mode 100644 index c440eae8a725f..0000000000000 --- a/tests/baselines/reference/accessorField2(target=es2022).types +++ /dev/null @@ -1,47 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === -class C1 { ->C1 : C1 - - accessor #a: any; ->#a : any - - accessor #b = 1; ->#b : number ->1 : 1 - - static accessor #c: any; ->#c : any - - static accessor #d = 2; ->#d : number ->2 : 2 - - constructor() { - this.#a = 3; ->this.#a = 3 : 3 ->this.#a : any ->this : this ->3 : 3 - - this.#b = 4; ->this.#b = 4 : 4 ->this.#b : number ->this : this ->4 : 4 - } - - static { - this.#c = 5; ->this.#c = 5 : 5 ->this.#c : any ->this : typeof C1 ->5 : 5 - - this.#d = 6; ->this.#d = 6 : 6 ->this.#d : number ->this : typeof C1 ->6 : 6 - } -} - diff --git a/tests/baselines/reference/accessorField2(target=esnext).js b/tests/baselines/reference/accessorField2(target=esnext).js deleted file mode 100644 index bcfad4951288a..0000000000000 --- a/tests/baselines/reference/accessorField2(target=esnext).js +++ /dev/null @@ -1,34 +0,0 @@ -//// [accessorField2.ts] -class C1 { - accessor #a: any; - accessor #b = 1; - static accessor #c: any; - static accessor #d = 2; - - constructor() { - this.#a = 3; - this.#b = 4; - } - - static { - this.#c = 5; - this.#d = 6; - } -} - - -//// [accessorField2.js] -class C1 { - accessor #a; - accessor #b = 1; - static accessor #c; - static accessor #d = 2; - constructor() { - this.#a = 3; - this.#b = 4; - } - static { - this.#c = 5; - this.#d = 6; - } -} diff --git a/tests/baselines/reference/accessorField2(target=esnext).symbols b/tests/baselines/reference/accessorField2(target=esnext).symbols deleted file mode 100644 index cd33647f39592..0000000000000 --- a/tests/baselines/reference/accessorField2(target=esnext).symbols +++ /dev/null @@ -1,37 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - accessor #a: any; ->#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) - - accessor #b = 1; ->#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) - - static accessor #c: any; ->#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) - - static accessor #d = 2; ->#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) - - constructor() { - this.#a = 3; ->this.#a : Symbol(C1.#a, Decl(accessorField2.ts, 0, 10)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#b = 4; ->this.#b : Symbol(C1.#b, Decl(accessorField2.ts, 1, 21)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } - - static { - this.#c = 5; ->this.#c : Symbol(C1.#c, Decl(accessorField2.ts, 2, 20)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - - this.#d = 6; ->this.#d : Symbol(C1.#d, Decl(accessorField2.ts, 3, 28)) ->this : Symbol(C1, Decl(accessorField2.ts, 0, 0)) - } -} - diff --git a/tests/baselines/reference/accessorField2(target=esnext).types b/tests/baselines/reference/accessorField2(target=esnext).types deleted file mode 100644 index c440eae8a725f..0000000000000 --- a/tests/baselines/reference/accessorField2(target=esnext).types +++ /dev/null @@ -1,47 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts === -class C1 { ->C1 : C1 - - accessor #a: any; ->#a : any - - accessor #b = 1; ->#b : number ->1 : 1 - - static accessor #c: any; ->#c : any - - static accessor #d = 2; ->#d : number ->2 : 2 - - constructor() { - this.#a = 3; ->this.#a = 3 : 3 ->this.#a : any ->this : this ->3 : 3 - - this.#b = 4; ->this.#b = 4 : 4 ->this.#b : number ->this : this ->4 : 4 - } - - static { - this.#c = 5; ->this.#c = 5 : 5 ->this.#c : any ->this : typeof C1 ->5 : 5 - - this.#d = 6; ->this.#d = 6 : 6 ->this.#d : number ->this : typeof C1 ->6 : 6 - } -} - diff --git a/tests/baselines/reference/accessorField3(target=es2015).js b/tests/baselines/reference/accessorField3(target=es2015).js deleted file mode 100644 index 302d5fdc600eb..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es2015).js +++ /dev/null @@ -1,39 +0,0 @@ -//// [accessorField3.ts] -class C1 { - accessor "w": any; - accessor "x" = 1; - static accessor "y": any; - static accessor "z" = 2; -} - - -//// [accessorField3.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage; -class C1 { - constructor() { - _C1__a_accessor_storage.set(this, void 0); - _C1__b_accessor_storage.set(this, 1); - } - get "w"() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); } - set "w"(value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); } - get "x"() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); } - set "x"(value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); } - static get "y"() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); } - static set "y"(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); } - static get "z"() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); } - static set "z"(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); } -} -_a = C1, _C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(); -_C1__c_accessor_storage = { value: void 0 }; -_C1__d_accessor_storage = { value: 2 }; diff --git a/tests/baselines/reference/accessorField3(target=es2015).symbols b/tests/baselines/reference/accessorField3(target=es2015).symbols deleted file mode 100644 index 0312c5a3cd1a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es2015).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) - - accessor "w": any; ->"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) - - accessor "x" = 1; ->"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) - - static accessor "y": any; ->"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) - - static accessor "z" = 2; ->"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) -} - diff --git a/tests/baselines/reference/accessorField3(target=es2015).types b/tests/baselines/reference/accessorField3(target=es2015).types deleted file mode 100644 index 4434ebeda37a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es2015).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : C1 - - accessor "w": any; ->"w" : any - - accessor "x" = 1; ->"x" : number ->1 : 1 - - static accessor "y": any; ->"y" : any - - static accessor "z" = 2; ->"z" : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField3(target=es2022).js b/tests/baselines/reference/accessorField3(target=es2022).js deleted file mode 100644 index 4cb2eed6d7678..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es2022).js +++ /dev/null @@ -1,24 +0,0 @@ -//// [accessorField3.ts] -class C1 { - accessor "w": any; - accessor "x" = 1; - static accessor "y": any; - static accessor "z" = 2; -} - - -//// [accessorField3.js] -class C1 { - #_a_accessor_storage; - get "w"() { return this.#_a_accessor_storage; } - set "w"(value) { this.#_a_accessor_storage = value; } - #_b_accessor_storage = 1; - get "x"() { return this.#_b_accessor_storage; } - set "x"(value) { this.#_b_accessor_storage = value; } - static #_c_accessor_storage; - static get "y"() { return this.#_c_accessor_storage; } - static set "y"(value) { this.#_c_accessor_storage = value; } - static #_d_accessor_storage = 2; - static get "z"() { return this.#_d_accessor_storage; } - static set "z"(value) { this.#_d_accessor_storage = value; } -} diff --git a/tests/baselines/reference/accessorField3(target=es2022).symbols b/tests/baselines/reference/accessorField3(target=es2022).symbols deleted file mode 100644 index 0312c5a3cd1a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es2022).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) - - accessor "w": any; ->"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) - - accessor "x" = 1; ->"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) - - static accessor "y": any; ->"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) - - static accessor "z" = 2; ->"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) -} - diff --git a/tests/baselines/reference/accessorField3(target=es2022).types b/tests/baselines/reference/accessorField3(target=es2022).types deleted file mode 100644 index 4434ebeda37a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es2022).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : C1 - - accessor "w": any; ->"w" : any - - accessor "x" = 1; ->"x" : number ->1 : 1 - - static accessor "y": any; ->"y" : any - - static accessor "z" = 2; ->"z" : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField3(target=es5).errors.txt b/tests/baselines/reference/accessorField3(target=es5).errors.txt deleted file mode 100644 index c52b7002bbceb..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es5).errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts (4 errors) ==== - class C1 { - accessor "w": any; - ~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - accessor "x" = 1; - ~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor "y": any; - ~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor "z" = 2; - ~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField3(target=es5).symbols b/tests/baselines/reference/accessorField3(target=es5).symbols deleted file mode 100644 index 0312c5a3cd1a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es5).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) - - accessor "w": any; ->"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) - - accessor "x" = 1; ->"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) - - static accessor "y": any; ->"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) - - static accessor "z" = 2; ->"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) -} - diff --git a/tests/baselines/reference/accessorField3(target=es5).types b/tests/baselines/reference/accessorField3(target=es5).types deleted file mode 100644 index 4434ebeda37a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=es5).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : C1 - - accessor "w": any; ->"w" : any - - accessor "x" = 1; ->"x" : number ->1 : 1 - - static accessor "y": any; ->"y" : any - - static accessor "z" = 2; ->"z" : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField3(target=esnext).js b/tests/baselines/reference/accessorField3(target=esnext).js deleted file mode 100644 index 6535fef4ac5d9..0000000000000 --- a/tests/baselines/reference/accessorField3(target=esnext).js +++ /dev/null @@ -1,16 +0,0 @@ -//// [accessorField3.ts] -class C1 { - accessor "w": any; - accessor "x" = 1; - static accessor "y": any; - static accessor "z" = 2; -} - - -//// [accessorField3.js] -class C1 { - accessor "w"; - accessor "x" = 1; - static accessor "y"; - static accessor "z" = 2; -} diff --git a/tests/baselines/reference/accessorField3(target=esnext).symbols b/tests/baselines/reference/accessorField3(target=esnext).symbols deleted file mode 100644 index 0312c5a3cd1a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=esnext).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField3.ts, 0, 0)) - - accessor "w": any; ->"w" : Symbol(C1["w"], Decl(accessorField3.ts, 0, 10)) - - accessor "x" = 1; ->"x" : Symbol(C1["x"], Decl(accessorField3.ts, 1, 22)) - - static accessor "y": any; ->"y" : Symbol(C1["y"], Decl(accessorField3.ts, 2, 21)) - - static accessor "z" = 2; ->"z" : Symbol(C1["z"], Decl(accessorField3.ts, 3, 29)) -} - diff --git a/tests/baselines/reference/accessorField3(target=esnext).types b/tests/baselines/reference/accessorField3(target=esnext).types deleted file mode 100644 index 4434ebeda37a4..0000000000000 --- a/tests/baselines/reference/accessorField3(target=esnext).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts === -class C1 { ->C1 : C1 - - accessor "w": any; ->"w" : any - - accessor "x" = 1; ->"x" : number ->1 : 1 - - static accessor "y": any; ->"y" : any - - static accessor "z" = 2; ->"z" : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField4(target=es2015).js b/tests/baselines/reference/accessorField4(target=es2015).js deleted file mode 100644 index 8631dca33e409..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es2015).js +++ /dev/null @@ -1,39 +0,0 @@ -//// [accessorField4.ts] -class C1 { - accessor 0: any; - accessor 1 = 1; - static accessor 2: any; - static accessor 3 = 2; -} - - -//// [accessorField4.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage; -class C1 { - constructor() { - _C1__a_accessor_storage.set(this, void 0); - _C1__b_accessor_storage.set(this, 1); - } - get 0() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); } - set 0(value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); } - get 1() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); } - set 1(value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); } - static get 2() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); } - static set 2(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); } - static get 3() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); } - static set 3(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); } -} -_a = C1, _C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(); -_C1__c_accessor_storage = { value: void 0 }; -_C1__d_accessor_storage = { value: 2 }; diff --git a/tests/baselines/reference/accessorField4(target=es2015).symbols b/tests/baselines/reference/accessorField4(target=es2015).symbols deleted file mode 100644 index 7720dcdf7d897..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es2015).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) - - accessor 0: any; ->0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) - - accessor 1 = 1; ->1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) - - static accessor 2: any; ->2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) - - static accessor 3 = 2; ->3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField4(target=es2015).types b/tests/baselines/reference/accessorField4(target=es2015).types deleted file mode 100644 index 702dc296d9b4c..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es2015).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : C1 - - accessor 0: any; ->0 : any - - accessor 1 = 1; ->1 : number ->1 : 1 - - static accessor 2: any; ->2 : any - - static accessor 3 = 2; ->3 : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField4(target=es2022).js b/tests/baselines/reference/accessorField4(target=es2022).js deleted file mode 100644 index 603b4bd3999b1..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es2022).js +++ /dev/null @@ -1,24 +0,0 @@ -//// [accessorField4.ts] -class C1 { - accessor 0: any; - accessor 1 = 1; - static accessor 2: any; - static accessor 3 = 2; -} - - -//// [accessorField4.js] -class C1 { - #_a_accessor_storage; - get 0() { return this.#_a_accessor_storage; } - set 0(value) { this.#_a_accessor_storage = value; } - #_b_accessor_storage = 1; - get 1() { return this.#_b_accessor_storage; } - set 1(value) { this.#_b_accessor_storage = value; } - static #_c_accessor_storage; - static get 2() { return this.#_c_accessor_storage; } - static set 2(value) { this.#_c_accessor_storage = value; } - static #_d_accessor_storage = 2; - static get 3() { return this.#_d_accessor_storage; } - static set 3(value) { this.#_d_accessor_storage = value; } -} diff --git a/tests/baselines/reference/accessorField4(target=es2022).symbols b/tests/baselines/reference/accessorField4(target=es2022).symbols deleted file mode 100644 index 7720dcdf7d897..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es2022).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) - - accessor 0: any; ->0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) - - accessor 1 = 1; ->1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) - - static accessor 2: any; ->2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) - - static accessor 3 = 2; ->3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField4(target=es2022).types b/tests/baselines/reference/accessorField4(target=es2022).types deleted file mode 100644 index 702dc296d9b4c..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es2022).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : C1 - - accessor 0: any; ->0 : any - - accessor 1 = 1; ->1 : number ->1 : 1 - - static accessor 2: any; ->2 : any - - static accessor 3 = 2; ->3 : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField4(target=es5).errors.txt b/tests/baselines/reference/accessorField4(target=es5).errors.txt deleted file mode 100644 index 47b0e61b4b75a..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es5).errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts (4 errors) ==== - class C1 { - accessor 0: any; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - accessor 1 = 1; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor 2: any; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor 3 = 2; - ~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField4(target=es5).symbols b/tests/baselines/reference/accessorField4(target=es5).symbols deleted file mode 100644 index 7720dcdf7d897..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es5).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) - - accessor 0: any; ->0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) - - accessor 1 = 1; ->1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) - - static accessor 2: any; ->2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) - - static accessor 3 = 2; ->3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField4(target=es5).types b/tests/baselines/reference/accessorField4(target=es5).types deleted file mode 100644 index 702dc296d9b4c..0000000000000 --- a/tests/baselines/reference/accessorField4(target=es5).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : C1 - - accessor 0: any; ->0 : any - - accessor 1 = 1; ->1 : number ->1 : 1 - - static accessor 2: any; ->2 : any - - static accessor 3 = 2; ->3 : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField4(target=esnext).js b/tests/baselines/reference/accessorField4(target=esnext).js deleted file mode 100644 index b0eafbf87f317..0000000000000 --- a/tests/baselines/reference/accessorField4(target=esnext).js +++ /dev/null @@ -1,16 +0,0 @@ -//// [accessorField4.ts] -class C1 { - accessor 0: any; - accessor 1 = 1; - static accessor 2: any; - static accessor 3 = 2; -} - - -//// [accessorField4.js] -class C1 { - accessor 0; - accessor 1 = 1; - static accessor 2; - static accessor 3 = 2; -} diff --git a/tests/baselines/reference/accessorField4(target=esnext).symbols b/tests/baselines/reference/accessorField4(target=esnext).symbols deleted file mode 100644 index 7720dcdf7d897..0000000000000 --- a/tests/baselines/reference/accessorField4(target=esnext).symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField4.ts, 0, 0)) - - accessor 0: any; ->0 : Symbol(C1[0], Decl(accessorField4.ts, 0, 10)) - - accessor 1 = 1; ->1 : Symbol(C1[1], Decl(accessorField4.ts, 1, 20)) - - static accessor 2: any; ->2 : Symbol(C1[2], Decl(accessorField4.ts, 2, 19)) - - static accessor 3 = 2; ->3 : Symbol(C1[3], Decl(accessorField4.ts, 3, 27)) -} - diff --git a/tests/baselines/reference/accessorField4(target=esnext).types b/tests/baselines/reference/accessorField4(target=esnext).types deleted file mode 100644 index 702dc296d9b4c..0000000000000 --- a/tests/baselines/reference/accessorField4(target=esnext).types +++ /dev/null @@ -1,19 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts === -class C1 { ->C1 : C1 - - accessor 0: any; ->0 : any - - accessor 1 = 1; ->1 : number ->1 : 1 - - static accessor 2: any; ->2 : any - - static accessor 3 = 2; ->3 : number ->2 : 2 -} - diff --git a/tests/baselines/reference/accessorField5(target=es2015).js b/tests/baselines/reference/accessorField5(target=es2015).js deleted file mode 100644 index 6e5f0cab385aa..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es2015).js +++ /dev/null @@ -1,53 +0,0 @@ -//// [accessorField5.ts] -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - // @ts-ignore - accessor [f()] = 1; -} - -//// [accessorField5.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage, _C2__e_accessor_storage, _b; -class C1 { - constructor() { - _C1__a_accessor_storage.set(this, void 0); - _C1__b_accessor_storage.set(this, 1); - } - get [(_C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(), "w")]() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); } - set ["w"](value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); } - get ["x"]() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); } - set ["x"](value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); } - static get ["y"]() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); } - static set ["y"](value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); } - static get ["z"]() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); } - static set ["z"](value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); } -} -_a = C1; -_C1__c_accessor_storage = { value: void 0 }; -_C1__d_accessor_storage = { value: 2 }; -class C2 { - constructor() { - // @ts-ignore - _C2__e_accessor_storage.set(this, 1); - } - // @ts-ignore - get [(_C2__e_accessor_storage = new WeakMap(), _b = f(), _b)]() { return __classPrivateFieldGet(this, _C2__e_accessor_storage, "f"); } - set [_b](value) { __classPrivateFieldSet(this, _C2__e_accessor_storage, value, "f"); } -} diff --git a/tests/baselines/reference/accessorField5(target=es2015).symbols b/tests/baselines/reference/accessorField5(target=es2015).symbols deleted file mode 100644 index e09a9785dc30f..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es2015).symbols +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) - - accessor ["w"]: any; ->["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) ->"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) - - accessor ["x"] = 1; ->["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) ->"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) - - static accessor ["y"]: any; ->["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) ->"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) - - static accessor ["z"] = 2; ->["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) ->"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) -} - -declare var f: any; ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) - -class C2 { ->C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) - - // @ts-ignore - accessor [f()] = 1; ->[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) -} diff --git a/tests/baselines/reference/accessorField5(target=es2015).types b/tests/baselines/reference/accessorField5(target=es2015).types deleted file mode 100644 index 60b575def5744..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es2015).types +++ /dev/null @@ -1,36 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : C1 - - accessor ["w"]: any; ->["w"] : any ->"w" : "w" - - accessor ["x"] = 1; ->["x"] : number ->"x" : "x" ->1 : 1 - - static accessor ["y"]: any; ->["y"] : any ->"y" : "y" - - static accessor ["z"] = 2; ->["z"] : number ->"z" : "z" ->2 : 2 -} - -declare var f: any; ->f : any - -class C2 { ->C2 : C2 - - // @ts-ignore - accessor [f()] = 1; ->[f()] : number ->f() : any ->f : any ->1 : 1 -} diff --git a/tests/baselines/reference/accessorField5(target=es2022).js b/tests/baselines/reference/accessorField5(target=es2022).js deleted file mode 100644 index 2388795f8ac3e..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es2022).js +++ /dev/null @@ -1,36 +0,0 @@ -//// [accessorField5.ts] -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - // @ts-ignore - accessor [f()] = 1; -} - -//// [accessorField5.js] -var _a; -class C1 { - #_a_accessor_storage; - get ["w"]() { return this.#_a_accessor_storage; } - set ["w"](value) { this.#_a_accessor_storage = value; } - #_b_accessor_storage = 1; - get ["x"]() { return this.#_b_accessor_storage; } - set ["x"](value) { this.#_b_accessor_storage = value; } - static #_c_accessor_storage; - static get ["y"]() { return this.#_c_accessor_storage; } - static set ["y"](value) { this.#_c_accessor_storage = value; } - static #_d_accessor_storage = 2; - static get ["z"]() { return this.#_d_accessor_storage; } - static set ["z"](value) { this.#_d_accessor_storage = value; } -} -class C2 { - #_e_accessor_storage = 1; - // @ts-ignore - get [(_a = f(), _a)]() { return this.#_e_accessor_storage; } - set [_a](value) { this.#_e_accessor_storage = value; } -} diff --git a/tests/baselines/reference/accessorField5(target=es2022).symbols b/tests/baselines/reference/accessorField5(target=es2022).symbols deleted file mode 100644 index e09a9785dc30f..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es2022).symbols +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) - - accessor ["w"]: any; ->["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) ->"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) - - accessor ["x"] = 1; ->["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) ->"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) - - static accessor ["y"]: any; ->["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) ->"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) - - static accessor ["z"] = 2; ->["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) ->"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) -} - -declare var f: any; ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) - -class C2 { ->C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) - - // @ts-ignore - accessor [f()] = 1; ->[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) -} diff --git a/tests/baselines/reference/accessorField5(target=es2022).types b/tests/baselines/reference/accessorField5(target=es2022).types deleted file mode 100644 index 60b575def5744..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es2022).types +++ /dev/null @@ -1,36 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : C1 - - accessor ["w"]: any; ->["w"] : any ->"w" : "w" - - accessor ["x"] = 1; ->["x"] : number ->"x" : "x" ->1 : 1 - - static accessor ["y"]: any; ->["y"] : any ->"y" : "y" - - static accessor ["z"] = 2; ->["z"] : number ->"z" : "z" ->2 : 2 -} - -declare var f: any; ->f : any - -class C2 { ->C2 : C2 - - // @ts-ignore - accessor [f()] = 1; ->[f()] : number ->f() : any ->f : any ->1 : 1 -} diff --git a/tests/baselines/reference/accessorField5(target=es5).errors.txt b/tests/baselines/reference/accessorField5(target=es5).errors.txt deleted file mode 100644 index 52fa176a00b10..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es5).errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts (4 errors) ==== - class C1 { - accessor ["w"]: any; - ~~~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - accessor ["x"] = 1; - ~~~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor ["y"]: any; - ~~~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - static accessor ["z"] = 2; - ~~~~~ -!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher. - } - - declare var f: any; - class C2 { - // @ts-ignore - accessor [f()] = 1; - } \ No newline at end of file diff --git a/tests/baselines/reference/accessorField5(target=es5).symbols b/tests/baselines/reference/accessorField5(target=es5).symbols deleted file mode 100644 index e09a9785dc30f..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es5).symbols +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) - - accessor ["w"]: any; ->["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) ->"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) - - accessor ["x"] = 1; ->["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) ->"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) - - static accessor ["y"]: any; ->["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) ->"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) - - static accessor ["z"] = 2; ->["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) ->"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) -} - -declare var f: any; ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) - -class C2 { ->C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) - - // @ts-ignore - accessor [f()] = 1; ->[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) -} diff --git a/tests/baselines/reference/accessorField5(target=es5).types b/tests/baselines/reference/accessorField5(target=es5).types deleted file mode 100644 index 60b575def5744..0000000000000 --- a/tests/baselines/reference/accessorField5(target=es5).types +++ /dev/null @@ -1,36 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : C1 - - accessor ["w"]: any; ->["w"] : any ->"w" : "w" - - accessor ["x"] = 1; ->["x"] : number ->"x" : "x" ->1 : 1 - - static accessor ["y"]: any; ->["y"] : any ->"y" : "y" - - static accessor ["z"] = 2; ->["z"] : number ->"z" : "z" ->2 : 2 -} - -declare var f: any; ->f : any - -class C2 { ->C2 : C2 - - // @ts-ignore - accessor [f()] = 1; ->[f()] : number ->f() : any ->f : any ->1 : 1 -} diff --git a/tests/baselines/reference/accessorField5(target=esnext).js b/tests/baselines/reference/accessorField5(target=esnext).js deleted file mode 100644 index 7c84d37e73c3d..0000000000000 --- a/tests/baselines/reference/accessorField5(target=esnext).js +++ /dev/null @@ -1,25 +0,0 @@ -//// [accessorField5.ts] -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - // @ts-ignore - accessor [f()] = 1; -} - -//// [accessorField5.js] -class C1 { - accessor ["w"]; - accessor ["x"] = 1; - static accessor ["y"]; - static accessor ["z"] = 2; -} -class C2 { - // @ts-ignore - accessor [f()] = 1; -} diff --git a/tests/baselines/reference/accessorField5(target=esnext).symbols b/tests/baselines/reference/accessorField5(target=esnext).symbols deleted file mode 100644 index e09a9785dc30f..0000000000000 --- a/tests/baselines/reference/accessorField5(target=esnext).symbols +++ /dev/null @@ -1,32 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField5.ts, 0, 0)) - - accessor ["w"]: any; ->["w"] : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) ->"w" : Symbol(C1["w"], Decl(accessorField5.ts, 0, 10)) - - accessor ["x"] = 1; ->["x"] : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) ->"x" : Symbol(C1["x"], Decl(accessorField5.ts, 1, 24)) - - static accessor ["y"]: any; ->["y"] : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) ->"y" : Symbol(C1["y"], Decl(accessorField5.ts, 2, 23)) - - static accessor ["z"] = 2; ->["z"] : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) ->"z" : Symbol(C1["z"], Decl(accessorField5.ts, 3, 31)) -} - -declare var f: any; ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) - -class C2 { ->C2 : Symbol(C2, Decl(accessorField5.ts, 7, 19)) - - // @ts-ignore - accessor [f()] = 1; ->[f()] : Symbol(C2[f()], Decl(accessorField5.ts, 8, 10)) ->f : Symbol(f, Decl(accessorField5.ts, 7, 11)) -} diff --git a/tests/baselines/reference/accessorField5(target=esnext).types b/tests/baselines/reference/accessorField5(target=esnext).types deleted file mode 100644 index 60b575def5744..0000000000000 --- a/tests/baselines/reference/accessorField5(target=esnext).types +++ /dev/null @@ -1,36 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts === -class C1 { ->C1 : C1 - - accessor ["w"]: any; ->["w"] : any ->"w" : "w" - - accessor ["x"] = 1; ->["x"] : number ->"x" : "x" ->1 : 1 - - static accessor ["y"]: any; ->["y"] : any ->"y" : "y" - - static accessor ["z"] = 2; ->["z"] : number ->"z" : "z" ->2 : 2 -} - -declare var f: any; ->f : any - -class C2 { ->C2 : C2 - - // @ts-ignore - accessor [f()] = 1; ->[f()] : number ->f() : any ->f : any ->1 : 1 -} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt deleted file mode 100644 index 4a63914155538..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== - class C1 { - accessor a: any; - } - - class C2 extends C1 { - a = 1; - ~ -!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - } - - class C3 extends C1 { - get a() { return super.a; } - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js deleted file mode 100644 index b2afea001fa94..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).js +++ /dev/null @@ -1,41 +0,0 @@ -//// [accessorField6.ts] -class C1 { - accessor a: any; -} - -class C2 extends C1 { - a = 1; -} - -class C3 extends C1 { - get a() { return super.a; } -} - - -//// [accessorField6.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var _C1_a_accessor_storage; -class C1 { - get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } - set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } -} -_C1_a_accessor_storage = new WeakMap(); -class C2 extends C1 { - constructor() { - super(...arguments); - this.a = 1; - } -} -class C3 extends C1 { - get a() { return super.a; } -} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types deleted file mode 100644 index a6b9efded46a1..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=false).types +++ /dev/null @@ -1,28 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return super.a; } ->a : any ->super.a : any ->super : C1 ->a : any -} - diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt deleted file mode 100644 index 4a63914155538..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== - class C1 { - accessor a: any; - } - - class C2 extends C1 { - a = 1; - ~ -!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - } - - class C3 extends C1 { - get a() { return super.a; } - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js deleted file mode 100644 index e217a7d9eb0c6..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).js +++ /dev/null @@ -1,49 +0,0 @@ -//// [accessorField6.ts] -class C1 { - accessor a: any; -} - -class C2 extends C1 { - a = 1; -} - -class C3 extends C1 { - get a() { return super.a; } -} - - -//// [accessorField6.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var _C1_a_accessor_storage; -class C1 { - constructor() { - _C1_a_accessor_storage.set(this, void 0); - } - get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); } - set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); } -} -_C1_a_accessor_storage = new WeakMap(); -class C2 extends C1 { - constructor() { - super(...arguments); - Object.defineProperty(this, "a", { - enumerable: true, - configurable: true, - writable: true, - value: 1 - }); - } -} -class C3 extends C1 { - get a() { return super.a; } -} diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types deleted file mode 100644 index a6b9efded46a1..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2015,usedefineforclassfields=true).types +++ /dev/null @@ -1,28 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return super.a; } ->a : any ->super.a : any ->super : C1 ->a : any -} - diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt deleted file mode 100644 index 4a63914155538..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== - class C1 { - accessor a: any; - } - - class C2 extends C1 { - a = 1; - ~ -!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - } - - class C3 extends C1 { - get a() { return super.a; } - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js deleted file mode 100644 index 27f356be65eef..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).js +++ /dev/null @@ -1,29 +0,0 @@ -//// [accessorField6.ts] -class C1 { - accessor a: any; -} - -class C2 extends C1 { - a = 1; -} - -class C3 extends C1 { - get a() { return super.a; } -} - - -//// [accessorField6.js] -class C1 { - #a_accessor_storage; - get a() { return this.#a_accessor_storage; } - set a(value) { this.#a_accessor_storage = value; } -} -class C2 extends C1 { - constructor() { - super(...arguments); - this.a = 1; - } -} -class C3 extends C1 { - get a() { return super.a; } -} diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types deleted file mode 100644 index a6b9efded46a1..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=false).types +++ /dev/null @@ -1,28 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return super.a; } ->a : any ->super.a : any ->super : C1 ->a : any -} - diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt deleted file mode 100644 index 4a63914155538..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== - class C1 { - accessor a: any; - } - - class C2 extends C1 { - a = 1; - ~ -!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - } - - class C3 extends C1 { - get a() { return super.a; } - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js deleted file mode 100644 index a2816090e4614..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).js +++ /dev/null @@ -1,26 +0,0 @@ -//// [accessorField6.ts] -class C1 { - accessor a: any; -} - -class C2 extends C1 { - a = 1; -} - -class C3 extends C1 { - get a() { return super.a; } -} - - -//// [accessorField6.js] -class C1 { - #a_accessor_storage; - get a() { return this.#a_accessor_storage; } - set a(value) { this.#a_accessor_storage = value; } -} -class C2 extends C1 { - a = 1; -} -class C3 extends C1 { - get a() { return super.a; } -} diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types deleted file mode 100644 index a6b9efded46a1..0000000000000 --- a/tests/baselines/reference/accessorField6(target=es2022,usedefineforclassfields=true).types +++ /dev/null @@ -1,28 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return super.a; } ->a : any ->super.a : any ->super : C1 ->a : any -} - diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt deleted file mode 100644 index 4a63914155538..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== - class C1 { - accessor a: any; - } - - class C2 extends C1 { - a = 1; - ~ -!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - } - - class C3 extends C1 { - get a() { return super.a; } - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js deleted file mode 100644 index e38b062084739..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).js +++ /dev/null @@ -1,26 +0,0 @@ -//// [accessorField6.ts] -class C1 { - accessor a: any; -} - -class C2 extends C1 { - a = 1; -} - -class C3 extends C1 { - get a() { return super.a; } -} - - -//// [accessorField6.js] -class C1 { -} -class C2 extends C1 { - constructor() { - super(...arguments); - this.a = 1; - } -} -class C3 extends C1 { - get a() { return super.a; } -} diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types deleted file mode 100644 index a6b9efded46a1..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=false).types +++ /dev/null @@ -1,28 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return super.a; } ->a : any ->super.a : any ->super : C1 ->a : any -} - diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt deleted file mode 100644 index 4a63914155538..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts (1 errors) ==== - class C1 { - accessor a: any; - } - - class C2 extends C1 { - a = 1; - ~ -!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property. - } - - class C3 extends C1 { - get a() { return super.a; } - } - \ No newline at end of file diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js deleted file mode 100644 index e6550dab6f237..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).js +++ /dev/null @@ -1,24 +0,0 @@ -//// [accessorField6.ts] -class C1 { - accessor a: any; -} - -class C2 extends C1 { - a = 1; -} - -class C3 extends C1 { - get a() { return super.a; } -} - - -//// [accessorField6.js] -class C1 { - accessor a; -} -class C2 extends C1 { - a = 1; -} -class C3 extends C1 { - get a() { return super.a; } -} diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols deleted file mode 100644 index 5b0d798ba80d5..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField6.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - a = 1; ->a : Symbol(C2.a, Decl(accessorField6.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField6.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField6.ts, 0, 0)) - - get a() { return super.a; } ->a : Symbol(C3.a, Decl(accessorField6.ts, 8, 21)) ->super.a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) ->super : Symbol(C1, Decl(accessorField6.ts, 0, 0)) ->a : Symbol(C1.a, Decl(accessorField6.ts, 0, 10)) -} - diff --git a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types deleted file mode 100644 index a6b9efded46a1..0000000000000 --- a/tests/baselines/reference/accessorField6(target=esnext,usedefineforclassfields=true).types +++ /dev/null @@ -1,28 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return super.a; } ->a : any ->super.a : any ->super : C1 ->a : any -} - diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js deleted file mode 100644 index 272f35f30706c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).js +++ /dev/null @@ -1,41 +0,0 @@ -//// [accessorField7.ts] -abstract class C1 { - abstract accessor a: any; -} - -class C2 extends C1 { - accessor a = 1; -} - -class C3 extends C1 { - get a() { return 1; } -} - - -//// [accessorField7.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var _C2_a_accessor_storage; -class C1 { -} -class C2 extends C1 { - constructor() { - super(...arguments); - _C2_a_accessor_storage.set(this, 1); - } - get a() { return __classPrivateFieldGet(this, _C2_a_accessor_storage, "f"); } - set a(value) { __classPrivateFieldSet(this, _C2_a_accessor_storage, value, "f"); } -} -_C2_a_accessor_storage = new WeakMap(); -class C3 extends C1 { - get a() { return 1; } -} diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types deleted file mode 100644 index a103af877051c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=false).types +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : C1 - - abstract accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - accessor a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return 1; } ->a : number ->1 : 1 -} - diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js deleted file mode 100644 index 272f35f30706c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).js +++ /dev/null @@ -1,41 +0,0 @@ -//// [accessorField7.ts] -abstract class C1 { - abstract accessor a: any; -} - -class C2 extends C1 { - accessor a = 1; -} - -class C3 extends C1 { - get a() { return 1; } -} - - -//// [accessorField7.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var _C2_a_accessor_storage; -class C1 { -} -class C2 extends C1 { - constructor() { - super(...arguments); - _C2_a_accessor_storage.set(this, 1); - } - get a() { return __classPrivateFieldGet(this, _C2_a_accessor_storage, "f"); } - set a(value) { __classPrivateFieldSet(this, _C2_a_accessor_storage, value, "f"); } -} -_C2_a_accessor_storage = new WeakMap(); -class C3 extends C1 { - get a() { return 1; } -} diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types deleted file mode 100644 index a103af877051c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2015,usedefineforclassfields=true).types +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : C1 - - abstract accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - accessor a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return 1; } ->a : number ->1 : 1 -} - diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js deleted file mode 100644 index ff282b347ece2..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).js +++ /dev/null @@ -1,29 +0,0 @@ -//// [accessorField7.ts] -abstract class C1 { - abstract accessor a: any; -} - -class C2 extends C1 { - accessor a = 1; -} - -class C3 extends C1 { - get a() { return 1; } -} - - -//// [accessorField7.js] -class C1 { -} -class C2 extends C1 { - constructor() { - super(...arguments); - this.#a_accessor_storage = 1; - } - #a_accessor_storage; - get a() { return this.#a_accessor_storage; } - set a(value) { this.#a_accessor_storage = value; } -} -class C3 extends C1 { - get a() { return 1; } -} diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types deleted file mode 100644 index a103af877051c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=false).types +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : C1 - - abstract accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - accessor a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return 1; } ->a : number ->1 : 1 -} - diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js deleted file mode 100644 index eb3c26be94053..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).js +++ /dev/null @@ -1,25 +0,0 @@ -//// [accessorField7.ts] -abstract class C1 { - abstract accessor a: any; -} - -class C2 extends C1 { - accessor a = 1; -} - -class C3 extends C1 { - get a() { return 1; } -} - - -//// [accessorField7.js] -class C1 { -} -class C2 extends C1 { - #a_accessor_storage = 1; - get a() { return this.#a_accessor_storage; } - set a(value) { this.#a_accessor_storage = value; } -} -class C3 extends C1 { - get a() { return 1; } -} diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types deleted file mode 100644 index a103af877051c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=es2022,usedefineforclassfields=true).types +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : C1 - - abstract accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - accessor a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return 1; } ->a : number ->1 : 1 -} - diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js deleted file mode 100644 index d84530fda0c48..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).js +++ /dev/null @@ -1,26 +0,0 @@ -//// [accessorField7.ts] -abstract class C1 { - abstract accessor a: any; -} - -class C2 extends C1 { - accessor a = 1; -} - -class C3 extends C1 { - get a() { return 1; } -} - - -//// [accessorField7.js] -class C1 { -} -class C2 extends C1 { - constructor() { - super(...arguments); - this.#a_1 = 1; - } -} -class C3 extends C1 { - get a() { return 1; } -} diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types deleted file mode 100644 index a103af877051c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=false).types +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : C1 - - abstract accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - accessor a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return 1; } ->a : number ->1 : 1 -} - diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js deleted file mode 100644 index 7951a92f92ba1..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).js +++ /dev/null @@ -1,23 +0,0 @@ -//// [accessorField7.ts] -abstract class C1 { - abstract accessor a: any; -} - -class C2 extends C1 { - accessor a = 1; -} - -class C3 extends C1 { - get a() { return 1; } -} - - -//// [accessorField7.js] -class C1 { -} -class C2 extends C1 { - accessor a = 1; -} -class C3 extends C1 { - get a() { return 1; } -} diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols deleted file mode 100644 index a0bed37bd9bb9..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).symbols +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - abstract accessor a: any; ->a : Symbol(C1.a, Decl(accessorField7.ts, 0, 19)) -} - -class C2 extends C1 { ->C2 : Symbol(C2, Decl(accessorField7.ts, 2, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - accessor a = 1; ->a : Symbol(C2.a, Decl(accessorField7.ts, 4, 21)) -} - -class C3 extends C1 { ->C3 : Symbol(C3, Decl(accessorField7.ts, 6, 1)) ->C1 : Symbol(C1, Decl(accessorField7.ts, 0, 0)) - - get a() { return 1; } ->a : Symbol(C3.a, Decl(accessorField7.ts, 8, 21)) -} - diff --git a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types b/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types deleted file mode 100644 index a103af877051c..0000000000000 --- a/tests/baselines/reference/accessorField7(target=esnext,usedefineforclassfields=true).types +++ /dev/null @@ -1,26 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts === -abstract class C1 { ->C1 : C1 - - abstract accessor a: any; ->a : any -} - -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - accessor a = 1; ->a : number ->1 : 1 -} - -class C3 extends C1 { ->C3 : C3 ->C1 : C1 - - get a() { return 1; } ->a : number ->1 : 1 -} - diff --git a/tests/baselines/reference/accessorField8.js b/tests/baselines/reference/accessorField8.js deleted file mode 100644 index b34d65f1f55e4..0000000000000 --- a/tests/baselines/reference/accessorField8.js +++ /dev/null @@ -1,49 +0,0 @@ -//// [accessorField8.ts] -class C1 { - accessor a: any; - static accessor b: any; -} - -declare class C2 { - accessor a: any; - static accessor b: any; -} - -function f() { - class C3 { - accessor a: any; - static accessor b: any; - } - return C3; -} - - -//// [accessorField8.js] -class C1 { - accessor a; - static accessor b; -} -function f() { - class C3 { - accessor a; - static accessor b; - } - return C3; -} - - -//// [accessorField8.d.ts] -declare class C1 { - accessor a: any; - static accessor b: any; -} -declare class C2 { - accessor a: any; - static accessor b: any; -} -declare function f(): { - new (): { - a: any; - }; - b: any; -}; diff --git a/tests/baselines/reference/accessorField8.symbols b/tests/baselines/reference/accessorField8.symbols deleted file mode 100644 index 77018c3b42ae5..0000000000000 --- a/tests/baselines/reference/accessorField8.symbols +++ /dev/null @@ -1,37 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts === -class C1 { ->C1 : Symbol(C1, Decl(accessorField8.ts, 0, 0)) - - accessor a: any; ->a : Symbol(C1.a, Decl(accessorField8.ts, 0, 10)) - - static accessor b: any; ->b : Symbol(C1.b, Decl(accessorField8.ts, 1, 20)) -} - -declare class C2 { ->C2 : Symbol(C2, Decl(accessorField8.ts, 3, 1)) - - accessor a: any; ->a : Symbol(C2.a, Decl(accessorField8.ts, 5, 18)) - - static accessor b: any; ->b : Symbol(C2.b, Decl(accessorField8.ts, 6, 20)) -} - -function f() { ->f : Symbol(f, Decl(accessorField8.ts, 8, 1)) - - class C3 { ->C3 : Symbol(C3, Decl(accessorField8.ts, 10, 14)) - - accessor a: any; ->a : Symbol(C3.a, Decl(accessorField8.ts, 11, 14)) - - static accessor b: any; ->b : Symbol(C3.b, Decl(accessorField8.ts, 12, 24)) - } - return C3; ->C3 : Symbol(C3, Decl(accessorField8.ts, 10, 14)) -} - diff --git a/tests/baselines/reference/accessorField8.types b/tests/baselines/reference/accessorField8.types deleted file mode 100644 index 040ad200d7865..0000000000000 --- a/tests/baselines/reference/accessorField8.types +++ /dev/null @@ -1,37 +0,0 @@ -=== tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts === -class C1 { ->C1 : C1 - - accessor a: any; ->a : any - - static accessor b: any; ->b : any -} - -declare class C2 { ->C2 : C2 - - accessor a: any; ->a : any - - static accessor b: any; ->b : any -} - -function f() { ->f : () => typeof C3 - - class C3 { ->C3 : C3 - - accessor a: any; ->a : any - - static accessor b: any; ->b : any - } - return C3; ->C3 : typeof C3 -} - diff --git a/tests/baselines/reference/accessorFieldAllowedModifiers.js b/tests/baselines/reference/accessorFieldAllowedModifiers.js deleted file mode 100644 index fb45e88068f84..0000000000000 --- a/tests/baselines/reference/accessorFieldAllowedModifiers.js +++ /dev/null @@ -1,49 +0,0 @@ -//// [accessorFieldAllowedModifiers.ts] -abstract class C1 { - accessor a: any; - public accessor b: any; - private accessor c: any; - protected accessor d: any; - abstract accessor e: any; - static accessor f: any; - public static accessor g: any; - private static accessor h: any; - protected static accessor i: any; - accessor #j: any; - accessor "k": any; - accessor 108: any; - accessor ["m"]: any; - accessor n!: number; -} - -class C2 extends C1 { - override accessor e: any; - static override accessor i: any; -} - -declare class C3 { - accessor a: any; -} - - - -//// [accessorFieldAllowedModifiers.js] -class C1 { - accessor a; - accessor b; - accessor c; - accessor d; - static accessor f; - static accessor g; - static accessor h; - static accessor i; - accessor #j; - accessor "k"; - accessor 108; - accessor ["m"]; - accessor n; -} -class C2 extends C1 { - accessor e; - static accessor i; -} diff --git a/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt b/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt deleted file mode 100644 index 0349a5292cab9..0000000000000 --- a/tests/baselines/reference/accessorFieldDisallowedModifiers.errors.txt +++ /dev/null @@ -1,124 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(2,14): error TS1030: 'accessor' modifier already seen. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(3,14): error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(4,13): error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(5,14): error TS1029: 'public' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(6,14): error TS1029: 'private' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(7,14): error TS1029: 'protected' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(8,14): error TS1029: 'abstract' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(9,14): error TS1029: 'static' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(10,5): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(11,5): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(12,5): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(13,5): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(14,15): error TS1276: An 'accessor' property cannot be declared optional. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(18,14): error TS1029: 'override' modifier must precede 'accessor' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(22,5): error TS1070: 'accessor' modifier cannot appear on a type member. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(25,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(26,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(27,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(28,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(29,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(30,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(31,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(32,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(33,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(33,25): error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(34,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(35,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts(36,1): error TS1275: 'accessor' modifier can only appear on a property declaration. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts (28 errors) ==== - abstract class C1 { - accessor accessor a: any; - ~~~~~~~~ -!!! error TS1030: 'accessor' modifier already seen. - readonly accessor b: any; - ~~~~~~~~ -!!! error TS1243: 'accessor' modifier cannot be used with 'readonly' modifier. - declare accessor c: any; - ~~~~~~~~ -!!! error TS1243: 'accessor' modifier cannot be used with 'declare' modifier. - accessor public d: any; - ~~~~~~ -!!! error TS1029: 'public' modifier must precede 'accessor' modifier. - accessor private e: any; - ~~~~~~~ -!!! error TS1029: 'private' modifier must precede 'accessor' modifier. - accessor protected f: any; - ~~~~~~~~~ -!!! error TS1029: 'protected' modifier must precede 'accessor' modifier. - accessor abstract g: any; - ~~~~~~~~ -!!! error TS1029: 'abstract' modifier must precede 'accessor' modifier. - accessor static h: any; - ~~~~~~ -!!! error TS1029: 'static' modifier must precede 'accessor' modifier. - accessor i() {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor get j() { return false; } - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor set k(v: any) {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor constructor() {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor l?: any; - ~ -!!! error TS1276: An 'accessor' property cannot be declared optional. - } - - class C2 extends C1 { - accessor override g: any; - ~~~~~~~~ -!!! error TS1029: 'override' modifier must precede 'accessor' modifier. - } - - interface I1 { - accessor a: number; - ~~~~~~~~ -!!! error TS1070: 'accessor' modifier cannot appear on a type member. - } - - accessor class C3 {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor interface I2 {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor namespace N1 {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor enum E1 {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor var V1: any; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor type T1 = never; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor function F1() {} - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor import "x"; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor import {} from "x"; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - ~~~ -!!! error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? - accessor export { V1 }; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor export default V1; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - accessor import N2 = N1; - ~~~~~~~~ -!!! error TS1275: 'accessor' modifier can only appear on a property declaration. - \ No newline at end of file diff --git a/tests/baselines/reference/accessorFieldDisallowedModifiers.js b/tests/baselines/reference/accessorFieldDisallowedModifiers.js deleted file mode 100644 index efc0082d637ad..0000000000000 --- a/tests/baselines/reference/accessorFieldDisallowedModifiers.js +++ /dev/null @@ -1,66 +0,0 @@ -//// [accessorFieldDisallowedModifiers.ts] -abstract class C1 { - accessor accessor a: any; - readonly accessor b: any; - declare accessor c: any; - accessor public d: any; - accessor private e: any; - accessor protected f: any; - accessor abstract g: any; - accessor static h: any; - accessor i() {} - accessor get j() { return false; } - accessor set k(v: any) {} - accessor constructor() {} - accessor l?: any; -} - -class C2 extends C1 { - accessor override g: any; -} - -interface I1 { - accessor a: number; -} - -accessor class C3 {} -accessor interface I2 {} -accessor namespace N1 {} -accessor enum E1 {} -accessor var V1: any; -accessor type T1 = never; -accessor function F1() {} -accessor import "x"; -accessor import {} from "x"; -accessor export { V1 }; -accessor export default V1; -accessor import N2 = N1; - - -//// [accessorFieldDisallowedModifiers.js] -class C1 { - accessor accessor a; - accessor b; - accessor d; - accessor e; - accessor f; - accessor static h; - accessor i() { } - accessor get j() { return false; } - accessor set k(v) { } - constructor() { } - accessor l; -} -class C2 extends C1 { - accessor g; -} -accessor class C3 { -} -accessor var E1; -(function (E1) { -})(E1 || (E1 = {})); -accessor var V1; -accessor function F1() { } -accessor import "x"; -export { V1 }; -export default V1; diff --git a/tests/baselines/reference/autoAccessor2(target=es2015).js b/tests/baselines/reference/autoAccessor2(target=es2015).js index 7b4cb28008e9e..2399dd2e5b502 100644 --- a/tests/baselines/reference/autoAccessor2(target=es2015).js +++ b/tests/baselines/reference/autoAccessor2(target=es2015).js @@ -1,20 +1,20 @@ //// [autoAccessor2.ts] -class C1 { - accessor #a: any; - accessor #b = 1; - static accessor #c: any; - static accessor #d = 2; - - constructor() { - this.#a = 3; - this.#b = 4; - } - - static { - this.#c = 5; - this.#d = 6; - } -} +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} //// [autoAccessor2.js] diff --git a/tests/baselines/reference/autoAccessor5(target=es2015).js b/tests/baselines/reference/autoAccessor5(target=es2015).js index a7394e4d18c8a..09a773c950eeb 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2015).js +++ b/tests/baselines/reference/autoAccessor5(target=es2015).js @@ -1,14 +1,14 @@ //// [autoAccessor5.ts] -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - accessor [f()] = 1; +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + accessor [f()] = 1; } //// [autoAccessor5.js] diff --git a/tests/baselines/reference/autoAccessor5(target=es2022).js b/tests/baselines/reference/autoAccessor5(target=es2022).js index f5022161cea00..51f3d6ded9305 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2022).js +++ b/tests/baselines/reference/autoAccessor5(target=es2022).js @@ -1,14 +1,14 @@ //// [autoAccessor5.ts] -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - accessor [f()] = 1; +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + accessor [f()] = 1; } //// [autoAccessor5.js] diff --git a/tests/baselines/reference/autoAccessor5(target=esnext).js b/tests/baselines/reference/autoAccessor5(target=esnext).js index d7620567c7b76..1d07c39a07f2c 100644 --- a/tests/baselines/reference/autoAccessor5(target=esnext).js +++ b/tests/baselines/reference/autoAccessor5(target=esnext).js @@ -1,14 +1,14 @@ //// [autoAccessor5.ts] -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - accessor [f()] = 1; +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + accessor [f()] = 1; } //// [autoAccessor5.js] diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts deleted file mode 100644 index 177db89c2eddb..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField1.ts +++ /dev/null @@ -1,9 +0,0 @@ -// @target: esnext, es2022, es2015, es5 -// @noEmitOnError: true - -class C1 { - accessor a: any; - accessor b = 1; - static accessor c: any; - static accessor d = 2; -} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts deleted file mode 100644 index 790702188cc35..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField2.ts +++ /dev/null @@ -1,18 +0,0 @@ -// @target: esnext, es2022, es2015 - -class C1 { - accessor #a: any; - accessor #b = 1; - static accessor #c: any; - static accessor #d = 2; - - constructor() { - this.#a = 3; - this.#b = 4; - } - - static { - this.#c = 5; - this.#d = 6; - } -} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts deleted file mode 100644 index 1c74a8be284c9..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField3.ts +++ /dev/null @@ -1,9 +0,0 @@ -// @target: esnext, es2022, es2015, es5 -// @noEmitOnError: true - -class C1 { - accessor "w": any; - accessor "x" = 1; - static accessor "y": any; - static accessor "z" = 2; -} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts deleted file mode 100644 index fcbf1e6f7bd58..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField4.ts +++ /dev/null @@ -1,9 +0,0 @@ -// @target: esnext, es2022, es2015, es5 -// @noEmitOnError: true - -class C1 { - accessor 0: any; - accessor 1 = 1; - static accessor 2: any; - static accessor 3 = 2; -} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts deleted file mode 100644 index 99e5cb140ef73..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField5.ts +++ /dev/null @@ -1,15 +0,0 @@ -// @target: esnext, es2022, es2015, es5 -// @noEmitOnError: true - -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - // @ts-ignore - accessor [f()] = 1; -} \ No newline at end of file diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts deleted file mode 100644 index aeb0c28609c25..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField6.ts +++ /dev/null @@ -1,14 +0,0 @@ -// @target: esnext, es2022, es2015 -// @useDefineForClassFields: * - -class C1 { - accessor a: any; -} - -class C2 extends C1 { - a = 1; -} - -class C3 extends C1 { - get a() { return super.a; } -} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts deleted file mode 100644 index 7993326180d10..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField7.ts +++ /dev/null @@ -1,14 +0,0 @@ -// @target: esnext, es2022, es2015 -// @useDefineForClassFields: * - -abstract class C1 { - abstract accessor a: any; -} - -class C2 extends C1 { - accessor a = 1; -} - -class C3 extends C1 { - get a() { return 1; } -} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts deleted file mode 100644 index 8e3a19e4d2b9d..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorField8.ts +++ /dev/null @@ -1,20 +0,0 @@ -// @target: esnext -// @declaration: true - -class C1 { - accessor a: any; - static accessor b: any; -} - -declare class C2 { - accessor a: any; - static accessor b: any; -} - -function f() { - class C3 { - accessor a: any; - static accessor b: any; - } - return C3; -} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts deleted file mode 100644 index 0c7bb3d1ad94f..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldAllowedModifiers.ts +++ /dev/null @@ -1,29 +0,0 @@ -// @target: esnext -// @noTypesAndSymbols: true - -abstract class C1 { - accessor a: any; - public accessor b: any; - private accessor c: any; - protected accessor d: any; - abstract accessor e: any; - static accessor f: any; - public static accessor g: any; - private static accessor h: any; - protected static accessor i: any; - accessor #j: any; - accessor "k": any; - accessor 108: any; - accessor ["m"]: any; - accessor n!: number; -} - -class C2 extends C1 { - override accessor e: any; - static override accessor i: any; -} - -declare class C3 { - accessor a: any; -} - diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts deleted file mode 100644 index 44e848c1d7ae9..0000000000000 --- a/tests/cases/conformance/classes/propertyMemberDeclarations/accessorFieldDisallowedModifiers.ts +++ /dev/null @@ -1,39 +0,0 @@ -// @target: esnext -// @noTypesAndSymbols: true - -abstract class C1 { - accessor accessor a: any; - readonly accessor b: any; - declare accessor c: any; - accessor public d: any; - accessor private e: any; - accessor protected f: any; - accessor abstract g: any; - accessor static h: any; - accessor i() {} - accessor get j() { return false; } - accessor set k(v: any) {} - accessor constructor() {} - accessor l?: any; -} - -class C2 extends C1 { - accessor override g: any; -} - -interface I1 { - accessor a: number; -} - -accessor class C3 {} -accessor interface I2 {} -accessor namespace N1 {} -accessor enum E1 {} -accessor var V1: any; -accessor type T1 = never; -accessor function F1() {} -accessor import "x"; -accessor import {} from "x"; -accessor export { V1 }; -accessor export default V1; -accessor import N2 = N1; From 96c93936ad8e897b1d71a0ecc8ea1cf2d0d827f3 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 24 Aug 2022 16:34:51 -0400 Subject: [PATCH 06/51] Thread 'experimentalDecorators' through some utility functions --- src/compiler/checker.ts | 10 ++- src/compiler/transformers/classFields.ts | 3 +- src/compiler/transformers/legacyDecorators.ts | 6 +- src/compiler/transformers/ts.ts | 5 +- src/compiler/utilities.ts | 77 +++++++++++-------- src/testRunner/unittests/transform.ts | 1 + .../privateNames/privateNamesAndDecorators.ts | 1 + 7 files changed, 63 insertions(+), 40 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1f4d1c93f003a..efa748ee20fb8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -357,6 +357,7 @@ namespace ts { const compilerOptions = host.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); const moduleKind = getEmitModuleKind(compilerOptions); + const legacyDecorators = !!compilerOptions.experimentalDecorators; const useDefineForClassFields = getUseDefineForClassFields(compilerOptions); const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions); const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks"); @@ -26026,7 +26027,7 @@ namespace ts { // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. if (declaration.kind === SyntaxKind.ClassDeclaration - && nodeIsDecorated(declaration as ClassDeclaration)) { + && nodeIsDecorated(legacyDecorators, declaration as ClassDeclaration)) { let container = getContainingClass(node); while (container !== undefined) { if (container === declaration && container.name !== node) { @@ -37335,7 +37336,7 @@ namespace ts { function checkDecorators(node: Node): void { // skip this check for nodes that cannot have decorators. These should have already had an error reported by // checkGrammarDecorators. - if (!canHaveDecorators(node) || !hasDecorators(node) || !node.modifiers || !nodeCanBeDecorated(node, node.parent, node.parent.parent)) { + if (!canHaveDecorators(node) || !hasDecorators(node) || !node.modifiers || !nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) { return; } @@ -44146,7 +44147,7 @@ namespace ts { if (!canHaveDecorators(node) || !hasDecorators(node)) { return false; } - if (!nodeCanBeDecorated(node, node.parent, node.parent.parent)) { + if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) { if (node.kind === SyntaxKind.MethodDeclaration && !nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } @@ -44154,7 +44155,7 @@ namespace ts { return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor) { + else if (legacyDecorators && (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor)) { const accessors = getAllAccessorDeclarations((node.parent as ClassDeclaration).members, node as AccessorDeclaration); if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -44518,6 +44519,7 @@ namespace ts { case SyntaxKind.ConstructorType: return nodeHasAnyModifiersExcept(node, SyntaxKind.AbstractKeyword); case SyntaxKind.ClassExpression: + return some(node.modifiers, isModifier); case SyntaxKind.InterfaceDeclaration: case SyntaxKind.VariableStatement: case SyntaxKind.TypeAliasDeclaration: diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 3ae7696d7c96e..2515353a9126d 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -142,6 +142,7 @@ namespace ts { const compilerOptions = context.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); const useDefineForClassFields = getUseDefineForClassFields(compilerOptions); + const legacyDecorators = !!compilerOptions.experimentalDecorators; // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. const shouldTransformInitializersUsingSet = !useDefineForClassFields; @@ -1111,7 +1112,7 @@ namespace ts { function getClassFacts(node: ClassLikeDeclaration) { let facts = ClassFacts.None; const original = getOriginalNode(node); - if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(original)) { + if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) { facts |= ClassFacts.ClassWasDecorated; } for (const member of node.members) { diff --git a/src/compiler/transformers/legacyDecorators.ts b/src/compiler/transformers/legacyDecorators.ts index fac91f5f6f584..0f96a52237336 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -66,7 +66,9 @@ namespace ts { } function visitClassDeclaration(node: ClassDeclaration): VisitResult { - if (!(classOrConstructorParameterIsDecorated(node) || childIsDecorated(node))) return visitEachChild(node, visitor, context); + if (!(classOrConstructorParameterIsDecorated(/*legacyDecorators*/ true, node) || childIsDecorated(/*legacyDecorators*/ true, node))) { + return visitEachChild(node, visitor, context); + } const statements = hasDecorators(node) ? transformClassDeclarationWithClassDecorators(node, node.name) : @@ -423,7 +425,7 @@ namespace ts { * @param member The class member. */ function isDecoratedClassElement(member: ClassElement, isStaticElement: boolean, parent: ClassLikeDeclaration) { - return nodeOrChildIsDecorated(member, parent) + return nodeOrChildIsDecorated(/*legacyDecorators*/ true, member, parent) && isStaticElement === isStatic(member); } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 0f2725559067b..210a815c43540 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -43,6 +43,7 @@ namespace ts { const compilerOptions = context.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); const moduleKind = getEmitModuleKind(compilerOptions); + const legacyDecorators = !!compilerOptions.experimentalDecorators; const typeSerializer = compilerOptions.emitDecoratorMetadata ? createRuntimeTypeSerializer(context) : undefined; // Save the previous transformation hooks. @@ -598,8 +599,8 @@ namespace ts { if (some(staticProperties)) facts |= ClassFacts.HasStaticInitializedProperties; const extendsClauseElement = getEffectiveBaseTypeNode(node); if (extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== SyntaxKind.NullKeyword) facts |= ClassFacts.IsDerivedClass; - if (classOrConstructorParameterIsDecorated(node)) facts |= ClassFacts.HasConstructorDecorators; - if (childIsDecorated(node)) facts |= ClassFacts.HasMemberDecorators; + if (classOrConstructorParameterIsDecorated(legacyDecorators, node)) facts |= ClassFacts.HasConstructorDecorators; + if (childIsDecorated(legacyDecorators, node)) facts |= ClassFacts.HasMemberDecorators; if (isExportOfNamespace(node)) facts |= ClassFacts.IsExportOfNamespace; else if (isDefaultExternalModuleExport(node)) facts |= ClassFacts.IsDefaultExternalExport; else if (isNamedExternalModuleExport(node)) facts |= ClassFacts.IsNamedExternalExport; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 792c7d1f5cb3c..edb92a867963f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1901,76 +1901,91 @@ namespace ts { } } - export function nodeCanBeDecorated(node: ClassDeclaration): true; - export function nodeCanBeDecorated(node: ClassElement, parent: Node): boolean; - export function nodeCanBeDecorated(node: Node, parent: Node, grandparent: Node): boolean; - export function nodeCanBeDecorated(node: Node, parent?: Node, grandparent?: Node): boolean { + export function nodeCanBeDecorated(useLegacyDecorators: boolean, node: ClassDeclaration): true; + export function nodeCanBeDecorated(useLegacyDecorators: boolean, node: ClassExpression): boolean; + export function nodeCanBeDecorated(useLegacyDecorators: boolean, node: ClassElement, parent: Node): boolean; + export function nodeCanBeDecorated(useLegacyDecorators: boolean, node: Node, parent: Node, grandparent: Node): boolean; + export function nodeCanBeDecorated(useLegacyDecorators: boolean, node: Node, parent?: Node, grandparent?: Node): boolean { // private names cannot be used with decorators yet - if (isNamedDeclaration(node) && isPrivateIdentifier(node.name)) { + if (useLegacyDecorators && isNamedDeclaration(node) && isPrivateIdentifier(node.name)) { return false; } + switch (node.kind) { case SyntaxKind.ClassDeclaration: - // classes are valid targets + // class declarations are valid targets return true; + case SyntaxKind.ClassExpression: + // class expressions are valid targets for native decorators + return !useLegacyDecorators; + case SyntaxKind.PropertyDeclaration: // property declarations are valid if their parent is a class declaration. - return parent!.kind === SyntaxKind.ClassDeclaration; + return parent !== undefined + && (useLegacyDecorators ? isClassDeclaration(parent) : isClassLike(parent)); case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.MethodDeclaration: // if this method has a body and its parent is a class declaration, this is a valid target. return (node as FunctionLikeDeclaration).body !== undefined - && parent!.kind === SyntaxKind.ClassDeclaration; + && parent !== undefined + && (useLegacyDecorators ? isClassDeclaration(parent) : isClassLike(parent)); case SyntaxKind.Parameter: - // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; + // TODO(rbuckton): Is there a way to support parameter decorators or should we wait until it is standardized? + if (!useLegacyDecorators) return false; + // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target. return (parent as FunctionLikeDeclaration).body !== undefined - && (parent!.kind === SyntaxKind.Constructor - || parent!.kind === SyntaxKind.MethodDeclaration - || parent!.kind === SyntaxKind.SetAccessor) - && grandparent!.kind === SyntaxKind.ClassDeclaration; + && parent !== undefined + && (parent.kind === SyntaxKind.Constructor + || parent.kind === SyntaxKind.MethodDeclaration + || parent.kind === SyntaxKind.SetAccessor) + && grandparent !== undefined + && grandparent.kind === SyntaxKind.ClassDeclaration; } return false; } - export function nodeIsDecorated(node: ClassDeclaration): boolean; - export function nodeIsDecorated(node: ClassElement, parent: Node): boolean; - export function nodeIsDecorated(node: Node, parent: Node, grandparent: Node): boolean; - export function nodeIsDecorated(node: Node, parent?: Node, grandparent?: Node): boolean { + export function nodeIsDecorated(useLegacyDecorators: boolean, node: ClassDeclaration | ClassExpression): boolean; + export function nodeIsDecorated(useLegacyDecorators: boolean, node: ClassElement, parent: Node): boolean; + export function nodeIsDecorated(useLegacyDecorators: boolean, node: Node, parent: Node, grandparent: Node): boolean; + export function nodeIsDecorated(useLegacyDecorators: boolean, node: Node, parent?: Node, grandparent?: Node): boolean { return hasDecorators(node) - && nodeCanBeDecorated(node, parent!, grandparent!); // TODO: GH#18217 + && nodeCanBeDecorated(useLegacyDecorators, node, parent!, grandparent!); } - export function nodeOrChildIsDecorated(node: ClassDeclaration): boolean; - export function nodeOrChildIsDecorated(node: ClassElement, parent: Node): boolean; - export function nodeOrChildIsDecorated(node: Node, parent: Node, grandparent: Node): boolean; - export function nodeOrChildIsDecorated(node: Node, parent?: Node, grandparent?: Node): boolean { - return nodeIsDecorated(node, parent!, grandparent!) || childIsDecorated(node, parent!); // TODO: GH#18217 + export function nodeOrChildIsDecorated(useLegacyDecorators: boolean, node: ClassDeclaration | ClassExpression): boolean; + export function nodeOrChildIsDecorated(useLegacyDecorators: boolean, node: ClassElement, parent: Node): boolean; + export function nodeOrChildIsDecorated(useLegacyDecorators: boolean, node: Node, parent: Node, grandparent: Node): boolean; + export function nodeOrChildIsDecorated(useLegacyDecorators: boolean, node: Node, parent?: Node, grandparent?: Node): boolean { + return nodeIsDecorated(useLegacyDecorators, node, parent!, grandparent!) + || childIsDecorated(useLegacyDecorators, node, parent!); } - export function childIsDecorated(node: ClassDeclaration): boolean; - export function childIsDecorated(node: Node, parent: Node): boolean; - export function childIsDecorated(node: Node, parent?: Node): boolean { + export function childIsDecorated(useLegacyDecorators: boolean, node: ClassDeclaration | ClassExpression): boolean; + export function childIsDecorated(useLegacyDecorators: boolean, node: Node, parent: Node): boolean; + export function childIsDecorated(useLegacyDecorators: boolean, node: Node, parent?: Node): boolean { switch (node.kind) { case SyntaxKind.ClassDeclaration: - return some((node as ClassDeclaration).members, m => nodeOrChildIsDecorated(m, node, parent!)); // TODO: GH#18217 + return some((node as ClassDeclaration).members, m => nodeOrChildIsDecorated(useLegacyDecorators, m, node, parent!)); + case SyntaxKind.ClassExpression: + return !useLegacyDecorators && some((node as ClassExpression).members, m => nodeOrChildIsDecorated(useLegacyDecorators, m, node, parent!)); case SyntaxKind.MethodDeclaration: case SyntaxKind.SetAccessor: case SyntaxKind.Constructor: - return some((node as FunctionLikeDeclaration).parameters, p => nodeIsDecorated(p, node, parent!)); // TODO: GH#18217 + return some((node as FunctionLikeDeclaration).parameters, p => nodeIsDecorated(useLegacyDecorators, p, node, parent!)); default: return false; } } - export function classOrConstructorParameterIsDecorated(node: ClassDeclaration): boolean { - if (nodeIsDecorated(node)) return true; + export function classOrConstructorParameterIsDecorated(useLegacyDecorators: boolean, node: ClassDeclaration | ClassExpression): boolean { + if (nodeIsDecorated(useLegacyDecorators, node)) return true; const constructor = getFirstConstructorWithBody(node); - return !!constructor && childIsDecorated(constructor, node); + return !!constructor && childIsDecorated(useLegacyDecorators, constructor, node); } export function isJSXTagName(node: Node) { diff --git a/src/testRunner/unittests/transform.ts b/src/testRunner/unittests/transform.ts index dadf9ecd6ae71..b6dd2ee5befe8 100644 --- a/src/testRunner/unittests/transform.ts +++ b/src/testRunner/unittests/transform.ts @@ -367,6 +367,7 @@ namespace ts { compilerOptions: { target: ScriptTarget.ES5, newLine: NewLineKind.CarriageReturnLineFeed, + experimentalDecorators: true, } }).outputText; diff --git a/tests/cases/conformance/classes/members/privateNames/privateNamesAndDecorators.ts b/tests/cases/conformance/classes/members/privateNames/privateNamesAndDecorators.ts index d82e05ef9735e..174be446b472c 100644 --- a/tests/cases/conformance/classes/members/privateNames/privateNamesAndDecorators.ts +++ b/tests/cases/conformance/classes/members/privateNames/privateNamesAndDecorators.ts @@ -1,3 +1,4 @@ +// @experimentalDecorators: true declare function dec(target: T): T; class A { From fdfb49c9652af520095c4bcde4a910d25a601700 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 24 Aug 2022 22:04:34 -0400 Subject: [PATCH 07/51] Split out decorators types from the default lib --- src/compiler/commandLineParser.ts | 5 +- src/harness/fourslashInterfaceImpl.ts | 12 + src/lib/decorators.d.ts | 247 ++++++++++++++++++ src/lib/decorators.legacy.d.ts | 4 + src/lib/decorators.parameters.d.ts | 14 + src/lib/es5.d.ts | 8 +- src/lib/libs.json | 3 + ...aintOfJavascriptClassExpression.errors.txt | 2 +- ...oratedDefaultExportsGetExportedAmd.symbols | 4 +- ...dDefaultExportsGetExportedCommonjs.symbols | 4 +- ...tedDefaultExportsGetExportedSystem.symbols | 4 +- ...oratedDefaultExportsGetExportedUmd.symbols | 4 +- .../decoratorMetadataConditionalType.symbols | 2 +- .../decoratorMetadataPromise.symbols | 2 +- ...adataRestParameterWithImportedType.symbols | 4 +- .../destructureOptionalParameter.symbols | 2 +- ...tructuringParameterDeclaration4.errors.txt | 2 +- .../reference/destructuringTuple.errors.txt | 4 +- .../duplicateNumericIndexers.errors.txt | 4 +- .../emitDecoratorMetadata_object.symbols | 4 +- .../emitDecoratorMetadata_restArgs.symbols | 4 +- ...errorMessageOnObjectLiteralType.errors.txt | 2 +- .../reference/externModule.errors.txt | 8 +- .../reference/invalidTypeOfTarget.errors.txt | 2 +- ...ithAsClauseAndLateBoundProperty.errors.txt | 2 +- .../metadataOfClassFromAlias.symbols | 2 +- .../metadataOfClassFromAlias2.symbols | 2 +- ...wExceptionVariableInCatchClause.errors.txt | 2 +- .../narrowFromAnyWithInstanceof.errors.txt | 4 +- .../narrowFromAnyWithTypePredicate.errors.txt | 4 +- ...peHidingMembersOfExtendedObject.errors.txt | 14 +- ...tringIndexerHidingObjectIndexer.errors.txt | 14 +- ...erAccessAfterPostfixExpression1.errors.txt | 2 +- ...gularExpressionDivideAmbiguity1.errors.txt | 2 +- ...gularExpressionDivideAmbiguity2.errors.txt | 2 +- .../reference/parserS7.2_A1.5_T2.errors.txt | 4 +- .../reference/parserS7.3_A1.1_T2.errors.txt | 2 +- .../reference/parserS7.6_A4.2_T1.errors.txt | 20 +- .../reference/parserUnicode1.errors.txt | 4 +- .../potentiallyUncalledDecorators.symbols | 8 +- .../project/baseline/amd/baseline.json | 2 + .../project/baseline/node/baseline.json | 2 + .../project/baseline2/amd/baseline2.json | 2 + .../project/baseline2/node/baseline2.json | 2 + .../project/baseline3/amd/baseline3.json | 2 + .../project/baseline3/node/baseline3.json | 2 + .../amd/cantFindTheModule.json | 2 + .../node/cantFindTheModule.json | 2 + .../amd/circularReferencing.json | 2 + .../node/circularReferencing.json | 2 + .../amd/circularReferencing2.json | 2 + .../node/circularReferencing2.json | 2 + .../declarationDir/amd/declarationDir.json | 2 + .../declarationDir/node/declarationDir.json | 2 + .../declarationDir2/amd/declarationDir2.json | 2 + .../declarationDir2/node/declarationDir2.json | 2 + .../declarationDir3/amd/declarationDir3.json | 2 + .../declarationDir3/node/declarationDir3.json | 2 + .../amd/declarationsCascadingImports.json | 2 + .../node/declarationsCascadingImports.json | 2 + .../amd/declarationsExportNamespace.json | 2 + .../node/declarationsExportNamespace.json | 2 + .../amd/declarationsGlobalImport.json | 2 + .../node/declarationsGlobalImport.json | 2 + .../amd/declarationsImportedInPrivate.json | 2 + .../node/declarationsImportedInPrivate.json | 2 + .../declarationsImportedUseInFunction.json | 2 + .../declarationsImportedUseInFunction.json | 2 + ...ionsIndirectImportShouldResultInError.json | 2 + ...ionsIndirectImportShouldResultInError.json | 2 + .../amd/declarationsMultipleTimesImport.json | 2 + .../node/declarationsMultipleTimesImport.json | 2 + ...clarationsMultipleTimesMultipleImport.json | 2 + ...clarationsMultipleTimesMultipleImport.json | 2 + .../amd/declarationsSimpleImport.json | 2 + .../node/declarationsSimpleImport.json | 2 + .../amd/declareExportAdded.json | 2 + .../node/declareExportAdded.json | 2 + .../amd/declareVariableCollision.json | 2 + .../node/declareVariableCollision.json | 2 + .../defaultExcludeNodeModulesAndOutDir.json | 2 + .../defaultExcludeNodeModulesAndOutDir.json | 2 + ...xcludeNodeModulesAndOutDirWithAllowJS.json | 2 + ...xcludeNodeModulesAndOutDirWithAllowJS.json | 2 + ...cludeNodeModulesAndRelativePathOutDir.json | 2 + ...cludeNodeModulesAndRelativePathOutDir.json | 2 + ...dulesAndRelativePathOutDirWithAllowJS.json | 2 + ...dulesAndRelativePathOutDirWithAllowJS.json | 2 + .../amd/defaultExcludeOnlyNodeModules.json | 2 + .../node/defaultExcludeOnlyNodeModules.json | 2 + ...oratorMetadataCommonJSISolatedModules.json | 2 + ...oratorMetadataCommonJSISolatedModules.json | 2 + ...adataCommonJSISolatedModulesNoResolve.json | 2 + ...adataCommonJSISolatedModulesNoResolve.json | 2 + .../amd/emitDecoratorMetadataSystemJS.json | 2 + .../node/emitDecoratorMetadataSystemJS.json | 2 + ...oratorMetadataSystemJSISolatedModules.json | 2 + ...oratorMetadataSystemJSISolatedModules.json | 2 + ...adataSystemJSISolatedModulesNoResolve.json | 2 + ...adataSystemJSISolatedModulesNoResolve.json | 2 + .../amd/extReferencingExtAndInt.json | 2 + .../node/extReferencingExtAndInt.json | 2 + .../amd/intReferencingExtAndInt.json | 2 + .../node/intReferencingExtAndInt.json | 2 + .../invalidRootFile/amd/invalidRootFile.json | 4 +- .../invalidRootFile/node/invalidRootFile.json | 4 +- ...CompilationDifferentNamesNotSpecified.json | 2 + ...CompilationDifferentNamesNotSpecified.json | 2 + ...DifferentNamesNotSpecifiedWithAllowJs.json | 2 + ...DifferentNamesNotSpecifiedWithAllowJs.json | 2 + ...ileCompilationDifferentNamesSpecified.json | 2 + ...ileCompilationDifferentNamesSpecified.json | 2 + ...ionDifferentNamesSpecifiedWithAllowJs.json | 2 + ...ionDifferentNamesSpecifiedWithAllowJs.json | 2 + ...jsFileCompilationSameNameDTsSpecified.json | 2 + ...jsFileCompilationSameNameDTsSpecified.json | 2 + ...lationSameNameDTsSpecifiedWithAllowJs.json | 2 + ...lationSameNameDTsSpecifiedWithAllowJs.json | 2 + ...ileCompilationSameNameDtsNotSpecified.json | 2 + ...ileCompilationSameNameDtsNotSpecified.json | 2 + ...ionSameNameDtsNotSpecifiedWithAllowJs.json | 2 + ...ionSameNameDtsNotSpecifiedWithAllowJs.json | 2 + ...eCompilationSameNameFilesNotSpecified.json | 2 + ...eCompilationSameNameFilesNotSpecified.json | 2 + ...nSameNameFilesNotSpecifiedWithAllowJs.json | 2 + ...nSameNameFilesNotSpecifiedWithAllowJs.json | 2 + ...FileCompilationSameNameFilesSpecified.json | 2 + ...FileCompilationSameNameFilesSpecified.json | 2 + ...tionSameNameFilesSpecifiedWithAllowJs.json | 2 + ...tionSameNameFilesSpecifiedWithAllowJs.json | 2 + ...ootAbsolutePathMixedSubfolderNoOutdir.json | 2 + ...ootAbsolutePathMixedSubfolderNoOutdir.json | 2 + ...hMixedSubfolderSpecifyOutputDirectory.json | 2 + ...hMixedSubfolderSpecifyOutputDirectory.json | 2 + ...tePathMixedSubfolderSpecifyOutputFile.json | 2 + ...tePathMixedSubfolderSpecifyOutputFile.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...AbsolutePathModuleMultifolderNoOutdir.json | 2 + ...AbsolutePathModuleMultifolderNoOutdir.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...athModuleMultifolderSpecifyOutputFile.json | 2 + ...athModuleMultifolderSpecifyOutputFile.json | 2 + ...pRootAbsolutePathModuleSimpleNoOutdir.json | 2 + ...pRootAbsolutePathModuleSimpleNoOutdir.json | 2 + ...athModuleSimpleSpecifyOutputDirectory.json | 2 + ...athModuleSimpleSpecifyOutputDirectory.json | 2 + ...lutePathModuleSimpleSpecifyOutputFile.json | 2 + ...lutePathModuleSimpleSpecifyOutputFile.json | 2 + ...otAbsolutePathModuleSubfolderNoOutdir.json | 2 + ...otAbsolutePathModuleSubfolderNoOutdir.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ePathModuleSubfolderSpecifyOutputFile.json | 2 + ...ePathModuleSubfolderSpecifyOutputFile.json | 2 + ...apRootAbsolutePathMultifolderNoOutdir.json | 2 + ...apRootAbsolutePathMultifolderNoOutdir.json | 2 + ...PathMultifolderSpecifyOutputDirectory.json | 2 + ...PathMultifolderSpecifyOutputDirectory.json | 2 + ...olutePathMultifolderSpecifyOutputFile.json | 2 + ...olutePathMultifolderSpecifyOutputFile.json | 2 + .../mapRootAbsolutePathSimpleNoOutdir.json | 2 + .../mapRootAbsolutePathSimpleNoOutdir.json | 2 + ...olutePathSimpleSpecifyOutputDirectory.json | 2 + ...olutePathSimpleSpecifyOutputDirectory.json | 2 + ...otAbsolutePathSimpleSpecifyOutputFile.json | 2 + ...otAbsolutePathSimpleSpecifyOutputFile.json | 2 + ...mapRootAbsolutePathSingleFileNoOutdir.json | 2 + ...mapRootAbsolutePathSingleFileNoOutdir.json | 2 + ...ePathSingleFileSpecifyOutputDirectory.json | 2 + ...ePathSingleFileSpecifyOutputDirectory.json | 2 + ...solutePathSingleFileSpecifyOutputFile.json | 2 + ...solutePathSingleFileSpecifyOutputFile.json | 2 + .../mapRootAbsolutePathSubfolderNoOutdir.json | 2 + .../mapRootAbsolutePathSubfolderNoOutdir.json | 2 + ...tePathSubfolderSpecifyOutputDirectory.json | 2 + ...tePathSubfolderSpecifyOutputDirectory.json | 2 + ...bsolutePathSubfolderSpecifyOutputFile.json | 2 + ...bsolutePathSubfolderSpecifyOutputFile.json | 2 + ...ootRelativePathMixedSubfolderNoOutdir.json | 2 + ...ootRelativePathMixedSubfolderNoOutdir.json | 2 + ...hMixedSubfolderSpecifyOutputDirectory.json | 2 + ...hMixedSubfolderSpecifyOutputDirectory.json | 2 + ...vePathMixedSubfolderSpecifyOutputFile.json | 2 + ...vePathMixedSubfolderSpecifyOutputFile.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...RelativePathModuleMultifolderNoOutdir.json | 2 + ...RelativePathModuleMultifolderNoOutdir.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...athModuleMultifolderSpecifyOutputFile.json | 2 + ...athModuleMultifolderSpecifyOutputFile.json | 2 + ...pRootRelativePathModuleSimpleNoOutdir.json | 2 + ...pRootRelativePathModuleSimpleNoOutdir.json | 2 + ...athModuleSimpleSpecifyOutputDirectory.json | 2 + ...athModuleSimpleSpecifyOutputDirectory.json | 2 + ...tivePathModuleSimpleSpecifyOutputFile.json | 2 + ...tivePathModuleSimpleSpecifyOutputFile.json | 2 + ...otRelativePathModuleSubfolderNoOutdir.json | 2 + ...otRelativePathModuleSubfolderNoOutdir.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ePathModuleSubfolderSpecifyOutputFile.json | 2 + ...ePathModuleSubfolderSpecifyOutputFile.json | 2 + ...apRootRelativePathMultifolderNoOutdir.json | 2 + ...apRootRelativePathMultifolderNoOutdir.json | 2 + ...PathMultifolderSpecifyOutputDirectory.json | 2 + ...PathMultifolderSpecifyOutputDirectory.json | 2 + ...ativePathMultifolderSpecifyOutputFile.json | 2 + ...ativePathMultifolderSpecifyOutputFile.json | 2 + .../mapRootRelativePathSimpleNoOutdir.json | 2 + .../mapRootRelativePathSimpleNoOutdir.json | 2 + ...ativePathSimpleSpecifyOutputDirectory.json | 2 + ...ativePathSimpleSpecifyOutputDirectory.json | 2 + ...otRelativePathSimpleSpecifyOutputFile.json | 2 + ...otRelativePathSimpleSpecifyOutputFile.json | 2 + ...mapRootRelativePathSingleFileNoOutdir.json | 2 + ...mapRootRelativePathSingleFileNoOutdir.json | 2 + ...ePathSingleFileSpecifyOutputDirectory.json | 2 + ...ePathSingleFileSpecifyOutputDirectory.json | 2 + ...lativePathSingleFileSpecifyOutputFile.json | 2 + ...lativePathSingleFileSpecifyOutputFile.json | 2 + .../mapRootRelativePathSubfolderNoOutdir.json | 2 + .../mapRootRelativePathSubfolderNoOutdir.json | 2 + ...vePathSubfolderSpecifyOutputDirectory.json | 2 + ...vePathSubfolderSpecifyOutputDirectory.json | 2 + ...elativePathSubfolderSpecifyOutputFile.json | 2 + ...elativePathSubfolderSpecifyOutputFile.json | 2 + ...apRootSourceRootWithNoSourceMapOption.json | 2 + ...apRootSourceRootWithNoSourceMapOption.json | 2 + .../amd/mapRootWithNoSourceMapOption.json | 2 + .../node/mapRootWithNoSourceMapOption.json | 2 + .../amd/maprootUrlMixedSubfolderNoOutdir.json | 2 + .../maprootUrlMixedSubfolderNoOutdir.json | 2 + ...lMixedSubfolderSpecifyOutputDirectory.json | 2 + ...lMixedSubfolderSpecifyOutputDirectory.json | 2 + ...ootUrlMixedSubfolderSpecifyOutputFile.json | 2 + ...ootUrlMixedSubfolderSpecifyOutputFile.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + .../maprootUrlModuleMultifolderNoOutdir.json | 2 + .../maprootUrlModuleMultifolderNoOutdir.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...UrlModuleMultifolderSpecifyOutputFile.json | 2 + ...UrlModuleMultifolderSpecifyOutputFile.json | 2 + .../amd/maprootUrlModuleSimpleNoOutdir.json | 2 + .../node/maprootUrlModuleSimpleNoOutdir.json | 2 + ...UrlModuleSimpleSpecifyOutputDirectory.json | 2 + ...UrlModuleSimpleSpecifyOutputDirectory.json | 2 + ...prootUrlModuleSimpleSpecifyOutputFile.json | 2 + ...prootUrlModuleSimpleSpecifyOutputFile.json | 2 + .../maprootUrlModuleSubfolderNoOutdir.json | 2 + .../maprootUrlModuleSubfolderNoOutdir.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...otUrlModuleSubfolderSpecifyOutputFile.json | 2 + ...otUrlModuleSubfolderSpecifyOutputFile.json | 2 + .../amd/maprootUrlMultifolderNoOutdir.json | 2 + .../node/maprootUrlMultifolderNoOutdir.json | 2 + ...tUrlMultifolderSpecifyOutputDirectory.json | 2 + ...tUrlMultifolderSpecifyOutputDirectory.json | 2 + ...aprootUrlMultifolderSpecifyOutputFile.json | 2 + ...aprootUrlMultifolderSpecifyOutputFile.json | 2 + .../amd/maprootUrlSimpleNoOutdir.json | 2 + .../node/maprootUrlSimpleNoOutdir.json | 2 + ...aprootUrlSimpleSpecifyOutputDirectory.json | 2 + ...aprootUrlSimpleSpecifyOutputDirectory.json | 2 + .../maprootUrlSimpleSpecifyOutputFile.json | 2 + .../maprootUrlSimpleSpecifyOutputFile.json | 2 + .../amd/maprootUrlSingleFileNoOutdir.json | 2 + .../node/maprootUrlSingleFileNoOutdir.json | 2 + ...otUrlSingleFileSpecifyOutputDirectory.json | 2 + ...otUrlSingleFileSpecifyOutputDirectory.json | 2 + ...maprootUrlSingleFileSpecifyOutputFile.json | 2 + ...maprootUrlSingleFileSpecifyOutputFile.json | 2 + .../amd/maprootUrlSubfolderNoOutdir.json | 2 + .../node/maprootUrlSubfolderNoOutdir.json | 2 + ...ootUrlSubfolderSpecifyOutputDirectory.json | 2 + ...ootUrlSubfolderSpecifyOutputDirectory.json | 2 + .../maprootUrlSubfolderSpecifyOutputFile.json | 2 + .../maprootUrlSubfolderSpecifyOutputFile.json | 2 + ...rlsourcerootUrlMixedSubfolderNoOutdir.json | 2 + ...rlsourcerootUrlMixedSubfolderNoOutdir.json | 2 + ...lMixedSubfolderSpecifyOutputDirectory.json | 2 + ...lMixedSubfolderSpecifyOutputDirectory.json | 2 + ...ootUrlMixedSubfolderSpecifyOutputFile.json | 2 + ...ootUrlMixedSubfolderSpecifyOutputFile.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...ourcerootUrlModuleMultifolderNoOutdir.json | 2 + ...ourcerootUrlModuleMultifolderNoOutdir.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...UrlModuleMultifolderSpecifyOutputFile.json | 2 + ...UrlModuleMultifolderSpecifyOutputFile.json | 2 + ...tUrlsourcerootUrlModuleSimpleNoOutdir.json | 2 + ...tUrlsourcerootUrlModuleSimpleNoOutdir.json | 2 + ...UrlModuleSimpleSpecifyOutputDirectory.json | 2 + ...UrlModuleSimpleSpecifyOutputDirectory.json | 2 + ...erootUrlModuleSimpleSpecifyOutputFile.json | 2 + ...erootUrlModuleSimpleSpecifyOutputFile.json | 2 + ...lsourcerootUrlModuleSubfolderNoOutdir.json | 2 + ...lsourcerootUrlModuleSubfolderNoOutdir.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...otUrlModuleSubfolderSpecifyOutputFile.json | 2 + ...otUrlModuleSubfolderSpecifyOutputFile.json | 2 + ...otUrlsourcerootUrlMultifolderNoOutdir.json | 2 + ...otUrlsourcerootUrlMultifolderNoOutdir.json | 2 + ...tUrlMultifolderSpecifyOutputDirectory.json | 2 + ...tUrlMultifolderSpecifyOutputDirectory.json | 2 + ...cerootUrlMultifolderSpecifyOutputFile.json | 2 + ...cerootUrlMultifolderSpecifyOutputFile.json | 2 + ...maprootUrlsourcerootUrlSimpleNoOutdir.json | 2 + ...maprootUrlsourcerootUrlSimpleNoOutdir.json | 2 + ...cerootUrlSimpleSpecifyOutputDirectory.json | 2 + ...cerootUrlSimpleSpecifyOutputDirectory.json | 2 + ...lsourcerootUrlSimpleSpecifyOutputFile.json | 2 + ...lsourcerootUrlSimpleSpecifyOutputFile.json | 2 + ...ootUrlsourcerootUrlSingleFileNoOutdir.json | 2 + ...ootUrlsourcerootUrlSingleFileNoOutdir.json | 2 + ...otUrlSingleFileSpecifyOutputDirectory.json | 2 + ...otUrlSingleFileSpecifyOutputDirectory.json | 2 + ...rcerootUrlSingleFileSpecifyOutputFile.json | 2 + ...rcerootUrlSingleFileSpecifyOutputFile.json | 2 + ...rootUrlsourcerootUrlSubfolderNoOutdir.json | 2 + ...rootUrlsourcerootUrlSubfolderNoOutdir.json | 2 + ...ootUrlSubfolderSpecifyOutputDirectory.json | 2 + ...ootUrlSubfolderSpecifyOutputDirectory.json | 2 + ...urcerootUrlSubfolderSpecifyOutputFile.json | 2 + ...urcerootUrlSubfolderSpecifyOutputFile.json | 2 + .../amd/moduleIdentifier.json | 2 + .../node/moduleIdentifier.json | 2 + .../amd/moduleMergingOrdering1.json | 2 + .../node/moduleMergingOrdering1.json | 2 + .../amd/moduleMergingOrdering2.json | 2 + .../node/moduleMergingOrdering2.json | 2 + .../amd/multipleLevelsModuleResolution.json | 2 + .../node/multipleLevelsModuleResolution.json | 2 + .../nestedDeclare/amd/nestedDeclare.json | 2 + .../nestedDeclare/node/nestedDeclare.json | 2 + .../amd/nestedLocalModuleSimpleCase.json | 2 + .../node/nestedLocalModuleSimpleCase.json | 2 + ...stedLocalModuleWithRecursiveTypecheck.json | 2 + ...stedLocalModuleWithRecursiveTypecheck.json | 2 + .../amd/nestedReferenceTags.json | 2 + .../node/nestedReferenceTags.json | 2 + .../amd/noProjectOptionAndInputFiles.json | 2 + .../node/noProjectOptionAndInputFiles.json | 2 + .../amd/nodeModulesImportHigher.json | 2 + .../node/nodeModulesImportHigher.json | 2 + .../amd/nodeModulesMaxDepthExceeded.json | 2 + .../node/nodeModulesMaxDepthExceeded.json | 2 + .../amd/nodeModulesMaxDepthIncreased.json | 2 + .../node/nodeModulesMaxDepthIncreased.json | 2 + .../project/nonRelative/amd/nonRelative.json | 2 + .../project/nonRelative/node/nonRelative.json | 2 + .../amd/outMixedSubfolderNoOutdir.json | 2 + .../node/outMixedSubfolderNoOutdir.json | 2 + ...tMixedSubfolderSpecifyOutputDirectory.json | 2 + ...tMixedSubfolderSpecifyOutputDirectory.json | 2 + .../outMixedSubfolderSpecifyOutputFile.json | 2 + .../outMixedSubfolderSpecifyOutputFile.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + .../amd/outModuleMultifolderNoOutdir.json | 2 + .../node/outModuleMultifolderNoOutdir.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...outModuleMultifolderSpecifyOutputFile.json | 2 + ...outModuleMultifolderSpecifyOutputFile.json | 2 + .../amd/outModuleSimpleNoOutdir.json | 2 + .../node/outModuleSimpleNoOutdir.json | 2 + ...outModuleSimpleSpecifyOutputDirectory.json | 2 + ...outModuleSimpleSpecifyOutputDirectory.json | 2 + .../amd/outModuleSimpleSpecifyOutputFile.json | 2 + .../outModuleSimpleSpecifyOutputFile.json | 2 + .../amd/outModuleSubfolderNoOutdir.json | 2 + .../node/outModuleSubfolderNoOutdir.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + .../outModuleSubfolderSpecifyOutputFile.json | 2 + .../outModuleSubfolderSpecifyOutputFile.json | 2 + .../amd/outMultifolderNoOutdir.json | 2 + .../node/outMultifolderNoOutdir.json | 2 + .../outMultifolderSpecifyOutputDirectory.json | 2 + .../outMultifolderSpecifyOutputDirectory.json | 2 + .../amd/outMultifolderSpecifyOutputFile.json | 2 + .../node/outMultifolderSpecifyOutputFile.json | 2 + .../amd/outSimpleNoOutdir.json | 2 + .../node/outSimpleNoOutdir.json | 2 + .../amd/outSimpleSpecifyOutputDirectory.json | 2 + .../node/outSimpleSpecifyOutputDirectory.json | 2 + .../amd/outSimpleSpecifyOutputFile.json | 2 + .../node/outSimpleSpecifyOutputFile.json | 2 + .../amd/outSingleFileNoOutdir.json | 2 + .../node/outSingleFileNoOutdir.json | 2 + .../outSingleFileSpecifyOutputDirectory.json | 2 + .../outSingleFileSpecifyOutputDirectory.json | 2 + .../amd/outSingleFileSpecifyOutputFile.json | 2 + .../node/outSingleFileSpecifyOutputFile.json | 2 + .../amd/outSubfolderNoOutdir.json | 2 + .../node/outSubfolderNoOutdir.json | 2 + .../outSubfolderSpecifyOutputDirectory.json | 2 + .../outSubfolderSpecifyOutputDirectory.json | 2 + .../amd/outSubfolderSpecifyOutputFile.json | 2 + .../node/outSubfolderSpecifyOutputFile.json | 2 + ...mportedModuleDeclarationsInsideModule.json | 2 + ...mportedModuleDeclarationsInsideModule.json | 2 + ...leDeclarationsInsideNonExportedModule.json | 2 + ...leDeclarationsInsideNonExportedModule.json | 2 + ...edModuleImportStatementInParentModule.json | 2 + ...edModuleImportStatementInParentModule.json | 2 + ...yCheckOnImportedModuleSimpleReference.json | 2 + ...yCheckOnImportedModuleSimpleReference.json | 2 + ...heckOnIndirectTypeFromTheExternalType.json | 2 + ...heckOnIndirectTypeFromTheExternalType.json | 2 + .../amd/projectOptionTest.json | 2 + .../node/projectOptionTest.json | 2 + .../prologueEmit/amd/prologueEmit.json | 2 + .../prologueEmit/node/prologueEmit.json | 2 + .../amd/quotesInFileAndDirectoryNames.json | 2 + .../node/quotesInFileAndDirectoryNames.json | 2 + .../amd/referencePathStatic.json | 2 + .../node/referencePathStatic.json | 2 + .../amd/referenceResolutionRelativePaths.json | 2 + .../referenceResolutionRelativePaths.json | 2 + ...olutionRelativePathsFromRootDirectory.json | 2 + ...olutionRelativePathsFromRootDirectory.json | 2 + ...renceResolutionRelativePathsNoResolve.json | 2 + ...renceResolutionRelativePathsNoResolve.json | 2 + ...nRelativePathsRelativeToRootDirectory.json | 2 + ...nRelativePathsRelativeToRootDirectory.json | 2 + .../amd/referenceResolutionSameFileTwice.json | 2 + .../referenceResolutionSameFileTwice.json | 2 + ...renceResolutionSameFileTwiceNoResolve.json | 2 + ...renceResolutionSameFileTwiceNoResolve.json | 2 + .../relativeGlobal/amd/relativeGlobal.json | 2 + .../relativeGlobal/node/relativeGlobal.json | 2 + .../amd/relativeGlobalRef.json | 2 + .../node/relativeGlobalRef.json | 2 + .../relativeNested/amd/relativeNested.json | 2 + .../relativeNested/node/relativeNested.json | 2 + .../amd/relativeNestedRef.json | 2 + .../node/relativeNestedRef.json | 2 + .../relativePaths/amd/relativePaths.json | 2 + .../relativePaths/node/relativePaths.json | 2 + .../rootDirectory/amd/rootDirectory.json | 2 + .../rootDirectory/node/rootDirectory.json | 2 + .../amd/rootDirectoryErrors.json | 2 + .../node/rootDirectoryErrors.json | 2 + .../amd/rootDirectoryWithSourceRoot.json | 2 + .../node/rootDirectoryWithSourceRoot.json | 2 + .../amd/rootDirectoryWithoutOutDir.json | 2 + .../node/rootDirectoryWithoutOutDir.json | 2 + ...ootAbsolutePathMixedSubfolderNoOutdir.json | 2 + ...ootAbsolutePathMixedSubfolderNoOutdir.json | 2 + ...hMixedSubfolderSpecifyOutputDirectory.json | 2 + ...hMixedSubfolderSpecifyOutputDirectory.json | 2 + ...tePathMixedSubfolderSpecifyOutputFile.json | 2 + ...tePathMixedSubfolderSpecifyOutputFile.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...AbsolutePathModuleMultifolderNoOutdir.json | 2 + ...AbsolutePathModuleMultifolderNoOutdir.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...athModuleMultifolderSpecifyOutputFile.json | 2 + ...athModuleMultifolderSpecifyOutputFile.json | 2 + ...eRootAbsolutePathModuleSimpleNoOutdir.json | 2 + ...eRootAbsolutePathModuleSimpleNoOutdir.json | 2 + ...athModuleSimpleSpecifyOutputDirectory.json | 2 + ...athModuleSimpleSpecifyOutputDirectory.json | 2 + ...lutePathModuleSimpleSpecifyOutputFile.json | 2 + ...lutePathModuleSimpleSpecifyOutputFile.json | 2 + ...otAbsolutePathModuleSubfolderNoOutdir.json | 2 + ...otAbsolutePathModuleSubfolderNoOutdir.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ePathModuleSubfolderSpecifyOutputFile.json | 2 + ...ePathModuleSubfolderSpecifyOutputFile.json | 2 + ...ceRootAbsolutePathMultifolderNoOutdir.json | 2 + ...ceRootAbsolutePathMultifolderNoOutdir.json | 2 + ...PathMultifolderSpecifyOutputDirectory.json | 2 + ...PathMultifolderSpecifyOutputDirectory.json | 2 + ...olutePathMultifolderSpecifyOutputFile.json | 2 + ...olutePathMultifolderSpecifyOutputFile.json | 2 + .../sourceRootAbsolutePathSimpleNoOutdir.json | 2 + .../sourceRootAbsolutePathSimpleNoOutdir.json | 2 + ...olutePathSimpleSpecifyOutputDirectory.json | 2 + ...olutePathSimpleSpecifyOutputDirectory.json | 2 + ...otAbsolutePathSimpleSpecifyOutputFile.json | 2 + ...otAbsolutePathSimpleSpecifyOutputFile.json | 2 + ...rceRootAbsolutePathSingleFileNoOutdir.json | 2 + ...rceRootAbsolutePathSingleFileNoOutdir.json | 2 + ...ePathSingleFileSpecifyOutputDirectory.json | 2 + ...ePathSingleFileSpecifyOutputDirectory.json | 2 + ...solutePathSingleFileSpecifyOutputFile.json | 2 + ...solutePathSingleFileSpecifyOutputFile.json | 2 + ...urceRootAbsolutePathSubfolderNoOutdir.json | 2 + ...urceRootAbsolutePathSubfolderNoOutdir.json | 2 + ...tePathSubfolderSpecifyOutputDirectory.json | 2 + ...tePathSubfolderSpecifyOutputDirectory.json | 2 + ...bsolutePathSubfolderSpecifyOutputFile.json | 2 + ...bsolutePathSubfolderSpecifyOutputFile.json | 2 + ...ootRelativePathMixedSubfolderNoOutdir.json | 2 + ...ootRelativePathMixedSubfolderNoOutdir.json | 2 + ...hMixedSubfolderSpecifyOutputDirectory.json | 2 + ...hMixedSubfolderSpecifyOutputDirectory.json | 2 + ...vePathMixedSubfolderSpecifyOutputFile.json | 2 + ...vePathMixedSubfolderSpecifyOutputFile.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...RelativePathModuleMultifolderNoOutdir.json | 2 + ...RelativePathModuleMultifolderNoOutdir.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...athModuleMultifolderSpecifyOutputFile.json | 2 + ...athModuleMultifolderSpecifyOutputFile.json | 2 + ...eRootRelativePathModuleSimpleNoOutdir.json | 2 + ...eRootRelativePathModuleSimpleNoOutdir.json | 2 + ...athModuleSimpleSpecifyOutputDirectory.json | 2 + ...athModuleSimpleSpecifyOutputDirectory.json | 2 + ...tivePathModuleSimpleSpecifyOutputFile.json | 2 + ...tivePathModuleSimpleSpecifyOutputFile.json | 2 + ...otRelativePathModuleSubfolderNoOutdir.json | 2 + ...otRelativePathModuleSubfolderNoOutdir.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ePathModuleSubfolderSpecifyOutputFile.json | 2 + ...ePathModuleSubfolderSpecifyOutputFile.json | 2 + ...ceRootRelativePathMultifolderNoOutdir.json | 2 + ...ceRootRelativePathMultifolderNoOutdir.json | 2 + ...PathMultifolderSpecifyOutputDirectory.json | 2 + ...PathMultifolderSpecifyOutputDirectory.json | 2 + ...ativePathMultifolderSpecifyOutputFile.json | 2 + ...ativePathMultifolderSpecifyOutputFile.json | 2 + .../sourceRootRelativePathSimpleNoOutdir.json | 2 + .../sourceRootRelativePathSimpleNoOutdir.json | 2 + ...ativePathSimpleSpecifyOutputDirectory.json | 2 + ...ativePathSimpleSpecifyOutputDirectory.json | 2 + ...otRelativePathSimpleSpecifyOutputFile.json | 2 + ...otRelativePathSimpleSpecifyOutputFile.json | 2 + ...rceRootRelativePathSingleFileNoOutdir.json | 2 + ...rceRootRelativePathSingleFileNoOutdir.json | 2 + ...ePathSingleFileSpecifyOutputDirectory.json | 2 + ...ePathSingleFileSpecifyOutputDirectory.json | 2 + ...lativePathSingleFileSpecifyOutputFile.json | 2 + ...lativePathSingleFileSpecifyOutputFile.json | 2 + ...urceRootRelativePathSubfolderNoOutdir.json | 2 + ...urceRootRelativePathSubfolderNoOutdir.json | 2 + ...vePathSubfolderSpecifyOutputDirectory.json | 2 + ...vePathSubfolderSpecifyOutputDirectory.json | 2 + ...elativePathSubfolderSpecifyOutputFile.json | 2 + ...elativePathSubfolderSpecifyOutputFile.json | 2 + .../amd/sourceRootWithNoSourceMapOption.json | 2 + .../node/sourceRootWithNoSourceMapOption.json | 2 + .../amd/sourcemapMixedSubfolderNoOutdir.json | 2 + .../node/sourcemapMixedSubfolderNoOutdir.json | 2 + ...pMixedSubfolderSpecifyOutputDirectory.json | 2 + ...pMixedSubfolderSpecifyOutputDirectory.json | 2 + ...rcemapMixedSubfolderSpecifyOutputFile.json | 2 + ...rcemapMixedSubfolderSpecifyOutputFile.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + .../sourcemapModuleMultifolderNoOutdir.json | 2 + .../sourcemapModuleMultifolderNoOutdir.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...mapModuleMultifolderSpecifyOutputFile.json | 2 + ...mapModuleMultifolderSpecifyOutputFile.json | 2 + .../amd/sourcemapModuleSimpleNoOutdir.json | 2 + .../node/sourcemapModuleSimpleNoOutdir.json | 2 + ...mapModuleSimpleSpecifyOutputDirectory.json | 2 + ...mapModuleSimpleSpecifyOutputDirectory.json | 2 + ...ourcemapModuleSimpleSpecifyOutputFile.json | 2 + ...ourcemapModuleSimpleSpecifyOutputFile.json | 2 + .../amd/sourcemapModuleSubfolderNoOutdir.json | 2 + .../sourcemapModuleSubfolderNoOutdir.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...cemapModuleSubfolderSpecifyOutputFile.json | 2 + ...cemapModuleSubfolderSpecifyOutputFile.json | 2 + .../amd/sourcemapMultifolderNoOutdir.json | 2 + .../node/sourcemapMultifolderNoOutdir.json | 2 + ...emapMultifolderSpecifyOutputDirectory.json | 2 + ...emapMultifolderSpecifyOutputDirectory.json | 2 + ...sourcemapMultifolderSpecifyOutputFile.json | 2 + ...sourcemapMultifolderSpecifyOutputFile.json | 2 + .../amd/sourcemapSimpleNoOutdir.json | 2 + .../node/sourcemapSimpleNoOutdir.json | 2 + ...sourcemapSimpleSpecifyOutputDirectory.json | 2 + ...sourcemapSimpleSpecifyOutputDirectory.json | 2 + .../amd/sourcemapSimpleSpecifyOutputFile.json | 2 + .../sourcemapSimpleSpecifyOutputFile.json | 2 + .../amd/sourcemapSingleFileNoOutdir.json | 2 + .../node/sourcemapSingleFileNoOutdir.json | 2 + ...cemapSingleFileSpecifyOutputDirectory.json | 2 + ...cemapSingleFileSpecifyOutputDirectory.json | 2 + .../sourcemapSingleFileSpecifyOutputFile.json | 2 + .../sourcemapSingleFileSpecifyOutputFile.json | 2 + .../amd/sourcemapSubfolderNoOutdir.json | 2 + .../node/sourcemapSubfolderNoOutdir.json | 2 + ...rcemapSubfolderSpecifyOutputDirectory.json | 2 + ...rcemapSubfolderSpecifyOutputDirectory.json | 2 + .../sourcemapSubfolderSpecifyOutputFile.json | 2 + .../sourcemapSubfolderSpecifyOutputFile.json | 2 + .../sourcerootUrlMixedSubfolderNoOutdir.json | 2 + .../sourcerootUrlMixedSubfolderNoOutdir.json | 2 + ...lMixedSubfolderSpecifyOutputDirectory.json | 2 + ...lMixedSubfolderSpecifyOutputDirectory.json | 2 + ...ootUrlMixedSubfolderSpecifyOutputFile.json | 2 + ...ootUrlMixedSubfolderSpecifyOutputFile.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...erSpecifyOutputFileAndOutputDirectory.json | 2 + ...ourcerootUrlModuleMultifolderNoOutdir.json | 2 + ...ourcerootUrlModuleMultifolderNoOutdir.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...duleMultifolderSpecifyOutputDirectory.json | 2 + ...UrlModuleMultifolderSpecifyOutputFile.json | 2 + ...UrlModuleMultifolderSpecifyOutputFile.json | 2 + .../sourcerootUrlModuleSimpleNoOutdir.json | 2 + .../sourcerootUrlModuleSimpleNoOutdir.json | 2 + ...UrlModuleSimpleSpecifyOutputDirectory.json | 2 + ...UrlModuleSimpleSpecifyOutputDirectory.json | 2 + ...erootUrlModuleSimpleSpecifyOutputFile.json | 2 + ...erootUrlModuleSimpleSpecifyOutputFile.json | 2 + .../sourcerootUrlModuleSubfolderNoOutdir.json | 2 + .../sourcerootUrlModuleSubfolderNoOutdir.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...ModuleSubfolderSpecifyOutputDirectory.json | 2 + ...otUrlModuleSubfolderSpecifyOutputFile.json | 2 + ...otUrlModuleSubfolderSpecifyOutputFile.json | 2 + .../amd/sourcerootUrlMultifolderNoOutdir.json | 2 + .../sourcerootUrlMultifolderNoOutdir.json | 2 + ...tUrlMultifolderSpecifyOutputDirectory.json | 2 + ...tUrlMultifolderSpecifyOutputDirectory.json | 2 + ...cerootUrlMultifolderSpecifyOutputFile.json | 2 + ...cerootUrlMultifolderSpecifyOutputFile.json | 2 + .../amd/sourcerootUrlSimpleNoOutdir.json | 2 + .../node/sourcerootUrlSimpleNoOutdir.json | 2 + ...cerootUrlSimpleSpecifyOutputDirectory.json | 2 + ...cerootUrlSimpleSpecifyOutputDirectory.json | 2 + .../sourcerootUrlSimpleSpecifyOutputFile.json | 2 + .../sourcerootUrlSimpleSpecifyOutputFile.json | 2 + .../amd/sourcerootUrlSingleFileNoOutdir.json | 2 + .../node/sourcerootUrlSingleFileNoOutdir.json | 2 + ...otUrlSingleFileSpecifyOutputDirectory.json | 2 + ...otUrlSingleFileSpecifyOutputDirectory.json | 2 + ...rcerootUrlSingleFileSpecifyOutputFile.json | 2 + ...rcerootUrlSingleFileSpecifyOutputFile.json | 2 + .../amd/sourcerootUrlSubfolderNoOutdir.json | 2 + .../node/sourcerootUrlSubfolderNoOutdir.json | 2 + ...ootUrlSubfolderSpecifyOutputDirectory.json | 2 + ...ootUrlSubfolderSpecifyOutputDirectory.json | 2 + ...urcerootUrlSubfolderSpecifyOutputFile.json | 2 + ...urcerootUrlSubfolderSpecifyOutputFile.json | 2 + .../amd/specifyExcludeUsingRelativepath.json | 2 + .../node/specifyExcludeUsingRelativepath.json | 2 + ...fyExcludeUsingRelativepathWithAllowJS.json | 2 + ...fyExcludeUsingRelativepathWithAllowJS.json | 2 + ...pecifyExcludeWithOutUsingRelativePath.json | 2 + ...pecifyExcludeWithOutUsingRelativePath.json | 2 + ...deWithOutUsingRelativePathWithAllowJS.json | 2 + ...deWithOutUsingRelativePathWithAllowJS.json | 2 + .../visibilityOfTypeUsedAcrossModules.json | 2 + .../visibilityOfTypeUsedAcrossModules.json | 2 + .../visibilityOfTypeUsedAcrossModules2.json | 2 + .../visibilityOfTypeUsedAcrossModules2.json | 2 + .../reference/promisePermutations.errors.txt | 2 +- .../reference/promisePermutations2.errors.txt | 2 +- .../reference/promisePermutations3.errors.txt | 4 +- .../reactJsxReactResolvedNodeNext.trace.json | 4 + ...eactJsxReactResolvedNodeNextEsm.trace.json | 4 + .../reference/redefineArray.errors.txt | 2 +- .../reference/scannerS7.2_A1.5_T2.errors.txt | 4 +- .../reference/scannerS7.3_A1.1_T2.errors.txt | 2 +- .../reference/scannerS7.6_A4.2_T1.errors.txt | 20 +- ...eStringsWithOverloadResolution1.errors.txt | 2 +- ...ingsWithOverloadResolution1_ES6.errors.txt | 2 +- ...does-not-add-color-when-NO_COLOR-is-set.js | 2 +- ...-when-host-can't-provide-terminal-width.js | 2 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 2 +- ...ariableDeclarationInStrictMode1.errors.txt | 4 +- ...tionForStringLiteralNonrelativeImport14.ts | 6 +- .../fourslash/completionsPaths_importType.ts | 2 + tests/cases/fourslash/server/projectInfo01.ts | 8 +- tests/cases/fourslash/server/projectInfo02.ts | 2 +- .../server/projectWithNonExistentFiles.ts | 2 +- 692 files changed, 1670 insertions(+), 115 deletions(-) create mode 100644 src/lib/decorators.d.ts create mode 100644 src/lib/decorators.legacy.d.ts create mode 100644 src/lib/decorators.parameters.d.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index aa67a5973caeb..a0cc67f56c124 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -93,7 +93,10 @@ namespace ts { ["esnext.bigint", "lib.es2020.bigint.d.ts"], ["esnext.string", "lib.es2022.string.d.ts"], ["esnext.promise", "lib.es2021.promise.d.ts"], - ["esnext.weakref", "lib.es2021.weakref.d.ts"] + ["esnext.weakref", "lib.es2021.weakref.d.ts"], + ["decorators", "lib.decorators.d.ts"], + ["decorators.legacy", "lib.decorators.legacy.d.ts"], + ["decorators.parameters", "lib.decorators.parameters.d.ts"], ]; /** diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 4112072d38835..1cee8441fbeb1 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1164,6 +1164,18 @@ namespace FourSlashInterface { typeEntry("PropertyDecorator"), typeEntry("MethodDecorator"), typeEntry("ParameterDecorator"), + interfaceEntry("ClassDecoratorContext"), + typeEntry("ClassDecoratorFunction"), + interfaceEntry("ClassMethodDecoratorContext"), + typeEntry("ClassMethodDecoratorFunction"), + interfaceEntry("ClassGetterDecoratorContext"), + typeEntry("ClassGetterDecoratorFunction"), + interfaceEntry("ClassSetterDecoratorContext"), + typeEntry("ClassSetterDecoratorFunction"), + interfaceEntry("ClassAccessorDecoratorContext"), + typeEntry("ClassAccessorDecoratorFunction"), + interfaceEntry("ClassFieldDecoratorContext"), + typeEntry("ClassFieldDecoratorFunction"), typeEntry("PromiseConstructorLike"), interfaceEntry("PromiseLike"), interfaceEntry("Promise"), diff --git a/src/lib/decorators.d.ts b/src/lib/decorators.d.ts new file mode 100644 index 0000000000000..8086704986eba --- /dev/null +++ b/src/lib/decorators.d.ts @@ -0,0 +1,247 @@ +/** + * Context provided to a class decorator. + */ +interface ClassDecoratorContext any> { + readonly kind: "class"; + readonly name: string | undefined; + + /** + * Adds a callback to be invoked after the class definition has been finalized. + * + * @example + * ```ts + * function customElement(name: string): ClassDecoratorFunction { + * return (target, { addInitializer }) => { + * addInitializer(function () { + * customElements.define(name, this); + * }); + * } + * } + * + * @customElement("my-element") + * class MyElement {} + * ``` + */ + addInitializer(initializer: (this: Class) => void): void; +} + +/** + * Describes a function that can be used to decorate a class. + */ +type ClassDecoratorFunction = < + In extends abstract new (...args: any[]) => any, + Out extends abstract new (...args: any[]) => any = In, + Class extends abstract new (...args: any[]) => any = Out +>(target: In, context: ClassDecoratorContext) => Out | void; + +/** + * Context provided to a class method decorator. + */ +interface ClassMethodDecoratorContext any> { + readonly kind: "method"; + readonly name: string | symbol; + readonly static: boolean; + readonly private: boolean; + readonly access: { + /** + * Gets the current value of the method from the provided receiver. + * + * @example + * let fn = context.access.get.call(instance); + */ + get(this: This): Value; + }; + + /** + * Adds a callback to be invoked either before static initializers are run (when + * decorating a `static` member), or before instance initializers are run (when + * decorating a non-`static` member). + * + * @example + * ```ts + * const bound: ClassMethodDecoratorFunction = (value, { name, private: isPrivate, addInitializer }) { + * if (isPrivate) throw new TypeError("Not supported on private methods."); + * addInitializer(function () { + * this[name] = this[name].bind(this); + * }); + * } + * + * class C { + * message = "Hello"; + * + * @bound + * m() { + * console.log(this.message); + * } + * } + * ``` + */ + addInitializer(initializer: (this: This) => void): void; +} + +/** + * Describes a function that can be used to decorate a class method. + */ +type ClassMethodDecoratorFunction = < + This, + In extends (this: This, ...args: any[]) => any, + Out extends (this: This, ...args: any[]) => any = In, + Value extends (this: This, ...args: any[]) => any = Out +>(target: In, context: ClassMethodDecoratorContext & Readonly>) => Out | void; + +/** + * Context provided to a class `get` method decorator. + */ +interface ClassGetterDecoratorContext { + readonly kind: "getter"; + readonly name: string | symbol; + readonly static: boolean; + readonly private: boolean; + readonly access: { + /** + * Invokes the getter on the provided receiver. + * + * @example + * let value = context.access.get.call(instance); + */ + get(this: This): Value; + }; + + /** + * Adds a callback to be invoked either before static initializers are run (when + * decorating a `static` member), or before instance initializers are run (when + * decorating a non-`static` member). + */ + addInitializer(initializer: (this: This) => void): void; +} + +/** + * Describes a function that can be used to decorate a class `get` method. + */ +type ClassGetterDecoratorFunction = < + This, + In, + Out = In, + Value = Out, +>(target: { get(this: This): In }, context: ClassGetterDecoratorContext) => { get(this: This): Out; } | void; + +/** + * Context provided to a class `set` method decorator. + */ +interface ClassSetterDecoratorContext { + readonly kind: "setter"; + readonly name: string | symbol; + readonly static: boolean; + readonly private: boolean; + readonly access: { + /** + * Invokes the setter on the provided receiver. + * + * @example + * context.access.set.call(instance, value); + */ + set(this: This, value: Value): void; + }; + + /** + * Adds a callback to be invoked either before static initializers are run (when + * decorating a `static` member), or before instance initializers are run (when + * decorating a non-`static` member). + */ + addInitializer(initializer: (this: This) => void): void; +} + +/** + * Describes a function that can be used to decorate a class `set` method. + */ +type ClassSetterDecoratorFunction = < + This, + In, + Out = In, + Value = Out +>(target: { set(this: This, value: In): void; }, context: ClassSetterDecoratorContext) => { set(this: This, value: Out): void; } | void; + +/** + * Context provided to a class `accessor` field decorator. + */ +interface ClassAccessorDecoratorContext { + readonly kind: "accessor"; + readonly name: string | symbol; + readonly static: boolean; + readonly private: boolean; + readonly access: { + /** + * Invokes the getter on the provided receiver. + * + * @example + * let value = context.access.get.call(instance); + */ + get(this: This): Value; + + /** + * Invokes the setter on the provided receiver. + * + * @example + * context.access.set.call(instance, value); + */ + set(this: This, value: Value): void; + }; + + /** + * Adds a callback to be invoked either before static initializers are run (when + * decorating a `static` member), or before instance initializers are run (when + * decorating a non-`static` member). + */ + addInitializer(initializer: (this: This) => void): void; +} + +/** + * Describes a function that can be used to decorate a class `accessor` field. + */ +type ClassAccessorDecoratorFunction = < + This, + In, + Out = In, + Value = Out +>( + target: { get(this: This): In; set(this: This, value: In): void; }, + context: ClassAccessorDecoratorContext +) => { get?(this: This): Out; set?(this: This, value: Out): void; init?(this: This, value: In): Out; } | void; + +/** + * Context provided to a class field decorator. + */ +interface ClassFieldDecoratorContext { + readonly kind: "field"; + readonly name: string | symbol; + readonly static: boolean; + readonly private: boolean; + readonly access: { + /** + * Gets the value of the field on the provided receiver. + */ + get(this: This): Value; + + /** + * Sets the value of the field on the provided receiver. + */ + set(this: This, value: Value): void; + }; + + /** + * Adds a callback to be invoked either before static initializers are run (when + * decorating a `static` member), or before instance initializers are run (when + * decorating a non-`static` member). + */ + addInitializer(initializer: (this: This) => void): void; +} + +/** + * Describes a function that can be used to decorate a class field. + */ +type ClassFieldDecoratorFunction = < + This, + In, + Out = In, + Value = Out +>(target: undefined, context: ClassAccessorDecoratorContext) => ((this: This, initialValue: In) => Out) | void; diff --git a/src/lib/decorators.legacy.d.ts b/src/lib/decorators.legacy.d.ts new file mode 100644 index 0000000000000..5638b44921b7a --- /dev/null +++ b/src/lib/decorators.legacy.d.ts @@ -0,0 +1,4 @@ +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; diff --git a/src/lib/decorators.parameters.d.ts b/src/lib/decorators.parameters.d.ts new file mode 100644 index 0000000000000..8e12faa924f2b --- /dev/null +++ b/src/lib/decorators.parameters.d.ts @@ -0,0 +1,14 @@ +interface ParameterDecoratorContext { + readonly kind: "parameter"; + readonly index: number; + readonly name: string | undefined; + readonly rest: boolean; + addInitializer(initializer: (this: Func) => void): void; +} + +type ParameterDecoratorFunction = < + Func extends Function, + This, + In, + Out = In +>(target: undefined, context: ParameterDecoratorContext) => ((this: This, initialValue: In) => Out) | void; diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index f4b499cd81691..54ddf71ebbbd4 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1,3 +1,6 @@ +/// +/// + ///////////////////////////// /// ECMAScript APIs ///////////////////////////// @@ -1478,11 +1481,6 @@ interface TypedPropertyDescriptor { set?: (value: T) => void; } -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - declare type PromiseConstructorLike = new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; interface PromiseLike { diff --git a/src/lib/libs.json b/src/lib/libs.json index a14e435290012..80a0de3c554e6 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -63,6 +63,9 @@ "es2022.sharedmemory", "es2022.string", "esnext.intl", + "decorators", + "decorators.legacy", + "decorators.parameters", // Default libraries "es5.full", "es2015.full", diff --git a/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt b/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt index c2defbf869963..fbe8190595e83 100644 --- a/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt +++ b/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/weird.js(9,17): error TS7006: Parameter 'error' implicitly someFunction(function(BaseClass) { ~~~~~~~~~~~~ !!! error TS2552: Cannot find name 'someFunction'. Did you mean 'Function'? -!!! related TS2728 /.ts/lib.es5.d.ts:318:13: 'Function' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:321:13: 'Function' is declared here. ~~~~~~~~~ !!! error TS7006: Parameter 'BaseClass' implicitly has an 'any' type. 'use strict'; diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols index 3e7ec56892711..39f0a9e33311a 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsAmd/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsAmd/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols index 383d7d2c0d2f2..36099c99f9847 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsCommonjs/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsCommonjs/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols index 73898da76c41a..ecc2e079809bd 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsSystem/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsSystem/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols index f93e5411306d7..9bc47a1f73699 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsUmd/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsUmd/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratorMetadataConditionalType.symbols b/tests/baselines/reference/decoratorMetadataConditionalType.symbols index 251a2bd77ba4a..9174571f8be37 100644 --- a/tests/baselines/reference/decoratorMetadataConditionalType.symbols +++ b/tests/baselines/reference/decoratorMetadataConditionalType.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/decoratorMetadataConditionalType.ts === declare function d(): PropertyDecorator; >d : Symbol(d, Decl(decoratorMetadataConditionalType.ts, 0, 0)) ->PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.es5.d.ts, --, --)) +>PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) abstract class BaseEntity { >BaseEntity : Symbol(BaseEntity, Decl(decoratorMetadataConditionalType.ts, 0, 40)) diff --git a/tests/baselines/reference/decoratorMetadataPromise.symbols b/tests/baselines/reference/decoratorMetadataPromise.symbols index f9a161f914815..594815bb05c7f 100644 --- a/tests/baselines/reference/decoratorMetadataPromise.symbols +++ b/tests/baselines/reference/decoratorMetadataPromise.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/decoratorMetadataPromise.ts === declare const decorator: MethodDecorator; >decorator : Symbol(decorator, Decl(decoratorMetadataPromise.ts, 0, 13)) ->MethodDecorator : Symbol(MethodDecorator, Decl(lib.es5.d.ts, --, --)) +>MethodDecorator : Symbol(MethodDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) class A { >A : Symbol(A, Decl(decoratorMetadataPromise.ts, 0, 41)) diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols index 6bad65ed2839d..d0a4a054c0562 100644 --- a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols @@ -30,7 +30,7 @@ import { SomeClass1 } from './aux1'; function annotation(): ClassDecorator { >annotation : Symbol(annotation, Decl(main.ts, 1, 36)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) return (target: any): void => { }; >target : Symbol(target, Decl(main.ts, 4, 12)) @@ -38,7 +38,7 @@ function annotation(): ClassDecorator { function annotation1(): MethodDecorator { >annotation1 : Symbol(annotation1, Decl(main.ts, 5, 1)) ->MethodDecorator : Symbol(MethodDecorator, Decl(lib.es5.d.ts, --, --)) +>MethodDecorator : Symbol(MethodDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) return (target: any): void => { }; >target : Symbol(target, Decl(main.ts, 8, 12)) diff --git a/tests/baselines/reference/destructureOptionalParameter.symbols b/tests/baselines/reference/destructureOptionalParameter.symbols index e763a2097a9f2..af85a8bb47eb5 100644 --- a/tests/baselines/reference/destructureOptionalParameter.symbols +++ b/tests/baselines/reference/destructureOptionalParameter.symbols @@ -48,7 +48,7 @@ interface QueryMetadataFactory { >read : Symbol(read, Decl(destructureOptionalParameter.ts, 14, 30)) }): ParameterDecorator; ->ParameterDecorator : Symbol(ParameterDecorator, Decl(lib.es5.d.ts, --, --)) +>ParameterDecorator : Symbol(ParameterDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) new (selector: Type | string, {descendants, read}?: { >selector : Symbol(selector, Decl(destructureOptionalParameter.ts, 17, 9)) diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index bb7aff5eb0fc0..435e733888af0 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -41,7 +41,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'? -!!! related TS2728 /.ts/lib.es5.d.ts:1490:13: 'Array' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1493:13: 'Array' is declared here. a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]] ~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type '[[any]]'. diff --git a/tests/baselines/reference/destructuringTuple.errors.txt b/tests/baselines/reference/destructuringTuple.errors.txt index e8548783cafc4..10122a2ff87c8 100644 --- a/tests/baselines/reference/destructuringTuple.errors.txt +++ b/tests/baselines/reference/destructuringTuple.errors.txt @@ -33,8 +33,8 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload mat !!! error TS2769: Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error. !!! error TS2769: Type 'never[]' is not assignable to type '[]'. !!! error TS2769: Target allows only 0 element(s) but source may have more. -!!! related TS6502 /.ts/lib.es5.d.ts:1455:24: The expected type comes from the return type of this signature. -!!! related TS6502 /.ts/lib.es5.d.ts:1461:27: The expected type comes from the return type of this signature. +!!! related TS6502 /.ts/lib.es5.d.ts:1458:24: The expected type comes from the return type of this signature. +!!! related TS6502 /.ts/lib.es5.d.ts:1464:27: The expected type comes from the return type of this signature. ~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(...items: ConcatArray[]): never[]', gave the following error. diff --git a/tests/baselines/reference/duplicateNumericIndexers.errors.txt b/tests/baselines/reference/duplicateNumericIndexers.errors.txt index b149e6f586d06..b7dda9f3db69e 100644 --- a/tests/baselines/reference/duplicateNumericIndexers.errors.txt +++ b/tests/baselines/reference/duplicateNumericIndexers.errors.txt @@ -10,8 +10,8 @@ tests/cases/conformance/types/members/duplicateNumericIndexers.ts(24,5): error T tests/cases/conformance/types/members/duplicateNumericIndexers.ts(25,5): error TS2374: Duplicate index signature for type 'number'. tests/cases/conformance/types/members/duplicateNumericIndexers.ts(29,5): error TS2374: Duplicate index signature for type 'number'. tests/cases/conformance/types/members/duplicateNumericIndexers.ts(30,5): error TS2374: Duplicate index signature for type 'number'. -lib.es5.d.ts(517,5): error TS2374: Duplicate index signature for type 'number'. -lib.es5.d.ts(1476,5): error TS2374: Duplicate index signature for type 'number'. +lib.es5.d.ts(520,5): error TS2374: Duplicate index signature for type 'number'. +lib.es5.d.ts(1479,5): error TS2374: Duplicate index signature for type 'number'. ==== tests/cases/conformance/types/members/duplicateNumericIndexers.ts (12 errors) ==== diff --git a/tests/baselines/reference/emitDecoratorMetadata_object.symbols b/tests/baselines/reference/emitDecoratorMetadata_object.symbols index fd9ff12a2c672..cd08fdd0071af 100644 --- a/tests/baselines/reference/emitDecoratorMetadata_object.symbols +++ b/tests/baselines/reference/emitDecoratorMetadata_object.symbols @@ -1,11 +1,11 @@ === tests/cases/compiler/emitDecoratorMetadata_object.ts === declare const MyClassDecorator: ClassDecorator; >MyClassDecorator : Symbol(MyClassDecorator, Decl(emitDecoratorMetadata_object.ts, 0, 13)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) declare const MyMethodDecorator: MethodDecorator; >MyMethodDecorator : Symbol(MyMethodDecorator, Decl(emitDecoratorMetadata_object.ts, 1, 13)) ->MethodDecorator : Symbol(MethodDecorator, Decl(lib.es5.d.ts, --, --)) +>MethodDecorator : Symbol(MethodDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @MyClassDecorator >MyClassDecorator : Symbol(MyClassDecorator, Decl(emitDecoratorMetadata_object.ts, 0, 13)) diff --git a/tests/baselines/reference/emitDecoratorMetadata_restArgs.symbols b/tests/baselines/reference/emitDecoratorMetadata_restArgs.symbols index 8a36fd89d358b..53cfde04dbc82 100644 --- a/tests/baselines/reference/emitDecoratorMetadata_restArgs.symbols +++ b/tests/baselines/reference/emitDecoratorMetadata_restArgs.symbols @@ -1,11 +1,11 @@ === tests/cases/compiler/emitDecoratorMetadata_restArgs.ts === declare const MyClassDecorator: ClassDecorator; >MyClassDecorator : Symbol(MyClassDecorator, Decl(emitDecoratorMetadata_restArgs.ts, 0, 13)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) declare const MyMethodDecorator: MethodDecorator; >MyMethodDecorator : Symbol(MyMethodDecorator, Decl(emitDecoratorMetadata_restArgs.ts, 1, 13)) ->MethodDecorator : Symbol(MethodDecorator, Decl(lib.es5.d.ts, --, --)) +>MethodDecorator : Symbol(MethodDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) @MyClassDecorator >MyClassDecorator : Symbol(MyClassDecorator, Decl(emitDecoratorMetadata_restArgs.ts, 0, 13)) diff --git a/tests/baselines/reference/errorMessageOnObjectLiteralType.errors.txt b/tests/baselines/reference/errorMessageOnObjectLiteralType.errors.txt index 8a5c1b069c593..cc8824851bc41 100644 --- a/tests/baselines/reference/errorMessageOnObjectLiteralType.errors.txt +++ b/tests/baselines/reference/errorMessageOnObjectLiteralType.errors.txt @@ -13,4 +13,4 @@ tests/cases/compiler/errorMessageOnObjectLiteralType.ts(6,8): error TS2551: Prop Object.getOwnPropertyNamess(null); ~~~~~~~~~~~~~~~~~~~~ !!! error TS2551: Property 'getOwnPropertyNamess' does not exist on type 'ObjectConstructor'. Did you mean 'getOwnPropertyNames'? -!!! related TS2728 /.ts/lib.es5.d.ts:181:5: 'getOwnPropertyNames' is declared here. \ No newline at end of file +!!! related TS2728 /.ts/lib.es5.d.ts:184:5: 'getOwnPropertyNames' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index 134443d52d215..47dab1f25bf74 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -66,20 +66,20 @@ tests/cases/compiler/externModule.ts(37,3): error TS2552: Cannot find name 'XDat var d=new XDate(); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:937:13: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:940:13: 'Date' is declared here. d.getDay(); d=new XDate(1978,2); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:937:13: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:940:13: 'Date' is declared here. d.getXDate(); var n=XDate.parse("3/2/2004"); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:937:13: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:940:13: 'Date' is declared here. n=XDate.UTC(1964,2,1); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:937:13: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:940:13: 'Date' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/invalidTypeOfTarget.errors.txt b/tests/baselines/reference/invalidTypeOfTarget.errors.txt index db87a34095213..0bcd66b4dd6f0 100644 --- a/tests/baselines/reference/invalidTypeOfTarget.errors.txt +++ b/tests/baselines/reference/invalidTypeOfTarget.errors.txt @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/invalidTypeOfTarget.ts var x7: typeof function f() { }; ~~~~~~~~ !!! error TS2552: Cannot find name 'function'. Did you mean 'Function'? -!!! related TS2728 /.ts/lib.es5.d.ts:318:13: 'Function' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:321:13: 'Function' is declared here. ~ !!! error TS1005: ',' expected. ~ diff --git a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt index 5fb49e0dd99b6..f9a462166d1ab 100644 --- a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt +++ b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt @@ -7,5 +7,5 @@ tests/cases/compiler/mappedTypeWithAsClauseAndLateBoundProperty.ts(3,1): error T tgt2 = src2; // Should error ~~~~ !!! error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (this: void, value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [iterator]: () => IterableIterator; [unscopables]: () => { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean; }; }' but required in type 'number[]'. -!!! related TS2728 /.ts/lib.es5.d.ts:1299:5: 'length' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1302:5: 'length' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/metadataOfClassFromAlias.symbols b/tests/baselines/reference/metadataOfClassFromAlias.symbols index e68e1fdab3e87..ac4584c8fd929 100644 --- a/tests/baselines/reference/metadataOfClassFromAlias.symbols +++ b/tests/baselines/reference/metadataOfClassFromAlias.symbols @@ -12,7 +12,7 @@ import { SomeClass } from './auxiliry'; function annotation(): PropertyDecorator { >annotation : Symbol(annotation, Decl(test.ts, 0, 39)) ->PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.es5.d.ts, --, --)) +>PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) return (target: any): void => { }; >target : Symbol(target, Decl(test.ts, 2, 12)) diff --git a/tests/baselines/reference/metadataOfClassFromAlias2.symbols b/tests/baselines/reference/metadataOfClassFromAlias2.symbols index 7c9881403a4b2..6eacac1beb97d 100644 --- a/tests/baselines/reference/metadataOfClassFromAlias2.symbols +++ b/tests/baselines/reference/metadataOfClassFromAlias2.symbols @@ -12,7 +12,7 @@ import { SomeClass } from './auxiliry'; function annotation(): PropertyDecorator { >annotation : Symbol(annotation, Decl(test.ts, 0, 39)) ->PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.es5.d.ts, --, --)) +>PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) return (target: any): void => { }; >target : Symbol(target, Decl(test.ts, 2, 12)) diff --git a/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt b/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt index 3a07bb2f5d9b6..0dca67020bedc 100644 --- a/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt +++ b/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt @@ -24,7 +24,7 @@ tests/cases/conformance/types/any/narrowExceptionVariableInCatchClause.ts(16,17) err.massage; // ERROR: Property 'massage' does not exist on type 'Error' ~~~~~~~ !!! error TS2551: Property 'massage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:1049:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1052:5: 'message' is declared here. } else { diff --git a/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt b/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt index 2206d1c9b214b..34f7a189084d0 100644 --- a/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt @@ -22,7 +22,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS x.mesage; ~~~~~~ !!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:1049:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1052:5: 'message' is declared here. } if (x instanceof Date) { @@ -30,6 +30,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS x.getHuors(); ~~~~~~~~ !!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'? -!!! related TS2728 /.ts/lib.es5.d.ts:783:5: 'getHours' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:786:5: 'getHours' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt index 109738a3f4bc8..57887337775c1 100644 --- a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt @@ -41,7 +41,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error x.mesage; ~~~~~~ !!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:1049:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1052:5: 'message' is declared here. } if (isDate(x)) { @@ -49,6 +49,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error x.getHuors(); ~~~~~~~~ !!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'? -!!! related TS2728 /.ts/lib.es5.d.ts:783:5: 'getHours' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:786:5: 'getHours' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt index 04c780f9e635f..efd29fd25da93 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts(10,5): error TS2411: Property 'data' of type 'A' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(124,5): error TS2411: Property 'constructor' of type 'Function' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(127,5): error TS2411: Property 'toString' of type '() => string' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(130,5): error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(133,5): error TS2411: Property 'valueOf' of type '() => Object' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(139,5): error TS2411: Property 'hasOwnProperty' of type '(v: PropertyKey) => boolean' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(145,5): error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(151,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: PropertyKey) => boolean' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(127,5): error TS2411: Property 'constructor' of type 'Function' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(130,5): error TS2411: Property 'toString' of type '() => string' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(133,5): error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(136,5): error TS2411: Property 'valueOf' of type '() => Object' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(142,5): error TS2411: Property 'hasOwnProperty' of type '(v: PropertyKey) => boolean' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(148,5): error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(154,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: PropertyKey) => boolean' is not assignable to 'string' index type 'Object'. ==== tests/cases/conformance/types/members/objectTypeHidingMembersOfExtendedObject.ts (1 errors) ==== diff --git a/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt b/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt index b049b6b9ad64a..9f969937e4f08 100644 --- a/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt +++ b/tests/baselines/reference/objectTypeWithStringIndexerHidingObjectIndexer.errors.txt @@ -1,10 +1,10 @@ -lib.es5.d.ts(124,5): error TS2411: Property 'constructor' of type 'Function' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(127,5): error TS2411: Property 'toString' of type '() => string' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(130,5): error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(133,5): error TS2411: Property 'valueOf' of type '() => Object' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(139,5): error TS2411: Property 'hasOwnProperty' of type '(v: PropertyKey) => boolean' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(145,5): error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to 'string' index type 'Object'. -lib.es5.d.ts(151,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: PropertyKey) => boolean' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(127,5): error TS2411: Property 'constructor' of type 'Function' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(130,5): error TS2411: Property 'toString' of type '() => string' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(133,5): error TS2411: Property 'toLocaleString' of type '() => string' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(136,5): error TS2411: Property 'valueOf' of type '() => Object' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(142,5): error TS2411: Property 'hasOwnProperty' of type '(v: PropertyKey) => boolean' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(148,5): error TS2411: Property 'isPrototypeOf' of type '(v: Object) => boolean' is not assignable to 'string' index type 'Object'. +lib.es5.d.ts(154,5): error TS2411: Property 'propertyIsEnumerable' of type '(v: PropertyKey) => boolean' is not assignable to 'string' index type 'Object'. ==== tests/cases/conformance/types/members/objectTypeWithStringIndexerHidingObjectIndexer.ts (0 errors) ==== diff --git a/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt index daab2dd65ec82..e54869c75ca99 100644 --- a/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt +++ b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt @@ -11,4 +11,4 @@ tests/cases/conformance/parser/ecmascript5/Expressions/parserMemberAccessAfterPo !!! error TS1005: ';' expected. ~~~~~~~~ !!! error TS2552: Cannot find name 'toString'. Did you mean 'String'? -!!! related TS2728 /.ts/lib.es5.d.ts:530:13: 'String' is declared here. \ No newline at end of file +!!! related TS2728 /.ts/lib.es5.d.ts:533:13: 'String' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/parserRegularExpressionDivideAmbiguity1.errors.txt b/tests/baselines/reference/parserRegularExpressionDivideAmbiguity1.errors.txt index 252a08e5c3874..f14b0ccbe41a7 100644 --- a/tests/baselines/reference/parserRegularExpressionDivideAmbiguity1.errors.txt +++ b/tests/baselines/reference/parserRegularExpressionDivideAmbiguity1.errors.txt @@ -7,6 +7,6 @@ tests/cases/conformance/parser/ecmascript5/RegularExpressions/parserRegularExpre /notregexp/a.foo(); ~~~~~~~~~ !!! error TS2552: Cannot find name 'notregexp'. Did you mean 'RegExp'? -!!! related TS2728 /.ts/lib.es5.d.ts:1045:13: 'RegExp' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1048:13: 'RegExp' is declared here. ~ !!! error TS2304: Cannot find name 'a'. \ No newline at end of file diff --git a/tests/baselines/reference/parserRegularExpressionDivideAmbiguity2.errors.txt b/tests/baselines/reference/parserRegularExpressionDivideAmbiguity2.errors.txt index 3eb2b9824267c..e0f32f5a497f1 100644 --- a/tests/baselines/reference/parserRegularExpressionDivideAmbiguity2.errors.txt +++ b/tests/baselines/reference/parserRegularExpressionDivideAmbiguity2.errors.txt @@ -6,6 +6,6 @@ tests/cases/conformance/parser/ecmascript5/RegularExpressions/parserRegularExpre (1) /notregexp/a.foo(); ~~~~~~~~~ !!! error TS2552: Cannot find name 'notregexp'. Did you mean 'RegExp'? -!!! related TS2728 /.ts/lib.es5.d.ts:1045:13: 'RegExp' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1048:13: 'RegExp' is declared here. ~ !!! error TS2304: Cannot find name 'a'. \ No newline at end of file diff --git a/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt b/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt index d89e7dbdbf68f..40996a0ba0425 100644 --- a/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt +++ b/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } //CHECK#2 @@ -28,7 +28,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS $ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } diff --git a/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt b/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt index 1b259eccc99b7..a80fcdc4d51a9 100644 --- a/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt +++ b/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt @@ -21,7 +21,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.3_A1.1_T2.ts(17,3): error TS $ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt b/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt index 3e7acb4d3f164..1046e88309abf 100644 --- a/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt +++ b/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt @@ -50,70 +50,70 @@ tests/cases/conformance/parser/ecmascript5/parserS7.6_A4.2_T1.ts(142,3): error T $ERROR('#А'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0411 = 1; if (Б !== 1) { $ERROR('#Б'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0412 = 1; if (В !== 1) { $ERROR('#В'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0413 = 1; if (Г !== 1) { $ERROR('#Г'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0414 = 1; if (Д !== 1) { $ERROR('#Д'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0415 = 1; if (Е !== 1) { $ERROR('#Е'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0416 = 1; if (Ж !== 1) { $ERROR('#Ж'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0417 = 1; if (З !== 1) { $ERROR('#З'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0418 = 1; if (И !== 1) { $ERROR('#И'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0419 = 1; if (Й !== 1) { $ERROR('#Й'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u041A = 1; if (К !== 1) { diff --git a/tests/baselines/reference/parserUnicode1.errors.txt b/tests/baselines/reference/parserUnicode1.errors.txt index d2f7148f6f271..335c136388c61 100644 --- a/tests/baselines/reference/parserUnicode1.errors.txt +++ b/tests/baselines/reference/parserUnicode1.errors.txt @@ -11,13 +11,13 @@ tests/cases/conformance/parser/ecmascript5/parserUnicode1.ts(10,5): error TS2552 $ERROR('#6.1: var \\u0078x = 1; xx === 6. Actual: ' + (xx)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } } catch (e) { $ERROR('#6.2: var \\u0078x = 1; xx === 6. Actual: ' + (xx)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/potentiallyUncalledDecorators.symbols b/tests/baselines/reference/potentiallyUncalledDecorators.symbols index 38fe3f3dc520e..9d14d52647e0c 100644 --- a/tests/baselines/reference/potentiallyUncalledDecorators.symbols +++ b/tests/baselines/reference/potentiallyUncalledDecorators.symbols @@ -15,7 +15,7 @@ class FooComponent { // Glimmer-style tracked API: declare const tracked: PropertyDecorator & { (...watchedProperties: string[]): any; } >tracked : Symbol(tracked, Decl(potentiallyUncalledDecorators.ts, 7, 13)) ->PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.es5.d.ts, --, --)) +>PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) >watchedProperties : Symbol(watchedProperties, Decl(potentiallyUncalledDecorators.ts, 7, 46)) class Person { @@ -50,9 +50,9 @@ class MultiplyByTwo { interface OmniDecorator extends MethodDecorator, ClassDecorator, PropertyDecorator { >OmniDecorator : Symbol(OmniDecorator, Decl(potentiallyUncalledDecorators.ts, 19, 1)) ->MethodDecorator : Symbol(MethodDecorator, Decl(lib.es5.d.ts, --, --)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) ->PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.es5.d.ts, --, --)) +>MethodDecorator : Symbol(MethodDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) +>PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.decorators.legacy.d.ts, --, --)) } declare function noArgs(): OmniDecorator; diff --git a/tests/baselines/reference/project/baseline/amd/baseline.json b/tests/baselines/reference/project/baseline/amd/baseline.json index 9755a1248e5d2..a657a20ad98e7 100644 --- a/tests/baselines/reference/project/baseline/amd/baseline.json +++ b/tests/baselines/reference/project/baseline/amd/baseline.json @@ -8,6 +8,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "emit.ts" ], diff --git a/tests/baselines/reference/project/baseline/node/baseline.json b/tests/baselines/reference/project/baseline/node/baseline.json index 9755a1248e5d2..a657a20ad98e7 100644 --- a/tests/baselines/reference/project/baseline/node/baseline.json +++ b/tests/baselines/reference/project/baseline/node/baseline.json @@ -8,6 +8,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "emit.ts" ], diff --git a/tests/baselines/reference/project/baseline2/amd/baseline2.json b/tests/baselines/reference/project/baseline2/amd/baseline2.json index 714753635fc4f..0f004751a1306 100644 --- a/tests/baselines/reference/project/baseline2/amd/baseline2.json +++ b/tests/baselines/reference/project/baseline2/amd/baseline2.json @@ -8,6 +8,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "dont_emit.ts" ], diff --git a/tests/baselines/reference/project/baseline2/node/baseline2.json b/tests/baselines/reference/project/baseline2/node/baseline2.json index 714753635fc4f..0f004751a1306 100644 --- a/tests/baselines/reference/project/baseline2/node/baseline2.json +++ b/tests/baselines/reference/project/baseline2/node/baseline2.json @@ -8,6 +8,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "dont_emit.ts" ], diff --git a/tests/baselines/reference/project/baseline3/amd/baseline3.json b/tests/baselines/reference/project/baseline3/amd/baseline3.json index 4229a725fea82..9ede04842b072 100644 --- a/tests/baselines/reference/project/baseline3/amd/baseline3.json +++ b/tests/baselines/reference/project/baseline3/amd/baseline3.json @@ -8,6 +8,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "nestedModule.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/baseline3/node/baseline3.json b/tests/baselines/reference/project/baseline3/node/baseline3.json index 4229a725fea82..9ede04842b072 100644 --- a/tests/baselines/reference/project/baseline3/node/baseline3.json +++ b/tests/baselines/reference/project/baseline3/node/baseline3.json @@ -8,6 +8,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "nestedModule.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/cantFindTheModule/amd/cantFindTheModule.json b/tests/baselines/reference/project/cantFindTheModule/amd/cantFindTheModule.json index 0b515284e3a08..4bb76415a9cf5 100644 --- a/tests/baselines/reference/project/cantFindTheModule/amd/cantFindTheModule.json +++ b/tests/baselines/reference/project/cantFindTheModule/amd/cantFindTheModule.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/cantFindTheModule/node/cantFindTheModule.json b/tests/baselines/reference/project/cantFindTheModule/node/cantFindTheModule.json index 0b515284e3a08..4bb76415a9cf5 100644 --- a/tests/baselines/reference/project/cantFindTheModule/node/cantFindTheModule.json +++ b/tests/baselines/reference/project/cantFindTheModule/node/cantFindTheModule.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/circularReferencing/amd/circularReferencing.json b/tests/baselines/reference/project/circularReferencing/amd/circularReferencing.json index f6d7713ab7e87..e0adde3643b7c 100644 --- a/tests/baselines/reference/project/circularReferencing/amd/circularReferencing.json +++ b/tests/baselines/reference/project/circularReferencing/amd/circularReferencing.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "consume.ts" ], diff --git a/tests/baselines/reference/project/circularReferencing/node/circularReferencing.json b/tests/baselines/reference/project/circularReferencing/node/circularReferencing.json index f6d7713ab7e87..e0adde3643b7c 100644 --- a/tests/baselines/reference/project/circularReferencing/node/circularReferencing.json +++ b/tests/baselines/reference/project/circularReferencing/node/circularReferencing.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "consume.ts" ], diff --git a/tests/baselines/reference/project/circularReferencing2/amd/circularReferencing2.json b/tests/baselines/reference/project/circularReferencing2/amd/circularReferencing2.json index 5a7ca027ac36c..0ead0bf51703f 100644 --- a/tests/baselines/reference/project/circularReferencing2/amd/circularReferencing2.json +++ b/tests/baselines/reference/project/circularReferencing2/amd/circularReferencing2.json @@ -7,6 +7,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "b.ts", "c.ts", "a.ts" diff --git a/tests/baselines/reference/project/circularReferencing2/node/circularReferencing2.json b/tests/baselines/reference/project/circularReferencing2/node/circularReferencing2.json index 5a7ca027ac36c..0ead0bf51703f 100644 --- a/tests/baselines/reference/project/circularReferencing2/node/circularReferencing2.json +++ b/tests/baselines/reference/project/circularReferencing2/node/circularReferencing2.json @@ -7,6 +7,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "b.ts", "c.ts", "a.ts" diff --git a/tests/baselines/reference/project/declarationDir/amd/declarationDir.json b/tests/baselines/reference/project/declarationDir/amd/declarationDir.json index 17abb913af055..4214974858c8f 100644 --- a/tests/baselines/reference/project/declarationDir/amd/declarationDir.json +++ b/tests/baselines/reference/project/declarationDir/amd/declarationDir.json @@ -11,6 +11,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "subfolder/b.ts", "a.ts", "subfolder/c.ts" diff --git a/tests/baselines/reference/project/declarationDir/node/declarationDir.json b/tests/baselines/reference/project/declarationDir/node/declarationDir.json index 17abb913af055..4214974858c8f 100644 --- a/tests/baselines/reference/project/declarationDir/node/declarationDir.json +++ b/tests/baselines/reference/project/declarationDir/node/declarationDir.json @@ -11,6 +11,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "subfolder/b.ts", "a.ts", "subfolder/c.ts" diff --git a/tests/baselines/reference/project/declarationDir2/amd/declarationDir2.json b/tests/baselines/reference/project/declarationDir2/amd/declarationDir2.json index 94bc3b1268d9b..8dca1ee9e8229 100644 --- a/tests/baselines/reference/project/declarationDir2/amd/declarationDir2.json +++ b/tests/baselines/reference/project/declarationDir2/amd/declarationDir2.json @@ -12,6 +12,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "subfolder/b.ts", "a.ts", "subfolder/c.ts" diff --git a/tests/baselines/reference/project/declarationDir2/node/declarationDir2.json b/tests/baselines/reference/project/declarationDir2/node/declarationDir2.json index 94bc3b1268d9b..8dca1ee9e8229 100644 --- a/tests/baselines/reference/project/declarationDir2/node/declarationDir2.json +++ b/tests/baselines/reference/project/declarationDir2/node/declarationDir2.json @@ -12,6 +12,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "subfolder/b.ts", "a.ts", "subfolder/c.ts" diff --git a/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.json b/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.json index d33019d5c8117..9ff661cf1941d 100644 --- a/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.json +++ b/tests/baselines/reference/project/declarationDir3/amd/declarationDir3.json @@ -12,6 +12,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "subfolder/b.ts", "a.ts", "subfolder/c.ts" diff --git a/tests/baselines/reference/project/declarationDir3/node/declarationDir3.json b/tests/baselines/reference/project/declarationDir3/node/declarationDir3.json index 2b9afd1da7c93..eec7e0d434d53 100644 --- a/tests/baselines/reference/project/declarationDir3/node/declarationDir3.json +++ b/tests/baselines/reference/project/declarationDir3/node/declarationDir3.json @@ -12,6 +12,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "subfolder/b.ts", "a.ts", "subfolder/c.ts" diff --git a/tests/baselines/reference/project/declarationsCascadingImports/amd/declarationsCascadingImports.json b/tests/baselines/reference/project/declarationsCascadingImports/amd/declarationsCascadingImports.json index 95a06e2c43ce3..ec65857139eb5 100644 --- a/tests/baselines/reference/project/declarationsCascadingImports/amd/declarationsCascadingImports.json +++ b/tests/baselines/reference/project/declarationsCascadingImports/amd/declarationsCascadingImports.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsCascadingImports/node/declarationsCascadingImports.json b/tests/baselines/reference/project/declarationsCascadingImports/node/declarationsCascadingImports.json index 95a06e2c43ce3..ec65857139eb5 100644 --- a/tests/baselines/reference/project/declarationsCascadingImports/node/declarationsCascadingImports.json +++ b/tests/baselines/reference/project/declarationsCascadingImports/node/declarationsCascadingImports.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsExportNamespace/amd/declarationsExportNamespace.json b/tests/baselines/reference/project/declarationsExportNamespace/amd/declarationsExportNamespace.json index 377f2cd4301b0..5ee4c3bdaf343 100644 --- a/tests/baselines/reference/project/declarationsExportNamespace/amd/declarationsExportNamespace.json +++ b/tests/baselines/reference/project/declarationsExportNamespace/amd/declarationsExportNamespace.json @@ -13,6 +13,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.d.ts", "useModule.ts" ] diff --git a/tests/baselines/reference/project/declarationsExportNamespace/node/declarationsExportNamespace.json b/tests/baselines/reference/project/declarationsExportNamespace/node/declarationsExportNamespace.json index 377f2cd4301b0..5ee4c3bdaf343 100644 --- a/tests/baselines/reference/project/declarationsExportNamespace/node/declarationsExportNamespace.json +++ b/tests/baselines/reference/project/declarationsExportNamespace/node/declarationsExportNamespace.json @@ -13,6 +13,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.d.ts", "useModule.ts" ] diff --git a/tests/baselines/reference/project/declarationsGlobalImport/amd/declarationsGlobalImport.json b/tests/baselines/reference/project/declarationsGlobalImport/amd/declarationsGlobalImport.json index 4e4a276b105fd..0158e73ba48c1 100644 --- a/tests/baselines/reference/project/declarationsGlobalImport/amd/declarationsGlobalImport.json +++ b/tests/baselines/reference/project/declarationsGlobalImport/amd/declarationsGlobalImport.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "glo_m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsGlobalImport/node/declarationsGlobalImport.json b/tests/baselines/reference/project/declarationsGlobalImport/node/declarationsGlobalImport.json index 4e4a276b105fd..0158e73ba48c1 100644 --- a/tests/baselines/reference/project/declarationsGlobalImport/node/declarationsGlobalImport.json +++ b/tests/baselines/reference/project/declarationsGlobalImport/node/declarationsGlobalImport.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "glo_m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/declarationsImportedInPrivate.json b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/declarationsImportedInPrivate.json index 0bd0319bcf634..1fa264e37abe0 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/declarationsImportedInPrivate.json +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/declarationsImportedInPrivate.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "private_m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/node/declarationsImportedInPrivate.json b/tests/baselines/reference/project/declarationsImportedInPrivate/node/declarationsImportedInPrivate.json index 0bd0319bcf634..1fa264e37abe0 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/node/declarationsImportedInPrivate.json +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/node/declarationsImportedInPrivate.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "private_m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/declarationsImportedUseInFunction.json b/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/declarationsImportedUseInFunction.json index c08c9d47452a9..f216999671c73 100644 --- a/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/declarationsImportedUseInFunction.json +++ b/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/declarationsImportedUseInFunction.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "fncOnly_m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsImportedUseInFunction/node/declarationsImportedUseInFunction.json b/tests/baselines/reference/project/declarationsImportedUseInFunction/node/declarationsImportedUseInFunction.json index c08c9d47452a9..f216999671c73 100644 --- a/tests/baselines/reference/project/declarationsImportedUseInFunction/node/declarationsImportedUseInFunction.json +++ b/tests/baselines/reference/project/declarationsImportedUseInFunction/node/declarationsImportedUseInFunction.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "fncOnly_m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/declarationsIndirectImportShouldResultInError.json b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/declarationsIndirectImportShouldResultInError.json index d254eba8d0224..5f73363211da6 100644 --- a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/declarationsIndirectImportShouldResultInError.json +++ b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/declarationsIndirectImportShouldResultInError.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "m5.ts", "useModule.ts" diff --git a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/declarationsIndirectImportShouldResultInError.json b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/declarationsIndirectImportShouldResultInError.json index d254eba8d0224..5f73363211da6 100644 --- a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/declarationsIndirectImportShouldResultInError.json +++ b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/declarationsIndirectImportShouldResultInError.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "m5.ts", "useModule.ts" diff --git a/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/declarationsMultipleTimesImport.json b/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/declarationsMultipleTimesImport.json index 7c8fc1343c9aa..0dc7b2394b46e 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/declarationsMultipleTimesImport.json +++ b/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/declarationsMultipleTimesImport.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsMultipleTimesImport/node/declarationsMultipleTimesImport.json b/tests/baselines/reference/project/declarationsMultipleTimesImport/node/declarationsMultipleTimesImport.json index 7c8fc1343c9aa..0dc7b2394b46e 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesImport/node/declarationsMultipleTimesImport.json +++ b/tests/baselines/reference/project/declarationsMultipleTimesImport/node/declarationsMultipleTimesImport.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/declarationsMultipleTimesMultipleImport.json b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/declarationsMultipleTimesMultipleImport.json index f3f40e98c9858..9b162c147a5a0 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/declarationsMultipleTimesMultipleImport.json +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/declarationsMultipleTimesMultipleImport.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "m5.ts", "useModule.ts" diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/declarationsMultipleTimesMultipleImport.json b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/declarationsMultipleTimesMultipleImport.json index f3f40e98c9858..9b162c147a5a0 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/declarationsMultipleTimesMultipleImport.json +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/declarationsMultipleTimesMultipleImport.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "m5.ts", "useModule.ts" diff --git a/tests/baselines/reference/project/declarationsSimpleImport/amd/declarationsSimpleImport.json b/tests/baselines/reference/project/declarationsSimpleImport/amd/declarationsSimpleImport.json index 252ede2efb224..f4444e64474d9 100644 --- a/tests/baselines/reference/project/declarationsSimpleImport/amd/declarationsSimpleImport.json +++ b/tests/baselines/reference/project/declarationsSimpleImport/amd/declarationsSimpleImport.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declarationsSimpleImport/node/declarationsSimpleImport.json b/tests/baselines/reference/project/declarationsSimpleImport/node/declarationsSimpleImport.json index 252ede2efb224..f4444e64474d9 100644 --- a/tests/baselines/reference/project/declarationsSimpleImport/node/declarationsSimpleImport.json +++ b/tests/baselines/reference/project/declarationsSimpleImport/node/declarationsSimpleImport.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m4.ts", "useModule.ts" ], diff --git a/tests/baselines/reference/project/declareExportAdded/amd/declareExportAdded.json b/tests/baselines/reference/project/declareExportAdded/amd/declareExportAdded.json index 87b93e70ac876..d38d9ddc9a758 100644 --- a/tests/baselines/reference/project/declareExportAdded/amd/declareExportAdded.json +++ b/tests/baselines/reference/project/declareExportAdded/amd/declareExportAdded.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref.d.ts", "consumer.ts" ], diff --git a/tests/baselines/reference/project/declareExportAdded/node/declareExportAdded.json b/tests/baselines/reference/project/declareExportAdded/node/declareExportAdded.json index 87b93e70ac876..d38d9ddc9a758 100644 --- a/tests/baselines/reference/project/declareExportAdded/node/declareExportAdded.json +++ b/tests/baselines/reference/project/declareExportAdded/node/declareExportAdded.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref.d.ts", "consumer.ts" ], diff --git a/tests/baselines/reference/project/declareVariableCollision/amd/declareVariableCollision.json b/tests/baselines/reference/project/declareVariableCollision/amd/declareVariableCollision.json index 1209d18100e4f..65ccf17f6919e 100644 --- a/tests/baselines/reference/project/declareVariableCollision/amd/declareVariableCollision.json +++ b/tests/baselines/reference/project/declareVariableCollision/amd/declareVariableCollision.json @@ -8,6 +8,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.d.ts", "in1.d.ts", "in2.d.ts" diff --git a/tests/baselines/reference/project/declareVariableCollision/node/declareVariableCollision.json b/tests/baselines/reference/project/declareVariableCollision/node/declareVariableCollision.json index 1209d18100e4f..65ccf17f6919e 100644 --- a/tests/baselines/reference/project/declareVariableCollision/node/declareVariableCollision.json +++ b/tests/baselines/reference/project/declareVariableCollision/node/declareVariableCollision.json @@ -8,6 +8,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.d.ts", "in1.d.ts", "in2.d.ts" diff --git a/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDir/amd/defaultExcludeNodeModulesAndOutDir.json b/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDir/amd/defaultExcludeNodeModulesAndOutDir.json index 37ce942ebd408..91920a455e9d4 100644 --- a/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDir/amd/defaultExcludeNodeModulesAndOutDir.json +++ b/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDir/amd/defaultExcludeNodeModulesAndOutDir.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDir/node/defaultExcludeNodeModulesAndOutDir.json b/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDir/node/defaultExcludeNodeModulesAndOutDir.json index 37ce942ebd408..91920a455e9d4 100644 --- a/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDir/node/defaultExcludeNodeModulesAndOutDir.json +++ b/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDir/node/defaultExcludeNodeModulesAndOutDir.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDirWithAllowJS/amd/defaultExcludeNodeModulesAndOutDirWithAllowJS.json b/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDirWithAllowJS/amd/defaultExcludeNodeModulesAndOutDirWithAllowJS.json index 039e08b7e748f..fff1ea080239e 100644 --- a/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDirWithAllowJS/amd/defaultExcludeNodeModulesAndOutDirWithAllowJS.json +++ b/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDirWithAllowJS/amd/defaultExcludeNodeModulesAndOutDirWithAllowJS.json @@ -4,6 +4,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDirWithAllowJS/node/defaultExcludeNodeModulesAndOutDirWithAllowJS.json b/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDirWithAllowJS/node/defaultExcludeNodeModulesAndOutDirWithAllowJS.json index 039e08b7e748f..fff1ea080239e 100644 --- a/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDirWithAllowJS/node/defaultExcludeNodeModulesAndOutDirWithAllowJS.json +++ b/tests/baselines/reference/project/defaultExcludeNodeModulesAndOutDirWithAllowJS/node/defaultExcludeNodeModulesAndOutDirWithAllowJS.json @@ -4,6 +4,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDir/amd/defaultExcludeNodeModulesAndRelativePathOutDir.json b/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDir/amd/defaultExcludeNodeModulesAndRelativePathOutDir.json index 9671ff57456d3..e43be5d0f705e 100644 --- a/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDir/amd/defaultExcludeNodeModulesAndRelativePathOutDir.json +++ b/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDir/amd/defaultExcludeNodeModulesAndRelativePathOutDir.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDir/node/defaultExcludeNodeModulesAndRelativePathOutDir.json b/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDir/node/defaultExcludeNodeModulesAndRelativePathOutDir.json index 9671ff57456d3..e43be5d0f705e 100644 --- a/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDir/node/defaultExcludeNodeModulesAndRelativePathOutDir.json +++ b/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDir/node/defaultExcludeNodeModulesAndRelativePathOutDir.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS/amd/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS.json b/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS/amd/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS.json index f467c0b1d3985..5af8a7f08ce3c 100644 --- a/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS/amd/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS.json +++ b/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS/amd/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS.json @@ -4,6 +4,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS/node/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS.json b/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS/node/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS.json index f467c0b1d3985..5af8a7f08ce3c 100644 --- a/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS/node/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS.json +++ b/tests/baselines/reference/project/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS/node/defaultExcludeNodeModulesAndRelativePathOutDirWithAllowJS.json @@ -4,6 +4,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/defaultExcludeOnlyNodeModules/amd/defaultExcludeOnlyNodeModules.json b/tests/baselines/reference/project/defaultExcludeOnlyNodeModules/amd/defaultExcludeOnlyNodeModules.json index cc9075b55f3d3..18778e7387bd8 100644 --- a/tests/baselines/reference/project/defaultExcludeOnlyNodeModules/amd/defaultExcludeOnlyNodeModules.json +++ b/tests/baselines/reference/project/defaultExcludeOnlyNodeModules/amd/defaultExcludeOnlyNodeModules.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/defaultExcludeOnlyNodeModules/node/defaultExcludeOnlyNodeModules.json b/tests/baselines/reference/project/defaultExcludeOnlyNodeModules/node/defaultExcludeOnlyNodeModules.json index cc9075b55f3d3..18778e7387bd8 100644 --- a/tests/baselines/reference/project/defaultExcludeOnlyNodeModules/node/defaultExcludeOnlyNodeModules.json +++ b/tests/baselines/reference/project/defaultExcludeOnlyNodeModules/node/defaultExcludeOnlyNodeModules.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/emitDecoratorMetadataCommonJSISolatedModules.json b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/emitDecoratorMetadataCommonJSISolatedModules.json index 75b1a829d4c9a..6848189cda4a5 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/emitDecoratorMetadataCommonJSISolatedModules.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/emitDecoratorMetadataCommonJSISolatedModules.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/emitDecoratorMetadataCommonJSISolatedModules.json b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/emitDecoratorMetadataCommonJSISolatedModules.json index 75b1a829d4c9a..6848189cda4a5 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/emitDecoratorMetadataCommonJSISolatedModules.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/emitDecoratorMetadataCommonJSISolatedModules.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.json b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.json index 07ec3b5ee88bf..121fb3a5c940e 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.json b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.json index 07ec3b5ee88bf..121fb3a5c940e 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/emitDecoratorMetadataSystemJS.json b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/emitDecoratorMetadataSystemJS.json index 921792b4d5834..dc03355fa1c76 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/emitDecoratorMetadataSystemJS.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/emitDecoratorMetadataSystemJS.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/emitDecoratorMetadataSystemJS.json b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/emitDecoratorMetadataSystemJS.json index 921792b4d5834..dc03355fa1c76 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/emitDecoratorMetadataSystemJS.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/emitDecoratorMetadataSystemJS.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/emitDecoratorMetadataSystemJSISolatedModules.json b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/emitDecoratorMetadataSystemJSISolatedModules.json index bf61617e9ee43..06a9aeb0c6ff1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/emitDecoratorMetadataSystemJSISolatedModules.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/emitDecoratorMetadataSystemJSISolatedModules.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/emitDecoratorMetadataSystemJSISolatedModules.json b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/emitDecoratorMetadataSystemJSISolatedModules.json index bf61617e9ee43..06a9aeb0c6ff1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/emitDecoratorMetadataSystemJSISolatedModules.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/emitDecoratorMetadataSystemJSISolatedModules.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.json b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.json index f8bf277afc9b7..12bdf4ad87c9e 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.json b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.json index f8bf277afc9b7..12bdf4ad87c9e 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.json +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.json @@ -5,6 +5,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/extReferencingExtAndInt/amd/extReferencingExtAndInt.json b/tests/baselines/reference/project/extReferencingExtAndInt/amd/extReferencingExtAndInt.json index a9cb45644300b..4e831c70cc536 100644 --- a/tests/baselines/reference/project/extReferencingExtAndInt/amd/extReferencingExtAndInt.json +++ b/tests/baselines/reference/project/extReferencingExtAndInt/amd/extReferencingExtAndInt.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "internal.ts", "external2.ts", "external.ts" diff --git a/tests/baselines/reference/project/extReferencingExtAndInt/node/extReferencingExtAndInt.json b/tests/baselines/reference/project/extReferencingExtAndInt/node/extReferencingExtAndInt.json index a9cb45644300b..4e831c70cc536 100644 --- a/tests/baselines/reference/project/extReferencingExtAndInt/node/extReferencingExtAndInt.json +++ b/tests/baselines/reference/project/extReferencingExtAndInt/node/extReferencingExtAndInt.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "internal.ts", "external2.ts", "external.ts" diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.json b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.json index 01f3f77cd8f90..6c1b0208c08f8 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.json +++ b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "internal2.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.json b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.json index 01f3f77cd8f90..6c1b0208c08f8 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.json +++ b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "internal2.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.json b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.json index 48214f84c42c3..e44762caccbb9 100644 --- a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.json +++ b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.json @@ -7,7 +7,9 @@ "a.ts" ], "resolvedInputFiles": [ - "lib.es5.d.ts" + "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts" ], "emittedFiles": [] } \ No newline at end of file diff --git a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.json b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.json index 48214f84c42c3..e44762caccbb9 100644 --- a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.json +++ b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.json @@ -7,7 +7,9 @@ "a.ts" ], "resolvedInputFiles": [ - "lib.es5.d.ts" + "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts" ], "emittedFiles": [] } \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/amd/jsFileCompilationDifferentNamesNotSpecified.json b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/amd/jsFileCompilationDifferentNamesNotSpecified.json index be94fc66a8c64..2a08e8c8281fe 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/amd/jsFileCompilationDifferentNamesNotSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/amd/jsFileCompilationDifferentNamesNotSpecified.json @@ -6,6 +6,8 @@ "project": "DifferentNamesNotSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "DifferentNamesNotSpecified/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/node/jsFileCompilationDifferentNamesNotSpecified.json b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/node/jsFileCompilationDifferentNamesNotSpecified.json index be94fc66a8c64..2a08e8c8281fe 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/node/jsFileCompilationDifferentNamesNotSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/node/jsFileCompilationDifferentNamesNotSpecified.json @@ -6,6 +6,8 @@ "project": "DifferentNamesNotSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "DifferentNamesNotSpecified/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.json index c46555642c029..07a76b67d5f50 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "DifferentNamesNotSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "DifferentNamesNotSpecifiedWithAllowJs/a.ts", "DifferentNamesNotSpecifiedWithAllowJs/b.js" ], diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.json index c46555642c029..07a76b67d5f50 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "DifferentNamesNotSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "DifferentNamesNotSpecifiedWithAllowJs/a.ts", "DifferentNamesNotSpecifiedWithAllowJs/b.js" ], diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.json b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.json index 502060573f515..95d8a687b9797 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.json @@ -6,6 +6,8 @@ "project": "DifferentNamesSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "DifferentNamesSpecified/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.json b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.json index 502060573f515..95d8a687b9797 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.json @@ -6,6 +6,8 @@ "project": "DifferentNamesSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "DifferentNamesSpecified/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.json index 8cf81d3ff9b26..0906672000255 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "DifferentNamesSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "DifferentNamesSpecifiedWithAllowJs/a.ts", "DifferentNamesSpecifiedWithAllowJs/b.js" ], diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.json index 8cf81d3ff9b26..0906672000255 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "DifferentNamesSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "DifferentNamesSpecifiedWithAllowJs/a.ts", "DifferentNamesSpecifiedWithAllowJs/b.js" ], diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecified/amd/jsFileCompilationSameNameDTsSpecified.json b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecified/amd/jsFileCompilationSameNameDTsSpecified.json index 9e7ef540d5386..b49d96d257cb1 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecified/amd/jsFileCompilationSameNameDTsSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecified/amd/jsFileCompilationSameNameDTsSpecified.json @@ -6,6 +6,8 @@ "project": "SameNameDTsSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameDTsSpecified/a.d.ts" ], "emittedFiles": [] diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecified/node/jsFileCompilationSameNameDTsSpecified.json b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecified/node/jsFileCompilationSameNameDTsSpecified.json index 9e7ef540d5386..b49d96d257cb1 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecified/node/jsFileCompilationSameNameDTsSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecified/node/jsFileCompilationSameNameDTsSpecified.json @@ -6,6 +6,8 @@ "project": "SameNameDTsSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameDTsSpecified/a.d.ts" ], "emittedFiles": [] diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.json index 9be7157af9964..ba0f9fa2a251a 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "SameNameDTsSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameDTsSpecifiedWithAllowJs/a.d.ts" ], "emittedFiles": [] diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/node/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/node/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.json index 9be7157af9964..ba0f9fa2a251a 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/node/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/node/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "SameNameDTsSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameDTsSpecifiedWithAllowJs/a.d.ts" ], "emittedFiles": [] diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecified/amd/jsFileCompilationSameNameDtsNotSpecified.json b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecified/amd/jsFileCompilationSameNameDtsNotSpecified.json index e29f95b2b96fd..0f15f8581d0e0 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecified/amd/jsFileCompilationSameNameDtsNotSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecified/amd/jsFileCompilationSameNameDtsNotSpecified.json @@ -6,6 +6,8 @@ "project": "SameNameDTsNotSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameDTsNotSpecified/a.d.ts" ], "emittedFiles": [] diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecified/node/jsFileCompilationSameNameDtsNotSpecified.json b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecified/node/jsFileCompilationSameNameDtsNotSpecified.json index e29f95b2b96fd..0f15f8581d0e0 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecified/node/jsFileCompilationSameNameDtsNotSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecified/node/jsFileCompilationSameNameDtsNotSpecified.json @@ -6,6 +6,8 @@ "project": "SameNameDTsNotSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameDTsNotSpecified/a.d.ts" ], "emittedFiles": [] diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.json index ebd4263bc1a63..90e73c5929972 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "SameNameDTsNotSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameDTsNotSpecifiedWithAllowJs/a.d.ts", "SameNameDTsNotSpecifiedWithAllowJs/a.js" ], diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.json index ebd4263bc1a63..90e73c5929972 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "SameNameDTsNotSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameDTsNotSpecifiedWithAllowJs/a.d.ts", "SameNameDTsNotSpecifiedWithAllowJs/a.js" ], diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecified/amd/jsFileCompilationSameNameFilesNotSpecified.json b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecified/amd/jsFileCompilationSameNameFilesNotSpecified.json index 4c001c1895dc9..fab79425254ee 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecified/amd/jsFileCompilationSameNameFilesNotSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecified/amd/jsFileCompilationSameNameFilesNotSpecified.json @@ -6,6 +6,8 @@ "project": "SameNameFilesNotSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameFilesNotSpecified/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecified/node/jsFileCompilationSameNameFilesNotSpecified.json b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecified/node/jsFileCompilationSameNameFilesNotSpecified.json index 4c001c1895dc9..fab79425254ee 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecified/node/jsFileCompilationSameNameFilesNotSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecified/node/jsFileCompilationSameNameFilesNotSpecified.json @@ -6,6 +6,8 @@ "project": "SameNameFilesNotSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameFilesNotSpecified/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.json index bb39a53bd9ef0..85a6f59946b6f 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "SameNameFilesNotSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameFilesNotSpecifiedWithAllowJs/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.json index bb39a53bd9ef0..85a6f59946b6f 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "SameNameFilesNotSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameFilesNotSpecifiedWithAllowJs/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecified/amd/jsFileCompilationSameNameFilesSpecified.json b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecified/amd/jsFileCompilationSameNameFilesSpecified.json index 37fa1c42071d2..9688907add484 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecified/amd/jsFileCompilationSameNameFilesSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecified/amd/jsFileCompilationSameNameFilesSpecified.json @@ -6,6 +6,8 @@ "project": "SameNameTsSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameTsSpecified/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecified/node/jsFileCompilationSameNameFilesSpecified.json b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecified/node/jsFileCompilationSameNameFilesSpecified.json index 37fa1c42071d2..9688907add484 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecified/node/jsFileCompilationSameNameFilesSpecified.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecified/node/jsFileCompilationSameNameFilesSpecified.json @@ -6,6 +6,8 @@ "project": "SameNameTsSpecified", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameTsSpecified/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.json index 426bbe37374e0..5b40f09f36c75 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "SameNameTsSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameTsSpecifiedWithAllowJs/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.json b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.json index 426bbe37374e0..5b40f09f36c75 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.json +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.json @@ -6,6 +6,8 @@ "project": "SameNameTsSpecifiedWithAllowJs", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "SameNameTsSpecifiedWithAllowJs/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/mapRootAbsolutePathMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/mapRootAbsolutePathMixedSubfolderNoOutdir.json index c384f244bb3c8..1ab0b95ea404d 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/mapRootAbsolutePathMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/mapRootAbsolutePathMixedSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/mapRootAbsolutePathMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/mapRootAbsolutePathMixedSubfolderNoOutdir.json index c384f244bb3c8..1ab0b95ea404d 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/mapRootAbsolutePathMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/mapRootAbsolutePathMixedSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json index c5294bdb084ec..f2a9aeb56aa97 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json index c5294bdb084ec..f2a9aeb56aa97 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json index baab17cf2d64f..c6b34436561dd 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json index baab17cf2d64f..c6b34436561dd 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 124c90dc1d738..5e94306523fd3 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -13,6 +13,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 124c90dc1d738..5e94306523fd3 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -13,6 +13,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderNoOutdir/amd/mapRootAbsolutePathModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderNoOutdir/amd/mapRootAbsolutePathModuleMultifolderNoOutdir.json index f41bf69a9fd9d..09ecf27ea6905 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderNoOutdir/amd/mapRootAbsolutePathModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderNoOutdir/amd/mapRootAbsolutePathModuleMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderNoOutdir/node/mapRootAbsolutePathModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderNoOutdir/node/mapRootAbsolutePathModuleMultifolderNoOutdir.json index f41bf69a9fd9d..09ecf27ea6905 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderNoOutdir/node/mapRootAbsolutePathModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderNoOutdir/node/mapRootAbsolutePathModuleMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json index a23115404e9b2..344393c631cc7 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json index a23115404e9b2..344393c631cc7 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json index 826fe0c8c8580..cd4835bbf7f51 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json index ca3367781afb6..9a0e4f121725f 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/mapRootAbsolutePathModuleMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleNoOutdir/amd/mapRootAbsolutePathModuleSimpleNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleNoOutdir/amd/mapRootAbsolutePathModuleSimpleNoOutdir.json index 7a14180cf664f..34768bd676dc2 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleNoOutdir/amd/mapRootAbsolutePathModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleNoOutdir/amd/mapRootAbsolutePathModuleSimpleNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleNoOutdir/node/mapRootAbsolutePathModuleSimpleNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleNoOutdir/node/mapRootAbsolutePathModuleSimpleNoOutdir.json index 7a14180cf664f..34768bd676dc2 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleNoOutdir/node/mapRootAbsolutePathModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleNoOutdir/node/mapRootAbsolutePathModuleSimpleNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json index 63f891de131d6..657ba7585fc90 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json index 63f891de131d6..657ba7585fc90 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json index 87354fd283c01..60f07373d3144 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json index bc140562415c7..450277c7af270 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSimpleSpecifyOutputFile/node/mapRootAbsolutePathModuleSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderNoOutdir/amd/mapRootAbsolutePathModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderNoOutdir/amd/mapRootAbsolutePathModuleSubfolderNoOutdir.json index 05928b51d904a..eadb8fec9b931 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderNoOutdir/amd/mapRootAbsolutePathModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderNoOutdir/amd/mapRootAbsolutePathModuleSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderNoOutdir/node/mapRootAbsolutePathModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderNoOutdir/node/mapRootAbsolutePathModuleSubfolderNoOutdir.json index 05928b51d904a..eadb8fec9b931 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderNoOutdir/node/mapRootAbsolutePathModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderNoOutdir/node/mapRootAbsolutePathModuleSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json index 65644350de869..864c4119bb625 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json index 65644350de869..864c4119bb625 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json index af131044b52bd..a54ef73304011 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json index 54a4040be8b03..928272566aadb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/mapRootAbsolutePathModuleSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/mapRootAbsolutePathMultifolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/mapRootAbsolutePathMultifolderNoOutdir.json index a0415bdf3bbe8..1b941103759fb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/mapRootAbsolutePathMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/mapRootAbsolutePathMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/mapRootAbsolutePathMultifolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/mapRootAbsolutePathMultifolderNoOutdir.json index a0415bdf3bbe8..1b941103759fb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/mapRootAbsolutePathMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/mapRootAbsolutePathMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.json index 18cb305466ba9..027ddf5273957 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.json index 18cb305466ba9..027ddf5273957 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathMultifolderSpecifyOutputFile.json index 4c161690a098e..bc11e112cf4b9 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.json index 4c161690a098e..bc11e112cf4b9 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/mapRootAbsolutePathSimpleNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/mapRootAbsolutePathSimpleNoOutdir.json index 904f0562dbb72..0de76b2a8a462 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/mapRootAbsolutePathSimpleNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/mapRootAbsolutePathSimpleNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/mapRootAbsolutePathSimpleNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/mapRootAbsolutePathSimpleNoOutdir.json index 904f0562dbb72..0de76b2a8a462 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/mapRootAbsolutePathSimpleNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/mapRootAbsolutePathSimpleNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathSimpleSpecifyOutputDirectory.json index 49698d06edf35..29953e63de0f7 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathSimpleSpecifyOutputDirectory.json index 49698d06edf35..29953e63de0f7 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/mapRootAbsolutePathSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/mapRootAbsolutePathSimpleSpecifyOutputFile.json index 40be449684dcc..33c73ff1feb61 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/mapRootAbsolutePathSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/mapRootAbsolutePathSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.json index 40be449684dcc..33c73ff1feb61 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileNoOutdir/amd/mapRootAbsolutePathSingleFileNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileNoOutdir/amd/mapRootAbsolutePathSingleFileNoOutdir.json index 121790c17dfdf..e653e2ca60cde 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileNoOutdir/amd/mapRootAbsolutePathSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileNoOutdir/amd/mapRootAbsolutePathSingleFileNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileNoOutdir/node/mapRootAbsolutePathSingleFileNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileNoOutdir/node/mapRootAbsolutePathSingleFileNoOutdir.json index 121790c17dfdf..e653e2ca60cde 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileNoOutdir/node/mapRootAbsolutePathSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileNoOutdir/node/mapRootAbsolutePathSingleFileNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputDirectory/amd/mapRootAbsolutePathSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputDirectory/amd/mapRootAbsolutePathSingleFileSpecifyOutputDirectory.json index 7cf1db1d5ee08..841f6a369b2e3 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputDirectory/amd/mapRootAbsolutePathSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputDirectory/amd/mapRootAbsolutePathSingleFileSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputDirectory/node/mapRootAbsolutePathSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputDirectory/node/mapRootAbsolutePathSingleFileSpecifyOutputDirectory.json index 7cf1db1d5ee08..841f6a369b2e3 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputDirectory/node/mapRootAbsolutePathSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputDirectory/node/mapRootAbsolutePathSingleFileSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/amd/mapRootAbsolutePathSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/amd/mapRootAbsolutePathSingleFileSpecifyOutputFile.json index f2cf449c4b0c8..818e5df89fdeb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/amd/mapRootAbsolutePathSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/amd/mapRootAbsolutePathSingleFileSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.json index f2cf449c4b0c8..818e5df89fdeb 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSingleFileSpecifyOutputFile/node/mapRootAbsolutePathSingleFileSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/mapRootAbsolutePathSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/mapRootAbsolutePathSubfolderNoOutdir.json index 141417a89f563..148b2606c16d5 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/mapRootAbsolutePathSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/mapRootAbsolutePathSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/mapRootAbsolutePathSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/mapRootAbsolutePathSubfolderNoOutdir.json index 141417a89f563..148b2606c16d5 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/mapRootAbsolutePathSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/mapRootAbsolutePathSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.json index 03fde77d639a5..299c72fa3c9ee 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.json index 03fde77d639a5..299c72fa3c9ee 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathSubfolderSpecifyOutputFile.json index 3cc9bcaac0138..701d236d0c921 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.json index 3cc9bcaac0138..701d236d0c921 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveMapRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/mapRootRelativePathMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/mapRootRelativePathMixedSubfolderNoOutdir.json index 97ebbc9c2b65b..5ed8625f1874e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/mapRootRelativePathMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/mapRootRelativePathMixedSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/mapRootRelativePathMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/mapRootRelativePathMixedSubfolderNoOutdir.json index 97ebbc9c2b65b..5ed8625f1874e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/mapRootRelativePathMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/mapRootRelativePathMixedSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.json index 15de8b0aa60b9..2936add88e5d8 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.json index 15de8b0aa60b9..2936add88e5d8 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json index 34f6378876b74..963ddc6cf78d3 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json index 34f6378876b74..963ddc6cf78d3 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index f633f198cd485..8160e95c62e57 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -12,6 +12,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index f633f198cd485..8160e95c62e57 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -12,6 +12,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderNoOutdir/amd/mapRootRelativePathModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderNoOutdir/amd/mapRootRelativePathModuleMultifolderNoOutdir.json index 4750a9a36235f..c4ce3aa0f7472 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderNoOutdir/amd/mapRootRelativePathModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderNoOutdir/amd/mapRootRelativePathModuleMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderNoOutdir/node/mapRootRelativePathModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderNoOutdir/node/mapRootRelativePathModuleMultifolderNoOutdir.json index 4750a9a36235f..c4ce3aa0f7472 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderNoOutdir/node/mapRootRelativePathModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderNoOutdir/node/mapRootRelativePathModuleMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory.json index 7753040f5178f..5503023d7b76a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory/node/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory/node/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory.json index 7753040f5178f..5503023d7b76a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory/node/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory/node/mapRootRelativePathModuleMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json index ea4674bfdc6cb..8663fb676df13 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/amd/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json index 8a67a80866d3f..5ae718014ef7b 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleMultifolderSpecifyOutputFile/node/mapRootRelativePathModuleMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleNoOutdir/amd/mapRootRelativePathModuleSimpleNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleNoOutdir/amd/mapRootRelativePathModuleSimpleNoOutdir.json index 1818ad4b8e08c..5fad1b73f5580 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleNoOutdir/amd/mapRootRelativePathModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleNoOutdir/amd/mapRootRelativePathModuleSimpleNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleNoOutdir/node/mapRootRelativePathModuleSimpleNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleNoOutdir/node/mapRootRelativePathModuleSimpleNoOutdir.json index 1818ad4b8e08c..5fad1b73f5580 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleNoOutdir/node/mapRootRelativePathModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleNoOutdir/node/mapRootRelativePathModuleSimpleNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputDirectory/amd/mapRootRelativePathModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputDirectory/amd/mapRootRelativePathModuleSimpleSpecifyOutputDirectory.json index 5673ec56f85a3..be94d728d42e3 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputDirectory/amd/mapRootRelativePathModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputDirectory/amd/mapRootRelativePathModuleSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputDirectory/node/mapRootRelativePathModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputDirectory/node/mapRootRelativePathModuleSimpleSpecifyOutputDirectory.json index 5673ec56f85a3..be94d728d42e3 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputDirectory/node/mapRootRelativePathModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputDirectory/node/mapRootRelativePathModuleSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.json index 2e3765fafdcf5..76eeb95324c93 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/amd/mapRootRelativePathModuleSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.json index cfbf2545a2cdd..30faceeb43d15 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSimpleSpecifyOutputFile/node/mapRootRelativePathModuleSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderNoOutdir/amd/mapRootRelativePathModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderNoOutdir/amd/mapRootRelativePathModuleSubfolderNoOutdir.json index 645bbf4bd7306..06268f9e62544 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderNoOutdir/amd/mapRootRelativePathModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderNoOutdir/amd/mapRootRelativePathModuleSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderNoOutdir/node/mapRootRelativePathModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderNoOutdir/node/mapRootRelativePathModuleSubfolderNoOutdir.json index 645bbf4bd7306..06268f9e62544 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderNoOutdir/node/mapRootRelativePathModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderNoOutdir/node/mapRootRelativePathModuleSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory.json index a5768712dfc0f..18d69858a1afd 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory/node/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory/node/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory.json index a5768712dfc0f..18d69858a1afd 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory/node/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory/node/mapRootRelativePathModuleSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json index 6249ba6684874..eaaf066b6059a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/amd/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json index 2ef8fc7db4aa9..3f9c7b37c9000 100644 --- a/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathModuleSubfolderSpecifyOutputFile/node/mapRootRelativePathModuleSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/mapRootRelativePathMultifolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/mapRootRelativePathMultifolderNoOutdir.json index f8ba39eb24761..fcff52e05e85a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/mapRootRelativePathMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/mapRootRelativePathMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/mapRootRelativePathMultifolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/mapRootRelativePathMultifolderNoOutdir.json index f8ba39eb24761..fcff52e05e85a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/mapRootRelativePathMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/mapRootRelativePathMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathMultifolderSpecifyOutputDirectory.json index 0c46f62d41d26..49302ac140810 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/mapRootRelativePathMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/mapRootRelativePathMultifolderSpecifyOutputDirectory.json index 0c46f62d41d26..49302ac140810 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/mapRootRelativePathMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/mapRootRelativePathMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.json index a855ef1f35c4c..f51c8f0a91251 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.json index a855ef1f35c4c..f51c8f0a91251 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/mapRootRelativePathSimpleNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/mapRootRelativePathSimpleNoOutdir.json index 3d13b8aa7bf7d..778f5091ba142 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/mapRootRelativePathSimpleNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/mapRootRelativePathSimpleNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/mapRootRelativePathSimpleNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/mapRootRelativePathSimpleNoOutdir.json index 3d13b8aa7bf7d..778f5091ba142 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/mapRootRelativePathSimpleNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/mapRootRelativePathSimpleNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/mapRootRelativePathSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/mapRootRelativePathSimpleSpecifyOutputDirectory.json index aa394560b4738..ffe4d88702961 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/mapRootRelativePathSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/mapRootRelativePathSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/mapRootRelativePathSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/mapRootRelativePathSimpleSpecifyOutputDirectory.json index aa394560b4738..ffe4d88702961 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/mapRootRelativePathSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/mapRootRelativePathSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/mapRootRelativePathSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/mapRootRelativePathSimpleSpecifyOutputFile.json index 95fa386fab55a..5ca065cdf0ee6 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/mapRootRelativePathSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/mapRootRelativePathSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.json index 95fa386fab55a..5ca065cdf0ee6 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSingleFileNoOutdir/amd/mapRootRelativePathSingleFileNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathSingleFileNoOutdir/amd/mapRootRelativePathSingleFileNoOutdir.json index 48c0a2cbe1944..a107330d658d9 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSingleFileNoOutdir/amd/mapRootRelativePathSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathSingleFileNoOutdir/amd/mapRootRelativePathSingleFileNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootRelativePathSingleFileNoOutdir/node/mapRootRelativePathSingleFileNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathSingleFileNoOutdir/node/mapRootRelativePathSingleFileNoOutdir.json index 48c0a2cbe1944..a107330d658d9 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSingleFileNoOutdir/node/mapRootRelativePathSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathSingleFileNoOutdir/node/mapRootRelativePathSingleFileNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputDirectory/amd/mapRootRelativePathSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputDirectory/amd/mapRootRelativePathSingleFileSpecifyOutputDirectory.json index cca2801a33176..544fddd1aea03 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputDirectory/amd/mapRootRelativePathSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputDirectory/amd/mapRootRelativePathSingleFileSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputDirectory/node/mapRootRelativePathSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputDirectory/node/mapRootRelativePathSingleFileSpecifyOutputDirectory.json index cca2801a33176..544fddd1aea03 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputDirectory/node/mapRootRelativePathSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputDirectory/node/mapRootRelativePathSingleFileSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/amd/mapRootRelativePathSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/amd/mapRootRelativePathSingleFileSpecifyOutputFile.json index 9e17526313097..eabd30d4b7aa6 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/amd/mapRootRelativePathSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/amd/mapRootRelativePathSingleFileSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.json index 9e17526313097..eabd30d4b7aa6 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathSingleFileSpecifyOutputFile/node/mapRootRelativePathSingleFileSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/mapRootRelativePathSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/mapRootRelativePathSubfolderNoOutdir.json index 436f1af69b76c..e046c89c6fd7e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/mapRootRelativePathSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/mapRootRelativePathSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/mapRootRelativePathSubfolderNoOutdir.json b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/mapRootRelativePathSubfolderNoOutdir.json index 436f1af69b76c..e046c89c6fd7e 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/mapRootRelativePathSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/mapRootRelativePathSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathSubfolderSpecifyOutputDirectory.json index b7aa1ac6c3bf2..7a760aeed6e42 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/mapRootRelativePathSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/mapRootRelativePathSubfolderSpecifyOutputDirectory.json index b7aa1ac6c3bf2..7a760aeed6e42 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/mapRootRelativePathSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/mapRootRelativePathSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/mapRootRelativePathSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/mapRootRelativePathSubfolderSpecifyOutputFile.json index cbf9e9113fcfd..43907c826b3f3 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/mapRootRelativePathSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/mapRootRelativePathSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.json index cbf9e9113fcfd..43907c826b3f3 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.json b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.json index 7ed8aefbc0cdd..3626df6e7b3ce 100644 --- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.json +++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.json @@ -8,6 +8,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.json b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.json index 7ed8aefbc0cdd..3626df6e7b3ce 100644 --- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.json +++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.json @@ -8,6 +8,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.json b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.json index aacd7addc7826..4295658406485 100644 --- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.json +++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.json @@ -7,6 +7,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.json b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.json index aacd7addc7826..4295658406485 100644 --- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.json +++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.json @@ -7,6 +7,8 @@ "mapRoot": "../mapFiles", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/maprootUrlMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/maprootUrlMixedSubfolderNoOutdir.json index cd209523da883..28d5d8a562868 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/maprootUrlMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/maprootUrlMixedSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/maprootUrlMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/maprootUrlMixedSubfolderNoOutdir.json index cd209523da883..28d5d8a562868 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/maprootUrlMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/maprootUrlMixedSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputDirectory.json index 730096ddc9894..ff578111c3dc9 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputDirectory.json index 730096ddc9894..ff578111c3dc9 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.json index 3eb104497982a..edb5ba808514d 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.json index 3eb104497982a..edb5ba808514d 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 59f5abc1a39d1..7b967675abfda 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -12,6 +12,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 59f5abc1a39d1..7b967675abfda 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -12,6 +12,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderNoOutdir/amd/maprootUrlModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlModuleMultifolderNoOutdir/amd/maprootUrlModuleMultifolderNoOutdir.json index be8aa65e5beca..4ef2816c00208 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderNoOutdir/amd/maprootUrlModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderNoOutdir/amd/maprootUrlModuleMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderNoOutdir/node/maprootUrlModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlModuleMultifolderNoOutdir/node/maprootUrlModuleMultifolderNoOutdir.json index be8aa65e5beca..4ef2816c00208 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderNoOutdir/node/maprootUrlModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderNoOutdir/node/maprootUrlModuleMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputDirectory/amd/maprootUrlModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputDirectory/amd/maprootUrlModuleMultifolderSpecifyOutputDirectory.json index d436c0adb20ec..1c707e92c7887 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputDirectory/amd/maprootUrlModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputDirectory/amd/maprootUrlModuleMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputDirectory/node/maprootUrlModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputDirectory/node/maprootUrlModuleMultifolderSpecifyOutputDirectory.json index d436c0adb20ec..1c707e92c7887 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputDirectory/node/maprootUrlModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputDirectory/node/maprootUrlModuleMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.json index 5defee5d62828..2b1eadcbd1b97 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlModuleMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.json index af083f7ecc7ca..999415d5deeae 100644 --- a/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlModuleMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleNoOutdir/amd/maprootUrlModuleSimpleNoOutdir.json b/tests/baselines/reference/project/maprootUrlModuleSimpleNoOutdir/amd/maprootUrlModuleSimpleNoOutdir.json index 403b231a829d4..eaf89425dde47 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleNoOutdir/amd/maprootUrlModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleNoOutdir/amd/maprootUrlModuleSimpleNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleNoOutdir/node/maprootUrlModuleSimpleNoOutdir.json b/tests/baselines/reference/project/maprootUrlModuleSimpleNoOutdir/node/maprootUrlModuleSimpleNoOutdir.json index 403b231a829d4..eaf89425dde47 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleNoOutdir/node/maprootUrlModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleNoOutdir/node/maprootUrlModuleSimpleNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputDirectory/amd/maprootUrlModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputDirectory/amd/maprootUrlModuleSimpleSpecifyOutputDirectory.json index ee4185a1a76d2..08a40b7e00fee 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputDirectory/amd/maprootUrlModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputDirectory/amd/maprootUrlModuleSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputDirectory/node/maprootUrlModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputDirectory/node/maprootUrlModuleSimpleSpecifyOutputDirectory.json index ee4185a1a76d2..08a40b7e00fee 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputDirectory/node/maprootUrlModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputDirectory/node/maprootUrlModuleSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.json index 96dd55ea5c857..070128f11b576 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlModuleSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.json index ea25729e572d9..087d1c667bb9d 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlModuleSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderNoOutdir/amd/maprootUrlModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlModuleSubfolderNoOutdir/amd/maprootUrlModuleSubfolderNoOutdir.json index 9287d0f7a571e..8fc1d8cedb3a6 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderNoOutdir/amd/maprootUrlModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderNoOutdir/amd/maprootUrlModuleSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderNoOutdir/node/maprootUrlModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlModuleSubfolderNoOutdir/node/maprootUrlModuleSubfolderNoOutdir.json index 9287d0f7a571e..8fc1d8cedb3a6 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderNoOutdir/node/maprootUrlModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderNoOutdir/node/maprootUrlModuleSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputDirectory/amd/maprootUrlModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputDirectory/amd/maprootUrlModuleSubfolderSpecifyOutputDirectory.json index fcda65ee6c200..ff4cef3be13f8 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputDirectory/amd/maprootUrlModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputDirectory/amd/maprootUrlModuleSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputDirectory/node/maprootUrlModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputDirectory/node/maprootUrlModuleSubfolderSpecifyOutputDirectory.json index fcda65ee6c200..ff4cef3be13f8 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputDirectory/node/maprootUrlModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputDirectory/node/maprootUrlModuleSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.json index 66fabb7816f02..24f628f187d86 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlModuleSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.json index a9e34f9b6eed2..bc6aa594d3842 100644 --- a/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlModuleSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/maprootUrlMultifolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/maprootUrlMultifolderNoOutdir.json index 9206e89c33b3e..37ab432cedcd3 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/maprootUrlMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/maprootUrlMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/maprootUrlMultifolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/maprootUrlMultifolderNoOutdir.json index 9206e89c33b3e..37ab432cedcd3 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/maprootUrlMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/maprootUrlMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlMultifolderSpecifyOutputDirectory.json index 64e3e87e16dc6..0f75f10c07243 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlMultifolderSpecifyOutputDirectory.json index 64e3e87e16dc6..0f75f10c07243 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/maprootUrlMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/maprootUrlMultifolderSpecifyOutputFile.json index 11eb4732184b0..917456b3ca031 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/maprootUrlMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/maprootUrlMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.json index 11eb4732184b0..917456b3ca031 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/maprootUrlSimpleNoOutdir.json b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/maprootUrlSimpleNoOutdir.json index ec29bed6aaef8..da40b52a456f5 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/maprootUrlSimpleNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/maprootUrlSimpleNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/maprootUrlSimpleNoOutdir.json b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/maprootUrlSimpleNoOutdir.json index ec29bed6aaef8..da40b52a456f5 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/maprootUrlSimpleNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/maprootUrlSimpleNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlSimpleSpecifyOutputDirectory.json index 3594ddff232ab..f49e46054f146 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/maprootUrlSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/maprootUrlSimpleSpecifyOutputDirectory.json index 3594ddff232ab..f49e46054f146 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/maprootUrlSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/maprootUrlSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/maprootUrlSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/maprootUrlSimpleSpecifyOutputFile.json index e8222b1929877..5c96ab2dc0bd2 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/maprootUrlSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/maprootUrlSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.json index e8222b1929877..5c96ab2dc0bd2 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSingleFileNoOutdir/amd/maprootUrlSingleFileNoOutdir.json b/tests/baselines/reference/project/maprootUrlSingleFileNoOutdir/amd/maprootUrlSingleFileNoOutdir.json index 93141edd251cb..c2b617c6c1977 100644 --- a/tests/baselines/reference/project/maprootUrlSingleFileNoOutdir/amd/maprootUrlSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlSingleFileNoOutdir/amd/maprootUrlSingleFileNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlSingleFileNoOutdir/node/maprootUrlSingleFileNoOutdir.json b/tests/baselines/reference/project/maprootUrlSingleFileNoOutdir/node/maprootUrlSingleFileNoOutdir.json index 93141edd251cb..c2b617c6c1977 100644 --- a/tests/baselines/reference/project/maprootUrlSingleFileNoOutdir/node/maprootUrlSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlSingleFileNoOutdir/node/maprootUrlSingleFileNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputDirectory/amd/maprootUrlSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputDirectory/amd/maprootUrlSingleFileSpecifyOutputDirectory.json index 6e9c187818560..582854bce24c6 100644 --- a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputDirectory/amd/maprootUrlSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputDirectory/amd/maprootUrlSingleFileSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputDirectory/node/maprootUrlSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputDirectory/node/maprootUrlSingleFileSpecifyOutputDirectory.json index 6e9c187818560..582854bce24c6 100644 --- a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputDirectory/node/maprootUrlSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputDirectory/node/maprootUrlSingleFileSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/amd/maprootUrlSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/amd/maprootUrlSingleFileSpecifyOutputFile.json index 0cf5124ba2555..448ead4532ffe 100644 --- a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/amd/maprootUrlSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/amd/maprootUrlSingleFileSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.json index 0cf5124ba2555..448ead4532ffe 100644 --- a/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlSingleFileSpecifyOutputFile/node/maprootUrlSingleFileSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/maprootUrlSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/maprootUrlSubfolderNoOutdir.json index b6d0ce41bc122..7e13b1db80f40 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/maprootUrlSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/maprootUrlSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/maprootUrlSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/maprootUrlSubfolderNoOutdir.json index b6d0ce41bc122..7e13b1db80f40 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/maprootUrlSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/maprootUrlSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlSubfolderSpecifyOutputDirectory.json index fbe7771b277fe..f00776700f7f0 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlSubfolderSpecifyOutputDirectory.json index fbe7771b277fe..f00776700f7f0 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/maprootUrlSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/maprootUrlSubfolderSpecifyOutputFile.json index 655a40b3393a0..70776c8580588 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/maprootUrlSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/maprootUrlSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.json index 655a40b3393a0..70776c8580588 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "mapRoot": "http://www.typescriptlang.org/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.json index d1a93e29b2023..e1c0360c2a4ad 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.json index d1a93e29b2023..e1c0360c2a4ad 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.json index 6c12235cbc708..90a87d8a5064b 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.json index 6c12235cbc708..90a87d8a5064b 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json index ae21979e6c928..71b1238bba5cf 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json index ae21979e6c928..71b1238bba5cf 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index fe8bf8f3296ae..9aeb2b6c76772 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -13,6 +13,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index fe8bf8f3296ae..9aeb2b6c76772 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -13,6 +13,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderNoOutdir/amd/maprootUrlsourcerootUrlModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderNoOutdir/amd/maprootUrlsourcerootUrlModuleMultifolderNoOutdir.json index 9c99beb9c8e6f..d3df7e3693c9e 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderNoOutdir/amd/maprootUrlsourcerootUrlModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderNoOutdir/amd/maprootUrlsourcerootUrlModuleMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderNoOutdir/node/maprootUrlsourcerootUrlModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderNoOutdir/node/maprootUrlsourcerootUrlModuleMultifolderNoOutdir.json index 9c99beb9c8e6f..d3df7e3693c9e 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderNoOutdir/node/maprootUrlsourcerootUrlModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderNoOutdir/node/maprootUrlsourcerootUrlModuleMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory.json index 799afd4ed2099..93884030e88e6 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory.json index 799afd4ed2099..93884030e88e6 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json index a8bee04af26cd..b074aae66cccd 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json index 0ae2591d19e89..500277e1680bf 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleNoOutdir/amd/maprootUrlsourcerootUrlModuleSimpleNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleNoOutdir/amd/maprootUrlsourcerootUrlModuleSimpleNoOutdir.json index 38b48f7d1201e..3e32619902a83 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleNoOutdir/amd/maprootUrlsourcerootUrlModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleNoOutdir/amd/maprootUrlsourcerootUrlModuleSimpleNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleNoOutdir/node/maprootUrlsourcerootUrlModuleSimpleNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleNoOutdir/node/maprootUrlsourcerootUrlModuleSimpleNoOutdir.json index 38b48f7d1201e..3e32619902a83 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleNoOutdir/node/maprootUrlsourcerootUrlModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleNoOutdir/node/maprootUrlsourcerootUrlModuleSimpleNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory.json index fc399923e4016..6464e9f189f1b 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory.json index fc399923e4016..6464e9f189f1b 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json index 23aa5d0d68b24..a4a700b6f7659 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json index 2c8735d84eb72..a1478f4c6f089 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderNoOutdir/amd/maprootUrlsourcerootUrlModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderNoOutdir/amd/maprootUrlsourcerootUrlModuleSubfolderNoOutdir.json index 79000bbe30441..93b2d0ff36805 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderNoOutdir/amd/maprootUrlsourcerootUrlModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderNoOutdir/amd/maprootUrlsourcerootUrlModuleSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderNoOutdir/node/maprootUrlsourcerootUrlModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderNoOutdir/node/maprootUrlsourcerootUrlModuleSubfolderNoOutdir.json index 79000bbe30441..93b2d0ff36805 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderNoOutdir/node/maprootUrlsourcerootUrlModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderNoOutdir/node/maprootUrlsourcerootUrlModuleSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory.json index c38278cadf766..f234ff79bb7be 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory.json index c38278cadf766..f234ff79bb7be 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json index 69a9afefdb100..cd461d9385fa7 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json index ab7fb6cbeb256..5b2dceeded387 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlModuleSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/maprootUrlsourcerootUrlMultifolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/maprootUrlsourcerootUrlMultifolderNoOutdir.json index e938716c5b72c..efc6778bfc8bd 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/maprootUrlsourcerootUrlMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/maprootUrlsourcerootUrlMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/maprootUrlsourcerootUrlMultifolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/maprootUrlsourcerootUrlMultifolderNoOutdir.json index e938716c5b72c..efc6778bfc8bd 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/maprootUrlsourcerootUrlMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/maprootUrlsourcerootUrlMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.json index 868b9d088e4da..8c703fa5ccc6d 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.json index 868b9d088e4da..8c703fa5ccc6d 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.json index 72ef4b2964d86..fc3a6893bc4c4 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.json index 72ef4b2964d86..fc3a6893bc4c4 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/maprootUrlsourcerootUrlSimpleNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/maprootUrlsourcerootUrlSimpleNoOutdir.json index 7181b5f41704e..458e16811a45f 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/maprootUrlsourcerootUrlSimpleNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/maprootUrlsourcerootUrlSimpleNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/maprootUrlsourcerootUrlSimpleNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/maprootUrlsourcerootUrlSimpleNoOutdir.json index 7181b5f41704e..458e16811a45f 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/maprootUrlsourcerootUrlSimpleNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/maprootUrlsourcerootUrlSimpleNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.json index faec1b8b44b30..d4302e162b5d7 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.json index faec1b8b44b30..d4302e162b5d7 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.json index c004c0c4170be..9c64212b2d218 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.json index c004c0c4170be..9c64212b2d218 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileNoOutdir/amd/maprootUrlsourcerootUrlSingleFileNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileNoOutdir/amd/maprootUrlsourcerootUrlSingleFileNoOutdir.json index 864a3a76a7c01..a6e7c99a61142 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileNoOutdir/amd/maprootUrlsourcerootUrlSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileNoOutdir/amd/maprootUrlsourcerootUrlSingleFileNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileNoOutdir/node/maprootUrlsourcerootUrlSingleFileNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileNoOutdir/node/maprootUrlsourcerootUrlSingleFileNoOutdir.json index 864a3a76a7c01..a6e7c99a61142 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileNoOutdir/node/maprootUrlsourcerootUrlSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileNoOutdir/node/maprootUrlsourcerootUrlSingleFileNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory.json index b89098730b5a2..dec6d99743271 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory.json index b89098730b5a2..dec6d99743271 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/amd/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/amd/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.json index 0b84f81a443cb..35ea35d2b5ce8 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/amd/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/amd/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.json index 0b84f81a443cb..35ea35d2b5ce8 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile/node/maprootUrlsourcerootUrlSingleFileSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/maprootUrlsourcerootUrlSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/maprootUrlsourcerootUrlSubfolderNoOutdir.json index 4e6b055540c4e..d0db93b829613 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/maprootUrlsourcerootUrlSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/maprootUrlsourcerootUrlSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/maprootUrlsourcerootUrlSubfolderNoOutdir.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/maprootUrlsourcerootUrlSubfolderNoOutdir.json index 4e6b055540c4e..d0db93b829613 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/maprootUrlsourcerootUrlSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/maprootUrlsourcerootUrlSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.json index 55d9965341ff1..0b4f7b711a761 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.json index 55d9965341ff1..0b4f7b711a761 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.json index 09af2494defd9..3882ed95cef2a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.json index 09af2494defd9..3882ed95cef2a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/moduleIdentifier/amd/moduleIdentifier.json b/tests/baselines/reference/project/moduleIdentifier/amd/moduleIdentifier.json index 6dde0bb16f43e..9e2c8a26469a9 100644 --- a/tests/baselines/reference/project/moduleIdentifier/amd/moduleIdentifier.json +++ b/tests/baselines/reference/project/moduleIdentifier/amd/moduleIdentifier.json @@ -7,6 +7,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "consume.ts" ], diff --git a/tests/baselines/reference/project/moduleIdentifier/node/moduleIdentifier.json b/tests/baselines/reference/project/moduleIdentifier/node/moduleIdentifier.json index 6dde0bb16f43e..9e2c8a26469a9 100644 --- a/tests/baselines/reference/project/moduleIdentifier/node/moduleIdentifier.json +++ b/tests/baselines/reference/project/moduleIdentifier/node/moduleIdentifier.json @@ -7,6 +7,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "consume.ts" ], diff --git a/tests/baselines/reference/project/moduleMergingOrdering1/amd/moduleMergingOrdering1.json b/tests/baselines/reference/project/moduleMergingOrdering1/amd/moduleMergingOrdering1.json index 0485ea8e63363..2f3f35fc0e3a2 100644 --- a/tests/baselines/reference/project/moduleMergingOrdering1/amd/moduleMergingOrdering1.json +++ b/tests/baselines/reference/project/moduleMergingOrdering1/amd/moduleMergingOrdering1.json @@ -7,6 +7,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts", "b.ts" ], diff --git a/tests/baselines/reference/project/moduleMergingOrdering1/node/moduleMergingOrdering1.json b/tests/baselines/reference/project/moduleMergingOrdering1/node/moduleMergingOrdering1.json index 0485ea8e63363..2f3f35fc0e3a2 100644 --- a/tests/baselines/reference/project/moduleMergingOrdering1/node/moduleMergingOrdering1.json +++ b/tests/baselines/reference/project/moduleMergingOrdering1/node/moduleMergingOrdering1.json @@ -7,6 +7,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts", "b.ts" ], diff --git a/tests/baselines/reference/project/moduleMergingOrdering2/amd/moduleMergingOrdering2.json b/tests/baselines/reference/project/moduleMergingOrdering2/amd/moduleMergingOrdering2.json index 133c445c25715..e41ec5b2faee4 100644 --- a/tests/baselines/reference/project/moduleMergingOrdering2/amd/moduleMergingOrdering2.json +++ b/tests/baselines/reference/project/moduleMergingOrdering2/amd/moduleMergingOrdering2.json @@ -7,6 +7,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "b.ts", "a.ts" ], diff --git a/tests/baselines/reference/project/moduleMergingOrdering2/node/moduleMergingOrdering2.json b/tests/baselines/reference/project/moduleMergingOrdering2/node/moduleMergingOrdering2.json index 133c445c25715..e41ec5b2faee4 100644 --- a/tests/baselines/reference/project/moduleMergingOrdering2/node/moduleMergingOrdering2.json +++ b/tests/baselines/reference/project/moduleMergingOrdering2/node/moduleMergingOrdering2.json @@ -7,6 +7,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "b.ts", "a.ts" ], diff --git a/tests/baselines/reference/project/multipleLevelsModuleResolution/amd/multipleLevelsModuleResolution.json b/tests/baselines/reference/project/multipleLevelsModuleResolution/amd/multipleLevelsModuleResolution.json index 891f43fd66189..61f9d23a2c134 100644 --- a/tests/baselines/reference/project/multipleLevelsModuleResolution/amd/multipleLevelsModuleResolution.json +++ b/tests/baselines/reference/project/multipleLevelsModuleResolution/amd/multipleLevelsModuleResolution.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "A/A.ts", "A/AA/AA.ts", "B/B.ts", diff --git a/tests/baselines/reference/project/multipleLevelsModuleResolution/node/multipleLevelsModuleResolution.json b/tests/baselines/reference/project/multipleLevelsModuleResolution/node/multipleLevelsModuleResolution.json index 891f43fd66189..61f9d23a2c134 100644 --- a/tests/baselines/reference/project/multipleLevelsModuleResolution/node/multipleLevelsModuleResolution.json +++ b/tests/baselines/reference/project/multipleLevelsModuleResolution/node/multipleLevelsModuleResolution.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "A/A.ts", "A/AA/AA.ts", "B/B.ts", diff --git a/tests/baselines/reference/project/nestedDeclare/amd/nestedDeclare.json b/tests/baselines/reference/project/nestedDeclare/amd/nestedDeclare.json index 182f0d3cf3ce6..541f0a349b225 100644 --- a/tests/baselines/reference/project/nestedDeclare/amd/nestedDeclare.json +++ b/tests/baselines/reference/project/nestedDeclare/amd/nestedDeclare.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "consume.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/nestedDeclare/node/nestedDeclare.json b/tests/baselines/reference/project/nestedDeclare/node/nestedDeclare.json index 182f0d3cf3ce6..541f0a349b225 100644 --- a/tests/baselines/reference/project/nestedDeclare/node/nestedDeclare.json +++ b/tests/baselines/reference/project/nestedDeclare/node/nestedDeclare.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "consume.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.json b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.json index 71b3fd37ad0fb..b3b4fdca8fbfc 100644 --- a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.json +++ b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test1.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.json b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.json index 71b3fd37ad0fb..b3b4fdca8fbfc 100644 --- a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.json +++ b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test1.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.json b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.json index 2449e3dd911a6..ec16a02ad3b1c 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.json +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test1.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.json b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.json index 2449e3dd911a6..ec16a02ad3b1c 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.json +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test1.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/nestedReferenceTags/amd/nestedReferenceTags.json b/tests/baselines/reference/project/nestedReferenceTags/amd/nestedReferenceTags.json index 72c54ff8f4723..e87c961036fc6 100644 --- a/tests/baselines/reference/project/nestedReferenceTags/amd/nestedReferenceTags.json +++ b/tests/baselines/reference/project/nestedReferenceTags/amd/nestedReferenceTags.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "lib/classA.ts", "lib/classB.ts", "main.ts" diff --git a/tests/baselines/reference/project/nestedReferenceTags/node/nestedReferenceTags.json b/tests/baselines/reference/project/nestedReferenceTags/node/nestedReferenceTags.json index 72c54ff8f4723..e87c961036fc6 100644 --- a/tests/baselines/reference/project/nestedReferenceTags/node/nestedReferenceTags.json +++ b/tests/baselines/reference/project/nestedReferenceTags/node/nestedReferenceTags.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "lib/classA.ts", "lib/classB.ts", "main.ts" diff --git a/tests/baselines/reference/project/noProjectOptionAndInputFiles/amd/noProjectOptionAndInputFiles.json b/tests/baselines/reference/project/noProjectOptionAndInputFiles/amd/noProjectOptionAndInputFiles.json index 2dbfdb4232f63..315e23b3cf25e 100644 --- a/tests/baselines/reference/project/noProjectOptionAndInputFiles/amd/noProjectOptionAndInputFiles.json +++ b/tests/baselines/reference/project/noProjectOptionAndInputFiles/amd/noProjectOptionAndInputFiles.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/noProjectOptionAndInputFiles/node/noProjectOptionAndInputFiles.json b/tests/baselines/reference/project/noProjectOptionAndInputFiles/node/noProjectOptionAndInputFiles.json index 2dbfdb4232f63..315e23b3cf25e 100644 --- a/tests/baselines/reference/project/noProjectOptionAndInputFiles/node/noProjectOptionAndInputFiles.json +++ b/tests/baselines/reference/project/noProjectOptionAndInputFiles/node/noProjectOptionAndInputFiles.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.json b/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.json index 43f2091bdec4b..48d51bb026d37 100644 --- a/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.json +++ b/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.json @@ -7,6 +7,8 @@ "project": "importHigher", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "importHigher/node_modules/m2/entry.js", "importHigher/node_modules/m1/index.js", "importHigher/node_modules/m2/node_modules/m3/index.js", diff --git a/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.json b/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.json index 43f2091bdec4b..48d51bb026d37 100644 --- a/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.json +++ b/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.json @@ -7,6 +7,8 @@ "project": "importHigher", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "importHigher/node_modules/m2/entry.js", "importHigher/node_modules/m1/index.js", "importHigher/node_modules/m2/node_modules/m3/index.js", diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.json b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.json index c3dcae4dcd5e2..cf20924641b75 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.json +++ b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.json @@ -7,6 +7,8 @@ "project": "maxDepthExceeded", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "maxDepthExceeded/node_modules/m1/index.js", "maxDepthExceeded/root.ts", "maxDepthExceeded/node_modules/m2/entry.js", diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.json b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.json index c3dcae4dcd5e2..cf20924641b75 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.json +++ b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.json @@ -7,6 +7,8 @@ "project": "maxDepthExceeded", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "maxDepthExceeded/node_modules/m1/index.js", "maxDepthExceeded/root.ts", "maxDepthExceeded/node_modules/m2/entry.js", diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.json b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.json index 9973c7d3c050c..230e8e959ece7 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.json +++ b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.json @@ -7,6 +7,8 @@ "project": "maxDepthIncreased", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "maxDepthIncreased/node_modules/m2/node_modules/m3/index.js", "maxDepthIncreased/node_modules/m2/entry.js", "maxDepthIncreased/node_modules/m1/index.js", diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.json b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.json index 9973c7d3c050c..230e8e959ece7 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.json +++ b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.json @@ -7,6 +7,8 @@ "project": "maxDepthIncreased", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "maxDepthIncreased/node_modules/m2/node_modules/m3/index.js", "maxDepthIncreased/node_modules/m2/entry.js", "maxDepthIncreased/node_modules/m1/index.js", diff --git a/tests/baselines/reference/project/nonRelative/amd/nonRelative.json b/tests/baselines/reference/project/nonRelative/amd/nonRelative.json index 6c09cfd6a4563..c9d773c1829fa 100644 --- a/tests/baselines/reference/project/nonRelative/amd/nonRelative.json +++ b/tests/baselines/reference/project/nonRelative/amd/nonRelative.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "lib/foo/b.ts", "lib/foo/a.ts", diff --git a/tests/baselines/reference/project/nonRelative/node/nonRelative.json b/tests/baselines/reference/project/nonRelative/node/nonRelative.json index 6c09cfd6a4563..c9d773c1829fa 100644 --- a/tests/baselines/reference/project/nonRelative/node/nonRelative.json +++ b/tests/baselines/reference/project/nonRelative/node/nonRelative.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "lib/foo/b.ts", "lib/foo/a.ts", diff --git a/tests/baselines/reference/project/outMixedSubfolderNoOutdir/amd/outMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/outMixedSubfolderNoOutdir/amd/outMixedSubfolderNoOutdir.json index 0337f4e39de80..8c7a98f959c01 100644 --- a/tests/baselines/reference/project/outMixedSubfolderNoOutdir/amd/outMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/outMixedSubfolderNoOutdir/amd/outMixedSubfolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMixedSubfolderNoOutdir/node/outMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/outMixedSubfolderNoOutdir/node/outMixedSubfolderNoOutdir.json index 0337f4e39de80..8c7a98f959c01 100644 --- a/tests/baselines/reference/project/outMixedSubfolderNoOutdir/node/outMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/outMixedSubfolderNoOutdir/node/outMixedSubfolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputDirectory/amd/outMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputDirectory/amd/outMixedSubfolderSpecifyOutputDirectory.json index 89732a1a90a9f..3852d0dd2148e 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputDirectory/amd/outMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputDirectory/amd/outMixedSubfolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputDirectory/node/outMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputDirectory/node/outMixedSubfolderSpecifyOutputDirectory.json index 89732a1a90a9f..3852d0dd2148e 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputDirectory/node/outMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputDirectory/node/outMixedSubfolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/outMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/outMixedSubfolderSpecifyOutputFile.json index 16a1d63a4b565..f5449179393f7 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/outMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/amd/outMixedSubfolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.json index 16a1d63a4b565..f5449179393f7 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFile/node/outMixedSubfolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index c086a62c93314..1d651c8adbf2b 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index c086a62c93314..1d651c8adbf2b 100644 --- a/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/outMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/outMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outModuleMultifolderNoOutdir/amd/outModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/outModuleMultifolderNoOutdir/amd/outModuleMultifolderNoOutdir.json index f4fbe495d2afb..3b03cfce24fd8 100644 --- a/tests/baselines/reference/project/outModuleMultifolderNoOutdir/amd/outModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/outModuleMultifolderNoOutdir/amd/outModuleMultifolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outModuleMultifolderNoOutdir/node/outModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/outModuleMultifolderNoOutdir/node/outModuleMultifolderNoOutdir.json index f4fbe495d2afb..3b03cfce24fd8 100644 --- a/tests/baselines/reference/project/outModuleMultifolderNoOutdir/node/outModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/outModuleMultifolderNoOutdir/node/outModuleMultifolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputDirectory/amd/outModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputDirectory/amd/outModuleMultifolderSpecifyOutputDirectory.json index 49cf8e201aa7b..af74f9b2f14e5 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputDirectory/amd/outModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputDirectory/amd/outModuleMultifolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputDirectory/node/outModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputDirectory/node/outModuleMultifolderSpecifyOutputDirectory.json index 49cf8e201aa7b..af74f9b2f14e5 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputDirectory/node/outModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputDirectory/node/outModuleMultifolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/outModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/outModuleMultifolderSpecifyOutputFile.json index 52b18451856f5..bc5db5e3f5f3d 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/outModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/amd/outModuleMultifolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.json index e269f20f11c7c..469166f948385 100644 --- a/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleMultifolderSpecifyOutputFile/node/outModuleMultifolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outModuleSimpleNoOutdir/amd/outModuleSimpleNoOutdir.json b/tests/baselines/reference/project/outModuleSimpleNoOutdir/amd/outModuleSimpleNoOutdir.json index 5563c1c68403b..fc4107dacccde 100644 --- a/tests/baselines/reference/project/outModuleSimpleNoOutdir/amd/outModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/outModuleSimpleNoOutdir/amd/outModuleSimpleNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSimpleNoOutdir/node/outModuleSimpleNoOutdir.json b/tests/baselines/reference/project/outModuleSimpleNoOutdir/node/outModuleSimpleNoOutdir.json index 5563c1c68403b..fc4107dacccde 100644 --- a/tests/baselines/reference/project/outModuleSimpleNoOutdir/node/outModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/outModuleSimpleNoOutdir/node/outModuleSimpleNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputDirectory/amd/outModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputDirectory/amd/outModuleSimpleSpecifyOutputDirectory.json index d325ef6426a33..8aa88510e71b0 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputDirectory/amd/outModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputDirectory/amd/outModuleSimpleSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputDirectory/node/outModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputDirectory/node/outModuleSimpleSpecifyOutputDirectory.json index d325ef6426a33..8aa88510e71b0 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputDirectory/node/outModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputDirectory/node/outModuleSimpleSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/outModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/outModuleSimpleSpecifyOutputFile.json index f217631f5c7ee..e7861f1a36d99 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/outModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/amd/outModuleSimpleSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.json index e6d00d2734614..4598de4d2051e 100644 --- a/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleSimpleSpecifyOutputFile/node/outModuleSimpleSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSubfolderNoOutdir/amd/outModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/outModuleSubfolderNoOutdir/amd/outModuleSubfolderNoOutdir.json index 9f477b355819c..341e05bc7bdc5 100644 --- a/tests/baselines/reference/project/outModuleSubfolderNoOutdir/amd/outModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/outModuleSubfolderNoOutdir/amd/outModuleSubfolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSubfolderNoOutdir/node/outModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/outModuleSubfolderNoOutdir/node/outModuleSubfolderNoOutdir.json index 9f477b355819c..341e05bc7bdc5 100644 --- a/tests/baselines/reference/project/outModuleSubfolderNoOutdir/node/outModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/outModuleSubfolderNoOutdir/node/outModuleSubfolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputDirectory/amd/outModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputDirectory/amd/outModuleSubfolderSpecifyOutputDirectory.json index ff3220970009d..cfbe79831f704 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputDirectory/amd/outModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputDirectory/amd/outModuleSubfolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputDirectory/node/outModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputDirectory/node/outModuleSubfolderSpecifyOutputDirectory.json index ff3220970009d..cfbe79831f704 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputDirectory/node/outModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputDirectory/node/outModuleSubfolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/outModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/outModuleSubfolderSpecifyOutputFile.json index f8af53fc67e96..cc00d955e4c15 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/outModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/amd/outModuleSubfolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.json index 2a20ee41c47d1..525e66e396aef 100644 --- a/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outModuleSubfolderSpecifyOutputFile/node/outModuleSubfolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outMultifolderNoOutdir/amd/outMultifolderNoOutdir.json b/tests/baselines/reference/project/outMultifolderNoOutdir/amd/outMultifolderNoOutdir.json index 96cf423ced237..60b2a61bf94d9 100644 --- a/tests/baselines/reference/project/outMultifolderNoOutdir/amd/outMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/outMultifolderNoOutdir/amd/outMultifolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMultifolderNoOutdir/node/outMultifolderNoOutdir.json b/tests/baselines/reference/project/outMultifolderNoOutdir/node/outMultifolderNoOutdir.json index 96cf423ced237..60b2a61bf94d9 100644 --- a/tests/baselines/reference/project/outMultifolderNoOutdir/node/outMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/outMultifolderNoOutdir/node/outMultifolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMultifolderSpecifyOutputDirectory/amd/outMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outMultifolderSpecifyOutputDirectory/amd/outMultifolderSpecifyOutputDirectory.json index 855c6446e0045..9eb7aecbcf907 100644 --- a/tests/baselines/reference/project/outMultifolderSpecifyOutputDirectory/amd/outMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outMultifolderSpecifyOutputDirectory/amd/outMultifolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMultifolderSpecifyOutputDirectory/node/outMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outMultifolderSpecifyOutputDirectory/node/outMultifolderSpecifyOutputDirectory.json index 855c6446e0045..9eb7aecbcf907 100644 --- a/tests/baselines/reference/project/outMultifolderSpecifyOutputDirectory/node/outMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outMultifolderSpecifyOutputDirectory/node/outMultifolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/amd/outMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/amd/outMultifolderSpecifyOutputFile.json index c5c34be23ed5d..ad7df0e44cd6d 100644 --- a/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/amd/outMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/amd/outMultifolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.json index c5c34be23ed5d..ad7df0e44cd6d 100644 --- a/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outMultifolderSpecifyOutputFile/node/outMultifolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/outSimpleNoOutdir/amd/outSimpleNoOutdir.json b/tests/baselines/reference/project/outSimpleNoOutdir/amd/outSimpleNoOutdir.json index 0b4424c5ecdc3..09b9c2f1b2c7f 100644 --- a/tests/baselines/reference/project/outSimpleNoOutdir/amd/outSimpleNoOutdir.json +++ b/tests/baselines/reference/project/outSimpleNoOutdir/amd/outSimpleNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSimpleNoOutdir/node/outSimpleNoOutdir.json b/tests/baselines/reference/project/outSimpleNoOutdir/node/outSimpleNoOutdir.json index 0b4424c5ecdc3..09b9c2f1b2c7f 100644 --- a/tests/baselines/reference/project/outSimpleNoOutdir/node/outSimpleNoOutdir.json +++ b/tests/baselines/reference/project/outSimpleNoOutdir/node/outSimpleNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSimpleSpecifyOutputDirectory/amd/outSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/outSimpleSpecifyOutputDirectory/amd/outSimpleSpecifyOutputDirectory.json index 1b67a03c5e88c..a378c869c6997 100644 --- a/tests/baselines/reference/project/outSimpleSpecifyOutputDirectory/amd/outSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outSimpleSpecifyOutputDirectory/amd/outSimpleSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSimpleSpecifyOutputDirectory/node/outSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/outSimpleSpecifyOutputDirectory/node/outSimpleSpecifyOutputDirectory.json index 1b67a03c5e88c..a378c869c6997 100644 --- a/tests/baselines/reference/project/outSimpleSpecifyOutputDirectory/node/outSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outSimpleSpecifyOutputDirectory/node/outSimpleSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSimpleSpecifyOutputFile/amd/outSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/outSimpleSpecifyOutputFile/amd/outSimpleSpecifyOutputFile.json index 1623778caebd3..73b40fdf5bcba 100644 --- a/tests/baselines/reference/project/outSimpleSpecifyOutputFile/amd/outSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outSimpleSpecifyOutputFile/amd/outSimpleSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.json index 1623778caebd3..73b40fdf5bcba 100644 --- a/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outSimpleSpecifyOutputFile/node/outSimpleSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSingleFileNoOutdir/amd/outSingleFileNoOutdir.json b/tests/baselines/reference/project/outSingleFileNoOutdir/amd/outSingleFileNoOutdir.json index 1666ffdab3e51..ab3378787cbb6 100644 --- a/tests/baselines/reference/project/outSingleFileNoOutdir/amd/outSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/outSingleFileNoOutdir/amd/outSingleFileNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/outSingleFileNoOutdir/node/outSingleFileNoOutdir.json b/tests/baselines/reference/project/outSingleFileNoOutdir/node/outSingleFileNoOutdir.json index 1666ffdab3e51..ab3378787cbb6 100644 --- a/tests/baselines/reference/project/outSingleFileNoOutdir/node/outSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/outSingleFileNoOutdir/node/outSingleFileNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/outSingleFileSpecifyOutputDirectory/amd/outSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/outSingleFileSpecifyOutputDirectory/amd/outSingleFileSpecifyOutputDirectory.json index a55ee979a8010..c5a744a4c26f1 100644 --- a/tests/baselines/reference/project/outSingleFileSpecifyOutputDirectory/amd/outSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outSingleFileSpecifyOutputDirectory/amd/outSingleFileSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/outSingleFileSpecifyOutputDirectory/node/outSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/outSingleFileSpecifyOutputDirectory/node/outSingleFileSpecifyOutputDirectory.json index a55ee979a8010..c5a744a4c26f1 100644 --- a/tests/baselines/reference/project/outSingleFileSpecifyOutputDirectory/node/outSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outSingleFileSpecifyOutputDirectory/node/outSingleFileSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/amd/outSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/amd/outSingleFileSpecifyOutputFile.json index 1dfb816bddd37..93882b8f8b36f 100644 --- a/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/amd/outSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/amd/outSingleFileSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.json index 1dfb816bddd37..93882b8f8b36f 100644 --- a/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outSingleFileSpecifyOutputFile/node/outSingleFileSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/outSubfolderNoOutdir/amd/outSubfolderNoOutdir.json b/tests/baselines/reference/project/outSubfolderNoOutdir/amd/outSubfolderNoOutdir.json index 7adfebb4b471b..5b54aaad20c5e 100644 --- a/tests/baselines/reference/project/outSubfolderNoOutdir/amd/outSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/outSubfolderNoOutdir/amd/outSubfolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSubfolderNoOutdir/node/outSubfolderNoOutdir.json b/tests/baselines/reference/project/outSubfolderNoOutdir/node/outSubfolderNoOutdir.json index 7adfebb4b471b..5b54aaad20c5e 100644 --- a/tests/baselines/reference/project/outSubfolderNoOutdir/node/outSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/outSubfolderNoOutdir/node/outSubfolderNoOutdir.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSubfolderSpecifyOutputDirectory/amd/outSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outSubfolderSpecifyOutputDirectory/amd/outSubfolderSpecifyOutputDirectory.json index 91276850919df..61a8efaf3f303 100644 --- a/tests/baselines/reference/project/outSubfolderSpecifyOutputDirectory/amd/outSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outSubfolderSpecifyOutputDirectory/amd/outSubfolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSubfolderSpecifyOutputDirectory/node/outSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/outSubfolderSpecifyOutputDirectory/node/outSubfolderSpecifyOutputDirectory.json index 91276850919df..61a8efaf3f303 100644 --- a/tests/baselines/reference/project/outSubfolderSpecifyOutputDirectory/node/outSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/outSubfolderSpecifyOutputDirectory/node/outSubfolderSpecifyOutputDirectory.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/amd/outSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/amd/outSubfolderSpecifyOutputFile.json index 1022af7eedae8..1a51de4c1df59 100644 --- a/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/amd/outSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/amd/outSubfolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.json index 1022af7eedae8..1a51de4c1df59 100644 --- a/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/outSubfolderSpecifyOutputFile/node/outSubfolderSpecifyOutputFile.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.json index 61cfd98c146a6..c82cb61abc67b 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "testGlo.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.json index 61cfd98c146a6..c82cb61abc67b 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "testGlo.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json index 3627c51b1aa65..3547143d0a026 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json index 3627c51b1aa65..3547143d0a026 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.json index 390751ee4010e..a040571a9d069 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.json index 390751ee4010e..a040571a9d069 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleSimpleReference/amd/privacyCheckOnImportedModuleSimpleReference.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleSimpleReference/amd/privacyCheckOnImportedModuleSimpleReference.json index b610f9b67a63a..35c2d19fdcf35 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleSimpleReference/amd/privacyCheckOnImportedModuleSimpleReference.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleSimpleReference/amd/privacyCheckOnImportedModuleSimpleReference.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "mExported.ts", "mNonExported.ts", "test.ts" diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleSimpleReference/node/privacyCheckOnImportedModuleSimpleReference.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleSimpleReference/node/privacyCheckOnImportedModuleSimpleReference.json index b610f9b67a63a..35c2d19fdcf35 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleSimpleReference/node/privacyCheckOnImportedModuleSimpleReference.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleSimpleReference/node/privacyCheckOnImportedModuleSimpleReference.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "mExported.ts", "mNonExported.ts", "test.ts" diff --git a/tests/baselines/reference/project/privacyCheckOnIndirectTypeFromTheExternalType/amd/privacyCheckOnIndirectTypeFromTheExternalType.json b/tests/baselines/reference/project/privacyCheckOnIndirectTypeFromTheExternalType/amd/privacyCheckOnIndirectTypeFromTheExternalType.json index b169a1c69257f..119bbb3686aa7 100644 --- a/tests/baselines/reference/project/privacyCheckOnIndirectTypeFromTheExternalType/amd/privacyCheckOnIndirectTypeFromTheExternalType.json +++ b/tests/baselines/reference/project/privacyCheckOnIndirectTypeFromTheExternalType/amd/privacyCheckOnIndirectTypeFromTheExternalType.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "indirectExternalModule.ts", "externalModule.ts", "test.ts" diff --git a/tests/baselines/reference/project/privacyCheckOnIndirectTypeFromTheExternalType/node/privacyCheckOnIndirectTypeFromTheExternalType.json b/tests/baselines/reference/project/privacyCheckOnIndirectTypeFromTheExternalType/node/privacyCheckOnIndirectTypeFromTheExternalType.json index b169a1c69257f..119bbb3686aa7 100644 --- a/tests/baselines/reference/project/privacyCheckOnIndirectTypeFromTheExternalType/node/privacyCheckOnIndirectTypeFromTheExternalType.json +++ b/tests/baselines/reference/project/privacyCheckOnIndirectTypeFromTheExternalType/node/privacyCheckOnIndirectTypeFromTheExternalType.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "indirectExternalModule.ts", "externalModule.ts", "test.ts" diff --git a/tests/baselines/reference/project/projectOptionTest/amd/projectOptionTest.json b/tests/baselines/reference/project/projectOptionTest/amd/projectOptionTest.json index 231f3e9afe579..d6424b40f430f 100644 --- a/tests/baselines/reference/project/projectOptionTest/amd/projectOptionTest.json +++ b/tests/baselines/reference/project/projectOptionTest/amd/projectOptionTest.json @@ -6,6 +6,8 @@ "project": "Test", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "Test/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/projectOptionTest/node/projectOptionTest.json b/tests/baselines/reference/project/projectOptionTest/node/projectOptionTest.json index 231f3e9afe579..d6424b40f430f 100644 --- a/tests/baselines/reference/project/projectOptionTest/node/projectOptionTest.json +++ b/tests/baselines/reference/project/projectOptionTest/node/projectOptionTest.json @@ -6,6 +6,8 @@ "project": "Test", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "Test/a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/prologueEmit/amd/prologueEmit.json b/tests/baselines/reference/project/prologueEmit/amd/prologueEmit.json index 44fc3168d4ea1..4bd84ede2e93f 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/prologueEmit.json +++ b/tests/baselines/reference/project/prologueEmit/amd/prologueEmit.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "globalThisCapture.ts", "__extends.ts" ], diff --git a/tests/baselines/reference/project/prologueEmit/node/prologueEmit.json b/tests/baselines/reference/project/prologueEmit/node/prologueEmit.json index 44fc3168d4ea1..4bd84ede2e93f 100644 --- a/tests/baselines/reference/project/prologueEmit/node/prologueEmit.json +++ b/tests/baselines/reference/project/prologueEmit/node/prologueEmit.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "globalThisCapture.ts", "__extends.ts" ], diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/quotesInFileAndDirectoryNames.json b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/quotesInFileAndDirectoryNames.json index bdebe6382c8f5..94f1eb4843501 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/quotesInFileAndDirectoryNames.json +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/quotesInFileAndDirectoryNames.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "li'b/class'A.ts", "m'ain.ts" ], diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/quotesInFileAndDirectoryNames.json b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/quotesInFileAndDirectoryNames.json index bdebe6382c8f5..94f1eb4843501 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/quotesInFileAndDirectoryNames.json +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/quotesInFileAndDirectoryNames.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "li'b/class'A.ts", "m'ain.ts" ], diff --git a/tests/baselines/reference/project/referencePathStatic/amd/referencePathStatic.json b/tests/baselines/reference/project/referencePathStatic/amd/referencePathStatic.json index db28d934fb821..2c3eacfb20722 100644 --- a/tests/baselines/reference/project/referencePathStatic/amd/referencePathStatic.json +++ b/tests/baselines/reference/project/referencePathStatic/amd/referencePathStatic.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "lib.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/referencePathStatic/node/referencePathStatic.json b/tests/baselines/reference/project/referencePathStatic/node/referencePathStatic.json index db28d934fb821..2c3eacfb20722 100644 --- a/tests/baselines/reference/project/referencePathStatic/node/referencePathStatic.json +++ b/tests/baselines/reference/project/referencePathStatic/node/referencePathStatic.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "lib.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/referenceResolutionRelativePaths.json b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/referenceResolutionRelativePaths.json index 00c235e16c9f8..129ce13db40ea 100644 --- a/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/referenceResolutionRelativePaths.json +++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/amd/referenceResolutionRelativePaths.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "../../../bar/bar.ts", "foo.ts" ], diff --git a/tests/baselines/reference/project/referenceResolutionRelativePaths/node/referenceResolutionRelativePaths.json b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/referenceResolutionRelativePaths.json index 00c235e16c9f8..129ce13db40ea 100644 --- a/tests/baselines/reference/project/referenceResolutionRelativePaths/node/referenceResolutionRelativePaths.json +++ b/tests/baselines/reference/project/referenceResolutionRelativePaths/node/referenceResolutionRelativePaths.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "../../../bar/bar.ts", "foo.ts" ], diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/referenceResolutionRelativePathsFromRootDirectory.json b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/referenceResolutionRelativePathsFromRootDirectory.json index cf3e51e5c7c60..c443a64e1df3f 100644 --- a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/referenceResolutionRelativePathsFromRootDirectory.json +++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/amd/referenceResolutionRelativePathsFromRootDirectory.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "bar/bar.ts", "src/ts/foo/foo.ts" ], diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/referenceResolutionRelativePathsFromRootDirectory.json b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/referenceResolutionRelativePathsFromRootDirectory.json index cf3e51e5c7c60..c443a64e1df3f 100644 --- a/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/referenceResolutionRelativePathsFromRootDirectory.json +++ b/tests/baselines/reference/project/referenceResolutionRelativePathsFromRootDirectory/node/referenceResolutionRelativePathsFromRootDirectory.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "bar/bar.ts", "src/ts/foo/foo.ts" ], diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/referenceResolutionRelativePathsNoResolve.json b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/referenceResolutionRelativePathsNoResolve.json index 949254979beb5..70ab84a4f50a7 100644 --- a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/referenceResolutionRelativePathsNoResolve.json +++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/amd/referenceResolutionRelativePathsNoResolve.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "foo.ts", "../../../bar/bar.ts" ], diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/referenceResolutionRelativePathsNoResolve.json b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/referenceResolutionRelativePathsNoResolve.json index 949254979beb5..70ab84a4f50a7 100644 --- a/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/referenceResolutionRelativePathsNoResolve.json +++ b/tests/baselines/reference/project/referenceResolutionRelativePathsNoResolve/node/referenceResolutionRelativePathsNoResolve.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "foo.ts", "../../../bar/bar.ts" ], diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/referenceResolutionRelativePathsRelativeToRootDirectory.json b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/referenceResolutionRelativePathsRelativeToRootDirectory.json index d1dbbcde56118..1cefdbe7921bf 100644 --- a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/referenceResolutionRelativePathsRelativeToRootDirectory.json +++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/amd/referenceResolutionRelativePathsRelativeToRootDirectory.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "../../../bar/bar.ts", "../../../src/ts/foo/foo.ts" ], diff --git a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/referenceResolutionRelativePathsRelativeToRootDirectory.json b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/referenceResolutionRelativePathsRelativeToRootDirectory.json index d1dbbcde56118..1cefdbe7921bf 100644 --- a/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/referenceResolutionRelativePathsRelativeToRootDirectory.json +++ b/tests/baselines/reference/project/referenceResolutionRelativePathsRelativeToRootDirectory/node/referenceResolutionRelativePathsRelativeToRootDirectory.json @@ -8,6 +8,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "../../../bar/bar.ts", "../../../src/ts/foo/foo.ts" ], diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/referenceResolutionSameFileTwice.json b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/referenceResolutionSameFileTwice.json index e295c549f83af..18b0bc3d92362 100644 --- a/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/referenceResolutionSameFileTwice.json +++ b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/referenceResolutionSameFileTwice.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/referenceResolutionSameFileTwice.json b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/referenceResolutionSameFileTwice.json index e295c549f83af..18b0bc3d92362 100644 --- a/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/referenceResolutionSameFileTwice.json +++ b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/referenceResolutionSameFileTwice.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/referenceResolutionSameFileTwiceNoResolve.json b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/referenceResolutionSameFileTwiceNoResolve.json index df013fc038963..a71527ddd7578 100644 --- a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/referenceResolutionSameFileTwiceNoResolve.json +++ b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/referenceResolutionSameFileTwiceNoResolve.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/referenceResolutionSameFileTwiceNoResolve.json b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/referenceResolutionSameFileTwiceNoResolve.json index df013fc038963..a71527ddd7578 100644 --- a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/referenceResolutionSameFileTwiceNoResolve.json +++ b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/referenceResolutionSameFileTwiceNoResolve.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/relativeGlobal/amd/relativeGlobal.json b/tests/baselines/reference/project/relativeGlobal/amd/relativeGlobal.json index 78c23379ac5ed..0f98943850eb1 100644 --- a/tests/baselines/reference/project/relativeGlobal/amd/relativeGlobal.json +++ b/tests/baselines/reference/project/relativeGlobal/amd/relativeGlobal.json @@ -7,6 +7,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "consume.ts" ], diff --git a/tests/baselines/reference/project/relativeGlobal/node/relativeGlobal.json b/tests/baselines/reference/project/relativeGlobal/node/relativeGlobal.json index 78c23379ac5ed..0f98943850eb1 100644 --- a/tests/baselines/reference/project/relativeGlobal/node/relativeGlobal.json +++ b/tests/baselines/reference/project/relativeGlobal/node/relativeGlobal.json @@ -7,6 +7,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "consume.ts" ], diff --git a/tests/baselines/reference/project/relativeGlobalRef/amd/relativeGlobalRef.json b/tests/baselines/reference/project/relativeGlobalRef/amd/relativeGlobalRef.json index 3e463b2e3d61d..32464f4c0c793 100644 --- a/tests/baselines/reference/project/relativeGlobalRef/amd/relativeGlobalRef.json +++ b/tests/baselines/reference/project/relativeGlobalRef/amd/relativeGlobalRef.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.d.ts", "consume.ts" ], diff --git a/tests/baselines/reference/project/relativeGlobalRef/node/relativeGlobalRef.json b/tests/baselines/reference/project/relativeGlobalRef/node/relativeGlobalRef.json index 3e463b2e3d61d..32464f4c0c793 100644 --- a/tests/baselines/reference/project/relativeGlobalRef/node/relativeGlobalRef.json +++ b/tests/baselines/reference/project/relativeGlobalRef/node/relativeGlobalRef.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.d.ts", "consume.ts" ], diff --git a/tests/baselines/reference/project/relativeNested/amd/relativeNested.json b/tests/baselines/reference/project/relativeNested/amd/relativeNested.json index aa4153f638a1a..afa486bfd7728 100644 --- a/tests/baselines/reference/project/relativeNested/amd/relativeNested.json +++ b/tests/baselines/reference/project/relativeNested/amd/relativeNested.json @@ -7,6 +7,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "main/consume.ts", "app.ts" diff --git a/tests/baselines/reference/project/relativeNested/node/relativeNested.json b/tests/baselines/reference/project/relativeNested/node/relativeNested.json index aa4153f638a1a..afa486bfd7728 100644 --- a/tests/baselines/reference/project/relativeNested/node/relativeNested.json +++ b/tests/baselines/reference/project/relativeNested/node/relativeNested.json @@ -7,6 +7,8 @@ "runTest": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.ts", "main/consume.ts", "app.ts" diff --git a/tests/baselines/reference/project/relativeNestedRef/amd/relativeNestedRef.json b/tests/baselines/reference/project/relativeNestedRef/amd/relativeNestedRef.json index ad0eb75178322..64a85305c0114 100644 --- a/tests/baselines/reference/project/relativeNestedRef/amd/relativeNestedRef.json +++ b/tests/baselines/reference/project/relativeNestedRef/amd/relativeNestedRef.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.d.ts", "main/consume.ts" ], diff --git a/tests/baselines/reference/project/relativeNestedRef/node/relativeNestedRef.json b/tests/baselines/reference/project/relativeNestedRef/node/relativeNestedRef.json index ad0eb75178322..64a85305c0114 100644 --- a/tests/baselines/reference/project/relativeNestedRef/node/relativeNestedRef.json +++ b/tests/baselines/reference/project/relativeNestedRef/node/relativeNestedRef.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "decl.d.ts", "main/consume.ts" ], diff --git a/tests/baselines/reference/project/relativePaths/amd/relativePaths.json b/tests/baselines/reference/project/relativePaths/amd/relativePaths.json index e0591c7597985..ce98f5d3d6684 100644 --- a/tests/baselines/reference/project/relativePaths/amd/relativePaths.json +++ b/tests/baselines/reference/project/relativePaths/amd/relativePaths.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "A/b.ts", "A/a.ts", "app.ts" diff --git a/tests/baselines/reference/project/relativePaths/node/relativePaths.json b/tests/baselines/reference/project/relativePaths/node/relativePaths.json index e0591c7597985..ce98f5d3d6684 100644 --- a/tests/baselines/reference/project/relativePaths/node/relativePaths.json +++ b/tests/baselines/reference/project/relativePaths/node/relativePaths.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "A/b.ts", "A/a.ts", "app.ts" diff --git a/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json index 8c7a5c125e9cf..96ae34f24c745 100644 --- a/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json +++ b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.json @@ -11,6 +11,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "FolderA/FolderB/FolderC/fileC.ts", "FolderA/FolderB/fileB.ts" ], diff --git a/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json index 8c7a5c125e9cf..96ae34f24c745 100644 --- a/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json +++ b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.json @@ -11,6 +11,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "FolderA/FolderB/FolderC/fileC.ts", "FolderA/FolderB/fileB.ts" ], diff --git a/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.json b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.json index 7deea1ddb8e2f..29426144daa0b 100644 --- a/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.json +++ b/tests/baselines/reference/project/rootDirectoryErrors/amd/rootDirectoryErrors.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "FolderA/FolderB/FolderC/fileC.ts", "FolderA/FolderB/fileB.ts" ], diff --git a/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.json b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.json index 7deea1ddb8e2f..29426144daa0b 100644 --- a/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.json +++ b/tests/baselines/reference/project/rootDirectoryErrors/node/rootDirectoryErrors.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "FolderA/FolderB/FolderC/fileC.ts", "FolderA/FolderB/fileB.ts" ], diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.json b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.json index debfdabbdfb1c..6efb352986a3c 100644 --- a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.json +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.json @@ -11,6 +11,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "FolderA/FolderB/FolderC/fileC.ts", "FolderA/FolderB/fileB.ts" ], diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.json b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.json index debfdabbdfb1c..6efb352986a3c 100644 --- a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.json +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.json @@ -11,6 +11,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "FolderA/FolderB/FolderC/fileC.ts", "FolderA/FolderB/fileB.ts" ], diff --git a/tests/baselines/reference/project/rootDirectoryWithoutOutDir/amd/rootDirectoryWithoutOutDir.json b/tests/baselines/reference/project/rootDirectoryWithoutOutDir/amd/rootDirectoryWithoutOutDir.json index ce32cd431b2cf..b14914ff0346c 100644 --- a/tests/baselines/reference/project/rootDirectoryWithoutOutDir/amd/rootDirectoryWithoutOutDir.json +++ b/tests/baselines/reference/project/rootDirectoryWithoutOutDir/amd/rootDirectoryWithoutOutDir.json @@ -7,6 +7,8 @@ "rootDir": "FolderA/FolderB/FolderC", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "FolderA/FolderB/FolderC/fileC.ts", "FolderA/FolderB/fileB.ts" ], diff --git a/tests/baselines/reference/project/rootDirectoryWithoutOutDir/node/rootDirectoryWithoutOutDir.json b/tests/baselines/reference/project/rootDirectoryWithoutOutDir/node/rootDirectoryWithoutOutDir.json index ce32cd431b2cf..b14914ff0346c 100644 --- a/tests/baselines/reference/project/rootDirectoryWithoutOutDir/node/rootDirectoryWithoutOutDir.json +++ b/tests/baselines/reference/project/rootDirectoryWithoutOutDir/node/rootDirectoryWithoutOutDir.json @@ -7,6 +7,8 @@ "rootDir": "FolderA/FolderB/FolderC", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "FolderA/FolderB/FolderC/fileC.ts", "FolderA/FolderB/fileB.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/sourceRootAbsolutePathMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/sourceRootAbsolutePathMixedSubfolderNoOutdir.json index 5558d09cff045..54dc140e1dfa4 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/sourceRootAbsolutePathMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/sourceRootAbsolutePathMixedSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/sourceRootAbsolutePathMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/sourceRootAbsolutePathMixedSubfolderNoOutdir.json index 5558d09cff045..54dc140e1dfa4 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/sourceRootAbsolutePathMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/sourceRootAbsolutePathMixedSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json index 08db981938ddc..99a53de496918 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json index 08db981938ddc..99a53de496918 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json index add85ba77b83a..499f2f3b1d907 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json index add85ba77b83a..499f2f3b1d907 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index f8cb5ae4005cc..7089293100780 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -13,6 +13,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index f8cb5ae4005cc..7089293100780 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -13,6 +13,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderNoOutdir/amd/sourceRootAbsolutePathModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderNoOutdir/amd/sourceRootAbsolutePathModuleMultifolderNoOutdir.json index 00275390d495a..cd1a32353f451 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderNoOutdir/amd/sourceRootAbsolutePathModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderNoOutdir/amd/sourceRootAbsolutePathModuleMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderNoOutdir/node/sourceRootAbsolutePathModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderNoOutdir/node/sourceRootAbsolutePathModuleMultifolderNoOutdir.json index 00275390d495a..cd1a32353f451 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderNoOutdir/node/sourceRootAbsolutePathModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderNoOutdir/node/sourceRootAbsolutePathModuleMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json index 3e9835cb39b8f..943c9f685e5fa 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json index 3e9835cb39b8f..943c9f685e5fa 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json index 87783cc3ebcd7..c5e8b375fe3e9 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json index c0cf625cc2b6a..f9228f2e9d3e1 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleNoOutdir/amd/sourceRootAbsolutePathModuleSimpleNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleNoOutdir/amd/sourceRootAbsolutePathModuleSimpleNoOutdir.json index 409d97ad10e21..c91638a9c7454 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleNoOutdir/amd/sourceRootAbsolutePathModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleNoOutdir/amd/sourceRootAbsolutePathModuleSimpleNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleNoOutdir/node/sourceRootAbsolutePathModuleSimpleNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleNoOutdir/node/sourceRootAbsolutePathModuleSimpleNoOutdir.json index 409d97ad10e21..c91638a9c7454 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleNoOutdir/node/sourceRootAbsolutePathModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleNoOutdir/node/sourceRootAbsolutePathModuleSimpleNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json index 2cdf90cf47a8b..72c7e99dcf028 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json index 2cdf90cf47a8b..72c7e99dcf028 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json index b3b9bda4d55d6..e92c71f42b150 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json index 6bac4492c05b8..1c41f04f7a66f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile/node/sourceRootAbsolutePathModuleSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderNoOutdir/amd/sourceRootAbsolutePathModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderNoOutdir/amd/sourceRootAbsolutePathModuleSubfolderNoOutdir.json index 9d91234a1a9b2..4de88028c9fba 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderNoOutdir/amd/sourceRootAbsolutePathModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderNoOutdir/amd/sourceRootAbsolutePathModuleSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderNoOutdir/node/sourceRootAbsolutePathModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderNoOutdir/node/sourceRootAbsolutePathModuleSubfolderNoOutdir.json index 9d91234a1a9b2..4de88028c9fba 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderNoOutdir/node/sourceRootAbsolutePathModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderNoOutdir/node/sourceRootAbsolutePathModuleSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json index 76ce8b750d84e..91547e5ec71b8 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json index 76ce8b750d84e..91547e5ec71b8 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json index efba75598433a..3b9d70d28c864 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json index 57ae179fadde2..b1e2eb2d31b68 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathModuleSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/sourceRootAbsolutePathMultifolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/sourceRootAbsolutePathMultifolderNoOutdir.json index 7e385c3c04120..74a242027c28e 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/sourceRootAbsolutePathMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/sourceRootAbsolutePathMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/sourceRootAbsolutePathMultifolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/sourceRootAbsolutePathMultifolderNoOutdir.json index 7e385c3c04120..74a242027c28e 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/sourceRootAbsolutePathMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/sourceRootAbsolutePathMultifolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.json index 075d479d4fd0f..d9a269478d964 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.json index 075d479d4fd0f..d9a269478d964 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathMultifolderSpecifyOutputFile.json index baec72a7bec0c..2ec1c0876bf20 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.json index baec72a7bec0c..2ec1c0876bf20 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/sourceRootAbsolutePathSimpleNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/sourceRootAbsolutePathSimpleNoOutdir.json index 7b82ba4969174..ff8d63233067a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/sourceRootAbsolutePathSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/sourceRootAbsolutePathSimpleNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/sourceRootAbsolutePathSimpleNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/sourceRootAbsolutePathSimpleNoOutdir.json index 7b82ba4969174..ff8d63233067a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/sourceRootAbsolutePathSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/sourceRootAbsolutePathSimpleNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.json index fe2e1509fbfcb..bcc8bbe3da8ba 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.json index fe2e1509fbfcb..bcc8bbe3da8ba 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathSimpleSpecifyOutputFile.json index 2c06a5d4780e0..6cbe6a5309118 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.json index 2c06a5d4780e0..6cbe6a5309118 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileNoOutdir/amd/sourceRootAbsolutePathSingleFileNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileNoOutdir/amd/sourceRootAbsolutePathSingleFileNoOutdir.json index e48dd56a9bbf6..dd2fff2cb99e1 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileNoOutdir/amd/sourceRootAbsolutePathSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileNoOutdir/amd/sourceRootAbsolutePathSingleFileNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileNoOutdir/node/sourceRootAbsolutePathSingleFileNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileNoOutdir/node/sourceRootAbsolutePathSingleFileNoOutdir.json index e48dd56a9bbf6..dd2fff2cb99e1 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileNoOutdir/node/sourceRootAbsolutePathSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileNoOutdir/node/sourceRootAbsolutePathSingleFileNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory/amd/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory/amd/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory.json index 7571482a15451..353bf2bcbe87a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory/amd/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory/amd/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory/node/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory/node/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory.json index 7571482a15451..353bf2bcbe87a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory/node/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory/node/sourceRootAbsolutePathSingleFileSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/amd/sourceRootAbsolutePathSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/amd/sourceRootAbsolutePathSingleFileSpecifyOutputFile.json index a337bb07bdc59..3942383f683a9 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/amd/sourceRootAbsolutePathSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/amd/sourceRootAbsolutePathSingleFileSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.json index a337bb07bdc59..3942383f683a9 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSingleFileSpecifyOutputFile/node/sourceRootAbsolutePathSingleFileSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/sourceRootAbsolutePathSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/sourceRootAbsolutePathSubfolderNoOutdir.json index 245f62e47c1ae..f1567a8882a1f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/sourceRootAbsolutePathSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/sourceRootAbsolutePathSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/sourceRootAbsolutePathSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/sourceRootAbsolutePathSubfolderNoOutdir.json index 245f62e47c1ae..f1567a8882a1f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/sourceRootAbsolutePathSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/sourceRootAbsolutePathSubfolderNoOutdir.json @@ -11,6 +11,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.json index cbc12d999e3d4..0cf86077a686c 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.json index cbc12d999e3d4..0cf86077a686c 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathSubfolderSpecifyOutputFile.json index e0f3690eba343..d3ac3a495d29f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.json index e0f3690eba343..d3ac3a495d29f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.json @@ -12,6 +12,8 @@ "resolveSourceRoot": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/sourceRootRelativePathMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/sourceRootRelativePathMixedSubfolderNoOutdir.json index e3461e3e97110..e88496235ff0a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/sourceRootRelativePathMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/sourceRootRelativePathMixedSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/sourceRootRelativePathMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/sourceRootRelativePathMixedSubfolderNoOutdir.json index e3461e3e97110..e88496235ff0a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/sourceRootRelativePathMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/sourceRootRelativePathMixedSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.json index 235203de03e60..215bf5be82ce7 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.json index 235203de03e60..215bf5be82ce7 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json index 093798629a8bf..fb08ca4bafae8 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json index 093798629a8bf..fb08ca4bafae8 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 5e13094efd317..e8ae9e150f063 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 5e13094efd317..e8ae9e150f063 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderNoOutdir/amd/sourceRootRelativePathModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderNoOutdir/amd/sourceRootRelativePathModuleMultifolderNoOutdir.json index c790fc7fa7eaf..98a9d8ddee1ef 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderNoOutdir/amd/sourceRootRelativePathModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderNoOutdir/amd/sourceRootRelativePathModuleMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderNoOutdir/node/sourceRootRelativePathModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderNoOutdir/node/sourceRootRelativePathModuleMultifolderNoOutdir.json index c790fc7fa7eaf..98a9d8ddee1ef 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderNoOutdir/node/sourceRootRelativePathModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderNoOutdir/node/sourceRootRelativePathModuleMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory.json index bf7f74954e9fa..26a7372bdd8b1 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory.json index bf7f74954e9fa..26a7372bdd8b1 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathModuleMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json index 3bf8e03753335..b23978bbacbcd 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/amd/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json index 92a4cbdfc7d91..8073c8445a71d 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleMultifolderSpecifyOutputFile/node/sourceRootRelativePathModuleMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleNoOutdir/amd/sourceRootRelativePathModuleSimpleNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleNoOutdir/amd/sourceRootRelativePathModuleSimpleNoOutdir.json index 2336f1abc31da..095f1679fe75a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleNoOutdir/amd/sourceRootRelativePathModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleNoOutdir/amd/sourceRootRelativePathModuleSimpleNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleNoOutdir/node/sourceRootRelativePathModuleSimpleNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleNoOutdir/node/sourceRootRelativePathModuleSimpleNoOutdir.json index 2336f1abc31da..095f1679fe75a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleNoOutdir/node/sourceRootRelativePathModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleNoOutdir/node/sourceRootRelativePathModuleSimpleNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory.json index e7ab45cb4d564..c76456c546746 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory/node/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory/node/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory.json index e7ab45cb4d564..c76456c546746 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory/node/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory/node/sourceRootRelativePathModuleSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json index 73af3537626ec..403c703dc3160 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/amd/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json index 602619898e980..5db69ae68331e 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSimpleSpecifyOutputFile/node/sourceRootRelativePathModuleSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderNoOutdir/amd/sourceRootRelativePathModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderNoOutdir/amd/sourceRootRelativePathModuleSubfolderNoOutdir.json index 8f4656da00e09..35884f5fd2aa1 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderNoOutdir/amd/sourceRootRelativePathModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderNoOutdir/amd/sourceRootRelativePathModuleSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderNoOutdir/node/sourceRootRelativePathModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderNoOutdir/node/sourceRootRelativePathModuleSubfolderNoOutdir.json index 8f4656da00e09..35884f5fd2aa1 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderNoOutdir/node/sourceRootRelativePathModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderNoOutdir/node/sourceRootRelativePathModuleSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory.json index 70b26bc417c97..5fa148b713127 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory.json index 70b26bc417c97..5fa148b713127 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathModuleSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json index 80c46e0284791..d7fa4c8247c7a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/amd/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json index e2a0f396502c4..e6049e27de13d 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathModuleSubfolderSpecifyOutputFile/node/sourceRootRelativePathModuleSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/sourceRootRelativePathMultifolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/sourceRootRelativePathMultifolderNoOutdir.json index c11b1817250af..b606a4dda8f9f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/sourceRootRelativePathMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/sourceRootRelativePathMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/sourceRootRelativePathMultifolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/sourceRootRelativePathMultifolderNoOutdir.json index c11b1817250af..b606a4dda8f9f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/sourceRootRelativePathMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/sourceRootRelativePathMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathMultifolderSpecifyOutputDirectory.json index 9b55aea3a2ff1..b50d1c469f44c 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathMultifolderSpecifyOutputDirectory.json index 9b55aea3a2ff1..b50d1c469f44c 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/sourceRootRelativePathMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/sourceRootRelativePathMultifolderSpecifyOutputFile.json index 5ffb3ed147240..9c57960eb74de 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/sourceRootRelativePathMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/sourceRootRelativePathMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.json index 5ffb3ed147240..9c57960eb74de 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/sourceRootRelativePathSimpleNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/sourceRootRelativePathSimpleNoOutdir.json index 3dd81001264e3..52b7b4e339932 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/sourceRootRelativePathSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/sourceRootRelativePathSimpleNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/sourceRootRelativePathSimpleNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/sourceRootRelativePathSimpleNoOutdir.json index 3dd81001264e3..52b7b4e339932 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/sourceRootRelativePathSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/sourceRootRelativePathSimpleNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathSimpleSpecifyOutputDirectory.json index aa88b3bc7dd93..bed9b7a091da4 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/sourceRootRelativePathSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/sourceRootRelativePathSimpleSpecifyOutputDirectory.json index aa88b3bc7dd93..bed9b7a091da4 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/sourceRootRelativePathSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/sourceRootRelativePathSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/sourceRootRelativePathSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/sourceRootRelativePathSimpleSpecifyOutputFile.json index 04f0a1686c67e..97c1eae937685 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/sourceRootRelativePathSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/sourceRootRelativePathSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.json index 04f0a1686c67e..97c1eae937685 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSingleFileNoOutdir/amd/sourceRootRelativePathSingleFileNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathSingleFileNoOutdir/amd/sourceRootRelativePathSingleFileNoOutdir.json index 56d9e5160db72..e15a5b5fed30d 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSingleFileNoOutdir/amd/sourceRootRelativePathSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSingleFileNoOutdir/amd/sourceRootRelativePathSingleFileNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootRelativePathSingleFileNoOutdir/node/sourceRootRelativePathSingleFileNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathSingleFileNoOutdir/node/sourceRootRelativePathSingleFileNoOutdir.json index 56d9e5160db72..e15a5b5fed30d 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSingleFileNoOutdir/node/sourceRootRelativePathSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSingleFileNoOutdir/node/sourceRootRelativePathSingleFileNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputDirectory/amd/sourceRootRelativePathSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputDirectory/amd/sourceRootRelativePathSingleFileSpecifyOutputDirectory.json index 9c787870ca1d0..395338208d629 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputDirectory/amd/sourceRootRelativePathSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputDirectory/amd/sourceRootRelativePathSingleFileSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputDirectory/node/sourceRootRelativePathSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputDirectory/node/sourceRootRelativePathSingleFileSpecifyOutputDirectory.json index 9c787870ca1d0..395338208d629 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputDirectory/node/sourceRootRelativePathSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputDirectory/node/sourceRootRelativePathSingleFileSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/amd/sourceRootRelativePathSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/amd/sourceRootRelativePathSingleFileSpecifyOutputFile.json index 5743795520b22..75bfb8792718a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/amd/sourceRootRelativePathSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/amd/sourceRootRelativePathSingleFileSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.json index 5743795520b22..75bfb8792718a 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSingleFileSpecifyOutputFile/node/sourceRootRelativePathSingleFileSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/sourceRootRelativePathSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/sourceRootRelativePathSubfolderNoOutdir.json index 43345666db832..10a988c4c140d 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/sourceRootRelativePathSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/sourceRootRelativePathSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/sourceRootRelativePathSubfolderNoOutdir.json b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/sourceRootRelativePathSubfolderNoOutdir.json index 43345666db832..10a988c4c140d 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/sourceRootRelativePathSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/sourceRootRelativePathSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathSubfolderSpecifyOutputDirectory.json index 37b9b953f505b..2d9abc19c8cba 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathSubfolderSpecifyOutputDirectory.json index 37b9b953f505b..2d9abc19c8cba 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/sourceRootRelativePathSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/sourceRootRelativePathSubfolderSpecifyOutputFile.json index 22602e7983033..603cc6ee949b0 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/sourceRootRelativePathSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/sourceRootRelativePathSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.json index 22602e7983033..603cc6ee949b0 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.json b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.json index d6bf964ac64a6..fc384d036c0a2 100644 --- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.json +++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.json @@ -7,6 +7,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.json b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.json index d6bf964ac64a6..fc384d036c0a2 100644 --- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.json +++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.json @@ -7,6 +7,8 @@ "sourceRoot": "../src", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/sourcemapMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/sourcemapMixedSubfolderNoOutdir.json index f5b8c0b912308..57da4ec829679 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/sourcemapMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/sourcemapMixedSubfolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/sourcemapMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/sourcemapMixedSubfolderNoOutdir.json index f5b8c0b912308..57da4ec829679 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/sourcemapMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/sourcemapMixedSubfolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputDirectory.json index 1de709bceb8dc..75e5d91e3b6fb 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputDirectory.json index 1de709bceb8dc..75e5d91e3b6fb 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.json index df192538c4b89..ca15bdbd0390a 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.json index df192538c4b89..ca15bdbd0390a 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index ce3f6fcc301bd..0e12348e4a879 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -11,6 +11,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index ce3f6fcc301bd..0e12348e4a879 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -11,6 +11,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderNoOutdir/amd/sourcemapModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/sourcemapModuleMultifolderNoOutdir/amd/sourcemapModuleMultifolderNoOutdir.json index b261594a8df14..96573ef4e5f05 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderNoOutdir/amd/sourcemapModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderNoOutdir/amd/sourcemapModuleMultifolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderNoOutdir/node/sourcemapModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/sourcemapModuleMultifolderNoOutdir/node/sourcemapModuleMultifolderNoOutdir.json index b261594a8df14..96573ef4e5f05 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderNoOutdir/node/sourcemapModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderNoOutdir/node/sourcemapModuleMultifolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputDirectory/amd/sourcemapModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputDirectory/amd/sourcemapModuleMultifolderSpecifyOutputDirectory.json index cf7c46ad11a39..b88e5a9345082 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputDirectory/amd/sourcemapModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputDirectory/amd/sourcemapModuleMultifolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputDirectory/node/sourcemapModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputDirectory/node/sourcemapModuleMultifolderSpecifyOutputDirectory.json index cf7c46ad11a39..b88e5a9345082 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputDirectory/node/sourcemapModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputDirectory/node/sourcemapModuleMultifolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.json index 5f4ed3c9e6d37..5ef45d7a2bf81 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/amd/sourcemapModuleMultifolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.json index 8167c8755d70e..3f397d21470eb 100644 --- a/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleMultifolderSpecifyOutputFile/node/sourcemapModuleMultifolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleNoOutdir/amd/sourcemapModuleSimpleNoOutdir.json b/tests/baselines/reference/project/sourcemapModuleSimpleNoOutdir/amd/sourcemapModuleSimpleNoOutdir.json index 04b53d1020fbd..0328c9914f0a1 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleNoOutdir/amd/sourcemapModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapModuleSimpleNoOutdir/amd/sourcemapModuleSimpleNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleNoOutdir/node/sourcemapModuleSimpleNoOutdir.json b/tests/baselines/reference/project/sourcemapModuleSimpleNoOutdir/node/sourcemapModuleSimpleNoOutdir.json index 04b53d1020fbd..0328c9914f0a1 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleNoOutdir/node/sourcemapModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapModuleSimpleNoOutdir/node/sourcemapModuleSimpleNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputDirectory/amd/sourcemapModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputDirectory/amd/sourcemapModuleSimpleSpecifyOutputDirectory.json index a2d323fe872c7..ed11d857232e6 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputDirectory/amd/sourcemapModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputDirectory/amd/sourcemapModuleSimpleSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputDirectory/node/sourcemapModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputDirectory/node/sourcemapModuleSimpleSpecifyOutputDirectory.json index a2d323fe872c7..ed11d857232e6 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputDirectory/node/sourcemapModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputDirectory/node/sourcemapModuleSimpleSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.json index 152a40bc573b1..968443c40f850 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/amd/sourcemapModuleSimpleSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.json index cdb829934f068..4287a57f845d3 100644 --- a/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleSimpleSpecifyOutputFile/node/sourcemapModuleSimpleSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderNoOutdir/amd/sourcemapModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcemapModuleSubfolderNoOutdir/amd/sourcemapModuleSubfolderNoOutdir.json index b9f300fe37db1..7c2604a204dbc 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderNoOutdir/amd/sourcemapModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderNoOutdir/amd/sourcemapModuleSubfolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderNoOutdir/node/sourcemapModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcemapModuleSubfolderNoOutdir/node/sourcemapModuleSubfolderNoOutdir.json index b9f300fe37db1..7c2604a204dbc 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderNoOutdir/node/sourcemapModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderNoOutdir/node/sourcemapModuleSubfolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputDirectory/amd/sourcemapModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputDirectory/amd/sourcemapModuleSubfolderSpecifyOutputDirectory.json index 708028e4cb473..f37af38b003d8 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputDirectory/amd/sourcemapModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputDirectory/amd/sourcemapModuleSubfolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputDirectory/node/sourcemapModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputDirectory/node/sourcemapModuleSubfolderSpecifyOutputDirectory.json index 708028e4cb473..f37af38b003d8 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputDirectory/node/sourcemapModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputDirectory/node/sourcemapModuleSubfolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.json index f9455330ff4e7..2e77077c1a94a 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/amd/sourcemapModuleSubfolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.json index 151376ed1d8a7..51f7e64041b82 100644 --- a/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapModuleSubfolderSpecifyOutputFile/node/sourcemapModuleSubfolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/sourcemapMultifolderNoOutdir.json b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/sourcemapMultifolderNoOutdir.json index a822e032bfc4a..df52282f135a8 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/sourcemapMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/sourcemapMultifolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/sourcemapMultifolderNoOutdir.json b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/sourcemapMultifolderNoOutdir.json index a822e032bfc4a..df52282f135a8 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/sourcemapMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/sourcemapMultifolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/sourcemapMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/sourcemapMultifolderSpecifyOutputDirectory.json index 7b911bc9857ce..a571424b3927d 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/sourcemapMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/sourcemapMultifolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/sourcemapMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/sourcemapMultifolderSpecifyOutputDirectory.json index 7b911bc9857ce..a571424b3927d 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/sourcemapMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/sourcemapMultifolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/sourcemapMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/sourcemapMultifolderSpecifyOutputFile.json index 8c6d41e7c4809..2be183ff65830 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/sourcemapMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/sourcemapMultifolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.json index 8c6d41e7c4809..2be183ff65830 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/sourcemapSimpleNoOutdir.json b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/sourcemapSimpleNoOutdir.json index e87a7b6c38978..dedc11ce3ed71 100644 --- a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/sourcemapSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/sourcemapSimpleNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/sourcemapSimpleNoOutdir.json b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/sourcemapSimpleNoOutdir.json index e87a7b6c38978..dedc11ce3ed71 100644 --- a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/sourcemapSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/sourcemapSimpleNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/sourcemapSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/sourcemapSimpleSpecifyOutputDirectory.json index 7046429aaba75..b5caaacbfc91a 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/sourcemapSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/sourcemapSimpleSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/sourcemapSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/sourcemapSimpleSpecifyOutputDirectory.json index 7046429aaba75..b5caaacbfc91a 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/sourcemapSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/sourcemapSimpleSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/sourcemapSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/sourcemapSimpleSpecifyOutputFile.json index 85e737101b395..171c6b3fa895a 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/sourcemapSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/sourcemapSimpleSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.json index 85e737101b395..171c6b3fa895a 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSingleFileNoOutdir/amd/sourcemapSingleFileNoOutdir.json b/tests/baselines/reference/project/sourcemapSingleFileNoOutdir/amd/sourcemapSingleFileNoOutdir.json index 3441d5c6a4835..bc24b0b02f89a 100644 --- a/tests/baselines/reference/project/sourcemapSingleFileNoOutdir/amd/sourcemapSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapSingleFileNoOutdir/amd/sourcemapSingleFileNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcemapSingleFileNoOutdir/node/sourcemapSingleFileNoOutdir.json b/tests/baselines/reference/project/sourcemapSingleFileNoOutdir/node/sourcemapSingleFileNoOutdir.json index 3441d5c6a4835..bc24b0b02f89a 100644 --- a/tests/baselines/reference/project/sourcemapSingleFileNoOutdir/node/sourcemapSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapSingleFileNoOutdir/node/sourcemapSingleFileNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputDirectory/amd/sourcemapSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputDirectory/amd/sourcemapSingleFileSpecifyOutputDirectory.json index 2b4661b72d618..398627aba0afa 100644 --- a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputDirectory/amd/sourcemapSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputDirectory/amd/sourcemapSingleFileSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputDirectory/node/sourcemapSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputDirectory/node/sourcemapSingleFileSpecifyOutputDirectory.json index 2b4661b72d618..398627aba0afa 100644 --- a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputDirectory/node/sourcemapSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputDirectory/node/sourcemapSingleFileSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/amd/sourcemapSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/amd/sourcemapSingleFileSpecifyOutputFile.json index b951c8969f0db..632cbb9485070 100644 --- a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/amd/sourcemapSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/amd/sourcemapSingleFileSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.json index b951c8969f0db..632cbb9485070 100644 --- a/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapSingleFileSpecifyOutputFile/node/sourcemapSingleFileSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/sourcemapSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/sourcemapSubfolderNoOutdir.json index efac57d108fba..50a5c31f190b0 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/sourcemapSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/sourcemapSubfolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/sourcemapSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/sourcemapSubfolderNoOutdir.json index efac57d108fba..50a5c31f190b0 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/sourcemapSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/sourcemapSubfolderNoOutdir.json @@ -9,6 +9,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/sourcemapSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/sourcemapSubfolderSpecifyOutputDirectory.json index e40ece951dd6c..4ebbac59dda34 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/sourcemapSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/sourcemapSubfolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/sourcemapSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/sourcemapSubfolderSpecifyOutputDirectory.json index e40ece951dd6c..4ebbac59dda34 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/sourcemapSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/sourcemapSubfolderSpecifyOutputDirectory.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/sourcemapSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/sourcemapSubfolderSpecifyOutputFile.json index e6d7e5bccb039..55e340576c426 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/sourcemapSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/sourcemapSubfolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.json index e6d7e5bccb039..55e340576c426 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.json @@ -10,6 +10,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/sourcerootUrlMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/sourcerootUrlMixedSubfolderNoOutdir.json index 42a7ecd93d59d..8a7f79e478414 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/sourcerootUrlMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/sourcerootUrlMixedSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/sourcerootUrlMixedSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/sourcerootUrlMixedSubfolderNoOutdir.json index 42a7ecd93d59d..8a7f79e478414 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/sourcerootUrlMixedSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/sourcerootUrlMixedSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.json index e7bbece8ed8c2..2fed55ae75e25 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.json index e7bbece8ed8c2..2fed55ae75e25 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.json index d9c3d06ec359d..52cda4cda4ca1 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.json index d9c3d06ec359d..52cda4cda4ca1 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 9518c0eaf0717..664d2fbc79510 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json index 9518c0eaf0717..664d2fbc79510 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.json @@ -12,6 +12,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderNoOutdir/amd/sourcerootUrlModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderNoOutdir/amd/sourcerootUrlModuleMultifolderNoOutdir.json index de3e5ce76549e..2fdfb4b184224 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderNoOutdir/amd/sourcerootUrlModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderNoOutdir/amd/sourcerootUrlModuleMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderNoOutdir/node/sourcerootUrlModuleMultifolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderNoOutdir/node/sourcerootUrlModuleMultifolderNoOutdir.json index de3e5ce76549e..2fdfb4b184224 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderNoOutdir/node/sourcerootUrlModuleMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderNoOutdir/node/sourcerootUrlModuleMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputDirectory/amd/sourcerootUrlModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputDirectory/amd/sourcerootUrlModuleMultifolderSpecifyOutputDirectory.json index 81609776e1d8e..27711bd31442e 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputDirectory/amd/sourcerootUrlModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputDirectory/amd/sourcerootUrlModuleMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputDirectory/node/sourcerootUrlModuleMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputDirectory/node/sourcerootUrlModuleMultifolderSpecifyOutputDirectory.json index 81609776e1d8e..27711bd31442e 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputDirectory/node/sourcerootUrlModuleMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputDirectory/node/sourcerootUrlModuleMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.json index 4eafa8707ee59..d52687f18ee57 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/amd/sourcerootUrlModuleMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.json index 9744a562988fd..aa275509db3ce 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleMultifolderSpecifyOutputFile/node/sourcerootUrlModuleMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_module_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleNoOutdir/amd/sourcerootUrlModuleSimpleNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlModuleSimpleNoOutdir/amd/sourcerootUrlModuleSimpleNoOutdir.json index 3d2f4d82e2d44..a020dd6db380c 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleNoOutdir/amd/sourcerootUrlModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleNoOutdir/amd/sourcerootUrlModuleSimpleNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleNoOutdir/node/sourcerootUrlModuleSimpleNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlModuleSimpleNoOutdir/node/sourcerootUrlModuleSimpleNoOutdir.json index 3d2f4d82e2d44..a020dd6db380c 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleNoOutdir/node/sourcerootUrlModuleSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleNoOutdir/node/sourcerootUrlModuleSimpleNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputDirectory/amd/sourcerootUrlModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputDirectory/amd/sourcerootUrlModuleSimpleSpecifyOutputDirectory.json index 38d54552cd6d4..c864c2d3766bb 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputDirectory/amd/sourcerootUrlModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputDirectory/amd/sourcerootUrlModuleSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputDirectory/node/sourcerootUrlModuleSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputDirectory/node/sourcerootUrlModuleSimpleSpecifyOutputDirectory.json index 38d54552cd6d4..c864c2d3766bb 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputDirectory/node/sourcerootUrlModuleSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputDirectory/node/sourcerootUrlModuleSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.json index 0be5b600ef7c9..8deb90ce856d9 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/amd/sourcerootUrlModuleSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.json index 36831a27e856d..b8606f5e8f206 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSimpleSpecifyOutputFile/node/sourcerootUrlModuleSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderNoOutdir/amd/sourcerootUrlModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderNoOutdir/amd/sourcerootUrlModuleSubfolderNoOutdir.json index 4f0ece6095fcf..9e1589bd95e91 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderNoOutdir/amd/sourcerootUrlModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderNoOutdir/amd/sourcerootUrlModuleSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderNoOutdir/node/sourcerootUrlModuleSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderNoOutdir/node/sourcerootUrlModuleSubfolderNoOutdir.json index 4f0ece6095fcf..9e1589bd95e91 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderNoOutdir/node/sourcerootUrlModuleSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderNoOutdir/node/sourcerootUrlModuleSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputDirectory/amd/sourcerootUrlModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputDirectory/amd/sourcerootUrlModuleSubfolderSpecifyOutputDirectory.json index cdd06e734f4dc..0da3eb3fb008b 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputDirectory/amd/sourcerootUrlModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputDirectory/amd/sourcerootUrlModuleSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputDirectory/node/sourcerootUrlModuleSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputDirectory/node/sourcerootUrlModuleSubfolderSpecifyOutputDirectory.json index cdd06e734f4dc..0da3eb3fb008b 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputDirectory/node/sourcerootUrlModuleSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputDirectory/node/sourcerootUrlModuleSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.json index 8c13f972a8852..e12d642b8a7cf 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/amd/sourcerootUrlModuleSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.json index 52889e98705b7..4af06269858a6 100644 --- a/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlModuleSubfolderSpecifyOutputFile/node/sourcerootUrlModuleSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/sourcerootUrlMultifolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/sourcerootUrlMultifolderNoOutdir.json index aa7c358f44268..ba83a6fcf4dde 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/sourcerootUrlMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/sourcerootUrlMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/sourcerootUrlMultifolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/sourcerootUrlMultifolderNoOutdir.json index aa7c358f44268..ba83a6fcf4dde 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/sourcerootUrlMultifolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/sourcerootUrlMultifolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/sourcerootUrlMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/sourcerootUrlMultifolderSpecifyOutputDirectory.json index 1fbf6071c4ed9..e8ec5c9da4e73 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/sourcerootUrlMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/sourcerootUrlMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/sourcerootUrlMultifolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/sourcerootUrlMultifolderSpecifyOutputDirectory.json index 1fbf6071c4ed9..e8ec5c9da4e73 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/sourcerootUrlMultifolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/sourcerootUrlMultifolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/sourcerootUrlMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/sourcerootUrlMultifolderSpecifyOutputFile.json index bb449513037db..b61ec6967e013 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/sourcerootUrlMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/sourcerootUrlMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.json index bb449513037db..b61ec6967e013 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "../outputdir_multifolder_ref/m2.ts", "test.ts" diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/sourcerootUrlSimpleNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/sourcerootUrlSimpleNoOutdir.json index 6b4c31401df64..0bb0b4fb96243 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/sourcerootUrlSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/sourcerootUrlSimpleNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/sourcerootUrlSimpleNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/sourcerootUrlSimpleNoOutdir.json index 6b4c31401df64..0bb0b4fb96243 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/sourcerootUrlSimpleNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/sourcerootUrlSimpleNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/sourcerootUrlSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/sourcerootUrlSimpleSpecifyOutputDirectory.json index f031a321ab16c..8d83bcbfa4a49 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/sourcerootUrlSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/sourcerootUrlSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/sourcerootUrlSimpleSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/sourcerootUrlSimpleSpecifyOutputDirectory.json index f031a321ab16c..8d83bcbfa4a49 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/sourcerootUrlSimpleSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/sourcerootUrlSimpleSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/sourcerootUrlSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/sourcerootUrlSimpleSpecifyOutputFile.json index 48c0b49939c9e..ccef6f8bc0ed1 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/sourcerootUrlSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/sourcerootUrlSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.json index 48c0b49939c9e..ccef6f8bc0ed1 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSingleFileNoOutdir/amd/sourcerootUrlSingleFileNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlSingleFileNoOutdir/amd/sourcerootUrlSingleFileNoOutdir.json index 9fdf263471875..a8ec7d985f71f 100644 --- a/tests/baselines/reference/project/sourcerootUrlSingleFileNoOutdir/amd/sourcerootUrlSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlSingleFileNoOutdir/amd/sourcerootUrlSingleFileNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcerootUrlSingleFileNoOutdir/node/sourcerootUrlSingleFileNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlSingleFileNoOutdir/node/sourcerootUrlSingleFileNoOutdir.json index 9fdf263471875..a8ec7d985f71f 100644 --- a/tests/baselines/reference/project/sourcerootUrlSingleFileNoOutdir/node/sourcerootUrlSingleFileNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlSingleFileNoOutdir/node/sourcerootUrlSingleFileNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputDirectory/amd/sourcerootUrlSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputDirectory/amd/sourcerootUrlSingleFileSpecifyOutputDirectory.json index 3b05fa22a175d..42bf8251c6834 100644 --- a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputDirectory/amd/sourcerootUrlSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputDirectory/amd/sourcerootUrlSingleFileSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputDirectory/node/sourcerootUrlSingleFileSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputDirectory/node/sourcerootUrlSingleFileSpecifyOutputDirectory.json index 3b05fa22a175d..42bf8251c6834 100644 --- a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputDirectory/node/sourcerootUrlSingleFileSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputDirectory/node/sourcerootUrlSingleFileSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/amd/sourcerootUrlSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/amd/sourcerootUrlSingleFileSpecifyOutputFile.json index 83d39ce3032b0..7ee955070277c 100644 --- a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/amd/sourcerootUrlSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/amd/sourcerootUrlSingleFileSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.json index 83d39ce3032b0..7ee955070277c 100644 --- a/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlSingleFileSpecifyOutputFile/node/sourcerootUrlSingleFileSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "test.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/sourcerootUrlSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/sourcerootUrlSubfolderNoOutdir.json index 913dea4977e70..4df27f46f032c 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/sourcerootUrlSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/sourcerootUrlSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/sourcerootUrlSubfolderNoOutdir.json b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/sourcerootUrlSubfolderNoOutdir.json index 913dea4977e70..4df27f46f032c 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/sourcerootUrlSubfolderNoOutdir.json +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/sourcerootUrlSubfolderNoOutdir.json @@ -10,6 +10,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/sourcerootUrlSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/sourcerootUrlSubfolderSpecifyOutputDirectory.json index 5ccc3eecec1ce..1f41e0112914c 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/sourcerootUrlSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/sourcerootUrlSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/sourcerootUrlSubfolderSpecifyOutputDirectory.json b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/sourcerootUrlSubfolderSpecifyOutputDirectory.json index 5ccc3eecec1ce..1f41e0112914c 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/sourcerootUrlSubfolderSpecifyOutputDirectory.json +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/sourcerootUrlSubfolderSpecifyOutputDirectory.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/sourcerootUrlSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/sourcerootUrlSubfolderSpecifyOutputFile.json index 7b99cb02c7c70..c3a146b56e722 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/sourcerootUrlSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/sourcerootUrlSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.json b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.json index 7b99cb02c7c70..c3a146b56e722 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.json +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.json @@ -11,6 +11,8 @@ "sourceRoot": "http://typescript.codeplex.com/", "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "ref/m1.ts", "test.ts" ], diff --git a/tests/baselines/reference/project/specifyExcludeUsingRelativepath/amd/specifyExcludeUsingRelativepath.json b/tests/baselines/reference/project/specifyExcludeUsingRelativepath/amd/specifyExcludeUsingRelativepath.json index 09fea457c511c..5da2d12ed996f 100644 --- a/tests/baselines/reference/project/specifyExcludeUsingRelativepath/amd/specifyExcludeUsingRelativepath.json +++ b/tests/baselines/reference/project/specifyExcludeUsingRelativepath/amd/specifyExcludeUsingRelativepath.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/specifyExcludeUsingRelativepath/node/specifyExcludeUsingRelativepath.json b/tests/baselines/reference/project/specifyExcludeUsingRelativepath/node/specifyExcludeUsingRelativepath.json index 09fea457c511c..5da2d12ed996f 100644 --- a/tests/baselines/reference/project/specifyExcludeUsingRelativepath/node/specifyExcludeUsingRelativepath.json +++ b/tests/baselines/reference/project/specifyExcludeUsingRelativepath/node/specifyExcludeUsingRelativepath.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/specifyExcludeUsingRelativepathWithAllowJS/amd/specifyExcludeUsingRelativepathWithAllowJS.json b/tests/baselines/reference/project/specifyExcludeUsingRelativepathWithAllowJS/amd/specifyExcludeUsingRelativepathWithAllowJS.json index ddc535263d2ce..0d793d94bf3e8 100644 --- a/tests/baselines/reference/project/specifyExcludeUsingRelativepathWithAllowJS/amd/specifyExcludeUsingRelativepathWithAllowJS.json +++ b/tests/baselines/reference/project/specifyExcludeUsingRelativepathWithAllowJS/amd/specifyExcludeUsingRelativepathWithAllowJS.json @@ -4,6 +4,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/specifyExcludeUsingRelativepathWithAllowJS/node/specifyExcludeUsingRelativepathWithAllowJS.json b/tests/baselines/reference/project/specifyExcludeUsingRelativepathWithAllowJS/node/specifyExcludeUsingRelativepathWithAllowJS.json index ddc535263d2ce..0d793d94bf3e8 100644 --- a/tests/baselines/reference/project/specifyExcludeUsingRelativepathWithAllowJS/node/specifyExcludeUsingRelativepathWithAllowJS.json +++ b/tests/baselines/reference/project/specifyExcludeUsingRelativepathWithAllowJS/node/specifyExcludeUsingRelativepathWithAllowJS.json @@ -4,6 +4,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePath/amd/specifyExcludeWithOutUsingRelativePath.json b/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePath/amd/specifyExcludeWithOutUsingRelativePath.json index 9e3b6cb04f457..7c8f51ea11026 100644 --- a/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePath/amd/specifyExcludeWithOutUsingRelativePath.json +++ b/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePath/amd/specifyExcludeWithOutUsingRelativePath.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePath/node/specifyExcludeWithOutUsingRelativePath.json b/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePath/node/specifyExcludeWithOutUsingRelativePath.json index 9e3b6cb04f457..7c8f51ea11026 100644 --- a/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePath/node/specifyExcludeWithOutUsingRelativePath.json +++ b/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePath/node/specifyExcludeWithOutUsingRelativePath.json @@ -5,6 +5,8 @@ "declaration": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePathWithAllowJS/amd/specifyExcludeWithOutUsingRelativePathWithAllowJS.json b/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePathWithAllowJS/amd/specifyExcludeWithOutUsingRelativePathWithAllowJS.json index 16afde3acf446..05018d02abd42 100644 --- a/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePathWithAllowJS/amd/specifyExcludeWithOutUsingRelativePathWithAllowJS.json +++ b/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePathWithAllowJS/amd/specifyExcludeWithOutUsingRelativePathWithAllowJS.json @@ -4,6 +4,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePathWithAllowJS/node/specifyExcludeWithOutUsingRelativePathWithAllowJS.json b/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePathWithAllowJS/node/specifyExcludeWithOutUsingRelativePathWithAllowJS.json index 16afde3acf446..05018d02abd42 100644 --- a/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePathWithAllowJS/node/specifyExcludeWithOutUsingRelativePathWithAllowJS.json +++ b/tests/baselines/reference/project/specifyExcludeWithOutUsingRelativePathWithAllowJS/node/specifyExcludeWithOutUsingRelativePathWithAllowJS.json @@ -4,6 +4,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "a.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules/amd/visibilityOfTypeUsedAcrossModules.json b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules/amd/visibilityOfTypeUsedAcrossModules.json index 9ea927e56c2ee..b7ca119530677 100644 --- a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules/amd/visibilityOfTypeUsedAcrossModules.json +++ b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules/amd/visibilityOfTypeUsedAcrossModules.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "fs.ts", "server.ts", "commands.ts" diff --git a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules/node/visibilityOfTypeUsedAcrossModules.json b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules/node/visibilityOfTypeUsedAcrossModules.json index 9ea927e56c2ee..b7ca119530677 100644 --- a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules/node/visibilityOfTypeUsedAcrossModules.json +++ b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules/node/visibilityOfTypeUsedAcrossModules.json @@ -7,6 +7,8 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "fs.ts", "server.ts", "commands.ts" diff --git a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.json b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.json index a4576cc7ff0aa..d1678028db77f 100644 --- a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.json +++ b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.json b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.json index a4576cc7ff0aa..d1678028db77f 100644 --- a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.json +++ b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.json @@ -6,6 +6,8 @@ ], "resolvedInputFiles": [ "lib.es5.d.ts", + "lib.decorators.d.ts", + "lib.decorators.legacy.d.ts", "main.ts" ], "emittedFiles": [ diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index c9862aec4ec6c..fcd86592200f9 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -447,7 +447,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2769: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1535:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1533:5: 'catch' is declared here. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index 17ac4d4aa3c72..53aebabf38660 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -351,7 +351,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1535:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1533:5: 'catch' is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index 835c3fcb71bcf..900a0e840a2c3 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -398,7 +398,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2769: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1535:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1533:5: 'catch' is declared here. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok @@ -445,5 +445,5 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (x: T): IPromise; (x: T, y: T): Promise; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1535:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1533:5: 'catch' is declared here. var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json index 5b9a25f308130..e6c50558f7929 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json @@ -151,5 +151,9 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json index 590cc918f3d5b..1222b87a6ccdb 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json @@ -145,5 +145,9 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/redefineArray.errors.txt b/tests/baselines/reference/redefineArray.errors.txt index 0af9576082efa..cc717eb669634 100644 --- a/tests/baselines/reference/redefineArray.errors.txt +++ b/tests/baselines/reference/redefineArray.errors.txt @@ -5,4 +5,4 @@ tests/cases/compiler/redefineArray.ts(1,1): error TS2741: Property 'isArray' is Array = function (n:number, s:string) {return n;}; ~~~~~ !!! error TS2741: Property 'isArray' is missing in type '(n: number, s: string) => number' but required in type 'ArrayConstructor'. -!!! related TS2728 /.ts/lib.es5.d.ts:1486:5: 'isArray' is declared here. \ No newline at end of file +!!! related TS2728 /.ts/lib.es5.d.ts:1489:5: 'isArray' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt b/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt index 535cc4b2f970f..24ea8ea6da466 100644 --- a/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt +++ b/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } //CHECK#2 @@ -28,7 +28,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error $ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } diff --git a/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt b/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt index 40c4e573c779d..c1f1822ccc568 100644 --- a/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt +++ b/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt @@ -21,7 +21,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.3_A1.1_T2.ts(17,3): error $ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt b/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt index ba258b4f255c3..74b70c26ed781 100644 --- a/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt +++ b/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt @@ -50,70 +50,70 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.6_A4.2_T1.ts(142,3): error $ERROR('#А'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0411 = 1; if (Б !== 1) { $ERROR('#Б'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0412 = 1; if (В !== 1) { $ERROR('#В'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0413 = 1; if (Г !== 1) { $ERROR('#Г'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0414 = 1; if (Д !== 1) { $ERROR('#Д'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0415 = 1; if (Е !== 1) { $ERROR('#Е'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0416 = 1; if (Ж !== 1) { $ERROR('#Ж'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0417 = 1; if (З !== 1) { $ERROR('#З'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0418 = 1; if (И !== 1) { $ERROR('#И'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u0419 = 1; if (Й !== 1) { $ERROR('#Й'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:1059:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1062:13: 'Error' is declared here. } var \u041A = 1; if (К !== 1) { diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index a9e6e98b25080..7222dcffe926c 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -38,7 +38,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. -!!! related TS2728 /.ts/lib.es5.d.ts:608:14: 'raw' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:611:14: 'raw' is declared here. !!! related TS2793 tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var b = foo([], 1); // string ~~ diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt index 6997efce9afd2..b7d6f9b7ab011 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt @@ -38,7 +38,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. -!!! related TS2728 /.ts/lib.es5.d.ts:608:14: 'raw' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:611:14: 'raw' is declared here. !!! related TS2793 tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1_ES6.ts:5:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. var b = foo([], 1); // string ~~ diff --git a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js index 45881e56abdd9..0c9d5111414c2 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js @@ -90,7 +90,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl, decorators, decorators.legacy, decorators.parameters default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index db9a561123600..ff2c5aab53dda 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -90,7 +90,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl, decorators, decorators.legacy, decorators.parameters default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index db9a561123600..ff2c5aab53dda 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -90,7 +90,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl, decorators, decorators.legacy, decorators.parameters default: undefined --allowJs diff --git a/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt b/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt index 0d78ecb6fb28f..26b23cc3b1b1d 100644 --- a/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt +++ b/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/variableDeclarationInStrictMode1.ts(2,5): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/variableDeclarationInStrictMode1.ts(2,5): error TS2300: Duplicate identifier 'eval'. -lib.es5.d.ts(32,18): error TS2300: Duplicate identifier 'eval'. +lib.es5.d.ts(35,18): error TS2300: Duplicate identifier 'eval'. ==== tests/cases/compiler/variableDeclarationInStrictMode1.ts (2 errors) ==== @@ -10,4 +10,4 @@ lib.es5.d.ts(32,18): error TS2300: Duplicate identifier 'eval'. !!! error TS1100: Invalid use of 'eval' in strict mode. ~~~~ !!! error TS2300: Duplicate identifier 'eval'. -!!! related TS6203 /.ts/lib.es5.d.ts:32:18: 'eval' was also declared here. \ No newline at end of file +!!! related TS6203 /.ts/lib.es5.d.ts:35:18: 'eval' was also declared here. \ No newline at end of file diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts index 2f683082db2da..e3bc4eccdc1f2 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport14.ts @@ -27,7 +27,7 @@ verify.completions({ marker: ["import_as0",], - exact: ["lib", "tests", + exact: ["lib", "lib.decorators", "lib.decorators.legacy", "tests", { name: "/module1", replacementSpan: { @@ -50,7 +50,7 @@ verify.completions({ verify.completions({ marker: ["import_equals0",], - exact: ["lib", "tests", + exact: ["lib", "lib.decorators", "lib.decorators.legacy", "tests", { name: "/module1", replacementSpan: { @@ -72,7 +72,7 @@ verify.completions({ verify.completions({ marker: ["require0",], - exact: ["lib", "tests", + exact: ["lib", "lib.decorators", "lib.decorators.legacy", "tests", { name: "/module1", replacementSpan: { diff --git a/tests/cases/fourslash/completionsPaths_importType.ts b/tests/cases/fourslash/completionsPaths_importType.ts index 3541f2c39e761..b001ebffc3b22 100644 --- a/tests/cases/fourslash/completionsPaths_importType.ts +++ b/tests/cases/fourslash/completionsPaths_importType.ts @@ -26,6 +26,8 @@ verify.completions( marker: "2", exact: [ { name: "lib", kind: "script", kindModifiers: ".d.ts" }, + { name: "lib.decorators", kind: "script", kindModifiers: ".d.ts" }, + { name: "lib.decorators.legacy", kind: "script", kindModifiers: ".d.ts" }, { name: "ns", kind: "script", kindModifiers: ".ts" }, { name: "user", kind: "script", kindModifiers: ".js" }, { name: "node_modules", kind: "directory" }, diff --git a/tests/cases/fourslash/server/projectInfo01.ts b/tests/cases/fourslash/server/projectInfo01.ts index 036aa5f0d4de6..8e03a15ca0127 100644 --- a/tests/cases/fourslash/server/projectInfo01.ts +++ b/tests/cases/fourslash/server/projectInfo01.ts @@ -14,11 +14,11 @@ ////console.log("nothing"); goTo.file("a.ts") -verify.ProjectInfo(["/lib.d.ts", "a.ts"]) +verify.ProjectInfo(["/lib.d.ts", "/lib.decorators.d.ts", "/lib.decorators.legacy.d.ts", "a.ts"]) goTo.file("b.ts") -verify.ProjectInfo(["/lib.d.ts", "a.ts", "b.ts"]) +verify.ProjectInfo(["/lib.d.ts", "/lib.decorators.d.ts", "/lib.decorators.legacy.d.ts", "a.ts", "b.ts"]) goTo.file("c.ts") -verify.ProjectInfo(["/lib.d.ts", "a.ts", "b.ts", "c.ts"]) +verify.ProjectInfo(["/lib.d.ts", "/lib.decorators.d.ts", "/lib.decorators.legacy.d.ts", "a.ts", "b.ts", "c.ts"]) goTo.file("d.ts") -verify.ProjectInfo(["/lib.d.ts", "d.ts"]) +verify.ProjectInfo(["/lib.d.ts", "/lib.decorators.d.ts", "/lib.decorators.legacy.d.ts", "d.ts"]) diff --git a/tests/cases/fourslash/server/projectInfo02.ts b/tests/cases/fourslash/server/projectInfo02.ts index fb7c9cf8257cb..724ed476dd169 100644 --- a/tests/cases/fourslash/server/projectInfo02.ts +++ b/tests/cases/fourslash/server/projectInfo02.ts @@ -10,4 +10,4 @@ ////{ "files": ["a.ts", "b.ts"] } goTo.file("a.ts") -verify.ProjectInfo(["/lib.d.ts", "a.ts", "b.ts", "tsconfig.json"]) +verify.ProjectInfo(["/lib.d.ts", "/lib.decorators.d.ts", "/lib.decorators.legacy.d.ts", "a.ts", "b.ts", "tsconfig.json"]) diff --git a/tests/cases/fourslash/server/projectWithNonExistentFiles.ts b/tests/cases/fourslash/server/projectWithNonExistentFiles.ts index a52c5f8918f9d..2d4e0dbc68c08 100644 --- a/tests/cases/fourslash/server/projectWithNonExistentFiles.ts +++ b/tests/cases/fourslash/server/projectWithNonExistentFiles.ts @@ -10,4 +10,4 @@ ////{ "files": ["a.ts", "c.ts", "b.ts"] } goTo.file("a.ts"); -verify.ProjectInfo(["/lib.d.ts", "a.ts", "b.ts", "tsconfig.json"]) +verify.ProjectInfo(["/lib.d.ts", "/lib.decorators.d.ts", "/lib.decorators.legacy.d.ts", "a.ts", "b.ts", "tsconfig.json"]) From beb8e0ad3b7d411fb8e5104e1b5b61990f163a0c Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 26 Aug 2022 14:13:56 -0400 Subject: [PATCH 08/51] Allow 'export default' before decorators --- src/compiler/binder.ts | 2 +- src/compiler/checker.ts | 627 +++++++++--------- src/compiler/diagnosticMessages.json | 2 +- src/compiler/factory/nodeFactory.ts | 106 +-- src/compiler/parser.ts | 364 +++++----- src/compiler/types.ts | 41 +- src/compiler/utilities.ts | 1 - .../reference/decoratorOnClass3.errors.txt | 12 - .../baselines/reference/decoratorOnClass3.js | 4 + .../reference/decoratorOnClass3.symbols | 2 +- ...ratorOnClassMethodThisParameter.errors.txt | 8 +- .../decoratorOnFunctionParameter.errors.txt | 8 +- .../thisTypeInFunctionsNegative.errors.txt | 15 +- .../thisTypeInFunctionsNegative.symbols | 6 +- .../thisTypeInFunctionsNegative.types | 9 +- 15 files changed, 609 insertions(+), 598 deletions(-) delete mode 100644 tests/baselines/reference/decoratorOnClass3.errors.txt diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 1e347f9d81e15..a1b9b39dee41e 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2783,7 +2783,7 @@ namespace ts { } function bindNamespaceExportDeclaration(node: NamespaceExportDeclaration) { - if (some(node.modifiers)) { + if (some(node.decoratorsAndModifiers)) { file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Modifiers_cannot_appear_here)); } const diag = !isSourceFile(node.parent) ? Diagnostics.Global_module_exports_may_only_appear_at_top_level diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index efa748ee20fb8..f403ed5f668bc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -35389,7 +35389,7 @@ namespace ts { // It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code // or if its FunctionBody is strict code(11.1.5). - checkGrammarDecoratorsAndModifiers(node); + checkGrammarModifiers(node); checkVariableLikeDeclaration(node); const func = getContainingFunction(node)!; @@ -35790,7 +35790,7 @@ namespace ts { function checkPropertyDeclaration(node: PropertyDeclaration | PropertySignature) { // Grammar checking - if (!checkGrammarDecoratorsAndModifiers(node) && !checkGrammarProperty(node)) checkGrammarComputedPropertyName(node.name); + if (!checkGrammarModifiers(node) && !checkGrammarProperty(node)) checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); @@ -35852,7 +35852,7 @@ namespace ts { } function checkClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration) { - checkGrammarDecoratorsAndModifiers(node); + checkGrammarModifiers(node); forEachChild(node, checkSourceElement); } @@ -38420,7 +38420,7 @@ namespace ts { function checkVariableStatement(node: VariableStatement) { // Grammar checking - if (!checkGrammarDecoratorsAndModifiers(node) && !checkGrammarVariableDeclarationList(node.declarationList)) checkGrammarForDisallowedLetOrConstStatement(node); + if (!checkGrammarModifiers(node) && !checkGrammarVariableDeclarationList(node.declarationList)) checkGrammarForDisallowedLetOrConstStatement(node); forEach(node.declarationList.declarations, checkSourceElement); } @@ -40721,7 +40721,7 @@ namespace ts { function checkInterfaceDeclaration(node: InterfaceDeclaration) { // Grammar checking - if (!checkGrammarDecoratorsAndModifiers(node)) checkGrammarInterfaceDeclaration(node); + if (!checkGrammarModifiers(node)) checkGrammarInterfaceDeclaration(node); checkTypeParameters(node.typeParameters); addLazyDiagnostic(() => { @@ -40763,7 +40763,7 @@ namespace ts { function checkTypeAliasDeclaration(node: TypeAliasDeclaration) { // Grammar checking - checkGrammarDecoratorsAndModifiers(node); + checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); @@ -40960,7 +40960,7 @@ namespace ts { function checkEnumDeclarationWorker(node: EnumDeclaration) { // Grammar checking - checkGrammarDecoratorsAndModifiers(node); + checkGrammarModifiers(node); checkCollisionsForDeclarationName(node, node.name); checkExportsOnMergedDeclarations(node); @@ -41073,7 +41073,7 @@ namespace ts { return; } - if (!checkGrammarDecoratorsAndModifiers(node)) { + if (!checkGrammarModifiers(node)) { if (!inAmbientContext && node.name.kind === SyntaxKind.StringLiteral) { grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names); } @@ -41458,7 +41458,7 @@ namespace ts { // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecoratorsAndModifiers(node) && hasEffectiveModifiers(node)) { + if (!checkGrammarModifiers(node) && hasEffectiveModifiers(node)) { grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -41493,7 +41493,7 @@ namespace ts { return; } - checkGrammarDecoratorsAndModifiers(node); + checkGrammarModifiers(node); if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); if (hasSyntacticModifier(node, ModifierFlags.Export)) { @@ -41532,7 +41532,7 @@ namespace ts { return; } - if (!checkGrammarDecoratorsAndModifiers(node) && hasSyntacticModifiers(node)) { + if (!checkGrammarModifiers(node) && hasSyntacticModifiers(node)) { grammarErrorOnFirstToken(node, Diagnostics.An_export_declaration_cannot_have_modifiers); } @@ -41696,7 +41696,7 @@ namespace ts { return; } // Grammar checking - if (!checkGrammarDecoratorsAndModifiers(node) && hasEffectiveModifiers(node)) { + if (!checkGrammarModifiers(node) && hasEffectiveModifiers(node)) { grammarErrorOnFirstToken(node, Diagnostics.An_export_assignment_cannot_have_modifiers); } @@ -44136,309 +44136,315 @@ namespace ts { } // GRAMMAR CHECKING - function checkGrammarDecoratorsAndModifiers(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators): boolean { - return checkGrammarDecorators(node) || checkGrammarModifiers(node); - } - - function checkGrammarDecorators(node: Node): boolean { - if (canHaveIllegalDecorators(node) && some(node.illegalDecorators)) { - return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here); - } - if (!canHaveDecorators(node) || !hasDecorators(node)) { - return false; - } - if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) { - if (node.kind === SyntaxKind.MethodDeclaration && !nodeIsPresent(node.body)) { - return grammarErrorOnFirstToken(node, Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); - } - else { - return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here); - } - } - else if (legacyDecorators && (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor)) { - const accessors = getAllAccessorDeclarations((node.parent as ClassDeclaration).members, node as AccessorDeclaration); - if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { - return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); - } - } - return false; - } - function checkGrammarModifiers(node: HasModifiers | HasIllegalModifiers): boolean { - const quickResult = reportObviousModifierErrors(node); + function checkGrammarModifiers(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators): boolean { + const quickResult = reportObviousDecoratorErrors(node) || reportObviousModifierErrors(node); if (quickResult !== undefined) { return quickResult; } - let lastStatic: Node | undefined, lastDeclare: Node | undefined, lastAsync: Node | undefined, lastOverride: Node | undefined; + if (isParameter(node) && parameterIsThisKeyword(node)) { + return grammarErrorOnFirstToken(node, Diagnostics.Decorators_and_modifiers_may_not_be_applied_to_this_parameters); + } + + let lastStatic: Node | undefined, lastDeclare: Node | undefined, lastAsync: Node | undefined, lastOverride: Node | undefined, firstDecorator: Decorator | undefined; let flags = ModifierFlags.None; - for (const modifier of node.modifiers!) { - if (isDecorator(modifier)) continue; - if (modifier.kind !== SyntaxKind.ReadonlyKeyword) { - if (node.kind === SyntaxKind.PropertySignature || node.kind === SyntaxKind.MethodSignature) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_member, tokenToString(modifier.kind)); + let sawExportBeforeDecorators = false; + for (const modifier of (node as HasModifiers).modifiers!) { + if (isDecorator(modifier)) { + if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) { + if (node.kind === SyntaxKind.MethodDeclaration && !nodeIsPresent(node.body)) { + return grammarErrorOnFirstToken(node, Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); + } + else { + return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here); + } } - if (node.kind === SyntaxKind.IndexSignature && (modifier.kind !== SyntaxKind.StaticKeyword || !isClassLike(node.parent))) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_index_signature, tokenToString(modifier.kind)); + else if (legacyDecorators && (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor)) { + const accessors = getAllAccessorDeclarations((node.parent as ClassDeclaration).members, node as AccessorDeclaration); + if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { + return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); + } } - } - if (modifier.kind !== SyntaxKind.InKeyword && modifier.kind !== SyntaxKind.OutKeyword) { - if (node.kind === SyntaxKind.TypeParameter) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, tokenToString(modifier.kind)); + if (flags & ~(ModifierFlags.ExportDefault | ModifierFlags.Decorator)) { + return grammarErrorOnNode(modifier, Diagnostics.Decorators_are_not_valid_here); + } + flags |= ModifierFlags.Decorator; + if (flags & ModifierFlags.Export) { + sawExportBeforeDecorators = true; } + firstDecorator ??= modifier; } - switch (modifier.kind) { - case SyntaxKind.ConstKeyword: - if (node.kind !== SyntaxKind.EnumDeclaration) { - return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(SyntaxKind.ConstKeyword)); - } - break; - case SyntaxKind.OverrideKeyword: - // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. - if (flags & ModifierFlags.Override) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override"); - } - else if (flags & ModifierFlags.Ambient) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "override", "declare"); - } - else if (flags & ModifierFlags.Readonly) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); + else { + if (modifier.kind !== SyntaxKind.ReadonlyKeyword) { + if (node.kind === SyntaxKind.PropertySignature || node.kind === SyntaxKind.MethodSignature) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_member, tokenToString(modifier.kind)); } - else if (flags & ModifierFlags.Accessor) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + if (node.kind === SyntaxKind.IndexSignature && (modifier.kind !== SyntaxKind.StaticKeyword || !isClassLike(node.parent))) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_index_signature, tokenToString(modifier.kind)); } - else if (flags & ModifierFlags.Async) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); + } + if (modifier.kind !== SyntaxKind.InKeyword && modifier.kind !== SyntaxKind.OutKeyword) { + if (node.kind === SyntaxKind.TypeParameter) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, tokenToString(modifier.kind)); } - flags |= ModifierFlags.Override; - lastOverride = modifier; - break; + } + switch (modifier.kind) { + case SyntaxKind.ConstKeyword: + if (node.kind !== SyntaxKind.EnumDeclaration) { + return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(SyntaxKind.ConstKeyword)); + } + break; + case SyntaxKind.OverrideKeyword: + // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. + if (flags & ModifierFlags.Override) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override"); + } + else if (flags & ModifierFlags.Ambient) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "override", "declare"); + } + else if (flags & ModifierFlags.Readonly) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); + } + else if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & ModifierFlags.Async) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); + } + flags |= ModifierFlags.Override; + lastOverride = modifier; + break; - case SyntaxKind.PublicKeyword: - case SyntaxKind.ProtectedKeyword: - case SyntaxKind.PrivateKeyword: - const text = visibilityToString(modifierToFlag(modifier.kind)); + case SyntaxKind.PublicKeyword: + case SyntaxKind.ProtectedKeyword: + case SyntaxKind.PrivateKeyword: + const text = visibilityToString(modifierToFlag(modifier.kind)); - if (flags & ModifierFlags.AccessibilityModifier) { - return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen); - } - else if (flags & ModifierFlags.Override) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "override"); - } - else if (flags & ModifierFlags.Static) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); - } - else if (flags & ModifierFlags.Accessor) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); - } - else if (flags & ModifierFlags.Readonly) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); - } - else if (flags & ModifierFlags.Async) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); - } - else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); - } - else if (flags & ModifierFlags.Abstract) { - if (modifier.kind === SyntaxKind.PrivateKeyword) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); + if (flags & ModifierFlags.AccessibilityModifier) { + return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen); } - else { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "abstract"); + else if (flags & ModifierFlags.Override) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "override"); } - } - else if (isPrivateIdentifierClassElementDeclaration(node)) { - return grammarErrorOnNode(modifier, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier); - } - flags |= modifierToFlag(modifier.kind); - break; - - case SyntaxKind.StaticKeyword: - if (flags & ModifierFlags.Static) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "static"); - } - else if (flags & ModifierFlags.Readonly) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); - } - else if (flags & ModifierFlags.Async) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); - } - else if (flags & ModifierFlags.Accessor) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); - } - else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); - } - else if (node.kind === SyntaxKind.Parameter) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); - } - else if (flags & ModifierFlags.Abstract) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); - } - else if (flags & ModifierFlags.Override) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "override"); - } - flags |= ModifierFlags.Static; - lastStatic = modifier; - break; + else if (flags & ModifierFlags.Static) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); + } + else if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } + else if (flags & ModifierFlags.Readonly) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); + } + else if (flags & ModifierFlags.Async) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); + } + else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); + } + else if (flags & ModifierFlags.Abstract) { + if (modifier.kind === SyntaxKind.PrivateKeyword) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); + } + else { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "abstract"); + } + } + else if (isPrivateIdentifierClassElementDeclaration(node)) { + return grammarErrorOnNode(modifier, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier); + } + flags |= modifierToFlag(modifier.kind); + break; - case SyntaxKind.AccessorKeyword: - if (flags & ModifierFlags.Accessor) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "accessor"); - } - else if (flags & ModifierFlags.Readonly) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); - } - else if (flags & ModifierFlags.Ambient) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); - } - else if (node.kind !== SyntaxKind.PropertyDeclaration) { - return grammarErrorOnNode(modifier, Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); - } + case SyntaxKind.StaticKeyword: + if (flags & ModifierFlags.Static) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "static"); + } + else if (flags & ModifierFlags.Readonly) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); + } + else if (flags & ModifierFlags.Async) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); + } + else if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); + } + else if (node.kind === SyntaxKind.Parameter) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + } + else if (flags & ModifierFlags.Abstract) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); + } + else if (flags & ModifierFlags.Override) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "override"); + } + flags |= ModifierFlags.Static; + lastStatic = modifier; + break; - flags |= ModifierFlags.Accessor; - break; + case SyntaxKind.AccessorKeyword: + if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & ModifierFlags.Readonly) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & ModifierFlags.Ambient) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== SyntaxKind.PropertyDeclaration) { + return grammarErrorOnNode(modifier, Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } - case SyntaxKind.ReadonlyKeyword: - if (flags & ModifierFlags.Readonly) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly"); - } - else if (node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.PropertySignature && node.kind !== SyntaxKind.IndexSignature && node.kind !== SyntaxKind.Parameter) { - // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. - return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); - } - flags |= ModifierFlags.Readonly; - break; + flags |= ModifierFlags.Accessor; + break; - case SyntaxKind.ExportKeyword: - if (flags & ModifierFlags.Export) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "export"); - } - else if (flags & ModifierFlags.Ambient) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); - } - else if (flags & ModifierFlags.Abstract) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); - } - else if (flags & ModifierFlags.Async) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); - } - else if (isClassLike(node.parent)) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); - } - else if (node.kind === SyntaxKind.Parameter) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); - } - flags |= ModifierFlags.Export; - break; - case SyntaxKind.DefaultKeyword: - const container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; - if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { - return grammarErrorOnNode(modifier, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); - } - else if (!(flags & ModifierFlags.Export)) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); - } + case SyntaxKind.ReadonlyKeyword: + if (flags & ModifierFlags.Readonly) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly"); + } + else if (node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.PropertySignature && node.kind !== SyntaxKind.IndexSignature && node.kind !== SyntaxKind.Parameter) { + // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. + return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); + } + flags |= ModifierFlags.Readonly; + break; - flags |= ModifierFlags.Default; - break; - case SyntaxKind.DeclareKeyword: - if (flags & ModifierFlags.Ambient) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "declare"); - } - else if (flags & ModifierFlags.Async) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); - } - else if (flags & ModifierFlags.Override) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override"); - } - else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); - } - else if (node.kind === SyntaxKind.Parameter) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); - } - else if ((node.parent.flags & NodeFlags.Ambient) && node.parent.kind === SyntaxKind.ModuleBlock) { - return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); - } - else if (isPrivateIdentifierClassElementDeclaration(node)) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare"); - } - flags |= ModifierFlags.Ambient; - lastDeclare = modifier; - break; + case SyntaxKind.ExportKeyword: + if (flags & ModifierFlags.Export) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "export"); + } + else if (flags & ModifierFlags.Ambient) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); + } + else if (flags & ModifierFlags.Abstract) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); + } + else if (flags & ModifierFlags.Async) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); + } + else if (isClassLike(node.parent)) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); + } + else if (node.kind === SyntaxKind.Parameter) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); + } + flags |= ModifierFlags.Export; + break; + case SyntaxKind.DefaultKeyword: + const container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; + if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { + return grammarErrorOnNode(modifier, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } + else if (!(flags & ModifierFlags.Export)) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); + } + else if (sawExportBeforeDecorators) { + return grammarErrorOnNode(firstDecorator!, Diagnostics.Decorators_are_not_valid_here); + } - case SyntaxKind.AbstractKeyword: - if (flags & ModifierFlags.Abstract) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "abstract"); - } - if (node.kind !== SyntaxKind.ClassDeclaration && - node.kind !== SyntaxKind.ConstructorType) { - if (node.kind !== SyntaxKind.MethodDeclaration && - node.kind !== SyntaxKind.PropertyDeclaration && - node.kind !== SyntaxKind.GetAccessor && - node.kind !== SyntaxKind.SetAccessor) { - return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); + flags |= ModifierFlags.Default; + break; + case SyntaxKind.DeclareKeyword: + if (flags & ModifierFlags.Ambient) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "declare"); } - if (!(node.parent.kind === SyntaxKind.ClassDeclaration && hasSyntacticModifier(node.parent, ModifierFlags.Abstract))) { - return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); + else if (flags & ModifierFlags.Async) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - if (flags & ModifierFlags.Static) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); + else if (flags & ModifierFlags.Override) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override"); } - if (flags & ModifierFlags.Private) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); + else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - if (flags & ModifierFlags.Async && lastAsync) { - return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); + else if (node.kind === SyntaxKind.Parameter) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - if (flags & ModifierFlags.Override) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); + else if ((node.parent.flags & NodeFlags.Ambient) && node.parent.kind === SyntaxKind.ModuleBlock) { + return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - if (flags & ModifierFlags.Accessor) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + else if (isPrivateIdentifierClassElementDeclaration(node)) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare"); } - } - if (isNamedDeclaration(node) && node.name.kind === SyntaxKind.PrivateIdentifier) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); - } + flags |= ModifierFlags.Ambient; + lastDeclare = modifier; + break; - flags |= ModifierFlags.Abstract; - break; + case SyntaxKind.AbstractKeyword: + if (flags & ModifierFlags.Abstract) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "abstract"); + } + if (node.kind !== SyntaxKind.ClassDeclaration && + node.kind !== SyntaxKind.ConstructorType) { + if (node.kind !== SyntaxKind.MethodDeclaration && + node.kind !== SyntaxKind.PropertyDeclaration && + node.kind !== SyntaxKind.GetAccessor && + node.kind !== SyntaxKind.SetAccessor) { + return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); + } + if (!(node.parent.kind === SyntaxKind.ClassDeclaration && hasSyntacticModifier(node.parent, ModifierFlags.Abstract))) { + return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); + } + if (flags & ModifierFlags.Static) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); + } + if (flags & ModifierFlags.Private) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); + } + if (flags & ModifierFlags.Async && lastAsync) { + return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); + } + if (flags & ModifierFlags.Override) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); + } + if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } + } + if (isNamedDeclaration(node) && node.name.kind === SyntaxKind.PrivateIdentifier) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); + } - case SyntaxKind.AsyncKeyword: - if (flags & ModifierFlags.Async) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "async"); - } - else if (flags & ModifierFlags.Ambient || node.parent.flags & NodeFlags.Ambient) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); - } - else if (node.kind === SyntaxKind.Parameter) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); - } - if (flags & ModifierFlags.Abstract) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); - } - flags |= ModifierFlags.Async; - lastAsync = modifier; - break; + flags |= ModifierFlags.Abstract; + break; - case SyntaxKind.InKeyword: - case SyntaxKind.OutKeyword: - const inOutFlag = modifier.kind === SyntaxKind.InKeyword ? ModifierFlags.In : ModifierFlags.Out; - const inOutText = modifier.kind === SyntaxKind.InKeyword ? "in" : "out"; - if (node.kind !== SyntaxKind.TypeParameter || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); - } - if (flags & inOutFlag) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, inOutText); - } - if (inOutFlag & ModifierFlags.In && flags & ModifierFlags.Out) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "in", "out"); - } - flags |= inOutFlag; - break; + case SyntaxKind.AsyncKeyword: + if (flags & ModifierFlags.Async) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "async"); + } + else if (flags & ModifierFlags.Ambient || node.parent.flags & NodeFlags.Ambient) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); + } + else if (node.kind === SyntaxKind.Parameter) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); + } + if (flags & ModifierFlags.Abstract) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); + } + flags |= ModifierFlags.Async; + lastAsync = modifier; + break; + + case SyntaxKind.InKeyword: + case SyntaxKind.OutKeyword: + const inOutFlag = modifier.kind === SyntaxKind.InKeyword ? ModifierFlags.In : ModifierFlags.Out; + const inOutText = modifier.kind === SyntaxKind.InKeyword ? "in" : "out"; + if (node.kind !== SyntaxKind.TypeParameter || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); + } + if (flags & inOutFlag) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, inOutText); + } + if (inOutFlag & ModifierFlags.In && flags & ModifierFlags.Out) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "in", "out"); + } + flags |= inOutFlag; + break; + } } } @@ -44474,14 +44480,12 @@ namespace ts { * undefined: Need to do full checking on the modifiers. */ function reportObviousModifierErrors(node: HasModifiers | HasIllegalModifiers): boolean | undefined { - return !node.modifiers - ? false - : shouldReportBadModifier(node) - ? grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here) - : undefined; + if (canHaveModifiers(node) ? node.modifiers === undefined : node.decoratorsAndModifiers === undefined) return false; + const modifier = shouldReportBadModifier(node); + return modifier && grammarErrorOnFirstToken(modifier, Diagnostics.Modifiers_cannot_appear_here); } - function shouldReportBadModifier(node: HasModifiers | HasIllegalModifiers): boolean { + function shouldReportBadModifier(node: HasModifiers | HasIllegalModifiers): Modifier | undefined { switch (node.kind) { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: @@ -44500,44 +44504,49 @@ namespace ts { case SyntaxKind.ArrowFunction: case SyntaxKind.Parameter: case SyntaxKind.TypeParameter: - return false; + return undefined; case SyntaxKind.ClassStaticBlockDeclaration: case SyntaxKind.PropertyAssignment: case SyntaxKind.ShorthandPropertyAssignment: case SyntaxKind.NamespaceExportDeclaration: case SyntaxKind.FunctionType: case SyntaxKind.MissingDeclaration: - return true; + return find(node.decoratorsAndModifiers, isModifier); default: if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { - return false; + return undefined; } switch (node.kind) { case SyntaxKind.FunctionDeclaration: - return nodeHasAnyModifiersExcept(node, SyntaxKind.AsyncKeyword); + return findFirstModifierExcept(node, SyntaxKind.AsyncKeyword); case SyntaxKind.ClassDeclaration: case SyntaxKind.ConstructorType: - return nodeHasAnyModifiersExcept(node, SyntaxKind.AbstractKeyword); + return findFirstModifierExcept(node, SyntaxKind.AbstractKeyword); case SyntaxKind.ClassExpression: - return some(node.modifiers, isModifier); case SyntaxKind.InterfaceDeclaration: case SyntaxKind.VariableStatement: case SyntaxKind.TypeAliasDeclaration: - return true; + return find(node.modifiers, isModifier); case SyntaxKind.EnumDeclaration: - return nodeHasAnyModifiersExcept(node, SyntaxKind.ConstKeyword); + return findFirstModifierExcept(node, SyntaxKind.ConstKeyword); default: Debug.assertNever(node); } } } - function nodeHasAnyModifiersExcept(node: HasModifiers, allowedModifier: SyntaxKind): boolean { - for (const modifier of node.modifiers!) { - if (isDecorator(modifier)) continue; - return modifier.kind !== allowedModifier; - } - return false; + function findFirstModifierExcept(node: HasModifiers, allowedModifier: SyntaxKind): Modifier | undefined { + const modifier = find(node.modifiers, isModifier); + return modifier && modifier.kind !== allowedModifier ? modifier : undefined; + } + + function reportObviousDecoratorErrors(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators) { + const decorator = shouldReportBadDecorator(node); + return decorator && grammarErrorOnFirstToken(decorator, Diagnostics.Decorators_are_not_valid_here); + } + + function shouldReportBadDecorator(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators): Decorator | undefined { + if (canHaveIllegalDecorators(node)) return find(node.decoratorsAndModifiers, isDecorator); } function checkGrammarAsyncModifier(node: Node, asyncModifier: Node): boolean { @@ -44633,7 +44642,7 @@ namespace ts { function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration | MethodSignature): boolean { // Prevent cascading error by short-circuit const file = getSourceFileOfNode(node); - return checkGrammarDecoratorsAndModifiers(node) || + return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file) || @@ -44704,7 +44713,7 @@ namespace ts { function checkGrammarIndexSignature(node: IndexSignatureDeclaration) { // Prevent cascading error by short-circuit - return checkGrammarDecoratorsAndModifiers(node) || checkGrammarIndexSignatureParameters(node); + return checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node); } function checkGrammarForAtLeastOneTypeArgument(node: Node, typeArguments: NodeArray | undefined): boolean { @@ -44752,7 +44761,7 @@ namespace ts { let seenExtendsClause = false; let seenImplementsClause = false; - if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) { + if (!checkGrammarModifiers(node) && node.heritageClauses) { for (const heritageClause of node.heritageClauses) { if (heritageClause.token === SyntaxKind.ExtendsKeyword) { if (seenExtendsClause) { @@ -44882,9 +44891,11 @@ namespace ts { } } } - else if (canHaveIllegalModifiers(prop) && prop.modifiers) { - for (const mod of prop.modifiers) { - grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); + else if (canHaveIllegalModifiers(prop) && prop.decoratorsAndModifiers) { + for (const mod of prop.decoratorsAndModifiers) { + if (isModifier(mod)) { + grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); + } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index bc71059ac83aa..584589ba17ffd 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1384,7 +1384,7 @@ "category": "Error", "code": 1432 }, - "Decorators may not be applied to 'this' parameters.": { + "Decorators and modifiers may not be applied to 'this' parameters.": { "category": "Error", "code": 1433 }, diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 9d7a2fce604d5..f8d8d96ff2127 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1463,6 +1463,7 @@ namespace ts { function finishUpdateMethodDeclaration(updated: Mutable, original: MethodDeclaration) { if (updated !== original) { + // copy children used only for error reporting updated.exclamationToken = original.exclamationToken; } return update(updated, original); @@ -1482,8 +1483,7 @@ namespace ts { node.transformFlags = propagateChildFlags(body) | TransformFlags.ContainsClassFields; // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; - node.modifiers = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -1499,8 +1499,8 @@ namespace ts { function finishUpdateClassStaticBlockDeclaration(updated: Mutable, original: ClassStaticBlockDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - updated.modifiers = original.modifiers; + // copy children used only for error reporting + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; } return update(updated, original); } @@ -1523,7 +1523,7 @@ namespace ts { node.transformFlags |= TransformFlags.ContainsES2015; // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; node.typeParameters = undefined; node.type = undefined; return node; @@ -1545,7 +1545,10 @@ namespace ts { function finishUpdateConstructorDeclaration(updated: Mutable, original: ConstructorDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -1595,6 +1598,7 @@ namespace ts { function finishUpdateGetAccessorDeclaration(updated: Mutable, original: GetAccessorDeclaration) { if (updated !== original) { + // copy children used only for error reporting updated.typeParameters = original.typeParameters; } return finishUpdateBaseSignatureDeclaration(updated, original); @@ -1641,6 +1645,7 @@ namespace ts { function finishUpdateSetAccessorDeclaration(updated: Mutable, original: SetAccessorDeclaration) { if (updated !== original) { + // copy children used only for error reporting updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -1822,7 +1827,7 @@ namespace ts { node.transformFlags = TransformFlags.ContainsTypeScript; // The following properties are used only to report grammar errors - node.modifiers = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -1842,7 +1847,8 @@ namespace ts { function finishUpdateFunctionTypeNode(updated: Mutable, original: FunctionTypeNode) { if (updated !== original) { - updated.modifiers = original.modifiers; + // copy children used only for error reporting + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -3724,7 +3730,7 @@ namespace ts { } // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -3753,7 +3759,9 @@ namespace ts { function finishUpdateFunctionDeclaration(updated: Mutable, original: FunctionDeclaration) { if (updated !== original) { // copy children used only for error reporting - updated.illegalDecorators = original.illegalDecorators; + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -3823,7 +3831,7 @@ namespace ts { node.transformFlags = TransformFlags.ContainsTypeScript; // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -3847,7 +3855,10 @@ namespace ts { function finishUpdateInterfaceDeclaration(updated: Mutable, original: InterfaceDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } } return update(updated, original); } @@ -3869,7 +3880,7 @@ namespace ts { node.transformFlags = TransformFlags.ContainsTypeScript; // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -3891,7 +3902,10 @@ namespace ts { function finishUpdateTypeAliasDeclaration(updated: Mutable, original: TypeAliasDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } } return update(updated, original); } @@ -3914,7 +3928,7 @@ namespace ts { node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Enum declarations cannot contain `await` // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -3933,7 +3947,10 @@ namespace ts { function finishUpdateEnumDeclaration(updated: Mutable, original: EnumDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } } return update(updated, original); } @@ -3963,7 +3980,7 @@ namespace ts { node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Module declarations cannot contain `await`. // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -3983,7 +4000,10 @@ namespace ts { function finishUpdateModuleDeclaration(updated: Mutable, original: ModuleDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } } return update(updated, original); } @@ -4028,8 +4048,7 @@ namespace ts { node.transformFlags = TransformFlags.ContainsTypeScript; // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; - node.modifiers = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -4042,8 +4061,8 @@ namespace ts { function finishUpdateNamespaceExportDeclaration(updated: Mutable, original: NamespaceExportDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - updated.modifiers = original.modifiers; + // copy children used only for error reporting + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; } return update(updated, original); } @@ -4067,7 +4086,7 @@ namespace ts { node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Import= declaration is always parsed in an Await context // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -4089,7 +4108,10 @@ namespace ts { function finishUpdateImportEqualsDeclaration(updated: Mutable, original: ImportEqualsDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } } return update(updated, original); } @@ -4112,7 +4134,7 @@ namespace ts { node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -4134,7 +4156,10 @@ namespace ts { function finishUpdateImportDeclaration(updated: Mutable, original: ImportDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } } return update(updated, original); } @@ -4302,7 +4327,7 @@ namespace ts { node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -4320,7 +4345,10 @@ namespace ts { function finishUpdateExportAssignment(updated: Mutable, original: ExportAssignment) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } } return update(updated, original); } @@ -4346,7 +4374,7 @@ namespace ts { node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; + node.decoratorsAndModifiers = undefined; return node; } @@ -4370,7 +4398,10 @@ namespace ts { function finishUpdateExportDeclaration(updated: Mutable, original: ExportDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + } } return update(updated, original); } @@ -5229,8 +5260,7 @@ namespace ts { propagateChildFlags(node.initializer); // The following properties are used only to report grammar errors - node.illegalDecorators = undefined; - node.modifiers = undefined; + node.decoratorsAndModifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; return node; @@ -5247,8 +5277,8 @@ namespace ts { function finishUpdatePropertyAssignment(updated: Mutable, original: PropertyAssignment) { // copy children used only for error reporting if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - updated.modifiers = original.modifiers; + // copy children used only for error reporting + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; } @@ -5269,8 +5299,7 @@ namespace ts { // The following properties are used only to report grammar errors node.equalsToken = undefined; - node.illegalDecorators = undefined; - node.modifiers = undefined; + node.decoratorsAndModifiers = undefined; node.questionToken = undefined; node.exclamationToken = undefined; return node; @@ -5287,11 +5316,10 @@ namespace ts { function finishUpdateShorthandPropertyAssignment(updated: Mutable, original: ShorthandPropertyAssignment) { if (updated !== original) { // copy children used only for error reporting - updated.equalsToken = original.equalsToken; - updated.illegalDecorators = original.illegalDecorators; - updated.modifiers = original.modifiers; + updated.decoratorsAndModifiers = original.decoratorsAndModifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; + updated.equalsToken = original.equalsToken; } return update(updated, original); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 1a9e69692ccbc..1da153410ae5c 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -110,8 +110,7 @@ namespace ts { visitNode(cbNode, node.expression); }, [SyntaxKind.ShorthandPropertyAssignment]: function forEachChildInShorthandPropertyAssignment(node: ShorthandPropertyAssignment, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || @@ -145,8 +144,7 @@ namespace ts { visitNode(cbNode, node.initializer); }, [SyntaxKind.PropertyAssignment]: function forEachChildInPropertyAssignment(node: PropertyAssignment, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || @@ -165,8 +163,7 @@ namespace ts { visitNode(cbNode, node.initializer); }, [SyntaxKind.IndexSignature]: function forEachChildInIndexSignature(node: IndexSignatureDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); @@ -178,7 +175,7 @@ namespace ts { visitNode(cbNode, node.type); }, [SyntaxKind.FunctionType]: function forEachChildInFunctionType(node: FunctionTypeNode, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); @@ -205,8 +202,7 @@ namespace ts { visitNode(cbNode, node.type); }, [SyntaxKind.Constructor]: function forEachChildInConstructor(node: ConstructorDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || @@ -230,8 +226,7 @@ namespace ts { visitNode(cbNode, node.body); }, [SyntaxKind.FunctionDeclaration]: function forEachChildInFunctionDeclaration(node: FunctionDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || @@ -257,8 +252,7 @@ namespace ts { visitNode(cbNode, node.body); }, [SyntaxKind.ClassStaticBlockDeclaration]: function forEachChildInClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || visitNode(cbNode, node.body); }, [SyntaxKind.TypeReference]: function forEachChildInTypeReference(node: TypeReferenceNode, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { @@ -416,8 +410,7 @@ namespace ts { visitNode(cbNode, node.endOfFileToken); }, [SyntaxKind.VariableStatement]: function forEachChildInVariableStatement(node: VariableStatement, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.declarationList); }, [SyntaxKind.VariableDeclarationList]: function forEachChildInVariableDeclarationList(node: VariableDeclarationList, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { @@ -501,23 +494,20 @@ namespace ts { [SyntaxKind.ClassDeclaration]: forEachChildInClassDeclarationOrExpression, [SyntaxKind.ClassExpression]: forEachChildInClassDeclarationOrExpression, [SyntaxKind.InterfaceDeclaration]: function forEachChildInInterfaceDeclaration(node: InterfaceDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); }, [SyntaxKind.TypeAliasDeclaration]: function forEachChildInTypeAliasDeclaration(node: TypeAliasDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); }, [SyntaxKind.EnumDeclaration]: function forEachChildInEnumDeclaration(node: EnumDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); }, @@ -526,20 +516,17 @@ namespace ts { visitNode(cbNode, node.initializer); }, [SyntaxKind.ModuleDeclaration]: function forEachChildInModuleDeclaration(node: ModuleDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); }, [SyntaxKind.ImportEqualsDeclaration]: function forEachChildInImportEqualsDeclaration(node: ImportEqualsDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); }, [SyntaxKind.ImportDeclaration]: function forEachChildInImportDeclaration(node: ImportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || visitNode(cbNode, node.assertClause); @@ -556,7 +543,7 @@ namespace ts { visitNode(cbNode, node.value); }, [SyntaxKind.NamespaceExportDeclaration]: function forEachChildInNamespaceExportDeclaration(node: NamespaceExportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || visitNode(cbNode, node.name); }, [SyntaxKind.NamespaceImport]: function forEachChildInNamespaceImport(node: NamespaceImport, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { @@ -568,8 +555,7 @@ namespace ts { [SyntaxKind.NamedImports]: forEachChildInNamedImportsOrExports, [SyntaxKind.NamedExports]: forEachChildInNamedImportsOrExports, [SyntaxKind.ExportDeclaration]: function forEachChildInExportDeclaration(node: ExportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || visitNode(cbNode, node.assertClause); @@ -577,8 +563,7 @@ namespace ts { [SyntaxKind.ImportSpecifier]: forEachChildInImportOrExportSpecifier, [SyntaxKind.ExportSpecifier]: forEachChildInImportOrExportSpecifier, [SyntaxKind.ExportAssignment]: function forEachChildInExportAssignment(node: ExportAssignment, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || visitNode(cbNode, node.expression); }, [SyntaxKind.TemplateExpression]: function forEachChildInTemplateExpression(node: TemplateExpression, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { @@ -611,8 +596,7 @@ namespace ts { return visitNode(cbNode, node.expression); }, [SyntaxKind.MissingDeclaration]: function forEachChildInMissingDeclaration(node: MissingDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); + return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers); }, [SyntaxKind.CommaListExpression]: function forEachChildInCommaListExpression(node: CommaListExpression, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNodes(cbNode, cbNodes, node.elements); @@ -2325,7 +2309,8 @@ namespace ts { } function canFollowExportModifier(): boolean { - return token() !== SyntaxKind.AsteriskToken + return token() === SyntaxKind.AtToken + || token() !== SyntaxKind.AsteriskToken && token() !== SyntaxKind.AsKeyword && token() !== SyntaxKind.OpenBraceToken && canFollowModifier(); @@ -2350,10 +2335,12 @@ namespace ts { function nextTokenCanFollowDefaultKeyword(): boolean { nextToken(); - return token() === SyntaxKind.ClassKeyword || token() === SyntaxKind.FunctionKeyword || - token() === SyntaxKind.InterfaceKeyword || - (token() === SyntaxKind.AbstractKeyword && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === SyntaxKind.AsyncKeyword && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + return token() === SyntaxKind.ClassKeyword + || token() === SyntaxKind.FunctionKeyword + || token() === SyntaxKind.InterfaceKeyword + || token() === SyntaxKind.AtToken + || (token() === SyntaxKind.AbstractKeyword && lookAhead(nextTokenIsClassKeywordOnSameLine)) + || (token() === SyntaxKind.AsyncKeyword && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element @@ -3434,7 +3421,7 @@ namespace ts { function parseTypeParameter(): TypeParameterDeclaration { const pos = getNodePos(); - const modifiers = parseModifiers(); + const modifiers = parseModifiers(/*allowDecorators*/ false); const name = parseIdentifier(); let constraint: TypeNode | undefined; let expression: Expression | undefined; @@ -3521,11 +3508,13 @@ namespace ts { // BindingElement[?Yield,?Await] // Decorators are parsed in the outer [Await] context, the rest of the parameter is parsed in the function's [Await] context. - const decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : doOutsideOfAwaitContext(parseDecorators); + const modifiers = inOuterAwaitContext ? + doInAwaitContext(() => parseModifiers(/*allowDecorators*/ true)) : + doOutsideOfAwaitContext(() => parseModifiers(/*allowDecorators*/ true)); if (token() === SyntaxKind.ThisKeyword) { const node = factory.createParameterDeclaration( - decorators, + modifiers, /*dotDotDotToken*/ undefined, createIdentifier(/*isIdentifier*/ true), /*questionToken*/ undefined, @@ -3533,8 +3522,9 @@ namespace ts { /*initializer*/ undefined ); - if (decorators) { - parseErrorAtRange(decorators[0], Diagnostics.Decorators_may_not_be_applied_to_this_parameters); + const modifier = firstOrUndefined(modifiers); + if (modifier) { + parseErrorAtRange(modifier, Diagnostics.Decorators_and_modifiers_may_not_be_applied_to_this_parameters); } return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -3543,7 +3533,6 @@ namespace ts { const savedTopLevel = topLevel; topLevel = false; - const modifiers = combineDecoratorsAndModifiers(decorators, parseModifiers()); const dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); if (!allowAmbiguity && !isParameterNameStart()) { @@ -3735,12 +3724,12 @@ namespace ts { return token() === SyntaxKind.ColonToken || token() === SyntaxKind.CommaToken || token() === SyntaxKind.CloseBracketToken; } - function parseIndexSignatureDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): IndexSignatureDeclaration { + function parseIndexSignatureDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): IndexSignatureDeclaration { const parameters = parseBracketedList(ParsingContext.Parameters, () => parseParameter(/*inOuterAwaitContext*/ false), SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); const type = parseTypeAnnotation(); parseTypeMemberSemicolon(); - const node = factory.createIndexSignature(modifiers, parameters, type); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createIndexSignature(extractModifiers(modifiers), parameters, type); + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -3813,17 +3802,17 @@ namespace ts { } const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - const modifiers = parseModifiers(); + const modifiers = parseModifiers(/*allowDecorators*/ false); if (parseContextualModifier(SyntaxKind.GetKeyword)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, SyntaxKind.GetAccessor, SignatureFlags.Type); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, SyntaxKind.GetAccessor, SignatureFlags.Type); } if (parseContextualModifier(SyntaxKind.SetKeyword)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, SyntaxKind.SetAccessor, SignatureFlags.Type); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, SyntaxKind.SetAccessor, SignatureFlags.Type); } if (isIndexSignature()) { - return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); + return parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers); } return parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers); } @@ -3993,7 +3982,7 @@ namespace ts { const node = isConstructorType ? factory.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory.createFunctionTypeNode(typeParameters, parameters, type); - if (!isConstructorType) (node as Mutable).modifiers = modifiers; + if (!isConstructorType) (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -4342,7 +4331,7 @@ namespace ts { function skipParameterStart(): boolean { if (isModifierKind(token())) { // Skip modifiers - parseModifiers(); + parseModifiers(/*allowDecorators*/ false); } if (isIdentifier() || token() === SyntaxKind.ThisKeyword) { nextToken(); @@ -6117,14 +6106,12 @@ namespace ts { return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc); } - const decorators = parseDecorators(); - const modifiers = parseModifiers(); - + const modifiers = parseModifiers(/*allowDecorators*/ true); if (parseContextualModifier(SyntaxKind.GetKeyword)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, SyntaxKind.GetAccessor, SignatureFlags.None); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, SyntaxKind.GetAccessor, SignatureFlags.None); } if (parseContextualModifier(SyntaxKind.SetKeyword)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, SyntaxKind.SetAccessor, SignatureFlags.None); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, SyntaxKind.SetAccessor, SignatureFlags.None); } const asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); @@ -6136,7 +6123,7 @@ namespace ts { const exclamationToken = parseOptionalToken(SyntaxKind.ExclamationToken); if (asteriskToken || token() === SyntaxKind.OpenParenToken || token() === SyntaxKind.LessThanToken) { - return parseMethodDeclaration(pos, hasJSDoc, decorators, modifiers, asteriskToken, name, questionToken, exclamationToken); + return parseMethodDeclaration(pos, hasJSDoc, modifiers, asteriskToken, name, questionToken, exclamationToken); } // check if it is short-hand property assignment or normal property assignment @@ -6160,8 +6147,7 @@ namespace ts { node = factory.createPropertyAssignment(name, initializer); } // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker - node.illegalDecorators = decorators; - node.modifiers = modifiers; + node.decoratorsAndModifiers = modifiers; node.questionToken = questionToken; node.exclamationToken = exclamationToken; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -6188,7 +6174,7 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - const modifiers = parseModifiers(); + const modifiers = parseModifiers(/*allowDecorators*/ false); parseExpected(SyntaxKind.FunctionKeyword); const asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); const isGenerator = asteriskToken ? SignatureFlags.Yield : SignatureFlags.None; @@ -6643,7 +6629,7 @@ namespace ts { } if (currentToken === SyntaxKind.EqualsToken || currentToken === SyntaxKind.AsteriskToken || currentToken === SyntaxKind.OpenBraceToken || currentToken === SyntaxKind.DefaultKeyword || - currentToken === SyntaxKind.AsKeyword) { + currentToken === SyntaxKind.AsKeyword || currentToken === SyntaxKind.AtToken) { return true; } continue; @@ -6740,16 +6726,16 @@ namespace ts { case SyntaxKind.OpenBraceToken: return parseBlock(/*ignoreMissingOpenBrace*/ false); case SyntaxKind.VarKeyword: - return parseVariableStatement(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined); + return parseVariableStatement(getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ undefined); case SyntaxKind.LetKeyword: if (isLetDeclaration()) { - return parseVariableStatement(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined); + return parseVariableStatement(getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ undefined); } break; case SyntaxKind.FunctionKeyword: - return parseFunctionDeclaration(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined); + return parseFunctionDeclaration(getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ undefined); case SyntaxKind.ClassKeyword: - return parseClassDeclaration(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined); + return parseClassDeclaration(getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ undefined); case SyntaxKind.IfKeyword: return parseIfStatement(); case SyntaxKind.DoKeyword: @@ -6816,8 +6802,7 @@ namespace ts { // not reusable in that context. const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - const decorators = parseDecorators(); - const modifiers = parseModifiers(); + const modifiers = parseModifiers(/*allowDecorators*/ true); const isAmbient = some(modifiers, isDeclareModifier); if (isAmbient) { const node = tryReuseAmbientDeclaration(pos); @@ -6828,10 +6813,10 @@ namespace ts { for (const m of modifiers!) { (m as Mutable).flags |= NodeFlags.Ambient; } - return doInsideOfContext(NodeFlags.Ambient, () => parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers)); + return doInsideOfContext(NodeFlags.Ambient, () => parseDeclarationWorker(pos, hasJSDoc, modifiers)); } else { - return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); + return parseDeclarationWorker(pos, hasJSDoc, modifiers); } } @@ -6844,47 +6829,46 @@ namespace ts { }); } - function parseDeclarationWorker(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): Statement { + function parseDeclarationWorker(pos: number, hasJSDoc: boolean, modifiersIn: NodeArray | undefined): Statement { switch (token()) { case SyntaxKind.VarKeyword: case SyntaxKind.LetKeyword: case SyntaxKind.ConstKeyword: - return parseVariableStatement(pos, hasJSDoc, decorators, modifiers); + return parseVariableStatement(pos, hasJSDoc, modifiersIn); case SyntaxKind.FunctionKeyword: - return parseFunctionDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseFunctionDeclaration(pos, hasJSDoc, modifiersIn); case SyntaxKind.ClassKeyword: - return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseClassDeclaration(pos, hasJSDoc, modifiersIn); case SyntaxKind.InterfaceKeyword: - return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseInterfaceDeclaration(pos, hasJSDoc, modifiersIn); case SyntaxKind.TypeKeyword: - return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseTypeAliasDeclaration(pos, hasJSDoc, modifiersIn); case SyntaxKind.EnumKeyword: - return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseEnumDeclaration(pos, hasJSDoc, modifiersIn); case SyntaxKind.GlobalKeyword: case SyntaxKind.ModuleKeyword: case SyntaxKind.NamespaceKeyword: - return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseModuleDeclaration(pos, hasJSDoc, modifiersIn); case SyntaxKind.ImportKeyword: - return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, modifiersIn); case SyntaxKind.ExportKeyword: nextToken(); switch (token()) { case SyntaxKind.DefaultKeyword: case SyntaxKind.EqualsToken: - return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); + return parseExportAssignment(pos, hasJSDoc, modifiersIn); case SyntaxKind.AsKeyword: - return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseNamespaceExportDeclaration(pos, hasJSDoc, modifiersIn); default: - return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseExportDeclaration(pos, hasJSDoc, modifiersIn); } default: - if (decorators || modifiers) { + if (modifiersIn) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. const missing = createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected); setTextRangePos(missing, pos); - missing.illegalDecorators = decorators; - missing.modifiers = modifiers; + (missing as Mutable).decoratorsAndModifiers = modifiersIn; return missing; } return undefined!; // TODO: GH#18217 @@ -7042,18 +7026,17 @@ namespace ts { return nextTokenIsIdentifier() && nextToken() === SyntaxKind.CloseParenToken; } - function parseVariableStatement(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): VariableStatement { + function parseVariableStatement(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): VariableStatement { const declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); - const node = factory.createVariableStatement(modifiers, declarationList); + const node = factory.createVariableStatement(extractModifiers(modifiers), declarationList); // Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker. - node.illegalDecorators = decorators; + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseFunctionDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): FunctionDeclaration { + function parseFunctionDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): FunctionDeclaration { const savedAwaitContext = inAwaitContext(); - const modifierFlags = modifiersToFlags(modifiers); parseExpected(SyntaxKind.FunctionKeyword); const asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); @@ -7067,8 +7050,8 @@ namespace ts { const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false); const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, Diagnostics.or_expected); setAwaitContext(savedAwaitContext); - const node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createFunctionDeclaration(extractModifiers(modifiers), asteriskToken, name, typeParameters, parameters, type, body); + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7084,17 +7067,17 @@ namespace ts { } } - function tryParseConstructorDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ConstructorDeclaration | undefined { + function tryParseConstructorDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): ConstructorDeclaration | undefined { return tryParse(() => { if (parseConstructorName()) { const typeParameters = parseTypeParameters(); const parameters = parseParameters(SignatureFlags.None); const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false); const body = parseFunctionBlockOrSemicolon(SignatureFlags.None, Diagnostics.or_expected); - const node = factory.createConstructorDeclaration(modifiers, parameters, body); + const node = factory.createConstructorDeclaration(extractModifiers(modifiers), parameters, body); // Attach invalid nodes if they exist so that we can report them in the grammar checker. - (node as Mutable).illegalDecorators = decorators; + (node as Mutable).decoratorsAndModifiers = modifiers; (node as Mutable).typeParameters = typeParameters; (node as Mutable).type = type; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -7105,8 +7088,7 @@ namespace ts { function parseMethodDeclaration( pos: number, hasJSDoc: boolean, - decorators: NodeArray | undefined, - modifiers: NodeArray | undefined, + modifiers: NodeArray | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, @@ -7120,7 +7102,7 @@ namespace ts { const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false); const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, diagnosticMessage); const node = factory.createMethodDeclaration( - combineDecoratorsAndModifiers(decorators, modifiers), + modifiers, asteriskToken, name, questionToken, @@ -7138,8 +7120,7 @@ namespace ts { function parsePropertyDeclaration( pos: number, hasJSDoc: boolean, - decorators: NodeArray | undefined, - modifiers: NodeArray | undefined, + modifiers: NodeArray | undefined, name: PropertyName, questionToken: QuestionToken | undefined ): PropertyDeclaration { @@ -7148,7 +7129,7 @@ namespace ts { const initializer = doOutsideOfContext(NodeFlags.YieldContext | NodeFlags.AwaitContext | NodeFlags.DisallowInContext, parseInitializer); parseSemicolonAfterPropertyName(name, type, initializer); const node = factory.createPropertyDeclaration( - combineDecoratorsAndModifiers(decorators, modifiers), + modifiers, name, questionToken || exclamationToken, type, @@ -7159,8 +7140,7 @@ namespace ts { function parsePropertyOrMethodDeclaration( pos: number, hasJSDoc: boolean, - decorators: NodeArray | undefined, - modifiers: NodeArray | undefined + modifiers: NodeArray | undefined ): PropertyDeclaration | MethodDeclaration { const asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); const name = parsePropertyName(); @@ -7168,20 +7148,20 @@ namespace ts { // report an error in the grammar checker. const questionToken = parseOptionalToken(SyntaxKind.QuestionToken); if (asteriskToken || token() === SyntaxKind.OpenParenToken || token() === SyntaxKind.LessThanToken) { - return parseMethodDeclaration(pos, hasJSDoc, decorators, modifiers, asteriskToken, name, questionToken, /*exclamationToken*/ undefined, Diagnostics.or_expected); + return parseMethodDeclaration(pos, hasJSDoc, modifiers, asteriskToken, name, questionToken, /*exclamationToken*/ undefined, Diagnostics.or_expected); } - return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken); + return parsePropertyDeclaration(pos, hasJSDoc, modifiers, name, questionToken); } - function parseAccessorDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined, kind: AccessorDeclaration["kind"], flags: SignatureFlags): AccessorDeclaration { + function parseAccessorDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined, kind: AccessorDeclaration["kind"], flags: SignatureFlags): AccessorDeclaration { const name = parsePropertyName(); const typeParameters = parseTypeParameters(); const parameters = parseParameters(SignatureFlags.None); const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false); const body = parseFunctionBlockOrSemicolon(flags); const node = kind === SyntaxKind.GetAccessor - ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) - : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); + ? factory.createGetAccessorDeclaration(modifiers, name, parameters, type, body) + : factory.createSetAccessorDeclaration(modifiers, name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors (node as Mutable).typeParameters = typeParameters; if (isSetAccessorDeclaration(node)) (node as Mutable).type = type; @@ -7257,12 +7237,11 @@ namespace ts { return false; } - function parseClassStaticBlockDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: ModifiersArray | undefined): ClassStaticBlockDeclaration { + function parseClassStaticBlockDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): ClassStaticBlockDeclaration { parseExpectedToken(SyntaxKind.StaticKeyword); const body = parseClassStaticBlockBody(); const node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); - (node as Mutable).illegalDecorators = decorators; - (node as Mutable).modifiers = modifiers; + (node as Mutable).decoratorsAndModifiers = modifiers; return node; } @@ -7303,16 +7282,7 @@ namespace ts { return finishNode(factory.createDecorator(expression), pos); } - function parseDecorators(): NodeArray | undefined { - const pos = getNodePos(); - let list, decorator; - while (decorator = tryParseDecorator()) { - list = append(list, decorator); - } - return list && createNodeArray(list, pos); - } - - function tryParseModifier(permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean, hasSeenStaticModifier?: boolean): Modifier | undefined { + function tryParseModifier(hasSeenStaticModifier: boolean, permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): Modifier | undefined { const pos = getNodePos(); const kind = token(); @@ -7338,14 +7308,6 @@ namespace ts { return finishNode(factory.createToken(kind as Modifier["kind"]), pos); } - function combineDecoratorsAndModifiers(decorators: NodeArray | undefined, modifiers: NodeArray | undefined): NodeArray | undefined { - if (!decorators) return modifiers; - if (!modifiers) return decorators; - const decoratorsAndModifiers = factory.createNodeArray(concatenate(decorators, modifiers)); - setTextRangePosEnd(decoratorsAndModifiers, decorators.pos, modifiers.end); - return decoratorsAndModifiers; - } - /* * There are situations in which a modifier like 'const' will appear unexpectedly, such as on a class member. * In those situations, if we are entirely sure that 'const' is not valid on its own (such as when ASI takes effect @@ -7353,16 +7315,44 @@ namespace ts { * * In such situations, 'permitInvalidConstAsModifier' should be set to true. */ - function parseModifiers(permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray | undefined { + function parseModifiers(allowDecorators: false, permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray | undefined; + function parseModifiers(allowDecorators: true, permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray | undefined; + function parseModifiers(allowDecorators: boolean, permitInvalidConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray | undefined { const pos = getNodePos(); - let list, modifier, hasSeenStatic = false; - while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) { - if (modifier.kind === SyntaxKind.StaticKeyword) hasSeenStatic = true; + let list: ModifierLike[] | undefined; + let modifier, hasSeenStaticModifier = false; + while (modifier = tryParseModifier(hasSeenStaticModifier, permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock)) { + if (modifier.kind === SyntaxKind.StaticKeyword) hasSeenStaticModifier = true; list = append(list, modifier); } + + // Decorators should be contiguous in a list of modifiers (i.e., `[...leadingModifiers, ...decorators, ...trailingModifiers]`). + // The leading modifiers *should* only contain `export` and `default` when decorators are present, but we'll handle errors for any other leading modifiers in the checker. + if (allowDecorators && token() === SyntaxKind.AtToken) { + let decorator; + while (decorator = tryParseDecorator()) { + list = append(list, decorator); + } + + while (modifier = tryParseModifier(hasSeenStaticModifier, permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock)) { + if (modifier.kind === SyntaxKind.StaticKeyword) hasSeenStaticModifier = true; + list = append(list, modifier); + } + } + return list && createNodeArray(list, pos); } + function extractModifiers(modifiersIn: NodeArray | undefined) { + const modifiersOut = filter(modifiersIn, isModifier); + if (modifiersOut === modifiersIn) return modifiersIn as NodeArray; + if (some(modifiersOut)) { + const modifiers = factory.createNodeArray(modifiersOut); + return setTextRangePosEnd(modifiers, first(modifiers).pos, last(modifiers).end); + } + return undefined; + } + function parseModifiersForArrowFunction(): NodeArray | undefined { let modifiers: NodeArray | undefined; if (token() === SyntaxKind.AsyncKeyword) { @@ -7382,29 +7372,28 @@ namespace ts { } const hasJSDoc = hasPrecedingJSDocComment(); - const decorators = parseDecorators(); - const modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true, /*stopOnStartOfClassStaticBlock*/ true); + const modifiers = parseModifiers(/*allowDecorators*/ true, /*permitInvalidConstAsModifier*/ true, /*stopOnStartOfClassStaticBlock*/ true); if (token() === SyntaxKind.StaticKeyword && lookAhead(nextTokenIsOpenBrace)) { - return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseClassStaticBlockDeclaration(pos, hasJSDoc, modifiers); } if (parseContextualModifier(SyntaxKind.GetKeyword)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, SyntaxKind.GetAccessor, SignatureFlags.None); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, SyntaxKind.GetAccessor, SignatureFlags.None); } if (parseContextualModifier(SyntaxKind.SetKeyword)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, SyntaxKind.SetAccessor, SignatureFlags.None); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, SyntaxKind.SetAccessor, SignatureFlags.None); } if (token() === SyntaxKind.ConstructorKeyword || token() === SyntaxKind.StringLiteral) { - const constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); + const constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, modifiers); if (constructorDeclaration) { return constructorDeclaration; } } if (isIndexSignature()) { - return parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers); } // It is very important that we check this *after* checking indexers because @@ -7419,17 +7408,17 @@ namespace ts { for (const m of modifiers!) { (m as Mutable).flags |= NodeFlags.Ambient; } - return doInsideOfContext(NodeFlags.Ambient, () => parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers)); + return doInsideOfContext(NodeFlags.Ambient, () => parsePropertyOrMethodDeclaration(pos, hasJSDoc, modifiers)); } else { - return parsePropertyOrMethodDeclaration(pos, hasJSDoc, decorators, modifiers); + return parsePropertyOrMethodDeclaration(pos, hasJSDoc, modifiers); } } - if (decorators || modifiers) { + if (modifiers) { // treat this as a property declaration with a missing name. const name = createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected); - return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, /*questionToken*/ undefined); + return parsePropertyDeclaration(pos, hasJSDoc, modifiers, name, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. @@ -7437,14 +7426,14 @@ namespace ts { } function parseClassExpression(): ClassExpression { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, SyntaxKind.ClassExpression) as ClassExpression; + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ undefined, SyntaxKind.ClassExpression) as ClassExpression; } - function parseClassDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ClassDeclaration { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, SyntaxKind.ClassDeclaration) as ClassDeclaration; + function parseClassDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): ClassDeclaration { + return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, SyntaxKind.ClassDeclaration) as ClassDeclaration; } - function parseClassDeclarationOrExpression(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined, kind: ClassLikeDeclaration["kind"]): ClassLikeDeclaration { + function parseClassDeclarationOrExpression(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined, kind: ClassLikeDeclaration["kind"]): ClassLikeDeclaration { const savedAwaitContext = inAwaitContext(); parseExpected(SyntaxKind.ClassKeyword); @@ -7466,8 +7455,8 @@ namespace ts { } setAwaitContext(savedAwaitContext); const node = kind === SyntaxKind.ClassDeclaration - ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) - : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); + ? factory.createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) + : factory.createClassExpression(modifiers, name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7529,26 +7518,26 @@ namespace ts { return parseList(ParsingContext.ClassMembers, parseClassElement); } - function parseInterfaceDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): InterfaceDeclaration { + function parseInterfaceDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): InterfaceDeclaration { parseExpected(SyntaxKind.InterfaceKeyword); const name = parseIdentifier(); const typeParameters = parseTypeParameters(); const heritageClauses = parseHeritageClauses(); const members = parseObjectTypeMembers(); - const node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createInterfaceDeclaration(extractModifiers(modifiers), name, typeParameters, heritageClauses, members); + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseTypeAliasDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): TypeAliasDeclaration { + function parseTypeAliasDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): TypeAliasDeclaration { parseExpected(SyntaxKind.TypeKeyword); const name = parseIdentifier(); const typeParameters = parseTypeParameters(); parseExpected(SyntaxKind.EqualsToken); const type = token() === SyntaxKind.IntrinsicKeyword && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); - const node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createTypeAliasDeclaration(extractModifiers(modifiers), name, typeParameters, type); + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7564,7 +7553,7 @@ namespace ts { return withJSDoc(finishNode(factory.createEnumMember(name, initializer), pos), hasJSDoc); } - function parseEnumDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): EnumDeclaration { + function parseEnumDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): EnumDeclaration { parseExpected(SyntaxKind.EnumKeyword); const name = parseIdentifier(); let members; @@ -7575,8 +7564,8 @@ namespace ts { else { members = createMissingList(); } - const node = factory.createEnumDeclaration(modifiers, name, members); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createEnumDeclaration(extractModifiers(modifiers), name, members); + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7593,20 +7582,20 @@ namespace ts { return finishNode(factory.createModuleBlock(statements), pos); } - function parseModuleOrNamespaceDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined, flags: NodeFlags): ModuleDeclaration { + function parseModuleOrNamespaceDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined, flags: NodeFlags): ModuleDeclaration { // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. const namespaceFlag = flags & NodeFlags.Namespace; const name = parseIdentifier(); const body = parseOptional(SyntaxKind.DotToken) - ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, NodeFlags.NestedNamespace | namespaceFlag) as NamespaceDeclaration + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*modifiers*/ undefined, NodeFlags.NestedNamespace | namespaceFlag) as NamespaceDeclaration : parseModuleBlock(); - const node = factory.createModuleDeclaration(modifiers, name, body, flags); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createModuleDeclaration(extractModifiers(modifiers), name, body, flags); + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseAmbientExternalModuleDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ModuleDeclaration { + function parseAmbientExternalModuleDeclaration(pos: number, hasJSDoc: boolean, modifiersIn: NodeArray | undefined): ModuleDeclaration { let flags: NodeFlags = 0; let name; if (token() === SyntaxKind.GlobalKeyword) { @@ -7625,16 +7614,16 @@ namespace ts { else { parseSemicolon(); } - const node = factory.createModuleDeclaration(modifiers, name, body, flags); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createModuleDeclaration(extractModifiers(modifiersIn), name, body, flags); + (node as Mutable).decoratorsAndModifiers = modifiersIn; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseModuleDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ModuleDeclaration { + function parseModuleDeclaration(pos: number, hasJSDoc: boolean, modifiersIn: NodeArray | undefined): ModuleDeclaration { let flags: NodeFlags = 0; if (token() === SyntaxKind.GlobalKeyword) { // global augmentation - return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, modifiersIn); } else if (parseOptional(SyntaxKind.NamespaceKeyword)) { flags |= NodeFlags.Namespace; @@ -7642,10 +7631,10 @@ namespace ts { else { parseExpected(SyntaxKind.ModuleKeyword); if (token() === SyntaxKind.StringLiteral) { - return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); + return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, modifiersIn); } } - return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); + return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, modifiersIn, flags); } function isExternalModuleReference() { @@ -7665,19 +7654,18 @@ namespace ts { return nextToken() === SyntaxKind.SlashToken; } - function parseNamespaceExportDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): NamespaceExportDeclaration { + function parseNamespaceExportDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): NamespaceExportDeclaration { parseExpected(SyntaxKind.AsKeyword); parseExpected(SyntaxKind.NamespaceKeyword); const name = parseIdentifier(); parseSemicolon(); const node = factory.createNamespaceExportDeclaration(name); // NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker - (node as Mutable).illegalDecorators = decorators; - (node as Mutable).modifiers = modifiers; + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseImportDeclarationOrImportEqualsDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ImportEqualsDeclaration | ImportDeclaration { + function parseImportDeclarationOrImportEqualsDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): ImportEqualsDeclaration | ImportDeclaration { parseExpected(SyntaxKind.ImportKeyword); const afterImportPos = scanner.getStartPos(); @@ -7698,7 +7686,7 @@ namespace ts { } if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) { - return parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly); + return parseImportEqualsDeclaration(pos, hasJSDoc, modifiers, identifier, isTypeOnly); } // ImportDeclaration: @@ -7720,8 +7708,8 @@ namespace ts { } parseSemicolon(); - const node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createImportDeclaration(extractModifiers(modifiers), importClause, moduleSpecifier, assertClause); + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7769,12 +7757,12 @@ namespace ts { return token() === SyntaxKind.CommaToken || token() === SyntaxKind.FromKeyword; } - function parseImportEqualsDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined, identifier: Identifier, isTypeOnly: boolean): ImportEqualsDeclaration { + function parseImportEqualsDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined, identifier: Identifier, isTypeOnly: boolean): ImportEqualsDeclaration { parseExpected(SyntaxKind.EqualsToken); const moduleReference = parseModuleReference(); parseSemicolon(); - const node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createImportEqualsDeclaration(extractModifiers(modifiers), isTypeOnly, identifier, moduleReference); + (node as Mutable).decoratorsAndModifiers = modifiers; const finished = withJSDoc(finishNode(node, pos), hasJSDoc); return finished; } @@ -7952,7 +7940,7 @@ namespace ts { return finishNode(factory.createNamespaceExport(parseIdentifierName()), pos); } - function parseExportDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ExportDeclaration { + function parseExportDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): ExportDeclaration { const savedAwaitContext = inAwaitContext(); setAwaitContext(/*value*/ true); let exportClause: NamedExportBindings | undefined; @@ -7982,12 +7970,12 @@ namespace ts { } parseSemicolon(); setAwaitContext(savedAwaitContext); - const node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createExportDeclaration(extractModifiers(modifiers), isTypeOnly, exportClause, moduleSpecifier, assertClause); + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseExportAssignment(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): ExportAssignment { + function parseExportAssignment(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): ExportAssignment { const savedAwaitContext = inAwaitContext(); setAwaitContext(/*value*/ true); let isExportEquals: boolean | undefined; @@ -8000,8 +7988,8 @@ namespace ts { const expression = parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); parseSemicolon(); setAwaitContext(savedAwaitContext); - const node = factory.createExportAssignment(modifiers, isExportEquals, expression); - (node as Mutable).illegalDecorators = decorators; + const node = factory.createExportAssignment(extractModifiers(modifiers), isExportEquals, expression); + (node as Mutable).decoratorsAndModifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bda77e561762d..241492a94b77f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1702,8 +1702,7 @@ namespace ts { readonly initializer: Expression; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; // property assignment cannot have decorators - /* @internal */ readonly modifiers?: NodeArray | undefined; // property assignment cannot have modifiers + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; // property assignment cannot have decorators or modifiers /* @internal */ readonly questionToken?: QuestionToken | undefined; // property assignment cannot have a question token /* @internal */ readonly exclamationToken?: ExclamationToken | undefined; // property assignment cannot have an exclamation token } @@ -1718,8 +1717,7 @@ namespace ts { readonly objectAssignmentInitializer?: Expression; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; // shorthand property assignment cannot have decorators - /* @internal */ readonly modifiers?: NodeArray | undefined; // shorthand property assignment cannot have modifiers + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; // shorthand property assignment cannot have decorators or modifiers /* @internal */ readonly questionToken?: QuestionToken | undefined; // shorthand property assignment cannot have a question token /* @internal */ readonly exclamationToken?: ExclamationToken | undefined; // shorthand property assignment cannot have an exclamation token } @@ -1800,7 +1798,7 @@ namespace ts { readonly body?: FunctionBody; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; // functions cannot have decorators + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; // functions cannot have decorators } export interface MethodSignature extends SignatureDeclarationBase, TypeElement { @@ -1837,7 +1835,7 @@ namespace ts { readonly body?: FunctionBody | undefined; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; // A constructor cannot have decorators + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; // constructors cannot have decorators /* @internal */ readonly typeParameters?: NodeArray; // A constructor cannot have type parameters /* @internal */ readonly type?: TypeNode; // A constructor cannot have a return type annotation } @@ -1884,7 +1882,7 @@ namespace ts { readonly type: TypeNode; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer { @@ -1896,8 +1894,7 @@ namespace ts { /* @internal */ returnFlowNode?: FlowNode; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; - /* @internal */ readonly modifiers?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface TypeNode extends Node { @@ -1946,7 +1943,7 @@ namespace ts { readonly kind: SyntaxKind.FunctionType; // The following properties are used only to report grammar errors - /* @internal */ readonly modifiers?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase { @@ -3052,8 +3049,7 @@ namespace ts { readonly name?: Identifier; // The following properties are used only to report grammar errors - /*@internal*/ illegalDecorators?: NodeArray | undefined; - /*@internal*/ modifiers?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export type BlockLike = @@ -3075,7 +3071,7 @@ namespace ts { readonly declarationList: VariableDeclarationList; // The following properties are used only to report grammar errors - /* @internal*/ illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface ExpressionStatement extends Statement { @@ -3289,7 +3285,7 @@ namespace ts { readonly members: NodeArray; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface HeritageClause extends Node { @@ -3307,7 +3303,7 @@ namespace ts { readonly type: TypeNode; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface EnumMember extends NamedDeclaration, JSDocContainer { @@ -3326,7 +3322,7 @@ namespace ts { readonly members: NodeArray; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export type ModuleName = @@ -3352,7 +3348,7 @@ namespace ts { readonly body?: ModuleBody | JSDocNamespaceDeclaration; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export type NamespaceBody = @@ -3403,7 +3399,7 @@ namespace ts { readonly moduleReference: ModuleReference; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface ExternalModuleReference extends Node { @@ -3426,7 +3422,7 @@ namespace ts { readonly assertClause?: AssertClause; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export type NamedImportBindings = @@ -3486,8 +3482,7 @@ namespace ts { readonly name: Identifier; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; - /* @internal */ readonly modifiers?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface ExportDeclaration extends DeclarationStatement, JSDocContainer { @@ -3502,7 +3497,7 @@ namespace ts { readonly assertClause?: AssertClause; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface NamedImports extends Node { @@ -3567,7 +3562,7 @@ namespace ts { readonly expression: Expression; // The following properties are used only to report grammar errors - /* @internal */ readonly illegalDecorators?: NodeArray | undefined; + /* @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface FileReference extends TextRange { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index edb92a867963f..f4525f2f5e40c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7568,7 +7568,6 @@ namespace ts { case SyntaxKind.Decorator: { const { parent } = node as Decorator; return canHaveDecorators(parent) ? parent.modifiers : - canHaveIllegalDecorators(parent) ? parent.illegalDecorators : undefined; } case SyntaxKind.HeritageClause: diff --git a/tests/baselines/reference/decoratorOnClass3.errors.txt b/tests/baselines/reference/decoratorOnClass3.errors.txt deleted file mode 100644 index dfa430dec0cd7..0000000000000 --- a/tests/baselines/reference/decoratorOnClass3.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -tests/cases/conformance/decorators/class/decoratorOnClass3.ts(3,1): error TS1128: Declaration or statement expected. - - -==== tests/cases/conformance/decorators/class/decoratorOnClass3.ts (1 errors) ==== - declare function dec(target: T): T; - - export - ~~~~~~ -!!! error TS1128: Declaration or statement expected. - @dec - class C { - } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClass3.js b/tests/baselines/reference/decoratorOnClass3.js index fc3255359c4ab..cb007d9c68378 100644 --- a/tests/baselines/reference/decoratorOnClass3.js +++ b/tests/baselines/reference/decoratorOnClass3.js @@ -7,12 +7,15 @@ class C { } //// [decoratorOnClass3.js] +"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.C = void 0; var C = /** @class */ (function () { function C() { } @@ -21,3 +24,4 @@ var C = /** @class */ (function () { ], C); return C; }()); +exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClass3.symbols b/tests/baselines/reference/decoratorOnClass3.symbols index 1a3ccaff8c6e6..35dbec88dc7ea 100644 --- a/tests/baselines/reference/decoratorOnClass3.symbols +++ b/tests/baselines/reference/decoratorOnClass3.symbols @@ -11,5 +11,5 @@ export >dec : Symbol(dec, Decl(decoratorOnClass3.ts, 0, 0)) class C { ->C : Symbol(C, Decl(decoratorOnClass3.ts, 2, 6)) +>C : Symbol(C, Decl(decoratorOnClass3.ts, 0, 38)) } diff --git a/tests/baselines/reference/decoratorOnClassMethodThisParameter.errors.txt b/tests/baselines/reference/decoratorOnClassMethodThisParameter.errors.txt index 02fb67534e881..0cd71e1cbcac2 100644 --- a/tests/baselines/reference/decoratorOnClassMethodThisParameter.errors.txt +++ b/tests/baselines/reference/decoratorOnClassMethodThisParameter.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(4,12): error TS1433: Decorators may not be applied to 'this' parameters. -tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(8,29): error TS1433: Decorators may not be applied to 'this' parameters. +tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(4,12): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(8,29): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(8,30): error TS2680: A 'this' parameter must be the first parameter. @@ -9,13 +9,13 @@ tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethod class C { method(@dec this: C) {} ~~~~ -!!! error TS1433: Decorators may not be applied to 'this' parameters. +!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. } class C2 { method(@dec allowed: C2, @dec this: C2) {} ~~~~~ -!!! error TS1433: Decorators may not be applied to 'this' parameters. +!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. ~~~~~~~~~~~~~ !!! error TS2680: A 'this' parameter must be the first parameter. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt b/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt index a2259e0666a12..c276adae75594 100644 --- a/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt +++ b/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(5,17): error TS1433: Decorators may not be applied to 'this' parameters. -tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(6,17): error TS1433: Decorators may not be applied to 'this' parameters. +tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(5,17): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(6,17): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. ==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts (2 errors) ==== @@ -9,7 +9,7 @@ tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(6,17) function direct(@dec this: C) { return this.n; } ~~~~ -!!! error TS1433: Decorators may not be applied to 'this' parameters. +!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. function called(@dec() this: C) { return this.n; } ~~~~~~ -!!! error TS1433: Decorators may not be applied to 'this' parameters. \ No newline at end of file +!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt index a3a3efafaa6e2..4f44ad576af5c 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt @@ -74,12 +74,11 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(158,17): e tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(162,9): error TS2681: A constructor cannot have a 'this' parameter. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(164,31): error TS2681: A constructor cannot have a 'this' parameter. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(165,30): error TS2680: A 'this' parameter must be the first parameter. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,26): error TS1359: Identifier expected. 'this' is a reserved word that cannot be used here. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,26): error TS2680: A 'this' parameter must be the first parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,20): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,23): error TS1359: Identifier expected. 'this' is a reserved word that cannot be used here. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,23): error TS2680: A 'this' parameter must be the first parameter. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,23): error TS1005: ',' expected. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,20): error TS1433: Decorators may not be applied to 'this' parameters. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,20): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,30): error TS1005: ',' expected. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,32): error TS1359: Identifier expected. 'new' is a reserved word that cannot be used here. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,37): error TS1005: ',' expected. @@ -94,7 +93,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(177,19): e tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot have a 'this' parameter. -==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (64 errors) ==== +==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (63 errors) ==== class C { n: number; explicitThis(this: this, m: number): number { @@ -393,10 +392,8 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e ///// parse errors ///// function modifiers(async this: C): number { return this.n; } - ~~~~ -!!! error TS1359: Identifier expected. 'this' is a reserved word that cannot be used here. - ~~~~~~~ -!!! error TS2680: A 'this' parameter must be the first parameter. + ~~~~~ +!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. function restParam(...this: C): number { return this.n; } ~~~~ !!! error TS1359: Identifier expected. 'this' is a reserved word that cannot be used here. @@ -407,7 +404,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e !!! error TS1005: ',' expected. function decorated(@deco() this: C): number { return this.n; } ~~~~~~~ -!!! error TS1433: Decorators may not be applied to 'this' parameters. +!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. function initializer(this: C = new C()): number { return this.n; } ~ !!! error TS1005: ',' expected. diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.symbols b/tests/baselines/reference/thisTypeInFunctionsNegative.symbols index 77b4b6a15a700..48bd2e998dd9a 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.symbols +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.symbols @@ -627,9 +627,11 @@ function notFirst(a: number, this: C): number { return this.n; } ///// parse errors ///// function modifiers(async this: C): number { return this.n; } >modifiers : Symbol(modifiers, Decl(thisTypeInFunctionsNegative.ts, 164, 64)) -> : Symbol((Missing), Decl(thisTypeInFunctionsNegative.ts, 167, 19)) ->this : Symbol(this, Decl(thisTypeInFunctionsNegative.ts, 167, 24)) +>this : Symbol(this, Decl(thisTypeInFunctionsNegative.ts, 167, 19)) >C : Symbol(C, Decl(thisTypeInFunctionsNegative.ts, 0, 0)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctionsNegative.ts, 0, 9)) +>this : Symbol(this, Decl(thisTypeInFunctionsNegative.ts, 167, 19)) +>n : Symbol(C.n, Decl(thisTypeInFunctionsNegative.ts, 0, 9)) function restParam(...this: C): number { return this.n; } >restParam : Symbol(restParam, Decl(thisTypeInFunctionsNegative.ts, 167, 60)) diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.types b/tests/baselines/reference/thisTypeInFunctionsNegative.types index 36837e3108934..733b8f1c0d1e5 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.types +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.types @@ -709,12 +709,11 @@ function notFirst(a: number, this: C): number { return this.n; } ///// parse errors ///// function modifiers(async this: C): number { return this.n; } ->modifiers : (: any, this: C) => number -> : any +>modifiers : (this: C) => number >this : C ->this.n : any ->this : any ->n : any +>this.n : number +>this : C +>n : number function restParam(...this: C): number { return this.n; } >restParam : (...: any[], this: C) => number From f5c69351c43e92b10c537e6c0ba8dcad87ede90a Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 31 Aug 2022 08:56:17 -0400 Subject: [PATCH 09/51] Clean up ts class transformation --- src/compiler/core.ts | 42 ++- src/compiler/factory/utilities.ts | 14 + src/compiler/parser.ts | 1 - src/compiler/transformers/legacyDecorators.ts | 11 +- src/compiler/transformers/module/module.ts | 21 +- src/compiler/transformers/ts.ts | 290 ++++++++++-------- src/compiler/utilities.ts | 28 ++ src/compiler/utilitiesPublic.ts | 7 +- .../amdImportNotAsPrimaryExpression.js | 3 +- .../commonJSImportAsPrimaryExpression.js | 3 +- .../commonJSImportNotAsPrimaryExpression.js | 3 +- .../customTransforms/before+decorators.js | 3 +- ...arationEmitLocalClassHasRequiredDeclare.js | 3 +- .../decoratorMetadataGenericTypeVariable.js | 3 +- ...ratorMetadataGenericTypeVariableDefault.js | 3 +- ...ratorMetadataGenericTypeVariableInScope.js | 3 +- ...oratorMetadataNoLibIsolatedModulesTypes.js | 3 +- .../decoratorMetadataOnInferredType.js | 3 +- ...orMetadataRestParameterWithImportedType.js | 3 +- .../decoratorMetadataWithConstructorType.js | 3 +- .../decoratorMetadataWithTypeOnlyImport2.js | 3 +- .../baselines/reference/decoratorOnClass2.js | 3 +- .../baselines/reference/decoratorOnClass3.js | 3 +- .../reference/decoratorOnClassConstructor2.js | 3 +- .../reference/decoratorOnClassConstructor3.js | 3 +- .../decoratorOnClassMethodThisParameter.js | 3 +- .../reference/es3defaultAliasIsQuoted.js | 3 +- .../reference/es6ModuleClassDeclaration.js | 3 +- .../reference/es6modulekindWithES5Target.js | 6 +- .../esnextmodulekindWithES5Target.js | 6 +- ...ClassWithStaticPropertyAssignmentsInES6.js | 3 +- .../reference/importImportOnlyModule.js | 3 +- .../reference/jsDeclarationsClasses.js | 9 +- .../reference/jsDeclarationsComputedNames.js | 3 +- .../baselines/reference/metadataImportType.js | 3 +- .../reference/metadataOfClassFromAlias.js | 3 +- .../reference/metadataOfClassFromAlias2.js | 3 +- .../reference/metadataOfEventAlias.js | 3 +- .../metadataReferencedWithinFilteredUnion.js | 3 +- .../privacyCannotNameVarTypeDeclFile.js | 6 +- .../reference/privateNameStaticEmitHelpers.js | 3 +- .../amd/main.js | 3 +- .../node/main.js | 3 +- .../amd/main.js | 3 +- .../node/main.js | 3 +- .../emitDecoratorMetadataSystemJS/amd/main.js | 3 +- .../node/main.js | 3 +- .../amd/main.js | 3 +- .../node/main.js | 3 +- .../amd/main.js | 3 +- .../node/main.js | 3 +- .../sourceMapValidationDecorators.js.map | 4 +- ...ourceMapValidationDecorators.sourcemap.txt | 26 +- .../reference/systemModuleTargetES6.js | 2 +- ...rgetEs6DecoratorMetadataImportNotElided.js | 3 +- .../templateLiteralsAndDecoratorMetadata.js | 3 +- ...fiers-across-projects-resolve-correctly.js | 3 +- 57 files changed, 350 insertions(+), 249 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 934f5ace84990..29503423de4c3 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1400,6 +1400,20 @@ namespace ts { return arrayFrom(arrayToMultiMap(values, getGroupId).values(), resultSelector); } + export function groupBy(values: readonly T[] | undefined, keySelector: (value: T) => value is U): { true?: U[], false?: Exclude[] }; + export function groupBy(values: readonly T[] | undefined, keySelector: (value: T) => K): { [P in K as `${P}`]?: T[]; }; + export function groupBy(values: readonly T[] | undefined, keySelector: (value: T) => K): { [P in K as `${P}`]?: T[]; } { + const result: Record = {}; + if (values) { + for (const value of values) { + const key = `${keySelector(value)}`; + const array = result[key] ??= []; + array.push(value); + } + } + return result as { [P in K as `${P}`]?: T[]; }; + } + export function clone(object: T): T { const result: any = {}; for (const id in object) { @@ -2489,13 +2503,29 @@ namespace ts { } export function takeWhile(array: readonly T[], predicate: (element: T) => element is U): U[]; - export function takeWhile(array: readonly T[], predicate: (element: T) => boolean): T[] { - const len = array.length; - let index = 0; - while (index < len && predicate(array[index])) { - index++; + export function takeWhile(array: readonly T[] | undefined, predicate: (element: T) => element is U): U[] | undefined; + export function takeWhile(array: readonly T[] | undefined, predicate: (element: T) => element is U): U[] | undefined { + if (array) { + const len = array.length; + let index = 0; + while (index < len && predicate(array[index])) { + index++; + } + return array.slice(0, index) as U[]; + } + } + + export function skipWhile(array: readonly T[], predicate: (element: T) => element is U): Exclude[]; + export function skipWhile(array: readonly T[] | undefined, predicate: (element: T) => element is U): Exclude[] | undefined; + export function skipWhile(array: readonly T[] | undefined, predicate: (element: T) => element is U): Exclude[] | undefined { + if (array) { + const len = array.length; + let index = 0; + while (index < len && predicate(array[index])) { + index++; + } + return array.slice(index) as Exclude[]; } - return array.slice(0, index); } /** diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 6c7f02c240f2e..dbdb78c26ed59 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -1233,6 +1233,20 @@ namespace ts { } } + function isExportOrDefaultKeywordKind(kind: SyntaxKind): kind is SyntaxKind.ExportKeyword | SyntaxKind.DefaultKeyword { + return kind === SyntaxKind.ExportKeyword || kind === SyntaxKind.DefaultKeyword; + } + + export function isExportOrDefaultModifier(node: Node): node is ExportKeyword | DefaultKeyword { + const kind = node.kind; + return isExportOrDefaultKeywordKind(kind); + } + + export function isNonExportDefaultModifier(node: Node): node is Exclude { + const kind = node.kind; + return isModifierKind(kind) && !isExportOrDefaultKeywordKind(kind); + } + /** * If `nodes` is not undefined, creates an empty `NodeArray` that preserves the `pos` and `end` of `nodes`. * @internal diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 1da153410ae5c..2b32c4a4c5168 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3365,7 +3365,6 @@ namespace ts { factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, - // TODO(rbuckton): JSDoc parameters don't have names (except `this`/`new`), should we manufacture an empty identifier? name!, /*questionToken*/ undefined, parseJSDocType(), diff --git a/src/compiler/transformers/legacyDecorators.ts b/src/compiler/transformers/legacyDecorators.ts index 0f96a52237336..b5028b2c5d286 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -70,7 +70,7 @@ namespace ts { return visitEachChild(node, visitor, context); } - const statements = hasDecorators(node) ? + const statements = classOrConstructorParameterIsDecorated(/*useLegacyDecorators*/ true, node) ? transformClassDeclarationWithClassDecorators(node, node.name) : transformClassDeclarationWithoutClassDecorators(node, node.name); @@ -390,6 +390,10 @@ namespace ts { return updated; } + function isSyntheticMetadataDecorator(node: Decorator) { + return isCallToHelper(node.expression, "___metadata" as __String); + } + /** * Transforms all of the decorators for a declaration into an array of expressions. * @@ -400,9 +404,12 @@ namespace ts { return undefined; } + // ensure that metadata decorators are last + const { false: decorators, true: metadata } = groupBy(allDecorators.decorators, isSyntheticMetadataDecorator); const decoratorExpressions: Expression[] = []; - addRange(decoratorExpressions, map(allDecorators.decorators, transformDecorator)); + addRange(decoratorExpressions, map(decorators, transformDecorator)); addRange(decoratorExpressions, flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); + addRange(decoratorExpressions, map(metadata, transformDecorator)); return decoratorExpressions; } diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 9b3b8e6ee1283..9fa8f738bafee 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1315,11 +1315,30 @@ namespace ts { // If we're exporting these variables, then these just become assignments to 'exports.x'. for (const variable of node.declarationList.declarations) { if (isIdentifier(variable.name) && isLocalName(variable.name)) { + // A "local name" generally means a variable declaration that *shouldn't* be + // converted to `exports.x = ...`, even if the declaration is exported. This + // usually indicates a class or function declaration that was converted into + // a variable declaration, as most references to the declaration will remain + // untransformed (i.e., `new C` rather than `new exports.C`). In these cases, + // an `export { x }` declaration will follow. if (!modifiers) { modifiers = visitNodes(node.modifiers, modifierVisitor, isModifier); } - variables = append(variables, variable); + if (variable.initializer) { + const updatedVariable = factory.updateVariableDeclaration( + variable, + variable.name, + /*exclamationToken*/ undefined, + /*type*/ undefined, + createExportExpression( + variable.name, + visitNode(variable.initializer, visitor, isExpression))); + variables = append(variables, updatedVariable); + } + else { + variables = append(variables, variable); + } } else if (variable.initializer) { if (!isBindingPattern(variable.name) && (isArrowFunction(variable.initializer) || isFunctionExpression(variable.initializer) || isClassExpression(variable.initializer))) { diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 210a815c43540..548efd9471215 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -15,16 +15,14 @@ namespace ts { const enum ClassFacts { None = 0, HasStaticInitializedProperties = 1 << 0, - HasConstructorDecorators = 1 << 1, + HasClassOrConstructorParameterDecorators = 1 << 1, HasMemberDecorators = 1 << 2, IsExportOfNamespace = 1 << 3, IsNamedExternalExport = 1 << 4, IsDefaultExternalExport = 1 << 5, IsDerivedClass = 1 << 6, - UseImmediatelyInvokedFunctionExpression = 1 << 7, - HasAnyDecorators = HasConstructorDecorators | HasMemberDecorators, - NeedsName = HasStaticInitializedProperties | HasMemberDecorators, + HasAnyDecorators = HasClassOrConstructorParameterDecorators | HasMemberDecorators, MayNeedImmediatelyInvokedFunctionExpression = HasAnyDecorators | HasStaticInitializedProperties, IsExported = IsExportOfNamespace | IsDefaultExternalExport | IsNamedExternalExport, } @@ -363,6 +361,14 @@ namespace ts { } } + function decoratorElidingVisitor(node: Node): VisitResult { + return isDecorator(node) ? undefined : visitor(node); + } + + function modifierElidingVisitor(node: Node): VisitResult { + return isModifier(node) ? undefined : visitor(node); + } + function modifierVisitor(node: Node): VisitResult { if (isDecorator(node)) return undefined; if (modifierToFlag(node.kind) & ModifierFlags.TypeScriptModifier) { @@ -594,17 +600,16 @@ namespace ts { ); } - function getClassFacts(node: ClassDeclaration, staticProperties: readonly PropertyDeclaration[]) { + function getClassFacts(node: ClassDeclaration) { let facts = ClassFacts.None; - if (some(staticProperties)) facts |= ClassFacts.HasStaticInitializedProperties; + if (some(getProperties(node, /*requireInitialized*/ true, /*isStatic*/ true))) facts |= ClassFacts.HasStaticInitializedProperties; const extendsClauseElement = getEffectiveBaseTypeNode(node); if (extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== SyntaxKind.NullKeyword) facts |= ClassFacts.IsDerivedClass; - if (classOrConstructorParameterIsDecorated(legacyDecorators, node)) facts |= ClassFacts.HasConstructorDecorators; + if (classOrConstructorParameterIsDecorated(legacyDecorators, node)) facts |= ClassFacts.HasClassOrConstructorParameterDecorators; if (childIsDecorated(legacyDecorators, node)) facts |= ClassFacts.HasMemberDecorators; if (isExportOfNamespace(node)) facts |= ClassFacts.IsExportOfNamespace; else if (isDefaultExternalModuleExport(node)) facts |= ClassFacts.IsDefaultExternalExport; else if (isNamedExternalModuleExport(node)) facts |= ClassFacts.IsNamedExternalExport; - if (languageVersion <= ScriptTarget.ES5 && (facts & ClassFacts.MayNeedImmediatelyInvokedFunctionExpression)) facts |= ClassFacts.UseImmediatelyInvokedFunctionExpression; return facts; } @@ -620,7 +625,13 @@ namespace ts { } function visitClassDeclaration(node: ClassDeclaration): VisitResult { - if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !(currentNamespace && hasSyntacticModifier(node, ModifierFlags.Export))) { + const facts = getClassFacts(node); + const promoteToIIFE = languageVersion <= ScriptTarget.ES5 && + !!(facts & ClassFacts.MayNeedImmediatelyInvokedFunctionExpression); + + if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && + !classOrConstructorParameterIsDecorated(legacyDecorators, node) && + !isExportOfNamespace(node)) { return factory.updateClassDeclaration( node, visitNodes(node.modifiers, modifierVisitor, isModifier), @@ -631,28 +642,41 @@ namespace ts { ); } - const staticProperties = getProperties(node, /*requireInitializer*/ true, /*isStatic*/ true); - const facts = getClassFacts(node, staticProperties); - - if (facts & ClassFacts.UseImmediatelyInvokedFunctionExpression) { + if (promoteToIIFE) { context.startLexicalEnvironment(); } - const name = node.name || (facts & ClassFacts.NeedsName ? factory.getGeneratedNameForNode(node) : undefined); - const allDecorators = getAllDecoratorsOfClass(node); - const decorators = transformAllDecoratorsOfDeclaration(node, node, allDecorators); + const moveModifiers = + promoteToIIFE || + facts & ClassFacts.IsExportOfNamespace || + facts & ClassFacts.HasClassOrConstructorParameterDecorators || + facts & ClassFacts.HasStaticInitializedProperties; - // we do not emit modifiers on the declaration if we are emitting an IIFE - const modifiers = !(facts & ClassFacts.UseImmediatelyInvokedFunctionExpression) - ? visitNodes(node.modifiers, modifierVisitor, isModifier) - : elideNodes(factory, node.modifiers); // preserve positions, if available + // elide modifiers on the declaration if we are emitting an IIFE or the class is + // a namespace export + let modifiers = moveModifiers ? + visitNodes(node.modifiers, modifierElidingVisitor, isModifierLike) : + visitNodes(node.modifiers, visitor, isModifierLike); + + // inject metadata only if the class is decorated + if (facts & ClassFacts.HasClassOrConstructorParameterDecorators) { + modifiers = injectClassTypeMetadata(modifiers, node); + } + + const needsName = + facts & ClassFacts.HasMemberDecorators || + facts & ClassFacts.HasStaticInitializedProperties; + + const name = needsName ? + node.name ?? factory.getGeneratedNameForNode(node) : + node.name; // ${modifiers} class ${name} ${heritageClauses} { // ${members} // } - const classStatement = factory.updateClassDeclaration( + const classDeclaration = factory.updateClassDeclaration( node, - concatenate(decorators, modifiers), + modifiers, name, /*typeParameters*/ undefined, visitNodes(node.heritageClauses, visitor, isHeritageClause), @@ -666,11 +690,10 @@ namespace ts { emitFlags |= EmitFlags.NoTrailingSourceMap; } - setEmitFlags(classStatement, emitFlags); + setEmitFlags(classDeclaration, emitFlags); - let statements: Statement[] = [classStatement]; - - if (facts & ClassFacts.UseImmediatelyInvokedFunctionExpression) { + let statement: VariableStatement | ClassDeclaration; + if (promoteToIIFE) { // When we emit a TypeScript class down to ES5, we must wrap it in an IIFE so that the // 'es2015' transformer can properly nest static initializers and decorators. The result // looks something like: @@ -682,6 +705,7 @@ namespace ts { // return C; // }(); // + const statements: Statement[] = [classDeclaration]; const closingBraceLocation = createTokenRange(skipTrivia(currentSourceFile.text, node.members.end), SyntaxKind.CloseBraceToken); const localName = factory.getInternalName(node); @@ -691,18 +715,24 @@ namespace ts { setTextRangeEnd(outer, closingBraceLocation.end); setEmitFlags(outer, EmitFlags.NoComments); - const statement = factory.createReturnStatement(outer); - setTextRangePos(statement, closingBraceLocation.pos); - setEmitFlags(statement, EmitFlags.NoComments | EmitFlags.NoTokenSourceMaps); - statements.push(statement); + const returnStatement = factory.createReturnStatement(outer); + setTextRangePos(returnStatement, closingBraceLocation.pos); + setEmitFlags(returnStatement, EmitFlags.NoComments | EmitFlags.NoTokenSourceMaps); + statements.push(returnStatement); insertStatementsAfterStandardPrologue(statements, context.endLexicalEnvironment()); const iife = factory.createImmediatelyInvokedArrowFunction(statements); setEmitFlags(iife, EmitFlags.TypeScriptClassWrapper); + // export let C = (() => { ... })(); + const modifiers = facts & ClassFacts.IsNamedExternalExport ? + factory.createModifiersFromModifierFlags(ModifierFlags.Export) : + undefined; + + // let C = (() => { ... })(); const varStatement = factory.createVariableStatement( - /*modifiers*/ undefined, + modifiers, factory.createVariableDeclarationList([ factory.createVariableDeclaration( factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ false), @@ -710,52 +740,62 @@ namespace ts { /*type*/ undefined, iife ) - ]) + ], NodeFlags.Let) ); setOriginalNode(varStatement, node); setCommentRange(varStatement, node); setSourceMapRange(varStatement, moveRangePastDecorators(node)); startOnNewLine(varStatement); - statements = [varStatement]; + statement = varStatement; } - - // If the class is exported as part of a TypeScript namespace, emit the namespace export. - // Otherwise, if the class was exported at the top level and was decorated, emit an export - // declaration or export default for the class. - if (facts & ClassFacts.IsExportOfNamespace) { - addExportMemberAssignment(statements, node); + else { + statement = classDeclaration; } - else if (facts & ClassFacts.UseImmediatelyInvokedFunctionExpression || facts & ClassFacts.HasConstructorDecorators) { + + if (moveModifiers) { + if (facts & ClassFacts.IsExportOfNamespace) { + return demarcateMultiStatementExport( + statement, + createExportMemberAssignmentStatement(node)); + } if (facts & ClassFacts.IsDefaultExternalExport) { - statements.push(factory.createExportDefault(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))); + return demarcateMultiStatementExport( + statement, + factory.createExportDefault(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))); } - else if (facts & ClassFacts.IsNamedExternalExport) { - statements.push(factory.createExternalModuleExport(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))); + if (facts & ClassFacts.IsNamedExternalExport && !promoteToIIFE) { + return demarcateMultiStatementExport( + statement, + factory.createExternalModuleExport(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))); } } - if (statements.length > 1) { - // Add a DeclarationMarker as a marker for the end of the declaration - statements.push(factory.createEndOfDeclarationMarker(node)); - setEmitFlags(classStatement, getEmitFlags(classStatement) | EmitFlags.HasEndOfDeclarationMarker); - } + return statement; + } - return singleOrMany(statements); + function demarcateMultiStatementExport(declarationStatement: Statement, exportStatement: Statement) { + addEmitFlags(declarationStatement, EmitFlags.HasEndOfDeclarationMarker); + return [ + declarationStatement, + exportStatement, + factory.createEndOfDeclarationMarker(declarationStatement) + ]; } function visitClassExpression(node: ClassExpression): Expression { - const allDecorators = getAllDecoratorsOfClass(node); - const decorators = transformAllDecoratorsOfDeclaration(node, node, allDecorators); + let modifiers = visitNodes(node.modifiers, modifierElidingVisitor, isModifierLike); + if (classOrConstructorParameterIsDecorated(legacyDecorators, node)) { + modifiers = injectClassTypeMetadata(modifiers, node); + } + return factory.updateClassExpression( node, - decorators, + modifiers, node.name, /*typeParameters*/ undefined, visitNodes(node.heritageClauses, visitor, isHeritageClause), - isClassLikeDeclarationWithTypeScriptSyntax(node) ? - transformClassMembers(node) : - visitNodes(node.members, getClassElementVisitor(node), isClassElement) + transformClassMembers(node) ); } @@ -765,72 +805,60 @@ namespace ts { * @param node The current class. */ function transformClassMembers(node: ClassDeclaration | ClassExpression) { - const members: ClassElement[] = []; + const members = visitNodes(node.members, getClassElementVisitor(node), isClassElement); + + let newMembers: ClassElement[] | undefined; const constructor = getFirstConstructorWithBody(node); const parametersWithPropertyAssignments = constructor && - filter(constructor.parameters, p => isParameterPropertyDeclaration(p, constructor)); + filter(constructor.parameters, (p): p is ParameterPropertyDeclaration => isParameterPropertyDeclaration(p, constructor)); if (parametersWithPropertyAssignments) { for (const parameter of parametersWithPropertyAssignments) { - if (isIdentifier(parameter.name)) { - members.push(setOriginalNode(factory.createPropertyDeclaration( - /*modifiers*/ undefined, - parameter.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined), parameter)); - } + const parameterProperty = factory.createPropertyDeclaration( + /*modifiers*/ undefined, + parameter.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); + setOriginalNode(parameterProperty, parameter); + newMembers = append(newMembers, parameterProperty); } } - addRange(members, visitNodes(node.members, getClassElementVisitor(node), isClassElement)); - return setTextRange(factory.createNodeArray(members), /*location*/ node.members); + if (newMembers) { + newMembers = addRange(newMembers, members); + return setTextRange(factory.createNodeArray(newMembers), /*location*/ node.members); + } + + return members; } - /** - * Transforms all of the decorators for a declaration into an array of expressions. - * - * @param node The declaration node. - * @param allDecorators An object containing all of the decorators for the declaration. - */ - function transformAllDecoratorsOfDeclaration(node: Declaration, container: ClassLikeDeclaration, allDecorators: AllDecorators | undefined) { - if (!allDecorators) { - return undefined; + function injectClassTypeMetadata(modifiers: NodeArray | undefined, node: ClassLikeDeclaration) { + const metadata = getTypeMetadata(node, node); + if (some(metadata)) { + const modifiersArray: ModifierLike[] = []; + addRange(modifiersArray, takeWhile(modifiers, isExportOrDefaultModifier)); + addRange(modifiersArray, filter(modifiers, isDecorator)); + addRange(modifiersArray, metadata); + addRange(modifiersArray, filter(skipWhile(modifiers, isExportOrDefaultModifier), isModifier)); + modifiers = setTextRange(factory.createNodeArray(modifiersArray), modifiers); } - const decorators = visitArray(allDecorators.decorators, visitor, isDecorator); - const parameterDecorators = flatMap(allDecorators.parameters, transformDecoratorsOfParameter); - const metadataDecorators = some(decorators) || some(parameterDecorators) ? getTypeMetadata(node, container) : undefined; - const result = factory.createNodeArray(concatenate(concatenate(decorators, parameterDecorators), metadataDecorators)); - const pos = firstOrUndefined(allDecorators.decorators)?.pos ?? -1; - const end = lastOrUndefined(allDecorators.decorators)?.end ?? -1; - setTextRangePosEnd(result, pos, end); - return result; + return modifiers; } - /** - * Transforms the decorators of a parameter into decorators of the class/method. - * - * @param parameterDecorators The decorators for the parameter at the provided offset. - * @param parameterOffset The offset of the parameter. - */ - function transformDecoratorsOfParameter(parameterDecorators: Decorator[], parameterOffset: number) { - if (parameterDecorators) { - const decorators: Decorator[] = []; - for (const parameterDecorator of parameterDecorators) { - const expression = visitNode(parameterDecorator.expression, visitor, isExpression); - const helper = emitHelpers().createParamHelper(expression, parameterOffset); - setTextRange(helper, parameterDecorator.expression); - setEmitFlags(helper, EmitFlags.NoComments); - - const decorator = factory.createDecorator(helper); - setSourceMapRange(decorator, parameterDecorator.expression); - setCommentRange(decorator, parameterDecorator.expression); - setEmitFlags(decorator, EmitFlags.NoComments); - decorators.push(decorator); + function injectClassElementTypeMetadata(modifiers: NodeArray | undefined, node: ClassElement, container: ClassLikeDeclaration | ObjectLiteralExpression) { + if (isClassLike(container) && classElementOrClassElementParameterIsDecorated(legacyDecorators, node, container)) { + const metadata = getTypeMetadata(node, container); + if (some(metadata)) { + const modifiersArray: ModifierLike[] = []; + addRange(modifiersArray, filter(modifiers, isDecorator)); + addRange(modifiersArray, metadata); + addRange(modifiersArray, filter(modifiers, isModifier)); + modifiers = setTextRange(factory.createNodeArray(modifiersArray), modifiers); } - return decorators; } + return modifiers; } /** @@ -1029,14 +1057,18 @@ namespace ts { return undefined; } - const allDecorators = getAllDecoratorsOfClassElement(node, parent); - const decorators = transformAllDecoratorsOfDeclaration(node, parent, allDecorators); + let modifiers = isClassLike(parent) ? !isAmbient ? + visitNodes(node.modifiers, visitor, isModifierLike) : + visitNodes(node.modifiers, modifierElidingVisitor, isModifierLike) : + visitNodes(node.modifiers, decoratorElidingVisitor, isModifierLike); + + modifiers = injectClassElementTypeMetadata(modifiers, node, parent); // Preserve a `declare x` property with decorators to be handled by the decorators transform if (isAmbient) { return factory.updatePropertyDeclaration( node, - concatenate(decorators, factory.createModifiersFromModifierFlags(ModifierFlags.Ambient)), + concatenate(modifiers, factory.createModifiersFromModifierFlags(ModifierFlags.Ambient)), visitNode(node.name, visitor, isPropertyName), /*questionOrExclamationToken*/ undefined, /*type*/ undefined, @@ -1046,7 +1078,7 @@ namespace ts { return factory.updatePropertyDeclaration( node, - concatenate(decorators, visitNodes(node.modifiers, modifierVisitor, isModifierLike)), + modifiers, visitPropertyNameOfClassElement(node), /*questionOrExclamationToken*/ undefined, /*type*/ undefined, @@ -1180,11 +1212,15 @@ namespace ts { return undefined; } - const allDecorators = isClassLike(parent) ? getAllDecoratorsOfClassElement(node, parent) : undefined; - const decorators = isClassLike(parent) ? transformAllDecoratorsOfDeclaration(node, parent, allDecorators) : undefined; + let modifiers = isClassLike(parent) ? + visitNodes(node.modifiers, visitor, isModifierLike) : + visitNodes(node.modifiers, decoratorElidingVisitor, isModifierLike); + + modifiers = injectClassElementTypeMetadata(modifiers, node, parent); + return factory.updateMethodDeclaration( node, - concatenate(decorators, visitNodes(node.modifiers, modifierVisitor, isModifierLike)), + modifiers, node.asteriskToken, visitPropertyNameOfClassElement(node), /*questionToken*/ undefined, @@ -1214,13 +1250,15 @@ namespace ts { return undefined; } - const decorators = isClassLike(parent) ? - transformAllDecoratorsOfDeclaration(node, parent, getAllDecoratorsOfClassElement(node, parent)) : - undefined; + let modifiers = isClassLike(parent) ? + visitNodes(node.modifiers, visitor, isModifierLike) : + visitNodes(node.modifiers, decoratorElidingVisitor, isModifierLike); + + modifiers = injectClassElementTypeMetadata(modifiers, node, parent); return factory.updateGetAccessorDeclaration( node, - concatenate(decorators, visitNodes(node.modifiers, modifierVisitor, isModifierLike)), + modifiers, visitPropertyNameOfClassElement(node), visitParameterList(node.parameters, visitor, context), /*type*/ undefined, @@ -1237,13 +1275,15 @@ namespace ts { return undefined; } - const decorators = isClassLike(parent) ? - transformAllDecoratorsOfDeclaration(node, parent, getAllDecoratorsOfClassElement(node, parent)) : - undefined; + let modifiers = isClassLike(parent) ? + visitNodes(node.modifiers, visitor, isModifierLike) : + visitNodes(node.modifiers, decoratorElidingVisitor, isModifierLike); + + modifiers = injectClassElementTypeMetadata(modifiers, node, parent); return factory.updateSetAccessorDeclaration( node, - concatenate(decorators, visitNodes(node.modifiers, modifierVisitor, isModifierLike)), + modifiers, visitPropertyNameOfClassElement(node), visitParameterList(node.parameters, visitor, context), visitFunctionBody(node.body, visitor, context) || factory.createBlock([]) @@ -1309,7 +1349,7 @@ namespace ts { const updated = factory.updateParameterDeclaration( node, - elideNodes(factory, node.modifiers), // preserve positions, if available + visitNodes(node.modifiers, node => isDecorator(node) ? visitor(node) : undefined, isModifierLike), node.dotDotDotToken, visitNode(node.name, visitor, isBindingName), /*questionToken*/ undefined, @@ -2243,7 +2283,7 @@ namespace ts { && hasSyntacticModifier(node, ModifierFlags.Default); } - function addExportMemberAssignment(statements: Statement[], node: ClassDeclaration | FunctionDeclaration) { + function createExportMemberAssignmentStatement(node: ClassDeclaration | FunctionDeclaration) { const expression = factory.createAssignment( factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node) @@ -2252,7 +2292,11 @@ namespace ts { const statement = factory.createExpressionStatement(expression); setSourceMapRange(statement, createRange(-1, node.end)); - statements.push(statement); + return statement; + } + + function addExportMemberAssignment(statements: Statement[], node: ClassDeclaration | FunctionDeclaration) { + statements.push(createExportMemberAssignmentStatement(node)); } function createNamespaceExport(exportName: Identifier, exportValue: Expression, location?: TextRange) { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f4525f2f5e40c..a2da620b6fd8f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1988,6 +1988,34 @@ namespace ts { return !!constructor && childIsDecorated(useLegacyDecorators, constructor, node); } + export function classElementOrClassElementParameterIsDecorated(useLegacyDecorators: boolean, node: ClassElement, parent: ClassDeclaration | ClassExpression): boolean { + let parameters: NodeArray | undefined; + if (isAccessor(node)) { + const { firstAccessor, secondAccessor, setAccessor } = getAllAccessorDeclarations(parent.members, node); + const firstAccessorWithDecorators = + hasDecorators(firstAccessor) ? firstAccessor : + secondAccessor && hasDecorators(secondAccessor) ? secondAccessor : + undefined; + if (!firstAccessorWithDecorators || node !== firstAccessorWithDecorators) { + return false; + } + parameters = setAccessor?.parameters; + } + else if (isMethodDeclaration(node)) { + parameters = node.parameters; + } + if (nodeIsDecorated(useLegacyDecorators, node, parent)) { + return true; + } + if (parameters) { + for (const parameter of parameters) { + if (parameterIsThisKeyword(parameter)) continue; + if (nodeIsDecorated(useLegacyDecorators, parameter, node, parent)) return true; + } + } + return false; + } + export function isJSXTagName(node: Node) { const { parent } = node; if (parent.kind === SyntaxKind.JsxOpeningElement || diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index c8b959eb8f87c..bc93daa3b973f 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -258,8 +258,13 @@ namespace ts { } export type ParameterPropertyDeclaration = ParameterDeclaration & { parent: ConstructorDeclaration, name: Identifier }; + export function isParameterPropertyDeclaration(node: Node, parent: Node): node is ParameterPropertyDeclaration { - return hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier) && parent.kind === SyntaxKind.Constructor; + return isParameter(node) && + !!node.name && // NOTE: JSDoc parameters may not have names + isIdentifier(node.name) && + isConstructorDeclaration(parent) && + hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier); } export function isEmptyBindingPattern(node: BindingName): node is BindingPattern { diff --git a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js index 6020113e64b87..a77b67636a438 100644 --- a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js +++ b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js @@ -36,14 +36,13 @@ define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; exports.E1 = exports.C1 = void 0; - var C1 = /** @class */ (function () { + var C1 = exports.C1 = /** @class */ (function () { function C1() { this.m1 = 42; } C1.s1 = true; return C1; }()); - exports.C1 = C1; var E1; (function (E1) { E1[E1["A"] = 0] = "A"; diff --git a/tests/baselines/reference/commonJSImportAsPrimaryExpression.js b/tests/baselines/reference/commonJSImportAsPrimaryExpression.js index f59e42beb1532..bc1b3f3986509 100644 --- a/tests/baselines/reference/commonJSImportAsPrimaryExpression.js +++ b/tests/baselines/reference/commonJSImportAsPrimaryExpression.js @@ -17,14 +17,13 @@ if(foo.C1.s1){ "use strict"; exports.__esModule = true; exports.C1 = void 0; -var C1 = /** @class */ (function () { +var C1 = exports.C1 = /** @class */ (function () { function C1() { this.m1 = 42; } C1.s1 = true; return C1; }()); -exports.C1 = C1; //// [foo_1.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js index cd1d0f85ec12f..58c637ab83bb2 100644 --- a/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js +++ b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js @@ -35,14 +35,13 @@ var e: number = 0; "use strict"; exports.__esModule = true; exports.E1 = exports.C1 = void 0; -var C1 = /** @class */ (function () { +var C1 = exports.C1 = /** @class */ (function () { function C1() { this.m1 = 42; } C1.s1 = true; return C1; }()); -exports.C1 = C1; var E1; (function (E1) { E1[E1["A"] = 0] = "A"; diff --git a/tests/baselines/reference/customTransforms/before+decorators.js b/tests/baselines/reference/customTransforms/before+decorators.js index ef705f0c9d850..7901f9846d9ce 100644 --- a/tests/baselines/reference/customTransforms/before+decorators.js +++ b/tests/baselines/reference/customTransforms/before+decorators.js @@ -13,7 +13,7 @@ var B = /** @class */ (function () { } return B; }()); -var C = /** @class */ (function () { +export var C = /** @class */ (function () { function C(b) { } C = __decorate([ @@ -22,5 +22,4 @@ var C = /** @class */ (function () { ], C); return C; }()); -export { C }; "changed"; diff --git a/tests/baselines/reference/declarationEmitLocalClassHasRequiredDeclare.js b/tests/baselines/reference/declarationEmitLocalClassHasRequiredDeclare.js index c79e0cc921e44..81299933cfbf5 100644 --- a/tests/baselines/reference/declarationEmitLocalClassHasRequiredDeclare.js +++ b/tests/baselines/reference/declarationEmitLocalClassHasRequiredDeclare.js @@ -24,13 +24,12 @@ var X = /** @class */ (function () { } return X; }()); -var A = /** @class */ (function () { +var A = exports.A = /** @class */ (function () { function A() { } A.X = X; return A; }()); -exports.A = A; var Y = /** @class */ (function () { function Y() { } diff --git a/tests/baselines/reference/decoratorMetadataGenericTypeVariable.js b/tests/baselines/reference/decoratorMetadataGenericTypeVariable.js index 393b7b9fec29b..1d32fff0c0c92 100644 --- a/tests/baselines/reference/decoratorMetadataGenericTypeVariable.js +++ b/tests/baselines/reference/decoratorMetadataGenericTypeVariable.js @@ -18,7 +18,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { }; exports.__esModule = true; exports.C = void 0; -var C = /** @class */ (function () { +var C = exports.C = /** @class */ (function () { function C() { } __decorate([ @@ -27,4 +27,3 @@ var C = /** @class */ (function () { ], C.prototype, "member"); return C; }()); -exports.C = C; diff --git a/tests/baselines/reference/decoratorMetadataGenericTypeVariableDefault.js b/tests/baselines/reference/decoratorMetadataGenericTypeVariableDefault.js index b3f9200ff99af..08d2c7d7a7ba8 100644 --- a/tests/baselines/reference/decoratorMetadataGenericTypeVariableDefault.js +++ b/tests/baselines/reference/decoratorMetadataGenericTypeVariableDefault.js @@ -18,7 +18,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { }; exports.__esModule = true; exports.C = void 0; -var C = /** @class */ (function () { +var C = exports.C = /** @class */ (function () { function C() { } __decorate([ @@ -27,4 +27,3 @@ var C = /** @class */ (function () { ], C.prototype, "member"); return C; }()); -exports.C = C; diff --git a/tests/baselines/reference/decoratorMetadataGenericTypeVariableInScope.js b/tests/baselines/reference/decoratorMetadataGenericTypeVariableInScope.js index 50583a896eb2c..b7fe02b8837c3 100644 --- a/tests/baselines/reference/decoratorMetadataGenericTypeVariableInScope.js +++ b/tests/baselines/reference/decoratorMetadataGenericTypeVariableInScope.js @@ -27,7 +27,7 @@ var TypeVariable = /** @class */ (function () { } return TypeVariable; }()); -var C = /** @class */ (function () { +var C = exports.C = /** @class */ (function () { function C() { } __decorate([ @@ -36,4 +36,3 @@ var C = /** @class */ (function () { ], C.prototype, "member"); return C; }()); -exports.C = C; diff --git a/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.js b/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.js index be5b5e4e75a0c..7d1f73e6adb7e 100644 --- a/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.js +++ b/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.js @@ -18,7 +18,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { }; exports.__esModule = true; exports.B = void 0; -var B = /** @class */ (function () { +var B = exports.B = /** @class */ (function () { function B() { } var _a; @@ -28,4 +28,3 @@ var B = /** @class */ (function () { ], B.prototype, "member"); return B; }()); -exports.B = B; diff --git a/tests/baselines/reference/decoratorMetadataOnInferredType.js b/tests/baselines/reference/decoratorMetadataOnInferredType.js index a2947a14efee4..8ea8ee7b06cbe 100644 --- a/tests/baselines/reference/decoratorMetadataOnInferredType.js +++ b/tests/baselines/reference/decoratorMetadataOnInferredType.js @@ -28,7 +28,7 @@ var A = /** @class */ (function () { }()); function decorator(target, propertyKey) { } -var B = /** @class */ (function () { +var B = exports.B = /** @class */ (function () { function B() { this.x = new A(); } @@ -38,4 +38,3 @@ var B = /** @class */ (function () { ], B.prototype, "x", void 0); return B; }()); -exports.B = B; diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js index c42cb65faa1de..ddb84dfe491a4 100644 --- a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js @@ -90,7 +90,7 @@ function annotation() { function annotation1() { return function (target) { }; } -var ClassA = /** @class */ (function () { +var ClassA = exports.ClassA = /** @class */ (function () { function ClassA() { var init = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -116,4 +116,3 @@ var ClassA = /** @class */ (function () { ], ClassA); return ClassA; }()); -exports.ClassA = ClassA; diff --git a/tests/baselines/reference/decoratorMetadataWithConstructorType.js b/tests/baselines/reference/decoratorMetadataWithConstructorType.js index 8ff397af61bf0..97d310b0adf36 100644 --- a/tests/baselines/reference/decoratorMetadataWithConstructorType.js +++ b/tests/baselines/reference/decoratorMetadataWithConstructorType.js @@ -28,7 +28,7 @@ var A = /** @class */ (function () { }()); function decorator(target, propertyKey) { } -var B = /** @class */ (function () { +var B = exports.B = /** @class */ (function () { function B() { this.x = new A(); } @@ -38,4 +38,3 @@ var B = /** @class */ (function () { ], B.prototype, "x", void 0); return B; }()); -exports.B = B; diff --git a/tests/baselines/reference/decoratorMetadataWithTypeOnlyImport2.js b/tests/baselines/reference/decoratorMetadataWithTypeOnlyImport2.js index 54af1f87a20bd..58c66855653b4 100644 --- a/tests/baselines/reference/decoratorMetadataWithTypeOnlyImport2.js +++ b/tests/baselines/reference/decoratorMetadataWithTypeOnlyImport2.js @@ -41,7 +41,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { }; exports.__esModule = true; exports.Main = void 0; -var Main = /** @class */ (function () { +var Main = exports.Main = /** @class */ (function () { function Main() { } __decorate([ @@ -50,4 +50,3 @@ var Main = /** @class */ (function () { ], Main.prototype, "field"); return Main; }()); -exports.Main = Main; diff --git a/tests/baselines/reference/decoratorOnClass2.js b/tests/baselines/reference/decoratorOnClass2.js index 7acc17151f67f..3347c0481c2e3 100644 --- a/tests/baselines/reference/decoratorOnClass2.js +++ b/tests/baselines/reference/decoratorOnClass2.js @@ -15,7 +15,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, }; Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; -var C = /** @class */ (function () { +var C = exports.C = /** @class */ (function () { function C() { } C = __decorate([ @@ -23,4 +23,3 @@ var C = /** @class */ (function () { ], C); return C; }()); -exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClass3.js b/tests/baselines/reference/decoratorOnClass3.js index cb007d9c68378..5edb1c7cfa4ad 100644 --- a/tests/baselines/reference/decoratorOnClass3.js +++ b/tests/baselines/reference/decoratorOnClass3.js @@ -16,7 +16,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, }; Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; -var C = /** @class */ (function () { +var C = exports.C = /** @class */ (function () { function C() { } C = __decorate([ @@ -24,4 +24,3 @@ var C = /** @class */ (function () { ], C); return C; }()); -exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClassConstructor2.js b/tests/baselines/reference/decoratorOnClassConstructor2.js index 23dbbf69036da..dff6101a9edf0 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor2.js +++ b/tests/baselines/reference/decoratorOnClassConstructor2.js @@ -55,7 +55,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; var _0_ts_1 = require("./0.ts"); var _0_ts_2 = require("./0.ts"); -var C = /** @class */ (function (_super) { +var C = exports.C = /** @class */ (function (_super) { __extends(C, _super); function C(prop) { return _super.call(this) || this; @@ -65,4 +65,3 @@ var C = /** @class */ (function (_super) { ], C); return C; }(_0_ts_1.base)); -exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClassConstructor3.js b/tests/baselines/reference/decoratorOnClassConstructor3.js index ff584adb5f043..c81f6d873558d 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor3.js +++ b/tests/baselines/reference/decoratorOnClassConstructor3.js @@ -58,7 +58,7 @@ exports.C = void 0; var _0_1 = require("./0"); var _0_2 = require("./0"); /* Comment on the Class Declaration */ -var C = /** @class */ (function (_super) { +var C = exports.C = /** @class */ (function (_super) { __extends(C, _super); function C(prop) { return _super.call(this) || this; @@ -68,4 +68,3 @@ var C = /** @class */ (function (_super) { ], C); return C; }(_0_1.base)); -exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClassMethodThisParameter.js b/tests/baselines/reference/decoratorOnClassMethodThisParameter.js index 0938ccbc4438b..d7a4ed9bf481b 100644 --- a/tests/baselines/reference/decoratorOnClassMethodThisParameter.js +++ b/tests/baselines/reference/decoratorOnClassMethodThisParameter.js @@ -30,8 +30,7 @@ var C2 = /** @class */ (function () { } C2.prototype.method = function (allowed) { }; __decorate([ - __param(0, dec), - __param(1, dec) + __param(0, dec) ], C2.prototype, "method", null); return C2; }()); diff --git a/tests/baselines/reference/es3defaultAliasIsQuoted.js b/tests/baselines/reference/es3defaultAliasIsQuoted.js index a486ad614046b..c8ae85c5bdf7f 100644 --- a/tests/baselines/reference/es3defaultAliasIsQuoted.js +++ b/tests/baselines/reference/es3defaultAliasIsQuoted.js @@ -17,13 +17,12 @@ assert(Foo.CONSTANT === "Foo"); "use strict"; exports.__esModule = true; exports.Foo = void 0; -var Foo = /** @class */ (function () { +var Foo = exports.Foo = /** @class */ (function () { function Foo() { } Foo.CONSTANT = "Foo"; return Foo; }()); -exports.Foo = Foo; function assert(value) { if (!value) throw new Error("Assertion failed!"); diff --git a/tests/baselines/reference/es6ModuleClassDeclaration.js b/tests/baselines/reference/es6ModuleClassDeclaration.js index a228739abbfb7..1a793a3ec113e 100644 --- a/tests/baselines/reference/es6ModuleClassDeclaration.js +++ b/tests/baselines/reference/es6ModuleClassDeclaration.js @@ -113,7 +113,7 @@ module m2 { } //// [es6ModuleClassDeclaration.js] -export class c { +class c { constructor() { this.x = 10; this.y = 30; @@ -129,6 +129,7 @@ export class c { } c.k = 20; c.l = 30; +export { c }; class c2 { constructor() { this.x = 10; diff --git a/tests/baselines/reference/es6modulekindWithES5Target.js b/tests/baselines/reference/es6modulekindWithES5Target.js index 3689bb9027f75..ee7248f0093be 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target.js +++ b/tests/baselines/reference/es6modulekindWithES5Target.js @@ -26,7 +26,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var C = /** @class */ (function () { +export var C = /** @class */ (function () { function C() { this.p = 1; } @@ -34,9 +34,8 @@ var C = /** @class */ (function () { C.s = 0; return C; }()); -export { C }; export { C as C2 }; -var D = /** @class */ (function () { +export var D = /** @class */ (function () { function D() { this.p = 1; } @@ -47,7 +46,6 @@ var D = /** @class */ (function () { ], D); return D; }()); -export { D }; export { D as D2 }; var E = /** @class */ (function () { function E() { diff --git a/tests/baselines/reference/esnextmodulekindWithES5Target.js b/tests/baselines/reference/esnextmodulekindWithES5Target.js index 061dd3e4050d9..7f5b300a7503b 100644 --- a/tests/baselines/reference/esnextmodulekindWithES5Target.js +++ b/tests/baselines/reference/esnextmodulekindWithES5Target.js @@ -26,7 +26,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var C = /** @class */ (function () { +export var C = /** @class */ (function () { function C() { this.p = 1; } @@ -34,9 +34,8 @@ var C = /** @class */ (function () { C.s = 0; return C; }()); -export { C }; export { C as C2 }; -var D = /** @class */ (function () { +export var D = /** @class */ (function () { function D() { this.p = 1; } @@ -47,7 +46,6 @@ var D = /** @class */ (function () { ], D); return D; }()); -export { D }; export { D as D2 }; var E = /** @class */ (function () { function E() { diff --git a/tests/baselines/reference/exportDefaultClassWithStaticPropertyAssignmentsInES6.js b/tests/baselines/reference/exportDefaultClassWithStaticPropertyAssignmentsInES6.js index 3acb89b8696d7..4aa354ee727e7 100644 --- a/tests/baselines/reference/exportDefaultClassWithStaticPropertyAssignmentsInES6.js +++ b/tests/baselines/reference/exportDefaultClassWithStaticPropertyAssignmentsInES6.js @@ -4,6 +4,7 @@ export default class { } //// [exportDefaultClassWithStaticPropertyAssignmentsInES6.js] -export default class default_1 { +class default_1 { } default_1.z = "Foo"; +export default default_1; diff --git a/tests/baselines/reference/importImportOnlyModule.js b/tests/baselines/reference/importImportOnlyModule.js index 447bb58d690b1..2df8cb46a7a1a 100644 --- a/tests/baselines/reference/importImportOnlyModule.js +++ b/tests/baselines/reference/importImportOnlyModule.js @@ -20,14 +20,13 @@ define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; exports.C1 = void 0; - var C1 = /** @class */ (function () { + var C1 = exports.C1 = /** @class */ (function () { function C1() { this.m1 = 42; } C1.s1 = true; return C1; }()); - exports.C1 = C1; }); //// [foo_1.js] define(["require", "exports"], function (require, exports) { diff --git a/tests/baselines/reference/jsDeclarationsClasses.js b/tests/baselines/reference/jsDeclarationsClasses.js index f1807e37f4c3d..f8982d3b554b0 100644 --- a/tests/baselines/reference/jsDeclarationsClasses.js +++ b/tests/baselines/reference/jsDeclarationsClasses.js @@ -219,14 +219,13 @@ var A = /** @class */ (function () { return A; }()); exports.A = A; -var B = /** @class */ (function () { +var B = exports.B = /** @class */ (function () { function B() { } B.cat = "cat"; return B; }()); -exports.B = B; -var C = /** @class */ (function () { +var C = exports.C = /** @class */ (function () { function C() { } C.Cls = /** @class */ (function () { @@ -236,7 +235,6 @@ var C = /** @class */ (function () { }()); return C; }()); -exports.C = C; var D = /** @class */ (function () { /** * @param {number} a @@ -250,7 +248,7 @@ exports.D = D; /** * @template T,U */ -var E = /** @class */ (function () { +var E = exports.E = /** @class */ (function () { /** * @param {T} a * @param {U} b @@ -317,7 +315,6 @@ var E = /** @class */ (function () { E.staticInitializedField = 12; return E; }()); -exports.E = E; /** * @template T,U */ diff --git a/tests/baselines/reference/jsDeclarationsComputedNames.js b/tests/baselines/reference/jsDeclarationsComputedNames.js index 127b4604583da..8b21f98c0b84d 100644 --- a/tests/baselines/reference/jsDeclarationsComputedNames.js +++ b/tests/baselines/reference/jsDeclarationsComputedNames.js @@ -50,7 +50,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass = void 0; var TopLevelSym = Symbol(); var InnerSym = Symbol(); -var MyClass = /** @class */ (function () { +var MyClass = exports.MyClass = /** @class */ (function () { /** * @param {typeof TopLevelSym | typeof InnerSym} _p */ @@ -64,7 +64,6 @@ var MyClass = /** @class */ (function () { MyClass[_a] = 12; return MyClass; }()); -exports.MyClass = MyClass; //// [index.d.ts] diff --git a/tests/baselines/reference/metadataImportType.js b/tests/baselines/reference/metadataImportType.js index 91232ed5865c6..480e5cd97aa1a 100644 --- a/tests/baselines/reference/metadataImportType.js +++ b/tests/baselines/reference/metadataImportType.js @@ -17,7 +17,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { }; exports.__esModule = true; exports.A = void 0; -var A = /** @class */ (function () { +var A = exports.A = /** @class */ (function () { function A() { } __decorate([ @@ -26,4 +26,3 @@ var A = /** @class */ (function () { ], A.prototype, "b"); return A; }()); -exports.A = A; diff --git a/tests/baselines/reference/metadataOfClassFromAlias.js b/tests/baselines/reference/metadataOfClassFromAlias.js index 657cdf21f975f..e63697b564d18 100644 --- a/tests/baselines/reference/metadataOfClassFromAlias.js +++ b/tests/baselines/reference/metadataOfClassFromAlias.js @@ -41,7 +41,7 @@ var auxiliry_1 = require("./auxiliry"); function annotation() { return function (target) { }; } -var ClassA = /** @class */ (function () { +var ClassA = exports.ClassA = /** @class */ (function () { function ClassA() { } __decorate([ @@ -50,4 +50,3 @@ var ClassA = /** @class */ (function () { ], ClassA.prototype, "array", void 0); return ClassA; }()); -exports.ClassA = ClassA; diff --git a/tests/baselines/reference/metadataOfClassFromAlias2.js b/tests/baselines/reference/metadataOfClassFromAlias2.js index 8b7a2b93130fd..02d2626a97e39 100644 --- a/tests/baselines/reference/metadataOfClassFromAlias2.js +++ b/tests/baselines/reference/metadataOfClassFromAlias2.js @@ -40,7 +40,7 @@ exports.ClassA = void 0; function annotation() { return function (target) { }; } -var ClassA = /** @class */ (function () { +var ClassA = exports.ClassA = /** @class */ (function () { function ClassA() { } __decorate([ @@ -49,4 +49,3 @@ var ClassA = /** @class */ (function () { ], ClassA.prototype, "array", void 0); return ClassA; }()); -exports.ClassA = ClassA; diff --git a/tests/baselines/reference/metadataOfEventAlias.js b/tests/baselines/reference/metadataOfEventAlias.js index 9993967432eae..c4d49829539f2 100644 --- a/tests/baselines/reference/metadataOfEventAlias.js +++ b/tests/baselines/reference/metadataOfEventAlias.js @@ -28,7 +28,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { Object.defineProperty(exports, "__esModule", { value: true }); exports.SomeClass = void 0; function Input(target, key) { } -var SomeClass = /** @class */ (function () { +var SomeClass = exports.SomeClass = /** @class */ (function () { function SomeClass() { } __decorate([ @@ -37,4 +37,3 @@ var SomeClass = /** @class */ (function () { ], SomeClass.prototype, "event", void 0); return SomeClass; }()); -exports.SomeClass = SomeClass; diff --git a/tests/baselines/reference/metadataReferencedWithinFilteredUnion.js b/tests/baselines/reference/metadataReferencedWithinFilteredUnion.js index 7c7d70c749b5a..1462af8a63290 100644 --- a/tests/baselines/reference/metadataReferencedWithinFilteredUnion.js +++ b/tests/baselines/reference/metadataReferencedWithinFilteredUnion.js @@ -42,7 +42,7 @@ exports.Class2 = void 0; var Class1_1 = require("./Class1"); function decorate(target, propertyKey) { } -var Class2 = /** @class */ (function () { +var Class2 = exports.Class2 = /** @class */ (function () { function Class2() { } Object.defineProperty(Class2.prototype, "prop", { @@ -59,4 +59,3 @@ var Class2 = /** @class */ (function () { ], Class2.prototype, "prop", null); return Class2; }()); -exports.Class2 = Class2; diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js index 91862eec66118..d6c0fb6b022e5 100644 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js @@ -156,7 +156,7 @@ exports.createExportedWidget4 = createExportedWidget4; exports.__esModule = true; exports.publicVarWithPrivateModulePropertyTypes1 = exports.publicVarWithPrivateModulePropertyTypes = exports.publicClassWithPrivateModulePropertyTypes = exports.publicVarWithPrivatePropertyTypes1 = exports.publicVarWithPrivatePropertyTypes = exports.publicClassWithWithPrivatePropertyTypes = void 0; var exporter = require("./privacyCannotNameVarTypeDeclFile_exporter"); -var publicClassWithWithPrivatePropertyTypes = /** @class */ (function () { +var publicClassWithWithPrivatePropertyTypes = exports.publicClassWithWithPrivatePropertyTypes = /** @class */ (function () { function publicClassWithWithPrivatePropertyTypes() { this.myPublicProperty = exporter.createExportedWidget1(); // Error this.myPrivateProperty = exporter.createExportedWidget1(); @@ -169,7 +169,6 @@ var publicClassWithWithPrivatePropertyTypes = /** @class */ (function () { publicClassWithWithPrivatePropertyTypes.myPrivateStaticProperty1 = exporter.createExportedWidget3(); return publicClassWithWithPrivatePropertyTypes; }()); -exports.publicClassWithWithPrivatePropertyTypes = publicClassWithWithPrivatePropertyTypes; var privateClassWithWithPrivatePropertyTypes = /** @class */ (function () { function privateClassWithWithPrivatePropertyTypes() { this.myPublicProperty = exporter.createExportedWidget1(); @@ -187,7 +186,7 @@ exports.publicVarWithPrivatePropertyTypes = exporter.createExportedWidget1(); // var privateVarWithPrivatePropertyTypes = exporter.createExportedWidget1(); exports.publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); // Error var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); -var publicClassWithPrivateModulePropertyTypes = /** @class */ (function () { +var publicClassWithPrivateModulePropertyTypes = exports.publicClassWithPrivateModulePropertyTypes = /** @class */ (function () { function publicClassWithPrivateModulePropertyTypes() { this.myPublicProperty = exporter.createExportedWidget2(); // Error this.myPublicProperty1 = exporter.createExportedWidget4(); // Error @@ -196,7 +195,6 @@ var publicClassWithPrivateModulePropertyTypes = /** @class */ (function () { publicClassWithPrivateModulePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error return publicClassWithPrivateModulePropertyTypes; }()); -exports.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; exports.publicVarWithPrivateModulePropertyTypes = exporter.createExportedWidget2(); // Error exports.publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); // Error var privateClassWithPrivateModulePropertyTypes = /** @class */ (function () { diff --git a/tests/baselines/reference/privateNameStaticEmitHelpers.js b/tests/baselines/reference/privateNameStaticEmitHelpers.js index 0e57493d5342d..9e1180deeac8e 100644 --- a/tests/baselines/reference/privateNameStaticEmitHelpers.js +++ b/tests/baselines/reference/privateNameStaticEmitHelpers.js @@ -16,7 +16,8 @@ export declare function __classPrivateFieldSet(receiver: T, //// [main.js] var _a, _S_a, _S_b, _S_c_get; import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib"; -export class S { +class S { } _a = S, _S_b = function _S_b() { __classPrivateFieldSet(this, _a, 42, "f", _S_a); }, _S_c_get = function _S_c_get() { return __classPrivateFieldGet(S, _a, "m", _S_b).call(S); }; _S_a = { value: 1 }; +export { S }; diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/main.js index 9ca20dffe6e8f..523abb1315121 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/main.js @@ -11,7 +11,7 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; - var MyClass1 = /** @class */ (function () { + var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,5 +22,4 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) ], MyClass1); return MyClass1; }()); - exports.MyClass1 = MyClass1; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/main.js index 7a668087a0301..adbff7ffa99a7 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/main.js @@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; var ng = require("angular2/core"); -var MyClass1 = /** @class */ (function () { +var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,4 +22,3 @@ var MyClass1 = /** @class */ (function () { ], MyClass1); return MyClass1; }()); -exports.MyClass1 = MyClass1; diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/main.js index 9ca20dffe6e8f..523abb1315121 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/main.js @@ -11,7 +11,7 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; - var MyClass1 = /** @class */ (function () { + var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,5 +22,4 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) ], MyClass1); return MyClass1; }()); - exports.MyClass1 = MyClass1; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/main.js index 7a668087a0301..adbff7ffa99a7 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/main.js @@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; var ng = require("angular2/core"); -var MyClass1 = /** @class */ (function () { +var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,4 +22,3 @@ var MyClass1 = /** @class */ (function () { ], MyClass1); return MyClass1; }()); -exports.MyClass1 = MyClass1; diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/main.js index 9ca20dffe6e8f..523abb1315121 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/main.js @@ -11,7 +11,7 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; - var MyClass1 = /** @class */ (function () { + var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,5 +22,4 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) ], MyClass1); return MyClass1; }()); - exports.MyClass1 = MyClass1; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/main.js index 7a668087a0301..adbff7ffa99a7 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/main.js @@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; var ng = require("angular2/core"); -var MyClass1 = /** @class */ (function () { +var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,4 +22,3 @@ var MyClass1 = /** @class */ (function () { ], MyClass1); return MyClass1; }()); -exports.MyClass1 = MyClass1; diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/main.js index 9ca20dffe6e8f..523abb1315121 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/main.js @@ -11,7 +11,7 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; - var MyClass1 = /** @class */ (function () { + var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,5 +22,4 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) ], MyClass1); return MyClass1; }()); - exports.MyClass1 = MyClass1; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/main.js index 7a668087a0301..adbff7ffa99a7 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/main.js @@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; var ng = require("angular2/core"); -var MyClass1 = /** @class */ (function () { +var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,4 +22,3 @@ var MyClass1 = /** @class */ (function () { ], MyClass1); return MyClass1; }()); -exports.MyClass1 = MyClass1; diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/main.js index 9ca20dffe6e8f..523abb1315121 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/main.js @@ -11,7 +11,7 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; - var MyClass1 = /** @class */ (function () { + var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,5 +22,4 @@ define(["require", "exports", "angular2/core"], function (require, exports, ng) ], MyClass1); return MyClass1; }()); - exports.MyClass1 = MyClass1; }); diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/main.js b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/main.js index 7a668087a0301..adbff7ffa99a7 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/main.js +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/main.js @@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { Object.defineProperty(exports, "__esModule", { value: true }); exports.MyClass1 = void 0; var ng = require("angular2/core"); -var MyClass1 = /** @class */ (function () { +var MyClass1 = exports.MyClass1 = /** @class */ (function () { function MyClass1(_elementRef) { this._elementRef = _elementRef; } @@ -22,4 +22,3 @@ var MyClass1 = /** @class */ (function () { ], MyClass1); return MyClass1; }()); -exports.MyClass1 = MyClass1; diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js.map b/tests/baselines/reference/sourceMapValidationDecorators.js.map index c980e54efb237..97eeb8282bf58 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.js.map +++ b/tests/baselines/reference/sourceMapValidationDecorators.js.map @@ -1,3 +1,3 @@ //// [sourceMapValidationDecorators.js.map] -{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":[],"mappings":";;;;;;;;;AASA;IACI,iBAGS,QAAgB;QAIvB,WAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,0BAAc;;QAJP,aAAQ,GAAR,QAAQ,CAAQ;IAKzB,CAAC;IAID,uBAAK,GAAL;QACI,OAAO,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5C,CAAC;IAUO,oBAAE,GAAV,UAGE,CAAS;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,sBAEI,8BAAS;aAFb;YAGI,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;aAED,UAGE,SAAiB;YACf,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC9B,CAAC;;;OAPA;IAbc,UAAE,GAAW,EAAG,CAAA;IAV/B;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;wCAGtB;IAID;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;sCACL;IAMlB;QACG,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;qCAGzB;IAED;QAAC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;QAMpB,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;4CAJzB;IAbc;QAFd,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;6BACQ;IAvB7B,OAAO;QAFZ,eAAe;QACf,eAAe,CAAC,EAAE,CAAC;QAGb,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,C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VydHlEZWNvcmF0b3IyKDYwKQogICAgcHJpdmF0ZSBzdGF0aWMgeDE6IG51bWJlciA9IDEwOwogICAgCiAgICBwcml2YXRlIGZuKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoNzApIAogICAgICB4OiBudW1iZXIpIHsKICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsKICAgIH0KCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDgwKQogICAgZ2V0IGdyZWV0aW5ncygpIHsKICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsKICAgIH0KCiAgICBzZXQgZ3JlZXRpbmdzKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoOTApIAogICAgICBncmVldGluZ3M6IHN0cmluZykgewogICAgICAgIHRoaXMuZ3JlZXRpbmcgPSBncmVldGluZ3M7CiAgICB9ICAgIAp9 +{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":[],"mappings":";;;;;;;;;AASA;IACI,iBAGS,QAAgB;QAIvB,WAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,0BAAc;;QAJP,aAAQ,GAAR,QAAQ,CAAQ;IAKzB,CAAC;IAID,uBAAK,GAAL;QACI,OAAO,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5C,CAAC;IAUO,oBAAE,GAAV,UAGE,CAAS;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAID,sBAAI,8BAAS;aAAb;YACI,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;aAED,UAGE,SAAiB;YACf,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC9B,CAAC;;;OAPA;IAbc,UAAE,GAAW,EAAG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WMgZ3JlZXRpbmc6IHN0cmluZywgCiAgICAgIAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoMzApIAogICAgICAuLi5iOiBzdHJpbmdbXSkgewogICAgfQogICAgCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDQwKQogICAgZ3JlZXQoKSB7CiAgICAgICAgcmV0dXJuICI8aDE+IiArIHRoaXMuZ3JlZXRpbmcgKyAiPC9oMT4iOwogICAgfQoKICAgIEBQcm9wZXJ0eURlY29yYXRvcjEKICAgIEBQcm9wZXJ0eURlY29yYXRvcjIoNTApCiAgICBwcml2YXRlIHg6IHN0cmluZzsKCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDYwKQogICAgcHJpdmF0ZSBzdGF0aWMgeDE6IG51bWJlciA9IDEwOwogICAgCiAgICBwcml2YXRlIGZuKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoNzApIAogICAgICB4OiBudW1iZXIpIHsKICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsKICAgIH0KCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDgwKQogICAgZ2V0IGdyZWV0aW5ncygpIHsKICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsKICAgIH0KCiAgICBzZXQgZ3JlZXRpbmdzKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoOTApIAogICAgICBncmVldGluZ3M6IHN0cmluZykgewogICAgICAgIHRoaXMuZ3JlZXRpbmcgPSBncmVldGluZ3M7CiAgICB9ICAgIAp9 diff --git a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt index 45c46f1eb1552..06296a367daaf 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt @@ -246,12 +246,12 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > + > @PropertyDecorator1 + > @PropertyDecorator2(80) > -2 > @PropertyDecorator1 - > @PropertyDecorator2(80) - > get +2 > get 3 > greetings -1->Emitted(24, 5) Source(42, 5) + SourceIndex(0) +1->Emitted(24, 5) Source(44, 5) + SourceIndex(0) 2 >Emitted(24, 27) Source(44, 9) + SourceIndex(0) 3 >Emitted(24, 57) Source(44, 18) + SourceIndex(0) --- @@ -259,7 +259,7 @@ sourceFile:sourceMapValidationDecorators.ts 1 >^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(25, 14) Source(42, 5) + SourceIndex(0) +1 >Emitted(25, 14) Source(44, 5) + SourceIndex(0) --- >>> return this.greeting; 1->^^^^^^^^^^^^ @@ -268,9 +268,7 @@ sourceFile:sourceMapValidationDecorators.ts 4 > ^ 5 > ^^^^^^^^ 6 > ^ -1->@PropertyDecorator1 - > @PropertyDecorator2(80) - > get greetings() { +1->get greetings() { > 2 > return 3 > this @@ -521,14 +519,16 @@ sourceFile:sourceMapValidationDecorators.ts 2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > + > @PropertyDecorator1 + > @PropertyDecorator2(80) > -1 >Emitted(47, 5) Source(42, 5) + SourceIndex(0) +1 >Emitted(47, 5) Source(44, 5) + SourceIndex(0) --- >>> PropertyDecorator1, 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^-> -1->@ +1-> 2 > PropertyDecorator1 1->Emitted(48, 9) Source(42, 6) + SourceIndex(0) 2 >Emitted(48, 27) Source(42, 24) + SourceIndex(0) @@ -835,9 +835,7 @@ sourceFile:sourceMapValidationDecorators.ts 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 > -3 > @ClassDecorator1 - > @ClassDecorator2(10) - > class Greeter { +3 > class Greeter { > constructor( > @ParameterDecorator1 > @ParameterDecorator2(20) @@ -883,7 +881,7 @@ sourceFile:sourceMapValidationDecorators.ts > } > } 1 >Emitted(66, 2) Source(54, 2) + SourceIndex(0) -2 >Emitted(66, 2) Source(8, 1) + SourceIndex(0) +2 >Emitted(66, 2) Source(10, 1) + SourceIndex(0) 3 >Emitted(66, 6) Source(54, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationDecorators.js.map \ No newline at end of file diff --git a/tests/baselines/reference/systemModuleTargetES6.js b/tests/baselines/reference/systemModuleTargetES6.js index 0df2835683e82..943e57ff742ac 100644 --- a/tests/baselines/reference/systemModuleTargetES6.js +++ b/tests/baselines/reference/systemModuleTargetES6.js @@ -35,8 +35,8 @@ System.register([], function (exports_1, context_1) { MyClass2 = class MyClass2 { static getInstance() { return MyClass2.value; } }; - exports_1("MyClass2", MyClass2); MyClass2.value = 42; + exports_1("MyClass2", MyClass2); } }; }); diff --git a/tests/baselines/reference/targetEs6DecoratorMetadataImportNotElided.js b/tests/baselines/reference/targetEs6DecoratorMetadataImportNotElided.js index d4781b57b5ca5..891f04581f436 100644 --- a/tests/baselines/reference/targetEs6DecoratorMetadataImportNotElided.js +++ b/tests/baselines/reference/targetEs6DecoratorMetadataImportNotElided.js @@ -35,7 +35,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { Input, TemplateRef } from './deps'; -var MyComponent = /** @class */ (function () { +export var MyComponent = /** @class */ (function () { function MyComponent() { } Object.defineProperty(MyComponent.prototype, "ref", { @@ -51,4 +51,3 @@ var MyComponent = /** @class */ (function () { ], MyComponent.prototype, "ref", null); return MyComponent; }()); -export { MyComponent }; diff --git a/tests/baselines/reference/templateLiteralsAndDecoratorMetadata.js b/tests/baselines/reference/templateLiteralsAndDecoratorMetadata.js index 72cdd31044dda..01bd4c0c1b08f 100644 --- a/tests/baselines/reference/templateLiteralsAndDecoratorMetadata.js +++ b/tests/baselines/reference/templateLiteralsAndDecoratorMetadata.js @@ -18,7 +18,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { }; exports.__esModule = true; exports.Greeter = void 0; -var Greeter = /** @class */ (function () { +var Greeter = exports.Greeter = /** @class */ (function () { function Greeter() { this.greeting = "employee"; //template literals on this line cause the issue } @@ -28,4 +28,3 @@ var Greeter = /** @class */ (function () { ], Greeter.prototype, "greeting"); return Greeter; }()); -exports.Greeter = Greeter; diff --git a/tests/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js b/tests/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js index cec8a6de30633..3356d7ba1811b 100644 --- a/tests/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js +++ b/tests/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js @@ -197,9 +197,10 @@ export declare class LassieDog extends Dog { //// [/src/src-dogs/lassie/lassiedog.js] import { Dog } from '../dog.js'; import { LASSIE_CONFIG } from './lassieconfig.js'; -export class LassieDog extends Dog { +class LassieDog extends Dog { static getDogConfig = () => LASSIE_CONFIG; } +export { LassieDog }; //// [/src/src-dogs/tsconfig.tsbuildinfo] From 50c7e00aa72a7b8c8d48ae19806b041a9817e20b Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Sat, 17 Sep 2022 18:59:04 -0400 Subject: [PATCH 10/51] WIP Stage 3 Decorators --- src/compiler/checker.ts | 207 +- src/compiler/commandLineParser.ts | 7 + src/compiler/emitter.ts | 66 +- src/compiler/factory/emitHelpers.ts | 247 ++ src/compiler/factory/nodeFactory.ts | 5 + src/compiler/factory/utilities.ts | 31 +- src/compiler/parser.ts | 17 + src/compiler/transformer.ts | 52 +- src/compiler/transformers/classFields.ts | 602 +++-- src/compiler/transformers/es2015.ts | 17 +- src/compiler/transformers/esDecorators.ts | 2050 +++++++++++++++++ src/compiler/transformers/legacyDecorators.ts | 6 +- src/compiler/transformers/ts.ts | 7 +- src/compiler/transformers/utilities.ts | 7 +- src/compiler/tsconfig.json | 1 + src/compiler/types.ts | 19 +- src/compiler/utilities.ts | 26 +- src/compiler/utilitiesPublic.ts | 1 + src/compiler/visitorPublic.ts | 19 + src/services/utilities.ts | 2 +- src/testRunner/unittests/transform.ts | 3 + .../reference/api/tsserverlibrary.d.ts | 9 +- tests/baselines/reference/api/typescript.d.ts | 9 +- .../reference/autoAccessor2(target=es2015).js | 32 +- .../reference/autoAccessor5(target=es2015).js | 22 +- .../reference/autoAccessor5(target=es2022).js | 22 +- .../reference/autoAccessor5(target=es5).js | 2 +- .../reference/autoAccessor5(target=esnext).js | 20 +- .../blockScopedVariablesUseBeforeDef.js | 6 + .../classExpressionWithDecorator1.errors.txt | 9 +- .../classExpressionWithDecorator1.js | 25 +- .../classExpressionWithDecorator1.types | 6 +- .../classStaticBlock18(target=es2015).js | 5 + .../classStaticBlock18(target=es5).js | 5 + .../decoratorOnArrowFunction.errors.txt | 13 +- .../reference/decoratorOnArrowFunction.types | 1 - .../reference/decoratorOnClass8.es6.js | 8 +- .../reference/decoratorOnClassProperty13.js | 8 +- .../decoratorOnFunctionExpression.errors.txt | 9 +- .../decoratorOnFunctionExpression.symbols | 2 +- .../decoratorOnFunctionExpression.types | 1 - .../emitClassExpressionInDeclarationFile2.js | 5 + ...tion-accessors-nonStatic(target=es2015).js | 48 + ...tion-accessors-nonStatic(target=es2022).js | 46 + ...aration-accessors-nonStatic(target=es5).js | 66 + ...tion-accessors-nonStatic(target=esnext).js | 31 + ...onStaticAbstract(target=es2015).errors.txt | 34 + ...essors-nonStaticAbstract(target=es2015).js | 19 + ...onStaticAbstract(target=es2022).errors.txt | 34 + ...essors-nonStaticAbstract(target=es2022).js | 19 + ...s-nonStaticAbstract(target=es5).errors.txt | 34 + ...accessors-nonStaticAbstract(target=es5).js | 22 + ...onStaticAbstract(target=esnext).errors.txt | 34 + ...essors-nonStaticAbstract(target=esnext).js | 19 + ...cessors-nonStaticPrivate(target=es2015).js | 34 + ...cessors-nonStaticPrivate(target=es2022).js | 30 + ...cessors-nonStaticPrivate(target=esnext).js | 16 + ...aration-accessors-static(target=es2015).js | 46 + ...aration-accessors-static(target=es2022).js | 44 + ...eclaration-accessors-static(target=es5).js | 66 + ...aration-accessors-static(target=esnext).js | 31 + ...-accessors-staticPrivate(target=es2015).js | 66 + ...-accessors-staticPrivate(target=es2022).js | 61 + ...-accessors-staticPrivate(target=esnext).js | 37 + ...ecorators-classDeclaration-classSuper.1.js | 50 + ...ecorators-classDeclaration-classSuper.2.js | 90 + ...ecorators-classDeclaration-classSuper.3.js | 94 + ...ecorators-classDeclaration-classSuper.4.js | 45 + ...ecorators-classDeclaration-classSuper.5.js | 183 ++ ...ecorators-classDeclaration-classSuper.6.js | 53 + ...ation-classThisReference(target=es2015).js | 42 + ...ation-classThisReference(target=es2022).js | 37 + ...ation-classThisReference(target=esnext).js | 22 + ...classDeclaration-classThisReference.es5.js | 46 + ...t=es2015,usedefineforclassfields=false).js | 39 + ...et=es2015,usedefineforclassfields=true).js | 54 + ...t=es2022,usedefineforclassfields=false).js | 38 + ...et=es2022,usedefineforclassfields=true).js | 34 + ...rget=es5,usedefineforclassfields=false).js | 40 + ...arget=es5,usedefineforclassfields=true).js | 55 + ...t=esnext,usedefineforclassfields=false).js | 38 + ...et=esnext,usedefineforclassfields=true).js | 22 + ...onStaticAbstract(target=es2015).errors.txt | 22 + ...fields-nonStaticAbstract(target=es2015).js | 16 + ...onStaticAbstract(target=es2022).errors.txt | 22 + ...fields-nonStaticAbstract(target=es2022).js | 16 + ...s-nonStaticAbstract(target=es5).errors.txt | 22 + ...on-fields-nonStaticAbstract(target=es5).js | 19 + ...onStaticAbstract(target=esnext).errors.txt | 22 + ...fields-nonStaticAbstract(target=esnext).js | 16 + ...AbstractAccessor(target=es2015).errors.txt | 22 + ...onStaticAbstractAccessor(target=es2015).js | 16 + ...AbstractAccessor(target=es2022).errors.txt | 22 + ...onStaticAbstractAccessor(target=es2022).js | 16 + ...AbstractAccessor(target=esnext).errors.txt | 22 + ...onStaticAbstractAccessor(target=esnext).js | 16 + ...fields-nonStaticAccessor(target=es2015).js | 44 + ...fields-nonStaticAccessor(target=es2022).js | 40 + ...fields-nonStaticAccessor(target=esnext).js | 22 + ...nonStaticAmbient(target=es2015).errors.txt | 22 + ...-fields-nonStaticAmbient(target=es2015).js | 16 + ...nonStaticAmbient(target=es2022).errors.txt | 22 + ...-fields-nonStaticAmbient(target=es2022).js | 16 + ...ds-nonStaticAmbient(target=es5).errors.txt | 22 + ...ion-fields-nonStaticAmbient(target=es5).js | 19 + ...nonStaticAmbient(target=esnext).errors.txt | 22 + ...-fields-nonStaticAmbient(target=esnext).js | 16 + ...-fields-nonStaticPrivate(target=es2015).js | 26 + ...-fields-nonStaticPrivate(target=es2022).js | 21 + ...-fields-nonStaticPrivate(target=esnext).js | 13 + ...nonStaticPrivateAccessor(target=es2015).js | 31 + ...nonStaticPrivateAccessor(target=es2022).js | 24 + ...nonStaticPrivateAccessor(target=esnext).js | 13 + ...t=es2015,usedefineforclassfields=false).js | 38 + ...et=es2015,usedefineforclassfields=true).js | 53 + ...t=es2022,usedefineforclassfields=false).js | 37 + ...et=es2022,usedefineforclassfields=true).js | 35 + ...rget=es5,usedefineforclassfields=false).js | 42 + ...arget=es5,usedefineforclassfields=true).js | 57 + ...t=esnext,usedefineforclassfields=false).js | 37 + ...et=esnext,usedefineforclassfields=true).js | 22 + ...on-fields-staticAccessor(target=es2015).js | 78 + ...on-fields-staticAccessor(target=es2022).js | 73 + ...on-fields-staticAccessor(target=esnext).js | 40 + ...ds-staticAmbient(target=es2015).errors.txt | 22 + ...ion-fields-staticAmbient(target=es2015).js | 16 + ...ds-staticAmbient(target=es2022).errors.txt | 22 + ...ion-fields-staticAmbient(target=es2022).js | 16 + ...ields-staticAmbient(target=es5).errors.txt | 22 + ...ration-fields-staticAmbient(target=es5).js | 19 + ...ds-staticAmbient(target=esnext).errors.txt | 22 + ...ion-fields-staticAmbient(target=esnext).js | 16 + ...ion-fields-staticPrivate(target=es2015).js | 58 + ...ion-fields-staticPrivate(target=es2022).js | 53 + ...ion-fields-staticPrivate(target=esnext).js | 32 + ...ds-staticPrivateAccessor(target=es2015).js | 63 + ...ds-staticPrivateAccessor(target=es2022).js | 58 + ...ds-staticPrivateAccessor(target=esnext).js | 32 + ...ration-methods-nonStatic(target=es2015).js | 36 + ...ration-methods-nonStatic(target=es2022).js | 34 + ...claration-methods-nonStatic(target=es5).js | 38 + ...ration-methods-nonStatic(target=esnext).js | 22 + ...onStaticAbstract(target=es2015).errors.txt | 22 + ...ethods-nonStaticAbstract(target=es2015).js | 16 + ...onStaticAbstract(target=es2022).errors.txt | 22 + ...ethods-nonStaticAbstract(target=es2022).js | 16 + ...s-nonStaticAbstract(target=es5).errors.txt | 22 + ...n-methods-nonStaticAbstract(target=es5).js | 19 + ...onStaticAbstract(target=esnext).errors.txt | 22 + ...ethods-nonStaticAbstract(target=esnext).js | 16 + ...methods-nonStaticPrivate(target=es2015).js | 28 + ...methods-nonStaticPrivate(target=es2022).js | 24 + ...methods-nonStaticPrivate(target=esnext).js | 13 + ...claration-methods-static(target=es2015).js | 34 + ...claration-methods-static(target=es2022).js | 32 + ...sDeclaration-methods-static(target=es5).js | 38 + ...claration-methods-static(target=esnext).js | 22 + ...on-methods-staticPrivate(target=es2015).js | 48 + ...on-methods-staticPrivate(target=es2022).js | 43 + ...on-methods-staticPrivate(target=esnext).js | 24 + ...ation-multipleDecorators(target=es2015).js | 27 + ...ation-multipleDecorators(target=es2022).js | 24 + ...laration-multipleDecorators(target=es5).js | 31 + ...ation-multipleDecorators(target=esnext).js | 14 + ...ration-nonStatic-methods(target=es2015).js | 41 + ...ration-nonStatic-methods(target=es2022).js | 39 + ...claration-nonStatic-methods(target=es5).js | 43 + ...ration-nonStatic-methods(target=esnext).js | 27 + ...ameterDecorators(target=es2015).errors.txt | 50 + ...tion-parameterDecorators(target=es2015).js | 34 + ...ameterDecorators(target=es2022).errors.txt | 50 + ...tion-parameterDecorators(target=es2022).js | 34 + ...parameterDecorators(target=es5).errors.txt | 50 + ...aration-parameterDecorators(target=es5).js | 54 + ...ameterDecorators(target=esnext).errors.txt | 50 + ...tion-parameterDecorators(target=esnext).js | 54 + ...laration-setFunctionName(target=es2015).js | 80 + ...laration-setFunctionName(target=es2022).js | 72 + ...Declaration-setFunctionName(target=es5).js | 99 + ...laration-setFunctionName(target=esnext).js | 38 + ...ators-classDeclaration-setFunctionName1.js | 72 + ...ion-simpleTransformation(target=es2015).js | 26 + ...ion-simpleTransformation(target=es2022).js | 23 + ...ration-simpleTransformation(target=es5).js | 30 + ...ion-simpleTransformation(target=esnext).js | 12 + ...Decorators-classExpression-classSuper.1.js | 49 + ...Decorators-classExpression-classSuper.2.js | 93 + ...Decorators-classExpression-classSuper.3.js | 94 + ...Decorators-classExpression-classSuper.4.js | 45 + ...Decorators-classExpression-classSuper.5.js | 183 ++ ...Decorators-classExpression-classSuper.6.js | 54 + ...ators-classExpression-namedEvaluation.1.js | 152 ++ ...tors-classExpression-namedEvaluation.10.js | 362 +++ ...tors-classExpression-namedEvaluation.11.js | 70 + ...ators-classExpression-namedEvaluation.2.js | 253 ++ ...ators-classExpression-namedEvaluation.3.js | 120 + ...ators-classExpression-namedEvaluation.4.js | 121 + ...ators-classExpression-namedEvaluation.5.js | 41 + ...ators-classExpression-namedEvaluation.6.js | 41 + ...ators-classExpression-namedEvaluation.7.js | 41 + ...ators-classExpression-namedEvaluation.8.js | 52 + ...ators-classExpression-namedEvaluation.9.js | 43 + ...ecoratorMetadata(target=es2015).errors.txt | 51 + ...rs-emitDecoratorMetadata(target=es2015).js | 149 ++ ...ecoratorMetadata(target=es2022).errors.txt | 51 + ...rs-emitDecoratorMetadata(target=es2022).js | 141 ++ ...itDecoratorMetadata(target=es5).errors.txt | 51 + ...ators-emitDecoratorMetadata(target=es5).js | 168 ++ ...ecoratorMetadata(target=esnext).errors.txt | 51 + ...rs-emitDecoratorMetadata(target=esnext).js | 108 + .../reference/generatorTypeCheck39.errors.txt | 5 +- .../reference/generatorTypeCheck59.errors.txt | 12 - .../reference/generatorTypeCheck61.errors.txt | 10 - ...manyCompilerErrorsInTheTwoFiles.errors.txt | 42 +- .../manyCompilerErrorsInTheTwoFiles.types | 15 +- .../privateNameFieldClassExpression.js | 5 + .../privateNameStaticFieldClassExpression.js | 5 + ...StaticFieldNoInitializer(target=es2015).js | 5 + .../annotateTransforms/tsconfig.json | 5 + .../staticFieldWithInterfaceContext.js | 14 + ...icCommentOnStaticFieldInClassExpression.js | 5 + ...tes-diagnostics-and-emit-for-decorators.js | 75 +- .../yieldExpressions/generatorTypeCheck39.ts | 4 +- .../yieldExpressions/generatorTypeCheck59.ts | 3 +- .../yieldExpressions/generatorTypeCheck61.ts | 3 +- ...rs-classDeclaration-accessors-nonStatic.ts | 16 + ...Declaration-accessors-nonStaticAbstract.ts | 16 + ...sDeclaration-accessors-nonStaticPrivate.ts | 10 + ...ators-classDeclaration-accessors-static.ts | 16 + ...lassDeclaration-accessors-staticPrivate.ts | 21 + ...ecorators-classDeclaration-classSuper.1.ts | 24 + ...ecorators-classDeclaration-classSuper.2.ts | 29 + ...ecorators-classDeclaration-classSuper.3.ts | 46 + ...ecorators-classDeclaration-classSuper.4.ts | 21 + ...ecorators-classDeclaration-classSuper.5.ts | 50 + ...ecorators-classDeclaration-classSuper.6.ts | 28 + ...classDeclaration-classThisReference.es5.ts | 13 + ...ors-classDeclaration-classThisReference.ts | 14 + ...ors-classDeclaration-multipleDecorators.ts | 10 + ...rs-classDeclaration-parameterDecorators.ts | 21 + ...rators-classDeclaration-setFunctionName.ts | 25 + ...s-classDeclaration-simpleTransformation.ts | 9 + ...ators-classDeclaration-fields-nonStatic.ts | 14 + ...assDeclaration-fields-nonStaticAbstract.ts | 13 + ...ration-fields-nonStaticAbstractAccessor.ts | 13 + ...assDeclaration-fields-nonStaticAccessor.ts | 13 + ...lassDeclaration-fields-nonStaticAmbient.ts | 13 + ...lassDeclaration-fields-nonStaticPrivate.ts | 9 + ...aration-fields-nonStaticPrivateAccessor.ts | 9 + ...corators-classDeclaration-fields-static.ts | 14 + ...-classDeclaration-fields-staticAccessor.ts | 23 + ...s-classDeclaration-fields-staticAmbient.ts | 13 + ...s-classDeclaration-fields-staticPrivate.ts | 19 + ...eclaration-fields-staticPrivateAccessor.ts | 19 + ...tors-classDeclaration-methods-nonStatic.ts | 13 + ...ssDeclaration-methods-nonStaticAbstract.ts | 13 + ...assDeclaration-methods-nonStaticPrivate.ts | 9 + ...orators-classDeclaration-methods-static.ts | 13 + ...-classDeclaration-methods-staticPrivate.ts | 15 + ...Decorators-classExpression-classSuper.1.ts | 24 + ...Decorators-classExpression-classSuper.2.ts | 29 + ...Decorators-classExpression-classSuper.3.ts | 46 + ...Decorators-classExpression-classSuper.4.ts | 21 + ...Decorators-classExpression-classSuper.5.ts | 50 + ...Decorators-classExpression-classSuper.6.ts | 28 + ...ators-classExpression-namedEvaluation.1.ts | 30 + ...tors-classExpression-namedEvaluation.10.ts | 35 + ...tors-classExpression-namedEvaluation.11.ts | 15 + ...ators-classExpression-namedEvaluation.2.ts | 34 + ...ators-classExpression-namedEvaluation.3.ts | 19 + ...ators-classExpression-namedEvaluation.4.ts | 20 + ...ators-classExpression-namedEvaluation.5.ts | 10 + ...ators-classExpression-namedEvaluation.6.ts | 10 + ...ators-classExpression-namedEvaluation.7.ts | 10 + ...ators-classExpression-namedEvaluation.8.ts | 19 + ...ators-classExpression-namedEvaluation.9.ts | 14 + .../esDecorators-emitDecoratorMetadata.ts | 51 + ...corators_blankCompilerOptionsInJsconfig.ts | 26 - ...corators_blankCompilerOptionsInTsconfig.ts | 26 - ...ors_disabledInCompilerOptionsInJsconfig.ts | 27 - ...ors_disabledInCompilerOptionsInTsconfig.ts | 27 - ...rators_missingCompilerOptionsInJsconfig.ts | 24 - ...rators_missingCompilerOptionsInTsconfig.ts | 24 - ...EnableExperimentalDecorators_noTsconfig.ts | 10 - 284 files changed, 12225 insertions(+), 516 deletions(-) create mode 100644 src/compiler/transformers/esDecorators.ts create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2015).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2022).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es5).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=esnext).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classSuper.1.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classSuper.3.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classSuper.4.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classSuper.5.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2015).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2022).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es5).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=esnext).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2015).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2022).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=esnext).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2015).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2022).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es5).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=esnext).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2015).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2022).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es5).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=esnext).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2015).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2022).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es5).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=esnext).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2015).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2022).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es5).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=esnext).errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-setFunctionName1.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classExpression-classSuper.1.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-classSuper.2.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-classSuper.3.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-classSuper.4.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-classSuper.5.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-classSuper.6.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js create mode 100644 tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).errors.txt create mode 100644 tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).errors.txt create mode 100644 tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).errors.txt create mode 100644 tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js create mode 100644 tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).errors.txt create mode 100644 tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).js delete mode 100644 tests/baselines/reference/generatorTypeCheck59.errors.txt delete mode 100644 tests/baselines/reference/generatorTypeCheck61.errors.txt create mode 100644 tests/baselines/reference/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStatic.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticPrivate.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-static.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-staticPrivate.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.1.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.2.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.3.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.4.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.5.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.6.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.es5.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-multipleDecorators.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-setFunctionName.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-simpleTransformation.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStatic.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAccessor.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticPrivate.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-static.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAccessor.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivate.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivateAccessor.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStatic.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticPrivate.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-static.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-staticPrivate.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.1.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.2.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.3.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.4.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.5.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.6.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.1.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.10.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.11.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.2.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.3.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.4.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.5.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.6.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.7.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.8.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.9.ts create mode 100644 tests/cases/conformance/esDecorators/esDecorators-emitDecoratorMetadata.ts delete mode 100644 tests/cases/fourslash/codefixEnableExperimentalDecorators_blankCompilerOptionsInJsconfig.ts delete mode 100644 tests/cases/fourslash/codefixEnableExperimentalDecorators_blankCompilerOptionsInTsconfig.ts delete mode 100644 tests/cases/fourslash/codefixEnableExperimentalDecorators_disabledInCompilerOptionsInJsconfig.ts delete mode 100644 tests/cases/fourslash/codefixEnableExperimentalDecorators_disabledInCompilerOptionsInTsconfig.ts delete mode 100644 tests/cases/fourslash/codefixEnableExperimentalDecorators_missingCompilerOptionsInJsconfig.ts delete mode 100644 tests/cases/fourslash/codefixEnableExperimentalDecorators_missingCompilerOptionsInTsconfig.ts delete mode 100644 tests/cases/fourslash/codefixEnableExperimentalDecorators_noTsconfig.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f403ed5f668bc..d1f157a1d9da1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -997,6 +997,12 @@ namespace ts { let deferredGlobalOmitSymbol: Symbol | undefined; let deferredGlobalAwaitedSymbol: Symbol | undefined; let deferredGlobalBigIntType: ObjectType | undefined; + let deferredGlobalClassDecoratorContextType: GenericType | undefined; + let deferredGlobalClassMethodDecoratorContextType: GenericType | undefined; + let deferredGlobalClassGetterDecoratorContextType: GenericType | undefined; + let deferredGlobalClassSetterDecoratorContextType: GenericType | undefined; + let deferredGlobalClassAccessorDecoratorContextType: GenericType | undefined; + let deferredGlobalClassFieldDecoratorContextType: GenericType | undefined; const allPotentiallyUnusedIdentifiers = new Map(); // key is file name @@ -14308,6 +14314,30 @@ namespace ts { return (deferredGlobalBigIntType ||= getGlobalType("BigInt" as __String, /*arity*/ 0, /*reportErrors*/ false)) || emptyObjectType; } + function getGlobalClassDecoratorContextType(reportErrors: boolean) { + return (deferredGlobalClassDecoratorContextType ??= getGlobalType("ClassDecoratorContext" as __String, /*arity*/ 1, reportErrors)) ?? emptyGenericType; + } + + function getGlobalClassMethodDecoratorContextType(reportErrors: boolean) { + return (deferredGlobalClassMethodDecoratorContextType ??= getGlobalType("ClassMethodDecoratorContext" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; + } + + function getGlobalClassGetterDecoratorContextType(reportErrors: boolean) { + return (deferredGlobalClassGetterDecoratorContextType ??= getGlobalType("ClassGetterDecoratorContext" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; + } + + function getGlobalClassSetterDecoratorContextType(reportErrors: boolean) { + return (deferredGlobalClassSetterDecoratorContextType ??= getGlobalType("ClassSetterDecoratorContext" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; + } + + function getGlobalClassAccessorDecoratorContextType(reportErrors: boolean) { + return (deferredGlobalClassAccessorDecoratorContextType ??= getGlobalType("ClassAccessorDecoratorContext" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; + } + + function getGlobalClassFieldDecoratorContextType(reportErrors: boolean) { + return (deferredGlobalClassFieldDecoratorContextType ??= getGlobalType("ClassFieldDecoratorContext" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; + } + /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -26329,7 +26359,7 @@ namespace ts { } function checkThisInStaticClassFieldInitializerInDecoratedClass(thisExpression: Node, container: Node) { - if (isPropertyDeclaration(container) && hasStaticModifier(container) && + if (isPropertyDeclaration(container) && hasStaticModifier(container) && legacyDecorators && container.initializer && textRangeContainsPositionInclusive(container.initializer, thisExpression.pos) && hasDecorators(container.parent)) { error(thisExpression, Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class); } @@ -30748,6 +30778,15 @@ namespace ts { * Returns the synthetic argument list for a decorator invocation. */ function getEffectiveDecoratorArguments(node: Decorator): readonly Expression[] { + return compilerOptions.experimentalDecorators ? + getEffectiveLegacyDecoratorArguments(node) : + getEffectiveESDecoratorArguments(node); + } + + /** + * Returns the synthetic argument list for a decorator invocation. + */ + function getEffectiveLegacyDecoratorArguments(node: Decorator): readonly Expression[] { const parent = node.parent; const expr = node.expression; switch (parent.kind) { @@ -30784,10 +30823,69 @@ namespace ts { return Debug.fail(); } + /** + * Returns the synthetic argument list for a decorator invocation. + */ + function getEffectiveESDecoratorArguments(node: Decorator): readonly Expression[] { + const parent = node.parent; + const expr = node.expression; + switch (parent.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: { + // For a class decorator, the `target` is the type of the class (e.g. the + // "static" or "constructor" side of the class). + + // TODO(rbuckton): Some mechanism of defining a type variable that + // is dependent on the result of evaluating all decorators. + const classInType = getTypeOfSymbol(getSymbolOfNode(parent)); + const classFinalType = classInType; + return [ + createSyntheticExpression(expr, classInType), + createSyntheticExpression(expr, createClassDecoratorContextType(classFinalType)) + ]; + } + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.PropertyDeclaration: { + // TODO(rbuckton): Some mechanism of defining a type variable that + // is dependent on the result of evaluating all decorators. + const nameType = undefined; + const isStatic = hasStaticModifier(parent); + const isPrivate = !!parent.name && isPrivateIdentifier(parent.name); + const valueInType = getTypeOfNode(parent); + const valueFinalType = valueInType; + const thisFinalType = unknownType; + const contextType = + isMethodDeclaration(parent) ? createClassMethodDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : + isGetAccessorDeclaration(parent) ? createClassGetterDecoratorContextType(thisFinalType, valueFinalType) : + isSetAccessorDeclaration(parent) ? createClassSetterDecoratorContextType(thisFinalType, valueFinalType) : + hasAccessorModifier(parent) ? createClassAccessorDecoratorContextType(thisFinalType, valueFinalType) : + createClassFieldDecoratorContextType(thisFinalType, valueFinalType); + return [ + createSyntheticExpression(expr, valueInType), + createSyntheticExpression(expr, contextType) + ]; + } + case SyntaxKind.Parameter: + Debug.fail("Not yet implemented."); + } + return Debug.fail(); + } + /** * Returns the argument count for a decorator node that works like a function invocation. */ function getDecoratorArgumentCount(node: Decorator, signature: Signature) { + return compilerOptions.experimentalDecorators ? + getLegacyDecoratorArgumentCount(node, signature) : + 2; + } + + /** + * Returns the argument count for a decorator node that works like a function invocation. + */ + function getLegacyDecoratorArgumentCount(node: Decorator, signature: Signature) { switch (node.parent.kind) { case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: @@ -30805,6 +30903,7 @@ namespace ts { return Debug.fail(); } } + function getDiagnosticSpanForCallNode(node: CallExpression, doNotIncludeArguments?: boolean) { let start: number; let length: number; @@ -32881,6 +32980,81 @@ namespace ts { } } + function createClassDecoratorContextType(classType: Type) { + const globalClassDecoratorContextType = getGlobalClassDecoratorContextType(/*reportErrors*/ true); + if (globalClassDecoratorContextType !== emptyGenericType) { + return createTypeReference(globalClassDecoratorContextType, [classType]); + } + return unknownType; + } + + function tryCreateDecoratorContextOverrideType(nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + let members: SymbolTable | undefined; + if (nameType !== undefined) { + const symbol = createSymbol(SymbolFlags.Property, "name" as __String); + symbol.type = nameType; + members ??= createSymbolTable(); + members.set(symbol.escapedName, symbol); + } + if (isStatic !== undefined) { + const symbol = createSymbol(SymbolFlags.Property, "static" as __String); + symbol.type = isStatic ? trueType : falseType; + members ??= createSymbolTable(); + members.set(symbol.escapedName, symbol); + } + if (isPrivate !== undefined) { + const symbol = createSymbol(SymbolFlags.Property, "private" as __String); + symbol.type = isPrivate ? trueType : falseType; + members ??= createSymbolTable(); + members.set(symbol.escapedName, symbol); + } + if (members) { + return createAnonymousType(/*symbol*/ undefined, members, emptyArray, emptyArray, emptyArray); + } + } + + function createClassMethodDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + const globalClassMethodDecoratorContextType = getGlobalClassMethodDecoratorContextType(/*reportErrors*/ true); + if (globalClassMethodDecoratorContextType !== emptyGenericType) { + const contextType = createTypeReference(globalClassMethodDecoratorContextType, [thisType, valueType]); + const overrideType = tryCreateDecoratorContextOverrideType(nameType, isStatic, isPrivate); + return overrideType ? getIntersectionType([contextType, overrideType]) : contextType; + } + return unknownType; + } + + function createClassGetterDecoratorContextType(thisType: Type, valueType: Type) { + const globalClassGetterDecoratorContextType = getGlobalClassGetterDecoratorContextType(/*reportErrors*/ true); + if (globalClassGetterDecoratorContextType !== emptyGenericType) { + return createTypeReference(globalClassGetterDecoratorContextType, [thisType, valueType]); + } + return unknownType; + } + + function createClassSetterDecoratorContextType(thisType: Type, valueType: Type) { + const globalClassSetterDecoratorContextType = getGlobalClassSetterDecoratorContextType(/*reportErrors*/ true); + if (globalClassSetterDecoratorContextType !== emptyGenericType) { + return createTypeReference(globalClassSetterDecoratorContextType, [thisType, valueType]); + } + return unknownType; + } + + function createClassAccessorDecoratorContextType(thisType: Type, valueType: Type) { + const globalClassAccessorDecoratorContextType = getGlobalClassAccessorDecoratorContextType(/*reportErrors*/ true); + if (globalClassAccessorDecoratorContextType !== emptyGenericType) { + return createTypeReference(globalClassAccessorDecoratorContextType, [thisType, valueType]); + } + return unknownType; + } + + function createClassFieldDecoratorContextType(thisType: Type, valueType: Type) { + const globalClassFieldDecoratorContextType = getGlobalClassFieldDecoratorContextType(/*reportErrors*/ true); + if (globalClassFieldDecoratorContextType !== emptyGenericType) { + return createTypeReference(globalClassFieldDecoratorContextType, [thisType, valueType]); + } + return unknownType; + } + function createPromiseType(promisedType: Type): Type { // creates a `Promise` type where `T` is the promisedType argument const globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); @@ -37189,6 +37363,7 @@ namespace ts { let expectedReturnType: Type; switch (node.parent.kind) { case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; const classSymbol = getSymbolOfNode(node.parent); const classConstructorType = getTypeOfSymbol(classSymbol); @@ -37206,12 +37381,14 @@ namespace ts { case SyntaxKind.SetAccessor: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; const methodType = getTypeOfNode(node.parent); - const descriptorType = createTypedPropertyDescriptorType(methodType); - expectedReturnType = getUnionType([descriptorType, voidType]); + expectedReturnType = getUnionType([ + legacyDecorators ? createTypedPropertyDescriptorType(methodType) : methodType, + voidType + ]); break; default: - return Debug.fail(); + return Debug.failBadSyntaxKind(node.parent); } checkTypeAssignableTo( @@ -37335,23 +37512,25 @@ namespace ts { /** Check the decorators of a node */ function checkDecorators(node: Node): void { // skip this check for nodes that cannot have decorators. These should have already had an error reported by - // checkGrammarDecorators. + // checkGrammarModifiers. if (!canHaveDecorators(node) || !hasDecorators(node) || !node.modifiers || !nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) { return; } - if (!compilerOptions.experimentalDecorators) { - error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning); - } - const firstDecorator = find(node.modifiers, isDecorator); if (!firstDecorator) { return; } - checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Decorate); - if (node.kind === SyntaxKind.Parameter) { - checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Param); + if (legacyDecorators) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Decorate); + if (node.kind === SyntaxKind.Parameter) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Param); + } + } + else if (languageVersion < ScriptTarget.ESNext) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.ESDecorate); + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.RunInitializers); } if (compilerOptions.emitDecoratorMetadata) { @@ -40047,7 +40226,7 @@ namespace ts { function checkClassDeclaration(node: ClassDeclaration) { const firstDecorator = find(node.modifiers, isDecorator); - if (firstDecorator && some(node.members, p => hasStaticModifier(p) && isPrivateIdentifierClassElementDeclaration(p))) { + if (legacyDecorators && firstDecorator && some(node.members, p => hasStaticModifier(p) && isPrivateIdentifierClassElementDeclaration(p))) { grammarErrorOnNode(firstDecorator, Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } if (!node.name && !hasSyntacticModifier(node, ModifierFlags.Default)) { @@ -44124,6 +44303,8 @@ namespace ts { case ExternalEmitHelpers.ClassPrivateFieldSet: return "__classPrivateFieldSet"; case ExternalEmitHelpers.ClassPrivateFieldIn: return "__classPrivateFieldIn"; case ExternalEmitHelpers.CreateBinding: return "__createBinding"; + case ExternalEmitHelpers.ESDecorate: return "__esDecorate"; + case ExternalEmitHelpers.RunInitializers: return "__runInitializers"; default: return Debug.fail("Unrecognized helper"); } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a0cc67f56c124..9a8a99877c5b7 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -318,6 +318,13 @@ namespace ts { description: Diagnostics.Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit, defaultValueDescription: Diagnostics.Platform_specific }, + { + name: "annotateTransforms", + type: "boolean", + affectsEmit: true, + category: Diagnostics.Compiler_Diagnostics, + defaultValueDescription: false + } ]; /* @internal */ diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 750f97f361530..4dccc9da4791d 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -384,7 +384,7 @@ namespace ts { return; } // Transform the source files - const transform = transformNodes(resolver, host, factory, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false); + const transform = transformNodes(resolver, host, /*factory*/ undefined, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false); const printerOptions: PrinterOptions = { removeComments: compilerOptions.removeComments, @@ -397,7 +397,8 @@ namespace ts { inlineSources: compilerOptions.inlineSources, extendedDiagnostics: compilerOptions.extendedDiagnostics, writeBundleFileInfo: !!bundleBuildInfo, - relativeToBuildInfo + relativeToBuildInfo, + annotateTransforms: compilerOptions.annotateTransforms }; // Create a printer to print the nodes @@ -438,7 +439,7 @@ namespace ts { // Do that here when emitting only dts files filesForEmit.forEach(collectLinkedAliases); } - const declarationTransform = transformNodes(resolver, host, factory, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false); + const declarationTransform = transformNodes(resolver, host, /*factory*/ undefined, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false); if (length(declarationTransform.diagnostics)) { for (const diagnostic of declarationTransform.diagnostics!) { emitterDiagnostics.add(diagnostic); @@ -457,7 +458,8 @@ namespace ts { onlyPrintJsDocStyle: true, writeBundleFileInfo: !!bundleBuildInfo, recordInternalSection: !!bundleBuildInfo, - relativeToBuildInfo + relativeToBuildInfo, + annotateTransforms: compilerOptions.annotateTransforms }; const declarationPrinter = createPrinter(printerOptions, { @@ -898,6 +900,7 @@ namespace ts { const newLine = getNewLineCharacter(printerOptions); const moduleKind = getEmitModuleKind(printerOptions); const bundledHelpers = new Map(); + const annotateTransforms = printerOptions.annotateTransforms; let currentSourceFile: SourceFile | undefined; let nodeIdToGeneratedName: string[]; // Map of generated names for specific nodes. @@ -1311,6 +1314,15 @@ namespace ts { function pipelineEmitWithHint(hint: EmitHint, node: Node): void { onBeforeEmitNode?.(node); + let wroteAnnotation = false; + if (annotateTransforms) { + const transformerNames = getTransformerNames(node); + if (transformerNames) { + transformerNames.reverse(); + writeComment(`/*tx: ${transformerNames.join("->")}(*/`); + wroteAnnotation = true; + } + } if (preserveSourceNewlines) { const savedPreserveSourceNewlines = preserveSourceNewlines; beforeEmitNode(node); @@ -1320,6 +1332,9 @@ namespace ts { else { pipelineEmitWithHintWorker(hint, node); } + if (wroteAnnotation) { + writeComment(`/*)*/`); + } onAfterEmitNode?.(node); // clear the parenthesizer rule as we ascend currentParenthesizerRule = undefined; @@ -1777,6 +1792,8 @@ namespace ts { return emitMetaProperty(node as MetaProperty); case SyntaxKind.SyntheticExpression: return Debug.fail("SyntheticExpression should never be printed."); + case SyntaxKind.MissingDeclaration: + return; // JSX case SyntaxKind.JsxElement: @@ -6046,4 +6063,45 @@ namespace ts { typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule; } + + function getTransformerNames(node: Node | undefined) { + let transformerNames: string[] | undefined; + let lastTransformerName: string | undefined; + while (node) { + const transformerName = getTransformerName(node.transformer); + if (transformerName && transformerName !== lastTransformerName) { + transformerNames = append(transformerNames, transformerName); + lastTransformerName = transformerName; + } + node = node.original; + } + return transformerNames; + } + + function getTransformerName(transformer: TransformerFactory | undefined) { + switch (transformer) { + case transformTypeScript: return "ts"; + case transformESNext: return "esnext"; + case transformES2021: return "es2021"; + case transformES2020: return "es2020"; + case transformES2019: return "es2019"; + case transformES2018: return "es2018"; + case transformES2017: return "es2017"; + case transformES2016: return "es2016"; + case transformES2015: return "es2015"; + case transformES5: return "es5"; + case transformClassFields: return "classFields"; + case transformESDecorators: return "esDecorators"; + case transformLegacyDecorators: return "legacyDecorators"; + case transformGenerators: return "generators"; + case transformJsx: return "jsx"; + case transformECMAScriptModule: return "esmodule"; + case transformModule: return "module"; + case transformSystemModule: return "system"; + case transformNodeModule: return "node"; + case transformDeclarations: return "declarations"; + case undefined: return; + default: return transformer.name; + } + } } diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index 85a12581965f8..4e086749d7ae4 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -1,11 +1,58 @@ /* @internal */ namespace ts { + /** + * Describes the decorator context object passed to a native ECMAScript decorator for a class. + */ + export interface ESDecorateClassContext { + /** + * The kind of the decorated element. + */ + kind: "class"; + + /** + * The name of the decorated element. + */ + name: Expression; + } + + /** + * Describes the decorator context object passed to a native ECMAScript decorator for a class element. + */ + export interface ESDecorateClassElementContext { + /** + * The kind of the decorated element. + */ + kind: "method" | "getter" | "setter" | "accessor" | "field"; + name: ESDecorateName; + static: boolean; + private: boolean; + access: ESDecorateClassElementAccess; + } + + export interface ESDecorateClassElementAccess { + get?: boolean; + set?: boolean; + } + + export type ESDecorateName = + | { computed: true, name: Expression } + | { computed: false, name: Identifier | PrivateIdentifier } + ; + + export type ESDecorateContext = + | ESDecorateClassContext + | ESDecorateClassElementContext + ; + export interface EmitHelperFactory { getUnscopedHelperName(name: string): Identifier; // TypeScript Helpers createDecorateHelper(decoratorExpressions: readonly Expression[], target: Expression, memberName?: Expression, descriptor?: Expression): Expression; createMetadataHelper(metadataKey: string, metadataValue: Expression): Expression; createParamHelper(expression: Expression, parameterOffset: number): Expression; + // ES Decorators Helpers + createESDecorateHelper(ctor: Expression, descriptorIn: Expression, decorators: Expression, contextIn: ESDecorateContext, initializers: Expression, extraInitializers: Expression): Expression; + createRunInitializersHelper(thisArg: Expression, initializers: Expression, value?: Expression): Expression; // ES2018 Helpers createAssignHelper(attributesSegments: readonly Expression[]): Expression; createAwaitHelper(expression: Expression): Expression; @@ -20,6 +67,8 @@ namespace ts { createExtendsHelper(name: Identifier): Expression; createTemplateObjectHelper(cooked: ArrayLiteralExpression, raw: ArrayLiteralExpression): Expression; createSpreadArrayHelper(to: Expression, from: Expression, packFrom: boolean): Expression; + createPropKeyHelper(expr: Expression): Expression; + createSetFunctionNameHelper(f: Expression, name: Expression, prefix?: string): Expression; // ES2015 Destructuring Helpers createValuesHelper(expression: Expression): Expression; createReadHelper(iteratorRecord: Expression, count: number | undefined): Expression; @@ -48,6 +97,9 @@ namespace ts { createDecorateHelper, createMetadataHelper, createParamHelper, + // ES Decorators Helpers + createESDecorateHelper, + createRunInitializersHelper, // ES2018 Helpers createAssignHelper, createAwaitHelper, @@ -62,6 +114,8 @@ namespace ts { createExtendsHelper, createTemplateObjectHelper, createSpreadArrayHelper, + createPropKeyHelper, + createSetFunctionNameHelper, // ES2015 Destructuring Helpers createValuesHelper, createReadHelper, @@ -135,6 +189,106 @@ namespace ts { ); } + // ES Decorators Helpers + + function createESDecorateClassContextObject(contextIn: ESDecorateClassContext) { + return factory.createObjectLiteralExpression([ + factory.createPropertyAssignment(factory.createIdentifier("kind"), factory.createStringLiteral("class")), + factory.createPropertyAssignment(factory.createIdentifier("name"), contextIn.name) + ]); + } + + function createESDecorateClassElementAccessGetMethod(elementName: ESDecorateName) { + const accessor = elementName.computed ? + factory.createElementAccessExpression(factory.createThis(), elementName.name) : + factory.createPropertyAccessExpression(factory.createThis(), elementName.name); + + return factory.createMethodDeclaration( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + "get", + /*questionToken*/ undefined, + /*typeParameters*/ undefined, + [], + /*type*/ undefined, + factory.createBlock([factory.createReturnStatement(accessor)]) + ); + } + + function createESDecorateClassElementAccessSetMethod(elementName: ESDecorateName) { + const accessor = elementName.computed ? + factory.createElementAccessExpression(factory.createThis(), elementName.name) : + factory.createPropertyAccessExpression(factory.createThis(), elementName.name); + + return factory.createMethodDeclaration( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + "set", + /*questionToken*/ undefined, + /*typeParameters*/ undefined, + [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, + factory.createIdentifier("value") + )], + /*type*/ undefined, + factory.createBlock([ + factory.createExpressionStatement( + factory.createAssignment( + accessor, + factory.createIdentifier("value") + ) + ) + ]) + ); + } + + function createESDecorateClassElementAccessObject(name: ESDecorateName, access: ESDecorateClassElementAccess) { + const properties: ObjectLiteralElementLike[] = []; + if (access.get) properties.push(createESDecorateClassElementAccessGetMethod(name)); + if (access.set) properties.push(createESDecorateClassElementAccessSetMethod(name)); + return factory.createObjectLiteralExpression(properties); + } + + function createESDecorateClassElementContextObject(contextIn: ESDecorateClassElementContext) { + return factory.createObjectLiteralExpression([ + factory.createPropertyAssignment(factory.createIdentifier("kind"), factory.createStringLiteral(contextIn.kind)), + factory.createPropertyAssignment(factory.createIdentifier("name"), contextIn.name.computed ? contextIn.name.name : factory.createStringLiteralFromNode(contextIn.name.name)), + factory.createPropertyAssignment(factory.createIdentifier("static"), contextIn.static ? factory.createTrue() : factory.createFalse()), + factory.createPropertyAssignment(factory.createIdentifier("private"), contextIn.private ? factory.createTrue() : factory.createFalse()), + factory.createPropertyAssignment(factory.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access)) + ]); + } + + function createESDecorateContextObject(contextIn: ESDecorateContext) { + return contextIn.kind === "class" ? createESDecorateClassContextObject(contextIn) : + createESDecorateClassElementContextObject(contextIn); + } + + function createESDecorateHelper(ctor: Expression, descriptorIn: Expression, decorators: Expression, contextIn: ESDecorateContext, initializers: Expression, extraInitializers: Expression) { + context.requestEmitHelper(esDecorateHelper); + return factory.createCallExpression( + getUnscopedHelperName("__esDecorate"), + /*typeArguments*/ undefined, + [ + ctor ?? factory.createNull(), + descriptorIn ?? factory.createNull(), + decorators, + createESDecorateContextObject(contextIn), + initializers, + extraInitializers + ]); + } + + function createRunInitializersHelper(thisArg: Expression, initializers: Expression, value?: Expression) { + context.requestEmitHelper(runInitializersHelper); + return factory.createCallExpression( + getUnscopedHelperName("__runInitializers"), + /*typeArguments*/ undefined, + value ? [thisArg, initializers, value] : [thisArg, initializers] + ); + } + // ES2018 Helpers function createAssignHelper(attributesSegments: Expression[]) { @@ -296,6 +450,24 @@ namespace ts { ); } + function createPropKeyHelper(expr: Expression) { + context.requestEmitHelper(propKeyHelper); + return factory.createCallExpression( + getUnscopedHelperName("__propKey"), + /*typeArguments*/ undefined, + [expr] + ); + } + + function createSetFunctionNameHelper(f: Expression, name: Expression): Expression { + context.requestEmitHelper(setFunctionNameHelper); + return factory.createCallExpression( + getUnscopedHelperName("__setFunctionName"), + /*typeArguments*/ undefined, + [f, name] + ); + } + // ES2015 Destructuring Helpers function createValuesHelper(expression: Expression) { @@ -466,6 +638,55 @@ namespace ts { };` }; + // ES Decorators Helpers + export const esDecorateHelper: UnscopedEmitHelper = { + name: "typescript:esDecorate", + importName: "__esDecorate", + scoped: false, + priority: 2, + text: ` + var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { extraInitializers.push(f); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (!result) continue; + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.push(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.push(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.key, descriptor); + };` + }; + + export const runInitializersHelper: UnscopedEmitHelper = { + name: "typescript:runInitializers", + importName: "__runInitializers", + scoped: false, + priority: 2, + text: ` + var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + };` + }; + // ES2018 Helpers export const assignHelper: UnscopedEmitHelper = { @@ -657,6 +878,28 @@ namespace ts { };` }; + export const propKeyHelper: UnscopedEmitHelper = { + name: "typescript:propKey", + importName: "__propKey", + scoped: false, + text: ` + var __propKey = (this && this.__propKey) || function (x) { + return typeof x === "symbol" ? x : "".concat(x); + };` + }; + + // https://tc39.es/ecma262/#sec-setfunctionname + export const setFunctionNameHelper: UnscopedEmitHelper = { + name: "typescript:setFunctionName", + importName: "__setFunctionName", + scoped: false, + text: ` + var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); + };` + }; + // ES2015 Destructuring Helpers export const valuesHelper: UnscopedEmitHelper = { @@ -1001,6 +1244,8 @@ namespace ts { decorateHelper, metadataHelper, paramHelper, + esDecorateHelper, + runInitializersHelper, assignHelper, awaitHelper, asyncGeneratorHelper, @@ -1013,6 +1258,8 @@ namespace ts { spreadArrayHelper, valuesHelper, readHelper, + propKeyHelper, + setFunctionNameHelper, generatorHelper, importStarHelper, importDefaultHelper, diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index f8d8d96ff2127..9cdd755f3b28c 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -510,6 +510,7 @@ namespace ts { createArraySliceCall, createArrayConcatCall, createObjectDefinePropertyCall, + createObjectGetOwnPropertyDescriptorCall, createReflectGetCall, createReflectSetCall, createPropertyDescriptor, @@ -5789,6 +5790,10 @@ namespace ts { return createGlobalMethodCall("Object", "defineProperty", [target, asExpression(propertyName), attributes]); } + function createObjectGetOwnPropertyDescriptorCall(target: Expression, propertyName: string | Expression) { + return createGlobalMethodCall("Object", "getOwnPropertyDescriptor", [target, asExpression(propertyName)]); + } + function createReflectGetCall(target: Expression, propertyKey: Expression, receiver?: Expression): CallExpression { return createGlobalMethodCall("Reflect", "get", receiver ? [target, propertyKey, receiver] : [target, propertyKey]); } diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index dbdb78c26ed59..9d0a472f3768d 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -411,9 +411,12 @@ namespace ts { && isUseStrictPrologue(firstStatement); } + export function isCommaExpression(node: Expression): node is BinaryExpression & { operatorToken: Token } { + return node.kind === SyntaxKind.BinaryExpression && (node as BinaryExpression).operatorToken.kind === SyntaxKind.CommaToken; + } + export function isCommaSequence(node: Expression): node is BinaryExpression & {operatorToken: Token} | CommaListExpression { - return node.kind === SyntaxKind.BinaryExpression && (node as BinaryExpression).operatorToken.kind === SyntaxKind.CommaToken || - node.kind === SyntaxKind.CommaListExpression; + return isCommaExpression(node) || isCommaListExpression(node); } export function isJSDocTypeAssertion(node: Node): node is JSDocTypeAssertion { @@ -437,6 +440,7 @@ namespace ts { return (kinds & OuterExpressionKinds.Parentheses) !== 0; case SyntaxKind.TypeAssertionExpression: case SyntaxKind.AsExpression: + case SyntaxKind.ExpressionWithTypeArguments: case SyntaxKind.SatisfiesExpression: return (kinds & OuterExpressionKinds.TypeAssertions) !== 0; case SyntaxKind.NonNullExpression: @@ -1335,7 +1339,6 @@ namespace ts { return `${privateName ? "#" : ""}${prefix}${baseName}${suffix}`; } - /** * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. */ @@ -1395,4 +1398,26 @@ namespace ts { ]) ); } + + export function findComputedPropertyNameCacheVariable(name: ComputedPropertyName) { + let node = name.expression; + while (true) { + node = skipOuterExpressions(node); + if (isCommaListExpression(node)) { + node = last(node.elements); + continue; + } + + if (isCommaExpression(node)) { + node = node.right; + continue; + } + + if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && isGeneratedIdentifier(node.left)) { + return node.left; + } + + break; + } + } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2b32c4a4c5168..1dab0f8cfe9d2 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4477,6 +4477,7 @@ namespace ts { case SyntaxKind.AwaitKeyword: case SyntaxKind.YieldKeyword: case SyntaxKind.PrivateIdentifier: + case SyntaxKind.AtToken: // Yield/await always starts an expression. Either it is an identifier (in which case // it is definitely an expression). Or it's a keyword (either because we're in // a generator or async function, or in strict mode (or both)) and it started a yield or await expression. @@ -6039,6 +6040,8 @@ namespace ts { } return parseFunctionExpression(); + case SyntaxKind.AtToken: + return parseDecoratoratedExpression(); case SyntaxKind.ClassKeyword: return parseClassExpression(); case SyntaxKind.FunctionKeyword: @@ -7424,6 +7427,20 @@ namespace ts { return Debug.fail("Should not have attempted to parse class member declaration."); } + function parseDecoratoratedExpression(): PrimaryExpression { + const pos = getNodePos(); + const hasJSDoc = hasPrecedingJSDocComment(); + const modifiers = parseModifiers(/*allowDecorators*/ true); + if (token() === SyntaxKind.ClassKeyword) { + return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, SyntaxKind.ClassExpression) as ClassExpression; + } + + const missing = createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Expression_expected); + setTextRangePos(missing, pos); + (missing as Mutable).decoratorsAndModifiers = modifiers; + return missing; + } + function parseClassExpression(): ClassExpression { return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ undefined, SyntaxKind.ClassExpression) as ClassExpression; } diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 12c6523839ddb..0ea1c8e473890 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -43,12 +43,20 @@ namespace ts { const languageVersion = getEmitScriptTarget(compilerOptions); const moduleKind = getEmitModuleKind(compilerOptions); + const useDefineForClassFields = getUseDefineForClassFields(compilerOptions); const transformers: TransformerFactory[] = []; addRange(transformers, customTransformers && map(customTransformers.before, wrapScriptTransformerFactory)); transformers.push(transformTypeScript); - transformers.push(transformLegacyDecorators); + + if (compilerOptions.experimentalDecorators) { + transformers.push(transformLegacyDecorators); + } + else if (languageVersion < ScriptTarget.ESNext || !useDefineForClassFields) { + transformers.push(transformESDecorators); + } + transformers.push(transformClassFields); if (getJSXTransformEnabled(compilerOptions)) { @@ -152,7 +160,7 @@ namespace ts { * @param transforms An array of `TransformerFactory` callbacks. * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ - export function transformNodes(resolver: EmitResolver | undefined, host: EmitHost | undefined, factory: NodeFactory, options: CompilerOptions, nodes: readonly T[], transformers: readonly TransformerFactory[], allowDtsFiles: boolean): TransformationResult { + export function transformNodes(resolver: EmitResolver | undefined, host: EmitHost | undefined, factoryIn: NodeFactory | undefined, options: CompilerOptions, nodes: readonly T[], transformers: readonly TransformerFactory[], allowDtsFiles: boolean): TransformationResult { const enabledSyntaxKindFeatures = new Array(SyntaxKind.Count); let lexicalEnvironmentVariableDeclarations: VariableDeclaration[]; let lexicalEnvironmentFunctionDeclarations: FunctionDeclaration[]; @@ -171,12 +179,13 @@ namespace ts { let onSubstituteNode: TransformationContext["onSubstituteNode"] = noEmitSubstitution; let onEmitNode: TransformationContext["onEmitNode"] = noEmitNotification; let state = TransformationState.Uninitialized; + const shouldAttachTransformer = options.annotateTransforms || Debug.isDebugging; const diagnostics: DiagnosticWithLocation[] = []; // The transformation context is provided to each transformer as part of transformer // initialization. const context: TransformationContext = { - factory, + factory: factoryIn ?? factory, getCompilerOptions: () => options, getEmitResolver: () => resolver!, // TODO: GH#18217 getEmitHost: () => host!, // TODO: GH#18217 @@ -224,7 +233,7 @@ namespace ts { performance.mark("beforeTransform"); // Chain together and initialize each transformer. - const transformersWithContext = transformers.map(t => t(context)); + const transformersWithContext = transformers.map(createTransformerWithContext); const transformation = (node: T): T => { for (const transform of transformersWithContext) { node = transform(node); @@ -258,6 +267,41 @@ namespace ts { diagnostics }; + function createTransformerWithContext(t: TransformerFactory) { + if (factoryIn || !shouldAttachTransformer) { + return t(context); + } + + const baseFactory = factory.baseFactory; + const perTransformerBaseFactory: BaseNodeFactory = { + createBaseSourceFileNode: kind => attachTransformer(baseFactory.createBaseSourceFileNode(kind), t), + createBaseIdentifierNode: kind => attachTransformer(baseFactory.createBaseIdentifierNode(kind), t), + createBasePrivateIdentifierNode: kind => attachTransformer(baseFactory.createBasePrivateIdentifierNode(kind), t), + createBaseTokenNode: kind => attachTransformer(baseFactory.createBaseTokenNode(kind), t), + createBaseNode: kind => attachTransformer(baseFactory.createBaseNode(kind), t), + }; + + const perTransformerFactory = createNodeFactory(NodeFactoryFlags.NoIndentationOnFreshPropertyAccess, perTransformerBaseFactory); + const perTransformerContext: TransformationContext = Object.create(context, { + factory: { + configurable: true, + writable: true, + value: perTransformerFactory + }, + getEmitHelperFactory: { + configurable: true, + writable: true, + value: memoize(() => createEmitHelperFactory(perTransformerContext)) + } + }); + return t(perTransformerContext); + } + + function attachTransformer(node: TNode, transformer: TransformerFactory) { + node.transformer = transformer; + return node; + } + function transformRoot(node: T) { return node && (!isSourceFile(node) || !node.isDeclarationFile) ? transformation(node) : node; } diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 2515353a9126d..ddef477f079dc 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -132,6 +132,7 @@ namespace ts { export function transformClassFields(context: TransformationContext) { const { factory, + getEmitHelperFactory: emitHelpers, hoistVariableDeclaration, endLexicalEnvironment, startLexicalEnvironment, @@ -224,13 +225,21 @@ namespace ts { case SyntaxKind.ClassDeclaration: return visitClassDeclaration(node as ClassDeclaration); case SyntaxKind.ClassExpression: - return visitClassExpression(node as ClassExpression); + return visitClassExpression(node as ClassExpression, /*referencedName*/ undefined); case SyntaxKind.ClassStaticBlockDeclaration: return visitClassStaticBlockDeclaration(node as ClassStaticBlockDeclaration); case SyntaxKind.PropertyDeclaration: return visitPropertyDeclaration(node as PropertyDeclaration); + case SyntaxKind.PropertyAssignment: + return visitPropertyAssignment(node as PropertyAssignment); case SyntaxKind.VariableStatement: return visitVariableStatement(node as VariableStatement); + case SyntaxKind.VariableDeclaration: + return visitVariableDeclaration(node as VariableDeclaration); + case SyntaxKind.BindingElement: + return visitBindingElement(node as BindingElement); + case SyntaxKind.ExportAssignment: + return visitExportAssignment(node as ExportAssignment); case SyntaxKind.PrivateIdentifier: return visitPrivateIdentifier(node as PrivateIdentifier); case SyntaxKind.PropertyAccessExpression: @@ -239,9 +248,11 @@ namespace ts { return visitElementAccessExpression(node as ElementAccessExpression); case SyntaxKind.PrefixUnaryExpression: case SyntaxKind.PostfixUnaryExpression: - return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, /*valueIsDiscarded*/ false); + return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, /*discarded*/ false); case SyntaxKind.BinaryExpression: - return visitBinaryExpression(node as BinaryExpression, /*valueIsDiscarded*/ false); + return visitBinaryExpression(node as BinaryExpression, /*discarded*/ false); + case SyntaxKind.ParenthesizedExpression: + return visitParenthesizedExpression(node as ParenthesizedExpression, /*discarded*/ false, /*referencedName*/ undefined); case SyntaxKind.CallExpression: return visitCallExpression(node as CallExpression); case SyntaxKind.ExpressionStatement: @@ -272,6 +283,19 @@ namespace ts { return visitEachChild(node, visitor, context); } + function namedEvaluationVisitor(node: Node, referencedName: Expression): VisitResult { + switch (node.kind) { + case SyntaxKind.PartiallyEmittedExpression: + return visitPartiallyEmittedExpression(node as PartiallyEmittedExpression, /*discarded*/ false, referencedName); + case SyntaxKind.ParenthesizedExpression: + return visitParenthesizedExpression(node as ParenthesizedExpression, /*discarded*/ false, referencedName); + case SyntaxKind.ClassExpression: + return visitClassExpression(node as ClassExpression, referencedName); + default: + return visitor(node); + } + } + /** * Visits a node in an expression whose result is discarded. */ @@ -279,9 +303,13 @@ namespace ts { switch (node.kind) { case SyntaxKind.PrefixUnaryExpression: case SyntaxKind.PostfixUnaryExpression: - return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, /*valueIsDiscarded*/ true); + return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, /*discarded*/ true); case SyntaxKind.BinaryExpression: - return visitBinaryExpression(node as BinaryExpression, /*valueIsDiscarded*/ true); + return visitBinaryExpression(node as BinaryExpression, /*discarded*/ true); + case SyntaxKind.CommaListExpression: + return visitCommaListExpression(node as CommaListExpression, /*discarded*/ true); + case SyntaxKind.ParenthesizedExpression: + return visitParenthesizedExpression(node as ParenthesizedExpression, /*discarded*/ true, /*referencedName*/ undefined); default: return visitor(node); } @@ -399,6 +427,24 @@ namespace ts { return visitEachChild(node, visitor, context); } + function visitPropertyAssignment(node: PropertyAssignment) { + // 13.2.5.5 RS: PropertyDefinitionEvaluation + // PropertyAssignment : PropertyName `:` AssignmentExpression + // ... + // 5. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true* and _isProtoSetter_ is *false*, then + // a. Let _popValue_ be ? NamedEvaluation of |AssignmentExpression| with argument _propKey_. + // ... + + if (!isProtoSetter(node.name) && + isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { + const { referencedName, name } = visitReferencedPropertyName(node.name); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updatePropertyAssignment(node, name, initializer); + } + + return visitEachChild(node, visitor, context); + } + function visitVariableStatement(node: VariableStatement) { const savedPendingStatements = pendingStatements; pendingStatements = []; @@ -412,8 +458,83 @@ namespace ts { return statement; } - function visitComputedPropertyName(node: ComputedPropertyName) { - let expression = visitNode(node.expression, visitor, isExpression); + function visitVariableDeclaration(node: VariableDeclaration) { + // 14.3.1.2 RS: Evaluation + // LexicalBinding : BindingIdentifier Initializer + // ... + // 3. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // a. Let _value_ be ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + // + // 14.3.2.1 RS: Evaluation + // VariableDeclaration : BindingIdentifier Initializer + // ... + // 3. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // a. Let _value_ be ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + + if (isIdentifier(node.name) && node.initializer && + isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { + const referencedName = factory.createStringLiteralFromNode(node.name); + const name = visitNode(node.name, visitor, isBindingName); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateVariableDeclaration(node, name, /*exclamationToken*/ undefined, /*type*/ undefined, initializer); + } + + return visitEachChild(node, visitor, context); + } + + function visitBindingElement(node: BindingElement) { + // 8.6.3 RS: IteratorBindingInitialization + // SingleNameBinding : BindingIdentifier Initializer? + // ... + // 5. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + // + // 14.3.3.3 RS: KeyedBindingInitialization + // SingleNameBinding : BindingIdentifier Initializer? + // ... + // 4. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + + if (!node.dotDotDotToken && + isIdentifier(node.name) && node.initializer && + isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { + const referencedName = factory.createStringLiteralFromNode(node.name); + const propertyName = visitNode(node.propertyName, visitor, isPropertyName); + const name = visitNode(node.name, visitor, isBindingName); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateBindingElement(node, /*dotDotDotToken*/ undefined, propertyName, name, initializer); + } + + return visitEachChild(node, visitor, context); + } + + function visitExportAssignment(node: ExportAssignment) { + // 16.2.3.7 RS: Evaluation + // ExportDeclaration : `export` `default` AssignmentExpression `;` + // 1. If IsAnonymmousFunctionDefinition(|AssignmentExpression|) is *true*, then + // a. Let _value_ be ? NamedEvaluation of |AssignmentExpression| with argument `"default"`. + // ... + + // NOTE: Since emit for `export =` translates to `module.exports = ...`, the assigned nameof the class + // is `""`. + + if (isAnonymousClassDeclarationNeedingAssignedName(node.expression)) { + const referencedName = factory.createStringLiteral(node.isExportEquals ? "" : "default"); + const modifiers = visitNodes(node.modifiers, visitor, isModifier); + const expression = visitNode(node.expression, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateExportAssignment(node, modifiers, expression); + } + + return visitEachChild(node, visitor, context); + } + + function injectPendingExpressions(expression: Expression) { if (some(pendingExpressions)) { if (isParenthesizedExpression(expression)) { expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions([...pendingExpressions, expression.expression])); @@ -423,7 +544,12 @@ namespace ts { } pendingExpressions = undefined; } - return factory.updateComputedPropertyName(node, expression); + return expression; + } + + function visitComputedPropertyName(node: ComputedPropertyName) { + const expression = visitNode(node.expression, visitor, isExpression); + return factory.updateComputedPropertyName(node, injectPendingExpressions(expression)); } function visitConstructorDeclaration(node: ConstructorDeclaration) { @@ -519,15 +645,23 @@ namespace ts { let getterName = name; let setterName = name; if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression)) { - const temp = factory.createTempVariable(hoistVariableDeclaration); - setSourceMapRange(temp, name.expression); - const expression = visitNode(name.expression, visitor, isExpression); - const assignment = factory.createAssignment(temp, expression); - setSourceMapRange(assignment, name.expression); - getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); - setterName = factory.updateComputedPropertyName(name, temp); + const cacheVariable = findComputedPropertyNameCacheVariable(name); + if (cacheVariable) { + getterName = factory.updateComputedPropertyName(name, visitNode(name.expression, visitor, isExpression)); + setterName = factory.updateComputedPropertyName(name, cacheVariable); + } + else { + const temp = factory.createTempVariable(hoistVariableDeclaration); + setSourceMapRange(temp, name.expression); + const expression = visitNode(name.expression, visitor, isExpression); + const assignment = factory.createAssignment(temp, expression); + setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, assignment); + setterName = factory.updateComputedPropertyName(name, temp); + } } + const backingField = createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); setOriginalNode(backingField, node); setEmitFlags(backingField, EmitFlags.NoComments); @@ -571,6 +705,18 @@ namespace ts { ); } + if (node.initializer && isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { + const { referencedName, name } = visitReferencedPropertyName(node.name); + return factory.updatePropertyDeclaration( + node, + visitNodes(node.modifiers, visitor, isModifierLike), + name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + visitNode(node.initializer, child => namedEvaluationVisitor(child, referencedName), isExpression) + ); + } + return visitEachChild(node, visitor, context); } @@ -580,7 +726,10 @@ namespace ts { // If it's not inlineable, then we emit an expression after the class which assigns // the property name to the temporary variable. - const expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + const expr = getPropertyNameExpressionIfNeeded( + node.name, + /*shouldHoist*/ !!node.initializer || useDefineForClassFields, + /*captureReferencedName*/ !!node.initializer && isAnonymousClassDeclarationNeedingAssignedName(node.initializer)); if (expr) { getPendingExpressions().push(expr); } @@ -723,7 +872,7 @@ namespace ts { return visitEachChild(node, visitor, context); } - function visitPreOrPostfixUnaryExpression(node: PrefixUnaryExpression | PostfixUnaryExpression, valueIsDiscarded: boolean) { + function visitPreOrPostfixUnaryExpression(node: PrefixUnaryExpression | PostfixUnaryExpression, discarded: boolean) { if (node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken) { const operand = skipParentheses(node.operand); @@ -735,7 +884,7 @@ namespace ts { const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver); let expression: Expression = createPrivateIdentifierAccess(info, readExpression); - const temp = isPrefixUnaryExpression(node) || valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); + const temp = isPrefixUnaryExpression(node) || discarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); expression = expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp); expression = createPrivateIdentifierAssignment( info, @@ -792,7 +941,7 @@ namespace ts { let expression: Expression = factory.createReflectGetCall(superClassReference, getterName, classConstructor); setTextRange(expression, operand); - const temp = valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); + const temp = discarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); expression = expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp); expression = factory.createReflectSetCall(superClassReference, setterName, expression, classConstructor); setOriginalNode(expression, node); @@ -942,7 +1091,31 @@ namespace ts { } } - function visitBinaryExpression(node: BinaryExpression, valueIsDiscarded: boolean) { + function isAnonymousClassDeclarationNeedingAssignedName(node: Expression) { + node = skipOuterExpressions(node); + if (isClassExpression(node) && !node.name) { + const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node); + const classStaticBlock = find(staticPropertiesOrClassStaticBlocks, isClassStaticBlockDeclaration); + if (classStaticBlock) { + for (const statement of classStaticBlock.body.statements) { + if (isExpressionStatement(statement) && + isCallToHelper(statement.expression, "___setFunctionName" as __String)) { + return false; + } + } + } + const hasTransformableStatics = + shouldTransformPrivateElementsOrClassStaticBlocks && + some(staticPropertiesOrClassStaticBlocks, node => + isClassStaticBlockDeclaration(node) || + isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && isInitializedProperty(node)); + return hasTransformableStatics; + } + return false; + } + + function visitBinaryExpression(node: BinaryExpression, discarded: boolean) { if (isDestructuringAssignment(node)) { // ({ x: obj.#x } = ...) // ({ x: super.x } = ...) @@ -962,6 +1135,47 @@ namespace ts { return expr; } if (isAssignmentExpression(node)) { + // 13.15.2 RS: Evaluation + // AssignmentExpression : LeftHandSideExpression `=` AssignmentExpression + // 1. If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then + // a. Let _lref_ be ? Evaluation of |LeftHandSideExpression|. + // b. If IsAnonymousFunctionDefinition(|AssignmentExpression|) and IsIdentifierRef of |LeftHandSideExpression| are both *true*, then + // i. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. + // ... + // + // AssignmentExpression : LeftHandSideExpression `&&=` AssignmentExpression + // ... + // 5. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true* and IsIdentifierRef of |LeftHandSideExpression| is *true*, then + // a. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. + // ... + // + // AssignmentExpression : LeftHandSideExpression `||=` AssignmentExpression + // ... + // 5. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true* and IsIdentifierRef of |LeftHandSideExpression| is *true*, then + // a. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. + // ... + // + // AssignmentExpression : LeftHandSideExpression `??=` AssignmentExpression + // ... + // 4. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true* and IsIdentifierRef of |LeftHandSideExpression| is *true*, then + // a. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. + // ... + + switch (node.operatorToken.kind) { + case SyntaxKind.EqualsToken: + case SyntaxKind.AmpersandAmpersandEqualsToken: + case SyntaxKind.BarBarEqualsToken: + case SyntaxKind.QuestionQuestionEqualsToken: + if (isIdentifier(node.left) && + isAnonymousClassDeclarationNeedingAssignedName(node.right)) { + const referencedName = factory.createStringLiteralFromNode(node.left); + const left = visitNode(node.left, visitor, isExpression); + const right = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateBinaryExpression(node, left, node.operatorToken, right); + } + break; + } + if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifierPropertyAccessExpression(node.left)) { // obj.#x = ... @@ -1026,7 +1240,7 @@ namespace ts { setTextRange(expression, node); } - const temp = valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); + const temp = discarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); if (temp) { expression = factory.createAssignment(temp, expression); setTextRange(temp, node); @@ -1059,6 +1273,58 @@ namespace ts { return visitEachChild(node, visitor, context); } + function visitCommaListExpression(node: CommaListExpression, discarded: boolean) { + const elements = discarded ? + visitCommaListElements(node.elements, discardedValueVisitor) : + visitCommaListElements(node.elements, visitor, discardedValueVisitor); + return factory.updateCommaListExpression(node, elements); + } + + function visitParenthesizedExpression(node: ParenthesizedExpression, discarded: boolean, referencedName: Expression | undefined) { + // 8.4.5 RS: NamedEvaluation + // ParenthesizedExpression : `(` Expression `)` + // ... + // 2. Return ? NamedEvaluation of |Expression| with argument _name_. + + const visitorFunc: Visitor = + discarded ? discardedValueVisitor : + referencedName ? node => namedEvaluationVisitor(node, referencedName) : + visitor; + const expression = visitNode(node.expression, visitorFunc, isExpression); + return factory.updateParenthesizedExpression(node, expression); + } + + function visitPartiallyEmittedExpression(node: PartiallyEmittedExpression, discarded: boolean, referencedName: Expression | undefined) { + // Emulates 8.4.5 RS: NamedEvaluation + + const visitorFunc: Visitor = + discarded ? discardedValueVisitor : + referencedName ? node => namedEvaluationVisitor(node, referencedName) : + visitor; + const expression = visitNode(node.expression, visitorFunc, isExpression); + return factory.updatePartiallyEmittedExpression(node, expression); + } + + function visitReferencedPropertyName(node: PropertyName) { + if (isPropertyNameLiteral(node) || isPrivateIdentifier(node)) { + const referencedName = factory.createStringLiteralFromNode(node); + const name = visitNode(node, visitor, isPropertyName); + return { referencedName, name }; + } + + if (isPropertyNameLiteral(node.expression) && !isIdentifier(node.expression)) { + const referencedName = factory.createStringLiteralFromNode(node.expression); + const name = visitNode(node, visitor, isPropertyName); + return { referencedName, name }; + } + + const referencedName = factory.createTempVariable(hoistVariableDeclaration); + const key = emitHelpers().createPropKeyHelper(visitNode(node.expression, visitor, isExpression)); + const assignment = factory.createAssignment(referencedName, key); + const name = factory.updateComputedPropertyName(node, injectPendingExpressions(assignment)); + return { referencedName, name }; + } + function createPrivateIdentifierAssignment(info: PrivateIdentifierInfo, receiver: Expression, right: Expression, operator: AssignmentOperator): Expression { receiver = visitNode(receiver, visitor, isExpression); right = visitNode(right, visitor, isExpression); @@ -1154,7 +1420,7 @@ namespace ts { return visitEachChild(node, visitor, context); } - function visitInNewClassLexicalEnvironment(node: T, visitor: (node: T, facts: ClassFacts) => U) { + function visitInNewClassLexicalEnvironment(node: T, referencedName: Expression | undefined, visitor: (node: T, facts: ClassFacts, referencedName: Expression | undefined) => U) { const savedCurrentClassContainer = currentClassContainer; const savedPendingExpressions = pendingExpressions; currentClassContainer = node; @@ -1185,7 +1451,7 @@ namespace ts { enableSubstitutionForClassStaticThisOrSuperReference(); } - const result = visitor(node, facts); + const result = visitor(node, facts, referencedName); endClassLexicalEnvironment(); currentClassContainer = savedCurrentClassContainer; pendingExpressions = savedPendingExpressions; @@ -1194,7 +1460,7 @@ namespace ts { } function visitClassDeclaration(node: ClassDeclaration) { - return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + return visitInNewClassLexicalEnvironment(node, /*referencedName*/ undefined, visitClassDeclarationInNewClassLexicalEnvironment); } function visitClassDeclarationInNewClassLexicalEnvironment(node: ClassDeclaration, facts: ClassFacts) { @@ -1251,11 +1517,11 @@ namespace ts { return statements; } - function visitClassExpression(node: ClassExpression): Expression { - return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + function visitClassExpression(node: ClassExpression, referencedName: Expression | undefined): Expression { + return visitInNewClassLexicalEnvironment(node, referencedName, visitClassExpressionInNewClassLexicalEnvironment); } - function visitClassExpressionInNewClassLexicalEnvironment(node: ClassExpression, facts: ClassFacts): Expression { + function visitClassExpressionInNewClassLexicalEnvironment(node: ClassExpression, facts: ClassFacts, referencedName: Expression | undefined): Expression { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -1307,7 +1573,7 @@ namespace ts { isPrivateIdentifierClassElementDeclaration(node) || shouldTransformInitializers && isInitializedProperty(node)); - if (hasTransformableStatics || some(pendingExpressions)) { + if (hasTransformableStatics || some(pendingExpressions) || referencedName) { if (isDecoratedClassDeclaration) { Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -1320,10 +1586,16 @@ namespace ts { addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } + if (referencedName) { + temp ??= createClassTempVar(); + } + if (temp) { - expressions.push( - startOnNewLine(factory.createAssignment(temp, classExpression)), - startOnNewLine(temp)); + expressions.push(startOnNewLine(factory.createAssignment(temp, classExpression))); + if (referencedName) { + expressions.push(emitHelpers().createSetFunctionNameHelper(temp, referencedName)); + } + expressions.push(startOnNewLine(temp)); } else { expressions.push(classExpression); @@ -1346,8 +1618,12 @@ namespace ts { // the body of a class with static initializers. setEmitFlags(classExpression, EmitFlags.Indented | getEmitFlags(classExpression)); expressions.push(startOnNewLine(factory.createAssignment(temp, classExpression))); + // Add any pending expressions leftover from elided or relocated computed property names addRange(expressions, map(pendingExpressions, startOnNewLine)); + if (referencedName) { + expressions.push(startOnNewLine(emitHelpers().createSetFunctionNameHelper(temp, referencedName))); + } addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(startOnNewLine(temp)); } @@ -1737,6 +2013,19 @@ namespace ts { // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) const emitAssignment = !useDefineForClassFields; + let referencedName: Expression | undefined; + if (!!property.initializer && isAnonymousClassDeclarationNeedingAssignedName(property.initializer)) { + if (isPropertyNameLiteral(property.name) || isPrivateIdentifier(property.name)) { + referencedName = factory.createStringLiteralFromNode(property.name); + } + else if (isPropertyNameLiteral(property.name.expression) && !isIdentifier(property.name.expression)) { + referencedName = factory.createStringLiteralFromNode(property.name.expression); + } + else { + referencedName = factory.getGeneratedNameForNode(property.name); + } + } + const propertyName = hasAccessorModifier(property) ? factory.getGeneratedPrivateNameForNode(property.name) : @@ -1748,6 +2037,10 @@ namespace ts { currentStaticPropertyDeclarationOrStaticBlock = property; } + const initializerVisitor: Visitor = + referencedName ? child => namedEvaluationVisitor(child, referencedName!) : + visitor; + if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifier(propertyName)) { const privateIdentifierInfo = accessPrivateIdentifier(propertyName); if (privateIdentifierInfo) { @@ -1755,14 +2048,14 @@ namespace ts { if (!privateIdentifierInfo.isStatic) { return createPrivateInstanceFieldInitializer( receiver, - visitNode(property.initializer, visitor, isExpression), + visitNode(property.initializer, initializerVisitor, isExpression), privateIdentifierInfo.brandCheckIdentifier ); } else { return createPrivateStaticFieldInitializer( privateIdentifierInfo.variableName, - visitNode(property.initializer, visitor, isExpression) + visitNode(property.initializer, initializerVisitor, isExpression) ); } } @@ -1783,7 +2076,7 @@ namespace ts { return undefined; } - const initializer = property.initializer || emitAssignment ? visitNode(property.initializer, visitor, isExpression) ?? factory.createVoidZero() + const initializer = property.initializer || emitAssignment ? visitNode(property.initializer, initializerVisitor, isExpression) ?? factory.createVoidZero() : isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && isIdentifier(propertyName) ? propertyName : factory.createVoidZero(); @@ -2008,9 +2301,9 @@ namespace ts { * value of the result or the expression itself if the value is either unused or safe to inline into multiple locations * @param shouldHoist Does the expression need to be reused? (ie, for an initializer or a decorator) */ - function getPropertyNameExpressionIfNeeded(name: PropertyName, shouldHoist: boolean): Expression | undefined { + function getPropertyNameExpressionIfNeeded(name: PropertyName, shouldHoist: boolean, captureReferencedName: boolean): Expression | undefined { if (isComputedPropertyName(name)) { - const expression = visitNode(name.expression, visitor, isExpression); + let expression = visitNode(name.expression, visitor, isExpression); const innerExpression = skipPartiallyEmittedExpressions(expression); const inlinable = isSimpleInlineableExpression(innerExpression); const alreadyTransformed = isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left); @@ -2022,6 +2315,9 @@ namespace ts { else { hoistVariableDeclaration(generatedName); } + if (captureReferencedName) { + expression = emitHelpers().createPropKeyHelper(expression); + } return factory.createAssignment(generatedName, expression); } return (inlinable || isIdentifier(innerExpression)) ? undefined : expression; @@ -2351,115 +2647,149 @@ namespace ts { ); } - function visitArrayAssignmentTarget(node: BindingOrAssignmentElement) { - const target = getTargetOfBindingOrAssignmentElement(node); - if (target) { - let wrapped: LeftHandSideExpression | undefined; - if (isPrivateIdentifierPropertyAccessExpression(target)) { - wrapped = wrapPrivateIdentifierForDestructuringTarget(target); + function visitDestructuringAssignmentTarget(node: LeftHandSideExpression): Expression { + if (isObjectLiteralExpression(node) || isArrayLiteralExpression(node)) { + return visitAssignmentPattern(node); + } + + if (isPrivateIdentifierPropertyAccessExpression(node)) { + return wrapPrivateIdentifierForDestructuringTarget(node); + } + else if (shouldTransformSuperInStaticInitializers && + isSuperProperty(node) && + currentStaticPropertyDeclarationOrStaticBlock && + currentClassLexicalEnvironment) { + const { classConstructor, superClassReference, facts } = currentClassLexicalEnvironment; + if (facts & ClassFacts.ClassWasDecorated) { + return visitInvalidSuperProperty(node); } - else if (shouldTransformSuperInStaticInitializers && - isSuperProperty(target) && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - const { classConstructor, superClassReference, facts } = currentClassLexicalEnvironment; - if (facts & ClassFacts.ClassWasDecorated) { - wrapped = visitInvalidSuperProperty(target); - } - else if (classConstructor && superClassReference) { - const name = - isElementAccessExpression(target) ? visitNode(target.argumentExpression, visitor, isExpression) : - isIdentifier(target.name) ? factory.createStringLiteralFromNode(target.name) : - undefined; - if (name) { - const temp = factory.createTempVariable(/*recordTempVariable*/ undefined); - wrapped = factory.createAssignmentTargetWrapper( + else if (classConstructor && superClassReference) { + const name = + isElementAccessExpression(node) ? visitNode(node.argumentExpression, visitor, isExpression) : + isIdentifier(node.name) ? factory.createStringLiteralFromNode(node.name) : + undefined; + if (name) { + const temp = factory.createTempVariable(/*recordTempVariable*/ undefined); + return factory.createAssignmentTargetWrapper( + temp, + factory.createReflectSetCall( + superClassReference, + name, temp, - factory.createReflectSetCall( - superClassReference, - name, - temp, - classConstructor, - ) - ); - } - } - } - if (wrapped) { - if (isAssignmentExpression(node)) { - return factory.updateBinaryExpression( - node, - wrapped, - node.operatorToken, - visitNode(node.right, visitor, isExpression) + classConstructor, + ) ); } - else if (isSpreadElement(node)) { - return factory.updateSpreadElement(node, wrapped); - } - else { - return wrapped; - } } } - return visitNode(node, assignmentTargetVisitor); + return visitEachChild(node, visitor, context); } - function visitObjectAssignmentTarget(node: ObjectLiteralElementLike) { - if (isObjectBindingOrAssignmentElement(node) && !isShorthandPropertyAssignment(node)) { - const target = getTargetOfBindingOrAssignmentElement(node); - let wrapped: LeftHandSideExpression | undefined; - if (target) { - if (isPrivateIdentifierPropertyAccessExpression(target)) { - wrapped = wrapPrivateIdentifierForDestructuringTarget(target); - } - else if (shouldTransformSuperInStaticInitializers && - isSuperProperty(target) && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - const { classConstructor, superClassReference, facts } = currentClassLexicalEnvironment; - if (facts & ClassFacts.ClassWasDecorated) { - wrapped = visitInvalidSuperProperty(target); - } - else if (classConstructor && superClassReference) { - const name = - isElementAccessExpression(target) ? visitNode(target.argumentExpression, visitor, isExpression) : - isIdentifier(target.name) ? factory.createStringLiteralFromNode(target.name) : - undefined; - if (name) { - const temp = factory.createTempVariable(/*recordTempVariable*/ undefined); - wrapped = factory.createAssignmentTargetWrapper( - temp, - factory.createReflectSetCall( - superClassReference, - name, - temp, - classConstructor, - ) - ); - } - } - } + function visitAssignmentElement(node: Exclude) { + // 13.15.5.5 RS: IteratorDestructuringAssignmentEvaluation + // AssignmentElement : DestructuringAssignmentTarget Initializer? + // ... + // 4. If |Initializer| is present and _value_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) and IsIdentifierRef of |DestructuringAssignmentTarget| are both *true*, then + // i. Let _v_ be ? NamedEvaluation of |Initializer| with argument _lref_.[[ReferencedName]]. + // ... + + if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { + const assignmentTarget = visitDestructuringAssignmentTarget(node.left); + let initializer: Expression; + if (isIdentifier(node.left) && + isAnonymousClassDeclarationNeedingAssignedName(node.right)) { + const referencedName = factory.createStringLiteralFromNode(node.left); + initializer = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); } - if (isPropertyAssignment(node)) { - const initializer = getInitializerOfBindingOrAssignmentElement(node); - return factory.updatePropertyAssignment( - node, - visitNode(node.name, visitor, isPropertyName), - wrapped ? - initializer ? factory.createAssignment(wrapped, visitNode(initializer, visitor)) : wrapped : - visitNode(node.initializer, assignmentTargetVisitor, isExpression) - ); - } - if (isSpreadAssignment(node)) { - return factory.updateSpreadAssignment( - node, - wrapped || visitNode(node.expression, assignmentTargetVisitor, isExpression) - ); + else { + initializer = visitNode(node.right, visitor, isExpression); } - Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); + return factory.updateBinaryExpression(node, assignmentTarget, node.operatorToken, initializer); + } + else { + return visitDestructuringAssignmentTarget(node); + } + } + + function visitAssignmentRestElement(node: SpreadElement) { + if (isLeftHandSideExpression(node.expression)) { + const expression = visitDestructuringAssignmentTarget(node.expression); + return factory.updateSpreadElement(node, expression); } - return visitNode(node, visitor); + + return visitEachChild(node, visitor, context); + } + + function visitArrayAssignmentElement(node: ArrayAssignmentElement) { + if (isSpreadElement(node)) return visitAssignmentRestElement(node); + if (!isOmittedExpression(node)) return visitAssignmentElement(node); + return visitEachChild(node, visitor, context); + + } + + function visitAssignmentProperty(node: PropertyAssignment) { + // AssignmentProperty : PropertyName `:` AssignmentElement + // AssignmentElement : DestructuringAssignmentTarget Initializer? + + // 13.15.5.6 RS: KeyedDestructuringAssignmentEvaluation + // AssignmentElement : DestructuringAssignmentTarget Initializer? + // ... + // 3. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousfunctionDefinition(|Initializer|) and IsIdentifierRef of |DestructuringAssignmentTarget| are both *true*, then + // i. Let _rhsValue_ be ? NamedEvaluation of |Initializer| with argument _lref_.[[ReferencedName]]. + // ... + + const name = visitNode(node.name, visitor, isPropertyName); + if (isAssignmentExpression(node.initializer, /*excludeCompoundAssignment*/ true)) { + const assignmentElement = visitAssignmentElement(node.initializer); + return factory.updatePropertyAssignment(node, name, assignmentElement); + } + + if (isLeftHandSideExpression(node.initializer)) { + const assignmentElement = visitDestructuringAssignmentTarget(node.initializer); + return factory.updatePropertyAssignment(node, name, assignmentElement); + } + + return visitEachChild(node, visitor, context); + } + + function visitShorthandAssignmentProperty(node: ShorthandPropertyAssignment) { + // AssignmentProperty : IdentifierReference Initializer? + + // 13.15.5.3 RS: PropertyDestructuringAssignmentEvaluation + // AssignmentProperty : IdentifierReference Initializer? + // ... + // 4. If |Initializer?| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _P_. + // ... + + if (node.objectAssignmentInitializer && + isAnonymousClassDeclarationNeedingAssignedName(node.objectAssignmentInitializer)) { + const name = visitNode(node.name, visitor, isIdentifier); + const referencedName = factory.createStringLiteralFromNode(node.name); + const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer); + } + + return visitEachChild(node, visitor, context); + } + + function visitAssignmentRestProperty(node: SpreadAssignment) { + if (isLeftHandSideExpression(node.expression)) { + const expression = visitDestructuringAssignmentTarget(node.expression); + return factory.updateSpreadAssignment(node, expression); + } + + return visitEachChild(node, visitor, context); + } + + function visitObjectAssignmentElement(node: ObjectAssignmentElement) { + if (isSpreadAssignment(node)) return visitAssignmentRestProperty(node); + if (isShorthandPropertyAssignment(node)) return visitShorthandAssignmentProperty(node); + if (isPropertyAssignment(node)) return visitAssignmentProperty(node); + return visitEachChild(node, visitor, context); } function visitAssignmentPattern(node: AssignmentPattern) { @@ -2474,7 +2804,7 @@ namespace ts { // [ { set value(x) { this.#myProp = x; } }.value ] = [ "hello" ]; return factory.updateArrayLiteralExpression( node, - visitNodes(node.elements, visitArrayAssignmentTarget, isExpression) + visitNodes(node.elements, visitArrayAssignmentElement, isExpression) ); } else { @@ -2488,7 +2818,7 @@ namespace ts { // ({ stringProperty: { set value(x) { this.#myProp = x; } }.value }) = { stringProperty: "hello" }; return factory.updateObjectLiteralExpression( node, - visitNodes(node.properties, visitObjectAssignmentTarget, isObjectLiteralElementLike) + visitNodes(node.properties, visitObjectAssignmentElement, isObjectLiteralElementLike) ); } } diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 9e3ef1b753b87..58b495a596e8d 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -3845,8 +3845,21 @@ namespace ts { addRange(statements, funcStatements, classBodyEnd + 1); } - // Add the remaining statements of the outer wrapper. - addRange(statements, remainingStatements); + // TODO(rbuckton): We should consider either improving the inlining here, or remove it entirely, since + // the new esDecorators emit doesn't inline. + + // Add the remaining statements of the outer wrapper. Use the 'return' statement + // of the inner wrapper if its expression is not trivially an Identifier. + const returnStatement = tryCast(elementAt(funcStatements, classBodyEnd), isReturnStatement); + for (const statement of remainingStatements) { + if (isReturnStatement(statement) && returnStatement?.expression && + !isIdentifier(returnStatement.expression)) { + statements.push(returnStatement); + } + else { + statements.push(statement); + } + } // The 'es2015' class transform may add an end-of-declaration marker. If so we will add it // after the remaining statements from the 'ts' transformer. diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts new file mode 100644 index 0000000000000..f0d17b017c8bf --- /dev/null +++ b/src/compiler/transformers/esDecorators.ts @@ -0,0 +1,2050 @@ +/*@internal*/ +namespace ts { + // Class/Decorator evaluation order, as it pertains to this transformer: + // + // 1. Class decorators are evaluated outside of the private name scope of the class. + // - 15.8.20 RS: BindingClassDeclarationEvaluation + // - 15.8.21 RS: Evaluation + // - 8.3.5 RS: NamedEvaluation + // 2. ClassHeritage clause is evaluated outside of the private name scope of the class. + // - 15.8.19 RS: ClassDefinitionEvaluation, Step 8.c. + // 3. The name of the class is assigned. + // 4. For each member: + // a. Member Decorators are evaluated. + // - 15.8.19 RS: ClassDefinitionEvaluation, Step 23. + // - Probably 15.7.13 RS: ClassElementEvaluation, but it's missing from spec text. + // b. Computed Property name is evaluated + // - 15.8.19 RS: ClassDefinitionEvaluation, Step 23. + // - 15.8.15 RS: ClassFieldDefinitionEvaluation, Step 1. + // - 15.4.5 RS: MethodDefinitionEvaluation, Step 1. + // 5. Static non-field element decorators are applied + // 6. Non-static non-field element decorators are applied + // 7. Static field element decorators are applied + // 8. Non-static field element decorators are applied + // 9. Class decorators are applied + // 10. Class binding is initialized + // 11. Static extra initializers are evaluated + // 12. Static fields are initialized and static blocks are evaluated + // 13. Class extra initializers are evaluated + + interface MemberInfo { + memberDecoratorsName: Identifier; // used in step 4.a + memberInitializersName?: Identifier; // used in step 12 and construction + memberDescriptorName?: Identifier; + } + + interface ClassInfo { + class: ClassLikeDeclaration; + + classDecoratorsName?: Identifier; // used in step 2 + classDescriptorName?: Identifier; // used in step 10 + classExtraInitializersName?: Identifier; // used in step 13 + classThis?: Identifier; // `_classThis`, if needed. + classSuper?: Identifier; // `_classSuper`, if needed. + + memberInfos?: ESMap; // used in step 4.a, 12, and construction + + instanceExtraInitializersName: Identifier | undefined; // used in construction + staticExtraInitializersName: Identifier | undefined; // used in step 11 + + staticNonFieldDecorationStatements?: Statement[]; + nonStaticNonFieldDecorationStatements?: Statement[]; + staticFieldDecorationStatements?: Statement[]; + nonStaticFieldDecorationStatements?: Statement[]; + + hasStaticInitializers: boolean; + hasNonAmbientInstanceFields: boolean; + hasInjectedInstanceInitializers?: boolean; + } + + interface ClassLexicalEnvironmentStackEntry { + kind: "class"; + next: LexicalEnvironmentStackEntry | undefined; + classInfo: ClassInfo | undefined; + savedPendingExpressions?: Expression[]; + } + + interface ClassElementLexicalEnvironmentStackEntry { + kind: "class-element"; + next: ClassLexicalEnvironmentStackEntry; + classThis?: Identifier; + classSuper?: Identifier; + } + + interface PropertyNameLexicalEnvironmentStackEntry { + kind: "name"; + next: ClassElementLexicalEnvironmentStackEntry; + } + + interface OtherLexicalEnvironmentStackEntry { + kind: "other"; + next: LexicalEnvironmentStackEntry | undefined; + depth: number; + savedPendingExpressions?: Expression[]; + } + + type LexicalEnvironmentStackEntry = + | ClassLexicalEnvironmentStackEntry + | ClassElementLexicalEnvironmentStackEntry + | OtherLexicalEnvironmentStackEntry + | PropertyNameLexicalEnvironmentStackEntry + ; + + export function transformESDecorators(context: TransformationContext) { + const { + factory, + getEmitHelperFactory: emitHelpers, + startLexicalEnvironment, + endLexicalEnvironment, + hoistVariableDeclaration, + } = context; + + let top: LexicalEnvironmentStackEntry | undefined; + let classInfo: ClassInfo | undefined; + let classThis: Identifier | undefined; + let classSuper: Identifier | undefined; + let pendingExpressions: Expression[] | undefined; + + return chainBundle(context, transformSourceFile); + + function transformSourceFile(node: SourceFile) { + top = undefined; + const visited = visitEachChild(node, visitor, context); + addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + + function updateState() { + classInfo = undefined; + classThis = undefined; + classSuper = undefined; + switch (top?.kind) { + case "class": + classInfo = top.classInfo; + break; + case "class-element": + classInfo = top.next.classInfo; + classThis = top.classThis; + classSuper = top.classSuper; + break; + case "name": + const grandparent = top.next.next.next; + if (grandparent?.kind === "class-element") { + classInfo = grandparent.next.classInfo; + classThis = grandparent.classThis; + classSuper = grandparent.classSuper; + } + break; + } + } + + function enterClass(classInfo: ClassInfo | undefined) { + top = { kind: "class", next: top, classInfo, savedPendingExpressions: pendingExpressions }; + pendingExpressions = undefined; + updateState(); + } + + function exitClass() { + Debug.assert(top?.kind === "class"); + pendingExpressions = top.savedPendingExpressions; + top = top.next; + updateState(); + } + + function enterClassElement(node: ClassElement) { + Debug.assert(top?.kind === "class"); + top = { kind: "class-element", next: top }; + if (isClassStaticBlockDeclaration(node) || isPropertyDeclaration(node) && hasStaticModifier(node)) { + top.classThis = top.next.classInfo?.classThis; + top.classSuper = top.next.classInfo?.classSuper; + } + updateState(); + } + + function exitClassElement() { + Debug.assert(top?.kind === "class-element"); + Debug.assert(top.next?.kind === "class"); + top = top.next; + updateState(); + } + + function enterName() { + Debug.assert(top?.kind === "class-element"); + top = { kind: "name", next: top }; + updateState(); + } + + function exitName() { + Debug.assert(top?.kind === "name"); + top = top.next; + updateState(); + } + + function enterOther() { + if (top?.kind === "other") { + Debug.assert(!pendingExpressions); + top.depth++; + } + else { + top = { kind: "other", next: top, depth: 0, savedPendingExpressions: pendingExpressions }; + pendingExpressions = undefined; + updateState(); + } + } + + function exitOther() { + Debug.assert(top?.kind === "other"); + if (top.depth > 0) { + Debug.assert(!pendingExpressions); + top.depth--; + } + else { + pendingExpressions = top.savedPendingExpressions; + top = top.next; + updateState(); + } + } + + function shouldVisitNode(node: Node) { + return !!(node.transformFlags & TransformFlags.ContainsDecorators) + || !!classThis && !!(node.transformFlags & TransformFlags.ContainsLexicalThis) + || !!classThis && !!classSuper && !!(node.transformFlags & TransformFlags.ContainsLexicalSuper); + } + + function visitor(node: Node): VisitResult { + if (!shouldVisitNode(node)) { + return node; + } + + switch (node.kind) { + case SyntaxKind.Decorator: // elided, will be emitted as part of `visitClassDeclaration` + return undefined; + case SyntaxKind.ClassDeclaration: + return visitClassDeclaration(node as ClassDeclaration); + case SyntaxKind.ClassExpression: + return visitClassExpression(node as ClassExpression, /*referencedName*/ undefined); + case SyntaxKind.Constructor: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.ClassStaticBlockDeclaration: + return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead."); + case SyntaxKind.Parameter: + return visitParameterDeclaration(node as ParameterDeclaration); + + // Support NamedEvaluation to ensure the correct class name for class expressions. + case SyntaxKind.BinaryExpression: + return visitBinaryExpression(node as BinaryExpression, /*discarded*/ false); + case SyntaxKind.PropertyAssignment: + return visitPropertyAssignment(node as PropertyAssignment); + case SyntaxKind.VariableDeclaration: + return visitVariableDeclaration(node as VariableDeclaration); + case SyntaxKind.BindingElement: + return visitBindingElement(node as BindingElement); + case SyntaxKind.ExportAssignment: + return visitExportAssignment(node as ExportAssignment); + case SyntaxKind.ThisKeyword: + return visitThisExpression(node as ThisExpression); + case SyntaxKind.ForStatement: + return visitForStatement(node as ForStatement); + case SyntaxKind.ExpressionStatement: + return visitExpressionStatement(node as ExpressionStatement); + case SyntaxKind.CommaListExpression: + return visitCommaListExpression(node as CommaListExpression, /*discarded*/ false); + case SyntaxKind.ParenthesizedExpression: + return visitParenthesizedExpression(node as ParenthesizedExpression, /*discarded*/ false, /*referencedName*/ undefined); + case SyntaxKind.PartiallyEmittedExpression: + return visitPartiallyEmittedExpression(node as PartiallyEmittedExpression, /*discarded*/ false, /*referencedName*/ undefined); + case SyntaxKind.CallExpression: + return visitCallExpression(node as CallExpression); + case SyntaxKind.TaggedTemplateExpression: + return visitTaggedTemplateExpression(node as TaggedTemplateExpression); + case SyntaxKind.PrefixUnaryExpression: + case SyntaxKind.PostfixUnaryExpression: + return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, /*discard*/ false); + case SyntaxKind.PropertyAccessExpression: + return visitPropertyAccessExpression(node as PropertyAccessExpression); + case SyntaxKind.ElementAccessExpression: + return visitElementAccessExpression(node as ElementAccessExpression); + case SyntaxKind.ComputedPropertyName: + return visitComputedPropertyName(node as ComputedPropertyName); + + case SyntaxKind.MethodDeclaration: // object literal methods and accessors + case SyntaxKind.SetAccessor: + case SyntaxKind.GetAccessor: + case SyntaxKind.FunctionExpression: + case SyntaxKind.FunctionDeclaration: { + enterOther(); + const result = visitEachChild(node, visitor, context); + exitOther(); + return result; + } + default: + return visitEachChild(node, visitor, context); + } + } + + function classElementVisitor(node: Node) { + switch (node.kind) { + case SyntaxKind.Constructor: + return visitConstructorDeclaration(node as ConstructorDeclaration); + case SyntaxKind.MethodDeclaration: + return visitMethodDeclaration(node as MethodDeclaration); + case SyntaxKind.GetAccessor: + return visitGetAccessorDeclaration(node as GetAccessorDeclaration); + case SyntaxKind.SetAccessor: + return visitSetAccessorDeclaration(node as SetAccessorDeclaration); + case SyntaxKind.PropertyDeclaration: + return visitPropertyDeclaration(node as PropertyDeclaration); + case SyntaxKind.ClassStaticBlockDeclaration: + return visitClassStaticBlockDeclaration(node as ClassStaticBlockDeclaration); + default: + return visitor(node); + } + } + + function namedEvaluationVisitor(node: Node, referencedName: Expression): VisitResult { + switch (node.kind) { + case SyntaxKind.PartiallyEmittedExpression: + return visitPartiallyEmittedExpression(node as PartiallyEmittedExpression, /*discarded*/ false, referencedName); + case SyntaxKind.ParenthesizedExpression: + return visitParenthesizedExpression(node as ParenthesizedExpression, /*discarded*/ false, referencedName); + case SyntaxKind.ClassExpression: + return visitClassExpression(node as ClassExpression, referencedName); + default: + return visitor(node); + } + } + + function discardedValueVisitor(node: Node): VisitResult { + switch (node.kind) { + case SyntaxKind.PrefixUnaryExpression: + case SyntaxKind.PostfixUnaryExpression: + return visitPreOrPostfixUnaryExpression(node as PrefixUnaryExpression | PostfixUnaryExpression, /*discarded*/ true); + case SyntaxKind.BinaryExpression: + return visitBinaryExpression(node as BinaryExpression, /*discarded*/ true); + case SyntaxKind.CommaListExpression: + return visitCommaListExpression(node as CommaListExpression, /*discarded*/ true); + case SyntaxKind.ParenthesizedExpression: + return visitParenthesizedExpression(node as ParenthesizedExpression, /*discarded*/ true, /*referencedName*/ undefined); + default: + return visitor(node); + } + } + + function getHelperVariableName(node: ClassLikeDeclaration | ClassElement) { + let declarationName = + node.name && isIdentifier(node.name) && !isGeneratedIdentifier(node.name) ? idText(node.name) : + node.name && isPrivateIdentifier(node.name) && !isGeneratedIdentifier(node.name) ? idText(node.name).slice(1) : + node.name && isStringLiteral(node.name) && isIdentifierText(node.name.text, ScriptTarget.ESNext) ? node.name.text : + isClassLike(node) ? "class" : "member"; + if (isGetAccessor(node)) declarationName = `get_${declarationName}`; + if (isSetAccessor(node)) declarationName = `set_${declarationName}`; + if (node.name && isPrivateIdentifier(node.name)) declarationName = `private_${declarationName}`; + if (isStatic(node)) declarationName = `static_${declarationName}`; + return "_" + declarationName; + } + + function createHelperVariable(node: ClassLikeDeclaration | ClassElement, suffix: string) { + return factory.createUniqueName(`${getHelperVariableName(node)}_${suffix}`, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.ReservedInNestedScopes); + } + + function createLet(name: Identifier, initializer?: Expression) { + return factory.createVariableStatement( + /*modifiers*/ undefined, + factory.createVariableDeclarationList([ + factory.createVariableDeclaration( + name, + /*exclamationToken*/ undefined, + /*type*/ undefined, + initializer + ), + ], NodeFlags.Let) + ); + } + + function createAssign(left: Expression, right: Expression) { + return factory.createExpressionStatement(factory.createAssignment(left, right)); + } + + function createClassInfo(node: ClassLikeDeclaration): ClassInfo { + let instanceExtraInitializersName: Identifier | undefined; + let staticExtraInitializersName: Identifier | undefined; + let hasStaticInitializers = false; + let hasNonAmbientInstanceFields = false; + + // Before visiting we perform a first pass to collect information we'll need + // as we descend. + + for (const member of node.members) { + if (isNamedClassElement(member) && nodeOrChildIsDecorated(/*legacyDecorators*/ false, member, node)) { + if (hasStaticModifier(member)) { + staticExtraInitializersName ??= factory.createUniqueName("_staticExtraInitializers", GeneratedIdentifierFlags.Optimistic); + } + else { + instanceExtraInitializersName ??= factory.createUniqueName("_instanceExtraInitializers", GeneratedIdentifierFlags.Optimistic); + } + } + if (isClassStaticBlockDeclaration(member)) { + hasStaticInitializers = true; + } + else if (isPropertyDeclaration(member)) { + if (hasStaticModifier(member)) { + hasStaticInitializers ||= (!!member.initializer || hasDecorators(member)); + } + else { + hasNonAmbientInstanceFields ||= !isAmbientPropertyDeclaration(member); + } + } + + // exit early if possible + if (staticExtraInitializersName && + instanceExtraInitializersName && + hasStaticInitializers && + hasNonAmbientInstanceFields) { + break; + } + } + + return { + class: node, + instanceExtraInitializersName, + staticExtraInitializersName, + hasStaticInitializers, + hasNonAmbientInstanceFields, + }; + } + + function containsLexicalSuperInStaticInitializer(node: ClassLikeDeclaration) { + for (const member of node.members) { + if (isClassStaticBlockDeclaration(member) || + isPropertyDeclaration(member) && hasStaticModifier(member)) { + if (member.transformFlags & TransformFlags.ContainsLexicalSuper) { + return true; + } + } + } + return false; + } + + function transformClassLike(node: ClassLikeDeclaration, className: Expression) { + startLexicalEnvironment(); + + const classReference = node.name ?? factory.getGeneratedNameForNode(node); + const classInfo = createClassInfo(node); + const classDefinitionStatements: Statement[] = []; + let leadingBlockStatements: Statement[] | undefined; + let trailingBlockStatements: Statement[] | undefined; + let syntheticConstructor: ConstructorDeclaration | undefined; + let heritageClauses: NodeArray | undefined; + + // 1. Class decorators are evaluated outside of the private name scope of the class. + const classDecorators = transformAllDecoratorsOfDeclaration(getAllDecoratorsOfClass(node)); + if (classDecorators) { + // - Since class decorators don't have privileged access to private names defined inside the class, + // they must be evaluated outside of the class body. + // - Since a class decorator can replace the class constructor, we must define a variable to keep track + // of the mutated class. + // - Since a class decorator can add extra initializers, we must define a variable to keep track of + // extra initializers. + classInfo.classDecoratorsName = factory.createUniqueName("_classDecorators", GeneratedIdentifierFlags.Optimistic); + classInfo.classDescriptorName = factory.createUniqueName("_classDescriptor", GeneratedIdentifierFlags.Optimistic); + classInfo.classExtraInitializersName = factory.createUniqueName("_classExtraInitializers", GeneratedIdentifierFlags.Optimistic); + classInfo.classThis = factory.createUniqueName("_classThis", GeneratedIdentifierFlags.Optimistic); + classDefinitionStatements.push( + createLet(classInfo.classDecoratorsName, factory.createArrayLiteralExpression(classDecorators)), + createLet(classInfo.classDescriptorName), + createLet(classInfo.classExtraInitializersName, factory.createArrayLiteralExpression()), + createLet(classInfo.classThis), + ); + } + + // Rewrite `super` in static initializers so that we can use the correct `this`. + if (classDecorators && containsLexicalSuperInStaticInitializer(node)) { + const extendsClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword); + const extendsElement = extendsClause && firstOrUndefined(extendsClause.types); + const extendsExpression = extendsElement && visitNode(extendsElement.expression, visitor, isExpression); + if (extendsExpression) { + classInfo.classSuper = factory.createUniqueName("_classSuper", GeneratedIdentifierFlags.Optimistic); + + // Ensure we do not give the class or function an assigned name due to the variable by prefixing it + // with `0, `. + const unwrapped = skipOuterExpressions(extendsExpression); + const safeExtendsExpression = + isClassExpression(unwrapped) && !unwrapped.name || + isFunctionExpression(unwrapped) && !unwrapped.name || + isArrowFunction(unwrapped) ? + factory.createComma(factory.createNumericLiteral(0), extendsExpression) : + extendsExpression; + classDefinitionStatements.push(createLet(classInfo.classSuper, safeExtendsExpression)); + const updatedExtendsElement = factory.updateExpressionWithTypeArguments(extendsElement, classInfo.classSuper, /*typeArguments*/ undefined); + const updatedExtendsClause = factory.updateHeritageClause(extendsClause, [updatedExtendsElement]); + heritageClauses = factory.createNodeArray([updatedExtendsClause]); + } + } + else { + // 2. ClassHeritage clause is evaluated outside of the private name scope of the class. + heritageClauses = visitNodes(node.heritageClauses, visitor, isHeritageClause); + } + + const lexicalClassThis = factory.createThis(); + const renamedClassThis = classInfo.classThis ?? lexicalClassThis; + + // 3. The name of the class is assigned. + // + // If the class did not have a name, set the assigned name as if from NamedEvaluation. + // We don't need to use the assigned name if it consists of the empty string and the transformed class + // expression won't get its name from any other source (such as the variable we create to handle + // class decorators) + const needsSetNameHelper = !getOriginalNode(node, isClassLike)?.name && (classDecorators || !isStringLiteral(className) || !isEmptyStringLiteral(className)); + if (needsSetNameHelper) { + const setNameExpr = emitHelpers().createSetFunctionNameHelper(lexicalClassThis, className); + leadingBlockStatements = append(leadingBlockStatements, factory.createExpressionStatement(setNameExpr)); + } + + // 4. For each member: + // a. Member Decorators are evaluated + // b. Computed Property Name is evaluated, if present + + // We visit members in two passes: + // - The first pass visits methods, accessors, and fields to collect decorators and computed property names. + // - The second pass visits the constructor to add instance initializers. + // + // NOTE: If there are no constructors, but there are instance initializers, a synthetic constructor is added. + + enterClass(classInfo); + let members = visitNodes(node.members, classElementVisitor, isClassElement); + if (pendingExpressions) { + for (const expression of pendingExpressions) { + const statement = factory.createExpressionStatement(expression); + leadingBlockStatements = append(leadingBlockStatements, statement); + } + pendingExpressions = undefined; + } + exitClass(); + + if (classInfo.instanceExtraInitializersName && !getFirstConstructorWithBody(node)) { + const initializerStatements = prepareConstructor(node, classInfo); + if (initializerStatements) { + const extendsClauseElement = getEffectiveBaseTypeNode(node); + const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== SyntaxKind.NullKeyword); + const constructorStatements: Statement[] = []; + if (isDerivedClass) { + const spreadArguments = factory.createSpreadElement(factory.createIdentifier("arguments")); + const superCall = factory.createCallExpression(factory.createSuper(), /*typeArguments*/ undefined, [spreadArguments]); + constructorStatements.push(factory.createExpressionStatement(superCall)); + } + + addRange(constructorStatements, initializerStatements); + + const constructorBody = factory.createBlock(constructorStatements, /*multiLine*/ true); + syntheticConstructor = factory.createConstructorDeclaration(/*modifiers*/ undefined, [], constructorBody); + } + } + + // Used in steps 5, 7, and 11 + if (classInfo.staticExtraInitializersName) { + classDefinitionStatements.push( + createLet(classInfo.staticExtraInitializersName, factory.createArrayLiteralExpression()) + ); + } + + // Used in steps 6, 8, and during construction + if (classInfo.instanceExtraInitializersName) { + classDefinitionStatements.push( + createLet(classInfo.instanceExtraInitializersName, factory.createArrayLiteralExpression()) + ); + } + + // Used in steps 7, 8, 12, and construction + if (classInfo.memberInfos) { + forEachEntry(classInfo.memberInfos, (memberInfo, member) => { + if (isStatic(member)) { + classDefinitionStatements.push(createLet(memberInfo.memberDecoratorsName)); + if (memberInfo.memberInitializersName) { + classDefinitionStatements.push(createLet(memberInfo.memberInitializersName, factory.createArrayLiteralExpression())); + } + if (memberInfo.memberDescriptorName) { + classDefinitionStatements.push(createLet(memberInfo.memberDescriptorName)); + } + } + }); + } + + // Used in steps 7, 8, 12, and construction + if (classInfo.memberInfos) { + forEachEntry(classInfo.memberInfos, (memberInfo, member) => { + if (!isStatic(member)) { + classDefinitionStatements.push(createLet(memberInfo.memberDecoratorsName)); + if (memberInfo.memberInitializersName) { + classDefinitionStatements.push(createLet(memberInfo.memberInitializersName, factory.createArrayLiteralExpression())); + } + if (memberInfo.memberDescriptorName) { + classDefinitionStatements.push(createLet(memberInfo.memberDescriptorName)); + } + } + }); + } + + // 5. Static non-field element decorators are applied + leadingBlockStatements = addRange(leadingBlockStatements, classInfo.staticNonFieldDecorationStatements); + + // 6. Non-static non-field element decorators are applied + leadingBlockStatements = addRange(leadingBlockStatements, classInfo.nonStaticNonFieldDecorationStatements); + + // 7. Static field element decorators are applied + leadingBlockStatements = addRange(leadingBlockStatements, classInfo.staticFieldDecorationStatements); + + // 8. Non-static field element decorators are applied + leadingBlockStatements = addRange(leadingBlockStatements, classInfo.nonStaticFieldDecorationStatements); + + // 9. Class decorators are applied + // 10. Class binding is initialized + if (classInfo.classDescriptorName && classInfo.classDecoratorsName && classInfo.classExtraInitializersName && classInfo.classThis) { + leadingBlockStatements ??= []; + + // __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: "C" }, _classExtraInitializers); + const valueProperty = factory.createPropertyAssignment("value", lexicalClassThis); + const classDescriptor = factory.createObjectLiteralExpression([valueProperty]); + const classDescriptorAssignment = factory.createAssignment(classInfo.classDescriptorName, classDescriptor); + const classNameReference = factory.createPropertyAccessExpression(lexicalClassThis, "name"); + const esDecorateHelper = emitHelpers().createESDecorateHelper( + factory.createNull(), + classDescriptorAssignment, + classInfo.classDecoratorsName, + { kind: "class", name: classNameReference }, + factory.createNull(), + classInfo.classExtraInitializersName + ); + leadingBlockStatements.push(factory.createExpressionStatement(esDecorateHelper)); + + // C = _classThis = _classDescriptor.value; + const classDescriptorValueReference = factory.createPropertyAccessExpression(classInfo.classDescriptorName, "value"); + const classThisAssignment = factory.createAssignment(classInfo.classThis, classDescriptorValueReference); + const classReferenceAssignment = factory.createAssignment(classReference, classThisAssignment); + leadingBlockStatements.push(factory.createExpressionStatement(classReferenceAssignment)); + } + + // 11. Static extra initializers are evaluated + if (classInfo.staticExtraInitializersName) { + const runStaticInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo.staticExtraInitializersName); + leadingBlockStatements = append(leadingBlockStatements, factory.createExpressionStatement(runStaticInitializersHelper)); + } + + // 12. Static fields are initialized and static blocks are evaluated + + // 13. Class extra initializers are evaluated + if (classInfo.classExtraInitializersName) { + const runClassInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo.classExtraInitializersName); + trailingBlockStatements = append(trailingBlockStatements, factory.createExpressionStatement(runClassInitializersHelper)); + } + + // If there are no other static initializers to run, combine the leading and trailing block statements + if (leadingBlockStatements && trailingBlockStatements && !classInfo.hasStaticInitializers) { + addRange(leadingBlockStatements, trailingBlockStatements); + trailingBlockStatements = undefined; + } + + let newMembers: readonly ClassElement[] = members; + + // insert a leading `static {}` block, if necessary + if (leadingBlockStatements) { + // class C { + // static { ... } + // ... + // } + const leadingStaticBlockBody = factory.createBlock(leadingBlockStatements, /*multiline*/ true); + const leadingStaticBlock = factory.createClassStaticBlockDeclaration(leadingStaticBlockBody); + newMembers = [leadingStaticBlock, ...newMembers]; + } + + // append the synthetic constructor, if necessary + if (syntheticConstructor) { + newMembers = [...newMembers, syntheticConstructor]; + } + + // append a trailing `static {}` block, if necessary + if (trailingBlockStatements) { + // class C { + // ... + // static { ... } + // } + const trailingStaticBlockBody = factory.createBlock(trailingBlockStatements, /*multiline*/ true); + const trailingStaticBlock = factory.createClassStaticBlockDeclaration(trailingStaticBlockBody); + newMembers = [...newMembers, trailingStaticBlock]; + } + + // Update members with newly added members. + if (newMembers !== members) { + members = setTextRange(factory.createNodeArray(newMembers), members); + } + + const lexicalEnvironment = endLexicalEnvironment(); + if (classDecorators) { + // We use `var` instead of `let` so we can leverage NamedEvaluation to define the class name + // and still be able to ensure it is initialized prior to any use in `static {}`. + + // (() => { + // let _classDecorators = [...]; + // let _classDescriptor; + // let _classExtraInitializers = []; + // let _classThis; + // ... + // var C = class { + // static { + // __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, ...); + // // `C` is initialized here + // C = _classThis = _classDescriptor.value; + // } + // static x = 1; + // static y = C.x; // `C` will already be defined here. + // static { ... } + // }; + // return C; + // })(); + + const classExpression = factory.createClassExpression(/*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, heritageClauses, members); + const classReferenceDeclaration = factory.createVariableDeclaration(classReference, /*exclamationToken*/ undefined, /*type*/ undefined, classExpression); + const classReferenceVarDeclList = factory.createVariableDeclarationList([classReferenceDeclaration]); + classDefinitionStatements.push( + factory.createVariableStatement(/*modifiers*/ undefined, classReferenceVarDeclList), + factory.createReturnStatement(classReference), + ); + } + else { + // return ; + const classExpression = factory.createClassExpression(/*modifiers*/ undefined, node.name, /*typeParameters*/ undefined, heritageClauses, members); + classDefinitionStatements.push(factory.createReturnStatement(classExpression)); + } + + return factory.createImmediatelyInvokedArrowFunction(factory.mergeLexicalEnvironment(classDefinitionStatements, lexicalEnvironment)); + } + + function isDecoratedClassLike(node: ClassLikeDeclaration) { + return classOrConstructorParameterIsDecorated(/*legacyDecorators*/ false, node) || + childIsDecorated(/*legacyDecorators*/ false, node); + } + + function visitClassDeclaration(node: ClassDeclaration): VisitResult { + if (isDecoratedClassLike(node)) { + if (hasSyntacticModifier(node, ModifierFlags.Export) && + hasSyntacticModifier(node, ModifierFlags.Default)) { + // export default (() => { ... })(); + // TODO(rbuckton): Why do we end up with a `default_1` class name for an `export default class {}` after the TS transform? + const originalClass = getOriginalNode(node, isClassLike) ?? node; + const className = originalClass.name ? factory.createStringLiteralFromNode(originalClass.name) : factory.createStringLiteral("default"); + const iife = transformClassLike(node, className); + const statement = factory.createExportDefault(iife); + setOriginalNode(statement, node); + return statement; + } + else { + // let C = (() => { ... })(); + Debug.assertIsDefined(node.name, "A class declaration that is not a default export must have a name."); + const iife = transformClassLike(node, factory.createStringLiteralFromNode(node.name)); + const modifiers = visitNodes(node.modifiers, node => tryCast(node, isModifier), isModifier); + const varDecl = factory.createVariableDeclaration(node.name, /*exclamationToken*/ undefined, /*type*/ undefined, iife); + const varDecls = factory.createVariableDeclarationList([varDecl], NodeFlags.Let); + const statement = factory.createVariableStatement(modifiers, varDecls); + setOriginalNode(statement, node); + return statement; + } + } + else { + const modifiers = visitNodes(node.modifiers, node => tryCast(node, isModifier)); + const heritageClauses = visitNodes(node.heritageClauses, visitor, isHeritageClause); + enterClass(/*classInfo*/ undefined); + const members = visitNodes(node.members, classElementVisitor, isClassElement); + exitClass(); + return factory.updateClassDeclaration(node, modifiers, node.name, /*typeParameters*/ undefined, heritageClauses, members); + } + } + + function visitClassExpression(node: ClassExpression, referencedName: Expression | undefined) { + if (isDecoratedClassLike(node)) { + const className = node.name ? factory.createStringLiteralFromNode(node.name) : referencedName ?? factory.createStringLiteral(""); + const iife = transformClassLike(node, className); + setOriginalNode(iife, node); + return iife; + } + else { + const modifiers = visitNodes(node.modifiers, node => tryCast(node, isModifier), isModifier); + const heritageClauses = visitNodes(node.heritageClauses, visitor, isHeritageClause); + enterClass(/*classInfo*/ undefined); + const members = visitNodes(node.members, classElementVisitor, isClassElement); + exitClass(); + return factory.updateClassExpression(node, modifiers, node.name, /*typeParameters*/ undefined, heritageClauses, members); + } + } + + function prepareConstructor(parent: ClassLikeDeclaration, classInfo: ClassInfo) { + if (classInfo.instanceExtraInitializersName && !classInfo.hasNonAmbientInstanceFields) { + // If there are instance extra initializers we need to add them to the body along with any + // field initializers + const statements: Statement[] = []; + + statements.push( + factory.createExpressionStatement( + emitHelpers().createRunInitializersHelper( + factory.createThis(), + classInfo.instanceExtraInitializersName + ) + ) + ); + + for (const member of parent.members) { + if (isPropertyDeclaration(member) && !isStatic(member)) { + // TODO(rbuckton) + Debug.assertNotNode(member.name, isComputedPropertyName, "Not yet implemented."); + + let initializer = member.initializer; + const initializers = classInfo.memberInfos?.get(member)?.memberInitializersName; + if (initializer || initializers) { + initializer ??= factory.createVoidZero(); + if (initializers) { + initializer = emitHelpers().createRunInitializersHelper( + factory.createThis(), + initializers, + initializer + ); + } + statements.push( + createAssign( + isIdentifier(member.name) || isPrivateIdentifier(member.name) ? + factory.createPropertyAccessExpression( + factory.createThis(), + member.name + ) : + factory.createElementAccessExpression( + factory.createThis(), + member.name + ), + initializer + ) + ); + } + } + } + + return statements; + } + } + + function visitConstructorDeclaration(node: ConstructorDeclaration) { + enterClassElement(node); + const modifiers = visitNodes(node.modifiers, node => tryCast(node, isModifier)); + const parameters = visitNodes(node.parameters, visitor, isParameterDeclaration); + let body: Block | undefined; + if (node.body && classInfo?.instanceExtraInitializersName) { + // If there are instance extra initializers we need to add them to the body along with any + // field initializers + const initializerStatements = prepareConstructor(classInfo.class, classInfo); + if (initializerStatements) { + const statements: Statement[] = []; + const nonPrologueStart = factory.copyPrologue(node.body.statements, statements, /*ensureUseStrict*/ false, visitor); + addRange(statements, initializerStatements); + addRange(statements, visitNodes(node.body.statements, visitor, isStatement, nonPrologueStart)); + body = factory.createBlock(statements, /*multiLine*/ true); + setOriginalNode(body, node.body); + setTextRange(body, node.body); + } + } + + body ??= visitNode(node.body, visitor, isBlock); + exitClassElement(); + return factory.updateConstructorDeclaration(node, modifiers, parameters, body); + } + + function finishClassElement(updated: ClassElement, original: ClassElement) { + if (updated !== original) { + // While we emit the source map for the node after skipping decorators and modifiers, + // we need to emit the comments for the original range. + setCommentRange(updated, original); + setSourceMapRange(updated, moveRangePastDecorators(original)); + } + return updated; + } + + function partialTransformClassElement(member: TNode, useNamedEvaluation: boolean, classInfo: ClassInfo | undefined, createDescriptor?: (node: TNode, modifiers: ModifiersArray | undefined) => Expression) { + let referencedName: Expression | undefined; + let name: PropertyName | undefined; + let initializersName: Identifier | undefined; + let thisArg: Identifier | undefined; + let descriptorName: Identifier | undefined; + if (!classInfo) { + const modifiers = visitNodes(member.modifiers, visitor, isModifier); + enterName(); + if (useNamedEvaluation) { + ({ referencedName, name } = visitReferencedPropertyName(member.name)); + } + else { + name = visitPropertyName(member.name); + } + exitName(); + return { modifiers, referencedName, name, initializersName, descriptorName, thisArg }; + } + + // TODO(rbuckton): Handle computed property names outside of currentClassInfo, currentClassThis, currentClassSuper + // Debug.assertNotNode(member.name, isComputedPropertyName, "Not yet implemented."); + + // Member decorators require privileged access to private names. However, computed property + // evaluation occurs interspersed with decorator evaluation. This means that if we encounter + // a computed property name we must inline decorator evaluation. + const memberDecorators = transformAllDecoratorsOfDeclaration(getAllDecoratorsOfClassElement(member, classInfo.class, /*useLegacyDecorators*/ false)); + const modifiers = visitNodes(member.modifiers, visitor, isModifier); + + if (memberDecorators) { + const memberDecoratorsName = createHelperVariable(member, "decorators"); + const memberDecoratorsArray = factory.createArrayLiteralExpression(memberDecorators); + const memberInfo: MemberInfo = { memberDecoratorsName }; + classInfo.memberInfos ??= new Map(); + classInfo.memberInfos.set(member, memberInfo); + pendingExpressions ??= []; + pendingExpressions.push(factory.createAssignment(memberDecoratorsName, memberDecoratorsArray)); + + // 5. Static non-field element decorators are applied + // 6. Non-static non-field element decorators are applied + // 7. Static field element decorators are applied + // 8. Non-static field element decorators are applied + const statements = + isMethodOrAccessor(member) ? + isStatic(member) ? + classInfo.staticNonFieldDecorationStatements ??= [] : + classInfo.nonStaticNonFieldDecorationStatements ??= [] : + isPropertyDeclaration(member) ? + isStatic(member) ? + classInfo.staticFieldDecorationStatements ??= [] : + classInfo.nonStaticFieldDecorationStatements ??= [] : + Debug.fail(); + + const kind = + isGetAccessorDeclaration(member) ? "getter" : + isSetAccessorDeclaration(member) ? "setter" : + isMethodDeclaration(member) ? "method" : + isAutoAccessorPropertyDeclaration(member) ? "accessor" : + isPropertyDeclaration(member) ? "field" : + Debug.fail(); + + let propertyName: ESDecorateName; + if (isIdentifier(member.name) || isPrivateIdentifier(member.name)) { + propertyName = { computed: false, name: member.name }; + } + else if (isPropertyNameLiteral(member.name)) { + propertyName = { computed: true, name: member.name }; + } + else { + const expression = member.name.expression; + if (isPropertyNameLiteral(expression) && !isIdentifier(expression)) { + propertyName = { computed: true, name: expression }; + } + else { + enterName(); + ({ referencedName, name } = visitReferencedPropertyName(member.name)); + propertyName = { computed: true, name: referencedName }; + exitName(); + } + } + + const context: ESDecorateClassElementContext = { + kind, + name: propertyName, + static: isStatic(member), + private: isPrivateIdentifier(member.name), + access: { + // 15.7.3 CreateDecoratorAccessObject (kind, name) + // 2. If _kind_ is ~field~, ~method~, ~accessor~, or ~getter~, then ... + get: isPropertyDeclaration(member) || isGetAccessorDeclaration(member) || isMethodDeclaration(member), + // 3. If _kind_ is ~field~, ~accessor~, or ~setter~, then ... + set: isPropertyDeclaration(member) || isSetAccessorDeclaration(member) + }, + }; + + const extraInitializers = isStatic(member) ? + classInfo.staticExtraInitializersName ??= factory.createUniqueName("_staticExtraInitializers", GeneratedIdentifierFlags.Optimistic) : + classInfo.instanceExtraInitializersName ??= factory.createUniqueName("_instanceExtraInitializers", GeneratedIdentifierFlags.Optimistic); + + if (isMethodOrAccessor(member)) { + // __esDecorate(this, null, _static_member_decorators, { kind: "method", name: "...", static: true, private: false, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, null, _member_decorators, { kind: "method", name: "...", static: false, private: false, access: { ... } }, _instanceExtraInitializers); + // __esDecorate(this, null, _static_member_decorators, { kind: "getter", name: "...", static: true, private: false, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, null, _member_decorators, { kind: "getter", name: "...", static: false, private: false, access: { ... } }, _instanceExtraInitializers); + // __esDecorate(this, null, _static_member_decorators, { kind: "setter", name: "...", static: true, private: false, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, null, _member_decorators, { kind: "setter", name: "...", static: false, private: false, access: { ... } }, _instanceExtraInitializers); + + // __esDecorate(this, _static_member_descriptor = { value() { ... } }, _static_member_decorators, { kind: "method", name: "...", static: true, private: true, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, _member_descriptor = { value() { ... } }, _member_decorators, { kind: "method", name: "...", static: false, private: true, access: { ... } }, _instanceExtraInitializers); + // __esDecorate(this, _static_member_descriptor = { get() { ... } }, _static_member_decorators, { kind: "getter", name: "...", static: true, private: true, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, _member_descriptor = { get() { ... } }, _member_decorators, { kind: "getter", name: "...", static: false, private: true, access: { ... } }, _instanceExtraInitializers); + // __esDecorate(this, _static_member_descriptor = { set() { ... } }, _static_member_decorators, { kind: "setter", name: "...", static: true, private: true, access: { ... } }, _staticExtraInitializers); + // __esDecorate(this, _member_descriptor = { set() { ... } }, _member_decorators, { kind: "setter", name: "...", static: false, private: true, access: { ... } }, _instanceExtraInitializers); + + let descriptor: Expression | undefined; + if (isPrivateIdentifier(member.name) && createDescriptor) { + descriptor = createDescriptor(member, visitNodes(modifiers, node => isStaticModifier(node) ? undefined : tryCast(node, isModifier), isModifier)); + memberInfo.memberDescriptorName = descriptorName = createHelperVariable(member, "descriptor"); + descriptor = factory.createAssignment(descriptorName, descriptor); + } + + statements.push( + factory.createExpressionStatement( + emitHelpers().createESDecorateHelper( + factory.createThis(), + descriptor ?? factory.createNull(), + memberDecoratorsName, + context, + factory.createNull(), + extraInitializers))); + } + else if (isPropertyDeclaration(member)) { + initializersName = memberInfo.memberInitializersName ??= createHelperVariable(member, "initializers"); + + // TODO(rbuckton): remove + // classInfo.pendingVariablesOutsideOfBody ??= []; + // classInfo.pendingVariablesOutsideOfBody.push({ name: initializersName, initializer: factory.createArrayLiteralExpression() }); + + if (isStatic(member)) { + thisArg = classInfo.classThis; + } + + let descriptor: Expression | undefined; + if (isPrivateIdentifier(member.name) && hasAccessorModifier(member) && createDescriptor) { + descriptor = createDescriptor(member, visitNodes(modifiers, node => isStaticModifier(node) ? undefined : node, isModifier)); + memberInfo.memberDescriptorName = descriptorName = createHelperVariable(member, "descriptor"); + descriptor = factory.createAssignment(descriptorName, descriptor); + } + + // _static_field_initializers = __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "...", static: true, private: ..., access: { ... } }, _staticExtraInitializers); + // _field_initializers = __esDecorate(null, null, _member_decorators, { kind: "field", name: "...", static: false, private: ..., access: { ... } }, _instanceExtraInitializers); + statements.push( + factory.createExpressionStatement( + emitHelpers().createESDecorateHelper( + isAutoAccessorPropertyDeclaration(member) ? + factory.createThis() : + factory.createNull(), + descriptor ?? factory.createNull(), + memberDecoratorsName, + context, + initializersName, + extraInitializers))); + } + } + + if (name === undefined) { + enterName(); + if (useNamedEvaluation) { + ({ referencedName, name } = visitReferencedPropertyName(member.name)); + } + else { + name = visitPropertyName(member.name); + } + exitName(); + } + + // if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression) && classInfo.pendingVariablesInsideOfBody) { + // let newPendingVariablesInsideOfBody: { name: Identifier, initializer?: Expression }[] | undefined; + // const expressions: Expression[] = []; + // for (const { name, initializer } of classInfo.pendingVariablesInsideOfBody) { + // if (!initializer) { + // newPendingVariablesInsideOfBody ??= []; + // newPendingVariablesInsideOfBody.push({ name }); + // } + // else { + // classInfo.pendingVariablesOutsideOfBody ??= []; + // classInfo.pendingVariablesOutsideOfBody.push({ name }); + // expressions.push(factory.createAssignment(name, initializer)); + // } + // } + // if (expressions.length) { + // expressions.push(name.expression); + // name = factory.updateComputedPropertyName(name, factory.inlineExpressions(expressions)); + // classInfo.pendingVariablesInsideOfBody = newPendingVariablesInsideOfBody; + // } + // } + + return { modifiers, referencedName, name, initializersName, descriptorName, thisArg }; + } + + function visitMethodDeclaration(node: MethodDeclaration) { + enterClassElement(node); + const { modifiers, name, descriptorName } = partialTransformClassElement(node, /*useNamedEvaluation*/ false, classInfo, createMethodDescriptorObject); + if (descriptorName) { + exitClassElement(); + return finishClassElement(createMethodDescriptorForwarder(modifiers, name, descriptorName), node); + } + else { + const parameters = visitNodes(node.parameters, visitor, isParameterDeclaration); + const body = visitNode(node.body, visitor, isBlock); + exitClassElement(); + return finishClassElement(factory.updateMethodDeclaration(node, modifiers, node.asteriskToken, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body), node); + } + } + + function visitGetAccessorDeclaration(node: GetAccessorDeclaration) { + enterClassElement(node); + const { modifiers, name, descriptorName } = partialTransformClassElement(node, /*useNamedEvaluation*/ false, classInfo, createGetAccessorDescriptorObject); + if (descriptorName) { + exitClassElement(); + return finishClassElement(createGetAccessorDescriptorForwarder(modifiers, name, descriptorName), node); + } + else { + const parameters = visitNodes(node.parameters, visitor, isParameterDeclaration); + const body = visitNode(node.body, visitor, isBlock); + exitClassElement(); + return finishClassElement(factory.updateGetAccessorDeclaration(node, modifiers, name, parameters, /*type*/ undefined, body), node); + } + } + + function visitSetAccessorDeclaration(node: SetAccessorDeclaration) { + enterClassElement(node); + const { modifiers, name, descriptorName } = partialTransformClassElement(node, /*useNamedEvaluation*/ false, classInfo, createSetAccessorDescriptorObject); + if (descriptorName) { + exitClassElement(); + return finishClassElement(createSetAccessorDescriptorForwarder(modifiers, name, descriptorName), node); + } + else { + const parameters = visitNodes(node.parameters, visitor, isParameterDeclaration); + const body = visitNode(node.body, visitor, isBlock); + exitClassElement(); + return finishClassElement(factory.updateSetAccessorDeclaration(node, modifiers, name, parameters, body), node); + } + } + + function visitClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration) { + enterClassElement(node); + + if (classInfo) classInfo.hasStaticInitializers = true; + const result = visitEachChild(node, visitor, context); + + exitClassElement(); + return result; + } + + function visitPropertyDeclaration(node: PropertyDeclaration) { + enterClassElement(node); + + // TODO(rbuckton) + Debug.assertNotNode(node, isAmbientPropertyDeclaration, "Not yet implemented."); + + // 10.2.1.3 RS: EvaluateBody + // Initializer : `=` AssignmentExpression + // ... + // 3. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true*, then + // a. Let _value_ be ? NamedEvaluation of |Initializer| with argument _functionObject_.[[ClassFieldInitializerName]]. + // ... + + const useNamedEvaluation = !!node.initializer && isDecoratedAnonymousClassExpression(node.initializer); + const { modifiers, name, referencedName, initializersName, /*descriptorName,*/ thisArg } = partialTransformClassElement(node, useNamedEvaluation, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : undefined); + + startLexicalEnvironment(); + + let initializer = referencedName ? + visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression): + visitNode(node.initializer, visitor, isExpression); + + if (initializersName) { + initializer = emitHelpers().createRunInitializersHelper( + thisArg ?? factory.createThis(), + initializersName, + initializer); + } + + if (!isStatic(node) && classInfo?.instanceExtraInitializersName && !classInfo?.hasInjectedInstanceInitializers) { + // for the first non-static field initializer, inject a call to `__runInitializers`. + classInfo.hasInjectedInstanceInitializers = true; + initializer ??= factory.createVoidZero(); + initializer = factory.createParenthesizedExpression(factory.createComma( + emitHelpers().createRunInitializersHelper( + factory.createThis(), + classInfo.instanceExtraInitializersName + ), + initializer + )); + } + + if (isStatic(node) && classInfo && initializer) { + classInfo.hasStaticInitializers = true; + } + + // if (hasAccessorModifier(node)) { + // if (descriptorName) { + // // given: + // // accessor #x = 1; + // // + // // emits: + // // static { + // // _esDecorate(null, _private_x_descriptor = { get() { return this.#x_1; }, set(value) { this.#x_1 = value; } }, ...) + // // } + // // ... + // // #x_1 = 1; + // // get #x() { return _private_x_descriptor.get.call(this); } + // // set #x(value) { _private_x_descriptor.set.call(this, value); } + // return [ + // finishClassElement(createAccessorPropertyBackingField(node, modifiers, initializer), node), + // finishClassElement(createGetAccessorDescriptorForwarder(modifiers, name, descriptorName), node), + // finishClassElement(createSetAccessorDescriptorForwarder(modifiers, name, descriptorName), node), + // ]; + // } + // else { + // // given: + // // accessor x = 1; + // // + // // emits: + // // #x = 1; + // // get x() { return this.#x; } + // // set x(value) { this.#x = value; } + // return [ + // finishClassElement(createAccessorPropertyBackingField(node, modifiers, initializer), node), + // finishClassElement(createAccessorPropertyGetRedirector(node, modifiers, name), node), + // finishClassElement(createAccessorPropertySetRedirector(node, modifiers, name), node), + // ]; + // } + // } + + const declarations = endLexicalEnvironment(); + if (some(declarations)) { + initializer = factory.createImmediatelyInvokedArrowFunction([ + ...declarations, + factory.createReturnStatement(initializer) + ]); + } + + exitClassElement(); + return finishClassElement(factory.updatePropertyDeclaration(node, modifiers, name, /*questionOrExclamationToken*/ undefined, /*type*/ undefined, initializer), node); + } + + function visitThisExpression(node: ThisExpression) { + return classThis ?? node; + } + + function visitCallExpression(node: CallExpression) { + if (isSuperProperty(node.expression) && classThis) { + const expression = visitNode(node.expression, visitor, isExpression); + const argumentsList = visitNodes(node.arguments, visitor, isExpression); + const invocation = factory.createFunctionCallCall(expression, classThis, argumentsList); + setOriginalNode(invocation, node); + setTextRange(invocation, node); + return invocation; + } + + return visitEachChild(node, visitor, context); + } + + function visitTaggedTemplateExpression(node: TaggedTemplateExpression) { + if (isSuperProperty(node.tag) && classThis) { + const tag = visitNode(node.tag, visitor, isExpression); + const boundTag = factory.createFunctionBindCall(tag, classThis, []); + setOriginalNode(boundTag, node); + setTextRange(boundTag, node); + const template = visitNode(node.template, visitor, isTemplateLiteral); + return factory.updateTaggedTemplateExpression(node, boundTag, /*typeArguments*/ undefined, template); + } + + return visitEachChild(node, visitor, context); + } + + function visitPropertyAccessExpression(node: PropertyAccessExpression) { + if (isSuperProperty(node) && isIdentifier(node.name) && classThis && classSuper) { + const propertyName = factory.createStringLiteralFromNode(node.name); + const superProperty = factory.createReflectGetCall(classSuper, propertyName, classThis); + setOriginalNode(superProperty, node.expression); + setTextRange(superProperty, node.expression); + return superProperty; + } + + return visitEachChild(node, visitor, context); + } + + function visitElementAccessExpression(node: ElementAccessExpression) { + if (isSuperProperty(node) && classThis && classSuper) { + const propertyName = visitNode(node.argumentExpression, visitor, isExpression); + const superProperty = factory.createReflectGetCall(classSuper, propertyName, classThis); + setOriginalNode(superProperty, node.expression); + setTextRange(superProperty, node.expression); + return superProperty; + } + + return visitEachChild(node, visitor, context); + } + + function visitParameterDeclaration(node: ParameterDeclaration) { + const updated = factory.updateParameterDeclaration( + node, + /*modifiers*/ undefined, + node.dotDotDotToken, + visitNode(node.name, visitor, isBindingName), + /*questionToken*/ undefined, + /*type*/ undefined, + visitNode(node.initializer, visitor, isExpression) + ); + if (updated !== node) { + // While we emit the source map for the node after skipping decorators and modifiers, + // we need to emit the comments for the original range. + setCommentRange(updated, node); + setTextRange(updated, moveRangePastModifiers(node)); + setSourceMapRange(updated, moveRangePastModifiers(node)); + setEmitFlags(updated.name, EmitFlags.NoTrailingSourceMap); + } + return updated; + } + + function isDecoratedAnonymousClassExpression(node: Expression) { + node = skipOuterExpressions(node); + return isClassExpression(node) && !node.name && isDecoratedClassLike(node); + } + + function visitForStatement(node: ForStatement) { + return factory.updateForStatement( + node, + visitNode(node.initializer, discardedValueVisitor, isForInitializer), + visitNode(node.condition, visitor, isExpression), + visitNode(node.incrementor, discardedValueVisitor, isExpression), + visitIterationBody(node.statement, visitor, context) + ); + } + + function visitExpressionStatement(node: ExpressionStatement) { + return visitEachChild(node, discardedValueVisitor, context); + } + + function visitBinaryExpression(node: BinaryExpression, discarded: boolean) { + if (isDestructuringAssignment(node)) { + const left = visitAssignmentPattern(node.left); + const right = visitNode(node.right, visitor, isExpression); + return factory.updateBinaryExpression(node, left, node.operatorToken, right); + } + + if (isAssignmentExpression(node)) { + // 13.15.2 RS: Evaluation + // AssignmentExpression : LeftHandSideExpression `=` AssignmentExpression + // 1. If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then + // a. Let _lref_ be ? Evaluation of |LeftHandSideExpression|. + // b. If IsAnonymousFunctionDefinition(|AssignmentExpression|) and IsIdentifierRef of |LeftHandSideExpression| are both *true*, then + // i. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. + // ... + // + // AssignmentExpression : LeftHandSideExpression `&&=` AssignmentExpression + // ... + // 5. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true* and IsIdentifierRef of |LeftHandSideExpression| is *true*, then + // a. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. + // ... + // + // AssignmentExpression : LeftHandSideExpression `||=` AssignmentExpression + // ... + // 5. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true* and IsIdentifierRef of |LeftHandSideExpression| is *true*, then + // a. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. + // ... + // + // AssignmentExpression : LeftHandSideExpression `??=` AssignmentExpression + // ... + // 4. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true* and IsIdentifierRef of |LeftHandSideExpression| is *true*, then + // a. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. + // ... + + switch (node.operatorToken.kind) { + case SyntaxKind.EqualsToken: + case SyntaxKind.AmpersandAmpersandEqualsToken: + case SyntaxKind.BarBarEqualsToken: + case SyntaxKind.QuestionQuestionEqualsToken: + if (isIdentifier(node.left) && + isDecoratedAnonymousClassExpression(node.right)) { + const referencedName = factory.createStringLiteralFromNode(node.left); + const left = visitNode(node.left, visitor, isExpression); + const right = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateBinaryExpression(node, left, node.operatorToken, right); + } + break; + } + + if (isSuperProperty(node.left) && classThis && classSuper) { + let setterName = + isElementAccessExpression(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : + isIdentifier(node.left.name) ? factory.createStringLiteralFromNode(node.left.name) : + undefined; + if (setterName) { + // super.x = ... + // super.x += ... + // super[x] = ... + // super[x] += ... + let expression = visitNode(node.right, visitor, isExpression); + if (isCompoundAssignment(node.operatorToken.kind)) { + let getterName = setterName; + if (!isSimpleInlineableExpression(setterName)) { + getterName = factory.createTempVariable(hoistVariableDeclaration); + setterName = factory.createAssignment(getterName, setterName); + } + + const superPropertyGet = factory.createReflectGetCall( + classSuper, + getterName, + classThis); + setOriginalNode(superPropertyGet, node.left); + setTextRange(superPropertyGet, node.left); + + expression = factory.createBinaryExpression( + superPropertyGet, + getNonAssignmentOperatorForCompoundAssignment(node.operatorToken.kind), + expression + ); + setTextRange(expression, node); + } + + const temp = discarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); + if (temp) { + expression = factory.createAssignment(temp, expression); + setTextRange(temp, node); + } + + expression = factory.createReflectSetCall( + classSuper, + setterName, + expression, + classThis + ); + setOriginalNode(expression, node); + setTextRange(expression, node); + + if (temp) { + expression = factory.createComma(expression, temp); + setTextRange(expression, node); + } + + return expression; + } + } + } + + if (node.operatorToken.kind === SyntaxKind.CommaToken) { + const left = visitNode(node.left, discardedValueVisitor, isExpression); + const right = visitNode(node.right, discarded ? discardedValueVisitor : visitor, isExpression); + return factory.updateBinaryExpression(node, left, node.operatorToken, right); + } + + return visitEachChild(node, visitor, context); + } + + function visitPreOrPostfixUnaryExpression(node: PrefixUnaryExpression | PostfixUnaryExpression, discarded: boolean) { + if (node.operator === SyntaxKind.PlusPlusToken || + node.operator === SyntaxKind.MinusMinusToken) { + const operand = skipParentheses(node.operand); + if (isSuperProperty(operand) && classThis && classSuper) { + let setterName = + isElementAccessExpression(operand) ? visitNode(operand.argumentExpression, visitor, isExpression) : + isIdentifier(operand.name) ? factory.createStringLiteralFromNode(operand.name) : + undefined; + if (setterName) { + let getterName = setterName; + if (!isSimpleInlineableExpression(setterName)) { + getterName = factory.createTempVariable(hoistVariableDeclaration); + setterName = factory.createAssignment(getterName, setterName); + } + + let expression: Expression = factory.createReflectGetCall(classSuper, getterName, classThis); + setOriginalNode(expression, node); + setTextRange(expression, node); + + const temp = discarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); + expression = expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp); + expression = factory.createReflectSetCall(classSuper, setterName, expression, classThis); + setOriginalNode(expression, node); + setTextRange(expression, node); + + if (temp) { + expression = factory.createComma(expression, temp); + setTextRange(expression, node); + } + + return expression; + } + } + } + + return visitEachChild(node, visitor, context); + } + + function visitCommaListExpression(node: CommaListExpression, discarded: boolean) { + const elements = discarded ? + visitCommaListElements(node.elements, discardedValueVisitor) : + visitCommaListElements(node.elements, visitor, discardedValueVisitor); + return factory.updateCommaListExpression(node, elements); + } + + function visitReferencedPropertyName(node: PropertyName) { + if (isPropertyNameLiteral(node) || isPrivateIdentifier(node)) { + const referencedName = factory.createStringLiteralFromNode(node); + const name = visitNode(node, visitor, isPropertyName); + return { referencedName, name }; + } + + if (isPropertyNameLiteral(node.expression) && !isIdentifier(node.expression)) { + const referencedName = factory.createStringLiteralFromNode(node.expression); + const name = visitNode(node, visitor, isPropertyName); + return { referencedName, name }; + } + + const referencedName = factory.createTempVariable(hoistVariableDeclaration); + const key = emitHelpers().createPropKeyHelper(visitNode(node.expression, visitor, isExpression)); + const assignment = factory.createAssignment(referencedName, key); + const name = factory.updateComputedPropertyName(node, injectPendingExpressions(assignment)); + return { referencedName, name }; + } + + function visitPropertyName(node: PropertyName) { + if (isComputedPropertyName(node)) { + return visitComputedPropertyName(node); + } + return visitNode(node, visitor, isPropertyName); + } + + function visitComputedPropertyName(node: ComputedPropertyName) { + let expression = visitNode(node.expression, visitor, isExpression); + if (!isSimpleInlineableExpression(expression)) { + expression = injectPendingExpressions(expression); + } + return factory.updateComputedPropertyName(node, expression); + } + + function visitPropertyAssignment(node: PropertyAssignment) { + // 13.2.5.5 RS: PropertyDefinitionEvaluation + // PropertyAssignment : PropertyName `:` AssignmentExpression + // ... + // 5. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true* and _isProtoSetter_ is *false*, then + // a. Let _popValue_ be ? NamedEvaluation of |AssignmentExpression| with argument _propKey_. + // ... + + if (!isProtoSetter(node.name) && + isDecoratedAnonymousClassExpression(node.initializer)) { + const { referencedName, name } = visitReferencedPropertyName(node.name); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updatePropertyAssignment(node, name, initializer); + } + + return visitEachChild(node, visitor, context); + } + + function visitVariableDeclaration(node: VariableDeclaration) { + // 14.3.1.2 RS: Evaluation + // LexicalBinding : BindingIdentifier Initializer + // ... + // 3. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // a. Let _value_ be ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + // + // 14.3.2.1 RS: Evaluation + // VariableDeclaration : BindingIdentifier Initializer + // ... + // 3. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // a. Let _value_ be ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + + if (isIdentifier(node.name) && node.initializer && + isDecoratedAnonymousClassExpression(node.initializer)) { + const referencedName = factory.createStringLiteralFromNode(node.name); + const name = visitNode(node.name, visitor, isBindingName); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateVariableDeclaration(node, name, /*exclamationToken*/ undefined, /*type*/ undefined, initializer); + } + + return visitEachChild(node, visitor, context); + } + + function visitBindingElement(node: BindingElement) { + // 8.6.3 RS: IteratorBindingInitialization + // SingleNameBinding : BindingIdentifier Initializer? + // ... + // 5. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + // + // 14.3.3.3 RS: KeyedBindingInitialization + // SingleNameBinding : BindingIdentifier Initializer? + // ... + // 4. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + + if (!node.dotDotDotToken && + isIdentifier(node.name) && node.initializer && + isDecoratedAnonymousClassExpression(node.initializer)) { + const referencedName = factory.createStringLiteralFromNode(node.name); + const propertyName = visitNode(node.propertyName, visitor, isPropertyName); + const name = visitNode(node.name, visitor, isBindingName); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateBindingElement(node, /*dotDotDotToken*/ undefined, propertyName, name, initializer); + } + + return visitEachChild(node, visitor, context); + } + + function visitDestructuringAssignmentTarget(node: LeftHandSideExpression): Expression { + if (isObjectLiteralExpression(node) || isArrayLiteralExpression(node)) { + return visitAssignmentPattern(node); + } + + if (isSuperProperty(node) && classThis && classSuper) { + const propertyName = + isElementAccessExpression(node) ? visitNode(node.argumentExpression, visitor, isExpression) : + isIdentifier(node.name) ? factory.createStringLiteralFromNode(node.name) : + undefined; + if (propertyName) { + const paramName = factory.createTempVariable(/*recordTempVariable*/ undefined); + const expression = factory.createAssignmentTargetWrapper( + paramName, + factory.createReflectSetCall( + classSuper, + propertyName, + paramName, + classThis, + ) + ); + setOriginalNode(expression, node); + setTextRange(expression, node); + return expression; + } + } + + return visitEachChild(node, visitor, context); + } + + function visitAssignmentElement(node: Exclude) { + // 13.15.5.5 RS: IteratorDestructuringAssignmentEvaluation + // AssignmentElement : DestructuringAssignmentTarget Initializer? + // ... + // 4. If |Initializer| is present and _value_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) and IsIdentifierRef of |DestructuringAssignmentTarget| are both *true*, then + // i. Let _v_ be ? NamedEvaluation of |Initializer| with argument _lref_.[[ReferencedName]]. + // ... + + if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { + const assignmentTarget = visitDestructuringAssignmentTarget(node.left); + let initializer: Expression; + if (isIdentifier(node.left) && + isDecoratedAnonymousClassExpression(node.right)) { + const referencedName = factory.createStringLiteralFromNode(node.left); + initializer = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); + } + else { + initializer = visitNode(node.right, visitor, isExpression); + } + return factory.updateBinaryExpression(node, assignmentTarget, node.operatorToken, initializer); + } + else { + return visitDestructuringAssignmentTarget(node); + } + } + + function visitAssignmentRestElement(node: SpreadElement) { + if (isLeftHandSideExpression(node.expression)) { + const expression = visitDestructuringAssignmentTarget(node.expression); + return factory.updateSpreadElement(node, expression); + } + + return visitEachChild(node, visitor, context); + } + + function visitArrayAssignmentElement(node: ArrayAssignmentElement) { + if (isSpreadElement(node)) return visitAssignmentRestElement(node); + if (!isOmittedExpression(node)) return visitAssignmentElement(node); + return visitEachChild(node, visitor, context); + } + + function visitAssignmentProperty(node: PropertyAssignment) { + // AssignmentProperty : PropertyName `:` AssignmentElement + // AssignmentElement : DestructuringAssignmentTarget Initializer? + + // 13.15.5.6 RS: KeyedDestructuringAssignmentEvaluation + // AssignmentElement : DestructuringAssignmentTarget Initializer? + // ... + // 3. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousfunctionDefinition(|Initializer|) and IsIdentifierRef of |DestructuringAssignmentTarget| are both *true*, then + // i. Let _rhsValue_ be ? NamedEvaluation of |Initializer| with argument _lref_.[[ReferencedName]]. + // ... + + const name = visitNode(node.name, visitor, isPropertyName); + if (isAssignmentExpression(node.initializer, /*excludeCompoundAssignment*/ true)) { + const assignmentElement = visitAssignmentElement(node.initializer); + return factory.updatePropertyAssignment(node, name, assignmentElement); + } + + if (isLeftHandSideExpression(node.initializer)) { + const assignmentElement = visitDestructuringAssignmentTarget(node.initializer); + return factory.updatePropertyAssignment(node, name, assignmentElement); + } + + return visitEachChild(node, visitor, context); + } + + function visitShorthandAssignmentProperty(node: ShorthandPropertyAssignment) { + // AssignmentProperty : IdentifierReference Initializer? + + // 13.15.5.3 RS: PropertyDestructuringAssignmentEvaluation + // AssignmentProperty : IdentifierReference Initializer? + // ... + // 4. If |Initializer?| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _P_. + // ... + + if (node.objectAssignmentInitializer && + isDecoratedAnonymousClassExpression(node.objectAssignmentInitializer)) { + const name = visitNode(node.name, visitor, isIdentifier); + const referencedName = factory.createStringLiteralFromNode(node.name); + const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer); + } + + return visitEachChild(node, visitor, context); + } + + function visitAssignmentRestProperty(node: SpreadAssignment) { + if (isLeftHandSideExpression(node.expression)) { + const expression = visitDestructuringAssignmentTarget(node.expression); + return factory.updateSpreadAssignment(node, expression); + } + + return visitEachChild(node, visitor, context); + } + + function visitObjectAssignmentElement(node: ObjectAssignmentElement) { + if (isSpreadAssignment(node)) return visitAssignmentRestProperty(node); + if (isShorthandPropertyAssignment(node)) return visitShorthandAssignmentProperty(node); + if (isPropertyAssignment(node)) return visitAssignmentProperty(node); + return visitEachChild(node, visitor, context); + } + + function visitAssignmentPattern(node: AssignmentPattern) { + if (isArrayLiteralExpression(node)) { + const elements = visitNodes(node.elements, visitArrayAssignmentElement, isExpression); + return factory.updateArrayLiteralExpression(node, elements); + } + else { + const properties = visitNodes(node.properties, visitObjectAssignmentElement, isObjectLiteralElementLike); + return factory.updateObjectLiteralExpression(node, properties); + } + } + + function visitExportAssignment(node: ExportAssignment) { + // 16.2.3.7 RS: Evaluation + // ExportDeclaration : `export` `default` AssignmentExpression `;` + // 1. If IsAnonymmousFunctionDefinition(|AssignmentExpression|) is *true*, then + // a. Let _value_ be ? NamedEvaluation of |AssignmentExpression| with argument `"default"`. + // ... + + // NOTE: Since emit for `export =` translates to `module.exports = ...`, the assigned nameof the class + // is `""`. + + if (isDecoratedAnonymousClassExpression(node.expression)) { + const referencedName = factory.createStringLiteral(node.isExportEquals ? "" : "default"); + const modifiers = visitNodes(node.modifiers, visitor, isModifier); + const expression = visitNode(node.expression, node => namedEvaluationVisitor(node, referencedName), isExpression); + return factory.updateExportAssignment(node, modifiers, expression); + } + + return visitEachChild(node, visitor, context); + } + + function visitParenthesizedExpression(node: ParenthesizedExpression, discarded: boolean, referencedName: Expression | undefined) { + // 8.4.5 RS: NamedEvaluation + // ParenthesizedExpression : `(` Expression `)` + // ... + // 2. Return ? NamedEvaluation of |Expression| with argument _name_. + + const visitorFunc: Visitor = + discarded ? discardedValueVisitor : + referencedName ? node => namedEvaluationVisitor(node, referencedName) : + visitor; + const expression = visitNode(node.expression, visitorFunc, isExpression); + return factory.updateParenthesizedExpression(node, expression); + } + + function visitPartiallyEmittedExpression(node: PartiallyEmittedExpression, discarded: boolean, referencedName: Expression | undefined) { + // Emulates 8.4.5 RS: NamedEvaluation + + const visitorFunc: Visitor = + discarded ? discardedValueVisitor : + referencedName ? node => namedEvaluationVisitor(node, referencedName) : + visitor; + const expression = visitNode(node.expression, visitorFunc, isExpression); + return factory.updatePartiallyEmittedExpression(node, expression); + } + + function injectPendingExpressions(expression: Expression) { + if (some(pendingExpressions)) { + if (isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions([...pendingExpressions, expression.expression])); + } + else { + expression = factory.inlineExpressions([...pendingExpressions, expression]); + } + pendingExpressions = undefined; + } + return expression; + } + + /** + * Transforms all of the decorators for a declaration into an array of expressions. + * + * @param allDecorators An object containing all of the decorators for the declaration. + */ + function transformAllDecoratorsOfDeclaration(allDecorators: AllDecorators | undefined) { + if (!allDecorators) { + return undefined; + } + + const decoratorExpressions: Expression[] = []; + addRange(decoratorExpressions, map(allDecorators.decorators, transformDecorator)); + addRange(decoratorExpressions, flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); + return decoratorExpressions; + } + + /** + * Transforms a decorator into an expression. + * + * @param decorator The decorator node. + */ + function transformDecorator(decorator: Decorator) { + return visitNode(decorator.expression, visitor, isExpression); + } + + /** + * Transforms the decorators of a parameter. + * + * @param decorators The decorators for the parameter at the provided offset. + * @param parameterOffset The offset of the parameter. + */ + function transformDecoratorsOfParameter(decorators: Decorator[], parameterOffset: number) { + let expressions: Expression[] | undefined; + if (decorators) { + expressions = []; + for (const decorator of decorators) { + const helper = emitHelpers().createParamHelper( + transformDecorator(decorator), + parameterOffset); + setTextRange(helper, decorator.expression); + setEmitFlags(helper, EmitFlags.NoComments); + expressions.push(helper); + } + } + + return expressions; + } + + /** + * Creates a `value`, `get`, or `set` method for a pseudo-{@link PropertyDescriptor} object. + */ + function createDescriptorMethod(original: Node, _name: PropertyName, modifiers: ModifiersArray | undefined, asteriskToken: AsteriskToken | undefined, kind: "value" | "get" | "set", parameters: readonly ParameterDeclaration[], body: Block | undefined) { + const func = factory.createFunctionExpression( + modifiers, + asteriskToken, + /*name*/ undefined, + /*typeParameters*/ undefined, + parameters, + /*type*/ undefined, + body ?? factory.createBlock([]) + ); + setOriginalNode(func, original); + setSourceMapRange(func, moveRangePastDecorators(original)); + setEmitFlags(func, EmitFlags.NoComments); + + // TODO(rbuckton): handle computed property names + const functionName = isPropertyNameLiteral(_name) || isPrivateIdentifier(_name) ? + factory.createStringLiteralFromNode(_name) : + undefined; + + const namedFunction = functionName ? + emitHelpers().createSetFunctionNameHelper(func, functionName) : + func; + + const method = factory.createPropertyAssignment(factory.createIdentifier(kind), namedFunction); + setOriginalNode(method, original); + setSourceMapRange(method, moveRangePastDecorators(original)); + setEmitFlags(method, EmitFlags.NoComments); + return method; + } + + /** + * Creates a pseudo-{@link PropertyDescriptor} object used when decorating a private {@link MethodDeclaration}. + */ + function createMethodDescriptorObject(node: MethodDeclaration, modifiers: ModifiersArray | undefined) { + return factory.createObjectLiteralExpression([ + createDescriptorMethod( + node, + node.name, + modifiers, + node.asteriskToken, + "value", + visitNodes(node.parameters, visitor, isParameter), + visitNode(node.body, visitor, isBlock)) + ]); + } + + /** + * Creates a pseudo-{@link PropertyDescriptor} object used when decorating a private {@link GetAccessorDeclaration}. + */ + function createGetAccessorDescriptorObject(node: GetAccessorDeclaration, modifiers: ModifiersArray | undefined) { + return factory.createObjectLiteralExpression([ + createDescriptorMethod( + node, + node.name, + modifiers, + /*asteriskToken*/ undefined, + "get", + [], + visitNode(node.body, visitor, isBlock)) + ]); + } + + /** + * Creates a pseudo-{@link PropertyDescriptor} object used when decorating a private {@link SetAccessorDeclaration}. + */ + function createSetAccessorDescriptorObject(node: SetAccessorDeclaration, modifiers: ModifiersArray | undefined) { + return factory.createObjectLiteralExpression([ + createDescriptorMethod( + node, + node.name, + modifiers, + /*asteriskToken*/ undefined, + "set", + visitNodes(node.parameters, visitor, isParameter), + visitNode(node.body, visitor, isBlock)) + ]); + } + + /** + * Creates a pseudo-{@link PropertyDescriptor} object used when decorating an `accessor` {@link PropertyDeclaration} with a private name. + */ + function createAccessorPropertyDescriptorObject(node: PropertyDeclaration, modifiers: ModifiersArray | undefined) { + // { + // get() { return this.${privateName}; }, + // set(value) { this.${privateName} = value; }, + // } + + return factory.createObjectLiteralExpression([ + createDescriptorMethod( + node, + node.name, + modifiers, + /*asteriskToken*/ undefined, + "get", + [], + factory.createBlock([ + factory.createReturnStatement( + factory.createPropertyAccessExpression( + factory.createThis(), + factory.getGeneratedPrivateNameForNode(node.name) + ) + ) + ]) + ), + createDescriptorMethod( + node, + node.name, + modifiers, + /*asteriskToken*/ undefined, + "set", + [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, + "value" + )], + factory.createBlock([ + factory.createExpressionStatement( + factory.createAssignment( + factory.createPropertyAccessExpression( + factory.createThis(), + factory.getGeneratedPrivateNameForNode(node.name) + ), + factory.createIdentifier("value") + ) + ) + ]) + ) + ]); + } + + /** + * Creates a {@link MethodDeclaration} that forwards its invocation to a {@link PropertyDescriptor} object. + * @param modifiers The modifiers for the resulting declaration. + * @param name The name for the resulting declaration. + * @param descriptorName The name of the descriptor variable. + */ + function createMethodDescriptorForwarder(modifiers: ModifiersArray | undefined, name: PropertyName, descriptorName: Identifier) { + // strip off all but the `static` modifier + modifiers = visitNodes(modifiers, node => isStaticModifier(node) ? node : undefined, isModifier); + return factory.createGetAccessorDeclaration( + modifiers, + name, + [], + /*type*/ undefined, + factory.createBlock([ + factory.createReturnStatement( + factory.createPropertyAccessExpression( + descriptorName, + factory.createIdentifier("value") + ) + ) + ]) + ); + } + + /** + * Creates a {@link GetAccessorDeclaration} that forwards its invocation to a {@link PropertyDescriptor} object. + * @param modifiers The modifiers for the resulting declaration. + * @param name The name for the resulting declaration. + * @param descriptorName The name of the descriptor variable. + */ + function createGetAccessorDescriptorForwarder(modifiers: ModifiersArray | undefined, name: PropertyName, descriptorName: Identifier) { + // strip off all but the `static` modifier + modifiers = visitNodes(modifiers, node => isStaticModifier(node) ? node : undefined, isModifier); + return factory.createGetAccessorDeclaration( + modifiers, + name, + [], + /*type*/ undefined, + factory.createBlock([ + factory.createReturnStatement( + factory.createFunctionCallCall( + factory.createPropertyAccessExpression( + descriptorName, + factory.createIdentifier("get") + ), + factory.createThis(), + [] + ) + ) + ]) + ); + } + + /** + * Creates a {@link SetAccessorDeclaration} that forwards its invocation to a {@link PropertyDescriptor} object. + * @param modifiers The modifiers for the resulting declaration. + * @param name The name for the resulting declaration. + * @param descriptorName The name of the descriptor variable. + */ + function createSetAccessorDescriptorForwarder(modifiers: ModifiersArray | undefined, name: PropertyName, descriptorName: Identifier) { + // strip off all but the `static` modifier + modifiers = visitNodes(modifiers, node => isStaticModifier(node) ? node : undefined, isModifier); + return factory.createSetAccessorDeclaration( + modifiers, + name, + [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, + "value" + )], + factory.createBlock([ + factory.createReturnStatement( + factory.createFunctionCallCall( + factory.createPropertyAccessExpression( + descriptorName, + factory.createIdentifier("set") + ), + factory.createThis(), + [factory.createIdentifier("value")] + ) + ) + ]) + ); + } + } +} diff --git a/src/compiler/transformers/legacyDecorators.ts b/src/compiler/transformers/legacyDecorators.ts index b5028b2c5d286..f8f87cb47f92a 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -94,7 +94,7 @@ namespace ts { function hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node: ClassDeclaration) { for (const member of node.members) { if (!canHaveDecorators(member)) continue; - const allDecorators = getAllDecoratorsOfClassElement(member, node); + const allDecorators = getAllDecoratorsOfClassElement(member, node, /*useLegacyDecorators*/ true); if (some(allDecorators?.decorators, decoratorContainsPrivateIdentifierInExpression)) return true; if (some(allDecorators?.parameters, parameterDecoratorsContainPrivateIdentifierInExpression)) return true; } @@ -258,7 +258,7 @@ namespace ts { const classExpression = factory.createClassExpression( /*modifiers*/ undefined, - name, + name && isGeneratedIdentifier(name) ? undefined : name, /*typeParameters*/ undefined, heritageClauses, members); @@ -472,7 +472,7 @@ namespace ts { * @param member The class member. */ function generateClassElementDecorationExpression(node: ClassExpression | ClassDeclaration, member: ClassElement) { - const allDecorators = getAllDecoratorsOfClassElement(member, node); + const allDecorators = getAllDecoratorsOfClassElement(member, node, /*useLegacyDecorators*/ true); const decoratorExpressions = transformAllDecoratorsOfDeclaration(allDecorators); if (!decoratorExpressions) { return undefined; diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 548efd9471215..7ae2837097a35 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -649,7 +649,7 @@ namespace ts { const moveModifiers = promoteToIIFE || facts & ClassFacts.IsExportOfNamespace || - facts & ClassFacts.HasClassOrConstructorParameterDecorators || + facts & ClassFacts.HasClassOrConstructorParameterDecorators && legacyDecorators || facts & ClassFacts.HasStaticInitializedProperties; // elide modifiers on the declaration if we are emitting an IIFE or the class is @@ -664,6 +664,7 @@ namespace ts { } const needsName = + moveModifiers && !node.name || facts & ClassFacts.HasMemberDecorators || facts & ClassFacts.HasStaticInitializedProperties; @@ -996,7 +997,7 @@ namespace ts { // The names are used more than once when: // - the property is non-static and its initializer is moved to the constructor (when there are parameter property assignments). // - the property has a decorator. - if (isComputedPropertyName(name) && ((!hasStaticModifier(member) && currentClassHasParameterProperties) || hasDecorators(member))) { + if (isComputedPropertyName(name) && ((!hasStaticModifier(member) && currentClassHasParameterProperties) || hasDecorators(member) && legacyDecorators)) { const expression = visitNode(name.expression, visitor, isExpression); const innerExpression = skipPartiallyEmittedExpressions(expression); if (!isSimpleInlineableExpression(innerExpression)) { @@ -1053,7 +1054,7 @@ namespace ts { function visitPropertyDeclaration(node: PropertyDeclaration, parent: ClassLikeDeclaration) { const isAmbient = node.flags & NodeFlags.Ambient || hasSyntacticModifier(node, ModifierFlags.Abstract); - if (isAmbient && !hasDecorators(node)) { + if (isAmbient && !(legacyDecorators && hasDecorators(node))) { return undefined; } diff --git a/src/compiler/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index 2c0552ee40c42..391ab27dfad24 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -438,10 +438,13 @@ namespace ts { * @param parent The class node that contains the member. * @param member The class member. */ - export function getAllDecoratorsOfClassElement(member: ClassElement, parent: ClassLikeDeclaration): AllDecorators | undefined { + export function getAllDecoratorsOfClassElement(member: ClassElement, parent: ClassLikeDeclaration, useLegacyDecorators: boolean): AllDecorators | undefined { switch (member.kind) { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: + if (!useLegacyDecorators) { + return getAllDecoratorsOfMethod(member as AccessorDeclaration); + } return getAllDecoratorsOfAccessors(member as AccessorDeclaration, parent); case SyntaxKind.MethodDeclaration: @@ -495,7 +498,7 @@ namespace ts { * * @param method The class method member. */ - function getAllDecoratorsOfMethod(method: MethodDeclaration): AllDecorators | undefined { + function getAllDecoratorsOfMethod(method: MethodDeclaration | AccessorDeclaration): AllDecorators | undefined { if (!method.body) { return undefined; } diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index cc5b4749835fd..3513feeef1324 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -49,6 +49,7 @@ "transformers/ts.ts", "transformers/classFields.ts", "transformers/typeSerializer.ts", + "transformers/esDecorators.ts", "transformers/legacyDecorators.ts", "transformers/es2017.ts", "transformers/es2018.ts", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 241492a94b77f..f35b62aebf4c1 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -885,6 +885,7 @@ namespace ts { /* @internal */ emitNode?: EmitNode; // Associated EmitNode (initialized by transforms) /* @internal */ contextualType?: Type; // Used to temporarily assign a contextual type during overload resolution /* @internal */ inferenceContext?: InferenceContext; // Inference context for contextual type + /* @internal */ transformer?: TransformerFactory; // Source transformer that created the node } export interface JSDocContainer { @@ -2416,6 +2417,9 @@ namespace ts { | SpreadAssignment // AssignmentRestProperty ; + /*@internal*/ + export type ObjectAssignmentElement = Exclude; + export type ArrayBindingOrAssignmentElement = | BindingElement | OmittedExpression // Elision @@ -2428,6 +2432,9 @@ namespace ts { | ElementAccessExpression // DestructuringAssignmentTarget ; + /*@internal*/ + export type ArrayAssignmentElement = Exclude; + export type BindingOrAssignmentElementRestIndicator = | DotDotDotToken // from BindingElement | SpreadElement // AssignmentRestElement @@ -2441,6 +2448,9 @@ namespace ts { | ElementAccessExpression | OmittedExpression; + /*@internal*/ + export type AssignmentElementTarget = Exclude; + export type ObjectBindingOrAssignmentPattern = | ObjectBindingPattern | ObjectLiteralExpression // ObjectAssignmentPattern @@ -3044,7 +3054,7 @@ namespace ts { readonly kind: SyntaxKind.DebuggerStatement; } - export interface MissingDeclaration extends DeclarationStatement { + export interface MissingDeclaration extends DeclarationStatement, PrimaryExpression { readonly kind: SyntaxKind.MissingDeclaration; readonly name?: Identifier; @@ -6660,6 +6670,7 @@ namespace ts { esModuleInterop?: boolean; /* @internal */ showConfig?: boolean; useDefineForClassFields?: boolean; + annotateTransforms?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } @@ -7466,8 +7477,10 @@ namespace ts { ClassPrivateFieldSet = 1 << 20, // __classPrivateFieldSet (used by the class private field transformation) ClassPrivateFieldIn = 1 << 21, // __classPrivateFieldIn (used by the class private field transformation) CreateBinding = 1 << 22, // __createBinding (use by the module transform for (re)exports and namespace imports) + ESDecorate = 1 << 23, // __esDecorate (used by ECMAScript decorators transformation) + RunInitializers = 1 << 24, // __runInitializers (used by ECMAScript decorators transformation) FirstEmitHelper = Extends, - LastEmitHelper = CreateBinding, + LastEmitHelper = RunInitializers, // Helpers included by ES2015 for..of ForOfIncludes = Values, @@ -8249,6 +8262,7 @@ namespace ts { /* @internal */ createFunctionCallCall(target: Expression, thisArg: Expression, argumentsList: readonly Expression[]): CallExpression; /* @internal */ createFunctionApplyCall(target: Expression, thisArg: Expression, argumentsExpression: Expression): CallExpression; /* @internal */ createObjectDefinePropertyCall(target: Expression, propertyName: string | Expression, attributes: Expression): CallExpression; + /* @internal */ createObjectGetOwnPropertyDescriptorCall(target: Expression, propertyName: string | Expression): CallExpression; /* @internal */ createReflectGetCall(target: Expression, propertyKey: Expression, receiver?: Expression): CallExpression; /* @internal */ createReflectSetCall(target: Expression, propertyKey: Expression, value: Expression, receiver?: Expression): CallExpression; /* @internal */ createPropertyDescriptor(attributes: PropertyDescriptorAttributes, singleLine?: boolean): ObjectLiteralExpression; @@ -8776,6 +8790,7 @@ namespace ts { /*@internal*/ stripInternal?: boolean; /*@internal*/ preserveSourceNewlines?: boolean; /*@internal*/ terminateUnterminatedLiterals?: boolean; + /*@internal*/ annotateTransforms?: boolean; /*@internal*/ relativeToBuildInfo?: (path: string) => string; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a2da620b6fd8f..31a110c8c3ff5 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1923,7 +1923,7 @@ namespace ts { case SyntaxKind.PropertyDeclaration: // property declarations are valid if their parent is a class declaration. return parent !== undefined - && (useLegacyDecorators ? isClassDeclaration(parent) : isClassLike(parent)); + && (useLegacyDecorators ? isClassDeclaration(parent) : isClassLike(parent) && !hasAbstractModifier(node) && !hasAmbientModifier(node)); case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: @@ -2016,6 +2016,19 @@ namespace ts { return false; } + export function isEmptyStringLiteral(node: StringLiteral): boolean { + if (node.textSourceNode) { + switch (node.textSourceNode.kind) { + case SyntaxKind.StringLiteral: + return isEmptyStringLiteral(node.textSourceNode); + case SyntaxKind.NoSubstitutionTemplateLiteral: + return node.text === ""; + } + return false; + } + return node.text === ""; + } + export function isJSXTagName(node: Node) { const { parent } = node; if (parent.kind === SyntaxKind.JsxOpeningElement || @@ -3485,6 +3498,17 @@ namespace ts { return node.kind === SyntaxKind.Identifier && (node as Identifier).escapedText === "Symbol"; } + /** + * Indicates whether a property name is the special `__proto__` property. + * Per the ECMA-262 spec, this only matters for property assignments whose name is + * the Identifier `__proto__`, or the string literal `"__proto__"`, but not for + * computed property names. + */ + export function isProtoSetter(node: PropertyName) { + return isIdentifier(node) ? idText(node) === "__proto__" : + isStringLiteral(node) && node.text === "__proto__"; + } + export function isPushOrUnshiftIdentifier(node: Identifier) { return node.escapedText === "push" || node.escapedText === "unshift"; } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index bc93daa3b973f..6c00d243bca19 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1614,6 +1614,7 @@ namespace ts { case SyntaxKind.ExpressionWithTypeArguments: case SyntaxKind.MetaProperty: case SyntaxKind.ImportKeyword: // technically this is only an Expression if it's in a CallExpression + case SyntaxKind.MissingDeclaration: return true; default: return false; diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 4069b1f86164a..83c1d5a85f61a 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -374,6 +374,25 @@ namespace ts { return updated; } + /** + * Visits the elements of a {@link CommaListExpression}. + * @param visitor The visitor to use when visiting expressions whose result will not be discarded at runtime. + * @param discardVisitor The visitor to use when visiting expressions whose result will be discarded at runtime. Defaults to {@link visitor}. + */ + export function visitCommaListElements(elements: NodeArray, visitor: Visitor, discardVisitor = visitor): NodeArray { + if (discardVisitor === visitor || elements.length <= 1) { + return visitNodes(elements, visitor, isExpression); + } + + let i = 0; + const length = elements.length; + return visitNodes(elements, node => { + const discarded = i < length - 1; + i++; + return discarded ? discardVisitor(node) : visitor(node); + }, isExpression); + } + /** * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. * diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 2c9fbe3011c95..cdb351bd454ef 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -11,7 +11,7 @@ declare var Promise: PromiseConstructor; // eslint-disable-line no-var /* @internal */ namespace ts { // These utilities are common to multiple language service features. - //#region + // #region export const scanner: Scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); export const enum SemanticMeaning { diff --git a/src/testRunner/unittests/transform.ts b/src/testRunner/unittests/transform.ts index b6dd2ee5befe8..433b78258badd 100644 --- a/src/testRunner/unittests/transform.ts +++ b/src/testRunner/unittests/transform.ts @@ -328,6 +328,7 @@ namespace ts { }, compilerOptions: { target: ScriptTarget.ES5, + experimentalDecorators: true, newLine: NewLineKind.CarriageReturnLineFeed, } }).outputText; @@ -639,6 +640,7 @@ class MyClass { }, compilerOptions: { target: ScriptTarget.ES2015, + experimentalDecorators: true, newLine: NewLineKind.CarriageReturnLineFeed, } }).outputText; @@ -654,6 +656,7 @@ const MyClass = class { }, compilerOptions: { target: ScriptTarget.ES2015, + experimentalDecorators: true, newLine: NewLineKind.CarriageReturnLineFeed, } }).outputText; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index c30eeaecddad7..3486d5655fa18 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1457,7 +1457,7 @@ declare namespace ts { export interface DebuggerStatement extends Statement { readonly kind: SyntaxKind.DebuggerStatement; } - export interface MissingDeclaration extends DeclarationStatement { + export interface MissingDeclaration extends DeclarationStatement, PrimaryExpression { readonly kind: SyntaxKind.MissingDeclaration; readonly name?: Identifier; } @@ -3088,6 +3088,7 @@ declare namespace ts { typeRoots?: string[]; esModuleInterop?: boolean; useDefineForClassFields?: boolean; + annotateTransforms?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } export interface WatchOptions { @@ -5122,6 +5123,12 @@ declare namespace ts { * Visits an iteration body, adding any block-scoped variables required by the transformation. */ function visitIterationBody(body: Statement, visitor: Visitor, context: TransformationContext): Statement; + /** + * Visits the elements of a {@link CommaListExpression}. + * @param visitor The visitor to use when visiting expressions whose result will not be discarded at runtime. + * @param discardVisitor The visitor to use when visiting expressions whose result will be discarded at runtime. Defaults to {@link visitor}. + */ + function visitCommaListElements(elements: NodeArray, visitor: Visitor, discardVisitor?: Visitor): NodeArray; /** * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. * diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 847e1301be640..5f9e1c14275ab 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1457,7 +1457,7 @@ declare namespace ts { export interface DebuggerStatement extends Statement { readonly kind: SyntaxKind.DebuggerStatement; } - export interface MissingDeclaration extends DeclarationStatement { + export interface MissingDeclaration extends DeclarationStatement, PrimaryExpression { readonly kind: SyntaxKind.MissingDeclaration; readonly name?: Identifier; } @@ -3088,6 +3088,7 @@ declare namespace ts { typeRoots?: string[]; esModuleInterop?: boolean; useDefineForClassFields?: boolean; + annotateTransforms?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } export interface WatchOptions { @@ -5122,6 +5123,12 @@ declare namespace ts { * Visits an iteration body, adding any block-scoped variables required by the transformation. */ function visitIterationBody(body: Statement, visitor: Visitor, context: TransformationContext): Statement; + /** + * Visits the elements of a {@link CommaListExpression}. + * @param visitor The visitor to use when visiting expressions whose result will not be discarded at runtime. + * @param discardVisitor The visitor to use when visiting expressions whose result will be discarded at runtime. Defaults to {@link visitor}. + */ + function visitCommaListElements(elements: NodeArray, visitor: Visitor, discardVisitor?: Visitor): NodeArray; /** * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. * diff --git a/tests/baselines/reference/autoAccessor2(target=es2015).js b/tests/baselines/reference/autoAccessor2(target=es2015).js index 2399dd2e5b502..7b4cb28008e9e 100644 --- a/tests/baselines/reference/autoAccessor2(target=es2015).js +++ b/tests/baselines/reference/autoAccessor2(target=es2015).js @@ -1,20 +1,20 @@ //// [autoAccessor2.ts] -class C1 { - accessor #a: any; - accessor #b = 1; - static accessor #c: any; - static accessor #d = 2; - - constructor() { - this.#a = 3; - this.#b = 4; - } - - static { - this.#c = 5; - this.#d = 6; - } -} +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} //// [autoAccessor2.js] diff --git a/tests/baselines/reference/autoAccessor5(target=es2015).js b/tests/baselines/reference/autoAccessor5(target=es2015).js index 09a773c950eeb..6f204b8217dcf 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2015).js +++ b/tests/baselines/reference/autoAccessor5(target=es2015).js @@ -1,14 +1,14 @@ //// [autoAccessor5.ts] -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - accessor [f()] = 1; +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + accessor [f()] = 1; } //// [autoAccessor5.js] @@ -45,6 +45,6 @@ class C2 { constructor() { _C2__e_accessor_storage.set(this, 1); } - get [(_C2__e_accessor_storage = new WeakMap(), _b = f(), _b)]() { return __classPrivateFieldGet(this, _C2__e_accessor_storage, "f"); } + get [(_C2__e_accessor_storage = new WeakMap(), _b = f())]() { return __classPrivateFieldGet(this, _C2__e_accessor_storage, "f"); } set [_b](value) { __classPrivateFieldSet(this, _C2__e_accessor_storage, value, "f"); } } diff --git a/tests/baselines/reference/autoAccessor5(target=es2022).js b/tests/baselines/reference/autoAccessor5(target=es2022).js index 51f3d6ded9305..f79577e076791 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2022).js +++ b/tests/baselines/reference/autoAccessor5(target=es2022).js @@ -1,14 +1,14 @@ //// [autoAccessor5.ts] -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - accessor [f()] = 1; +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + accessor [f()] = 1; } //// [autoAccessor5.js] @@ -29,6 +29,6 @@ class C1 { } class C2 { #_e_accessor_storage = 1; - get [(_a = f(), _a)]() { return this.#_e_accessor_storage; } + get [_a = f()]() { return this.#_e_accessor_storage; } set [_a](value) { this.#_e_accessor_storage = value; } } diff --git a/tests/baselines/reference/autoAccessor5(target=es5).js b/tests/baselines/reference/autoAccessor5(target=es5).js index 093dceb5fbd26..beb08668b0d50 100644 --- a/tests/baselines/reference/autoAccessor5(target=es5).js +++ b/tests/baselines/reference/autoAccessor5(target=es5).js @@ -67,7 +67,7 @@ var C2 = /** @class */ (function () { function C2() { _C2__a_accessor_storage.set(this, 1); } - Object.defineProperty(C2.prototype, (_C2__a_accessor_storage = new WeakMap(), _a = f(), _a), { + Object.defineProperty(C2.prototype, (_C2__a_accessor_storage = new WeakMap(), _a = f()), { get: function () { return __classPrivateFieldGet(this, _C2__a_accessor_storage, "f"); }, enumerable: false, configurable: true diff --git a/tests/baselines/reference/autoAccessor5(target=esnext).js b/tests/baselines/reference/autoAccessor5(target=esnext).js index 1d07c39a07f2c..d7620567c7b76 100644 --- a/tests/baselines/reference/autoAccessor5(target=esnext).js +++ b/tests/baselines/reference/autoAccessor5(target=esnext).js @@ -1,14 +1,14 @@ //// [autoAccessor5.ts] -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - accessor [f()] = 1; +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + accessor [f()] = 1; } //// [autoAccessor5.js] diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js index b49ce9ddaa4b2..4a7e70fb1064a 100644 --- a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js @@ -125,6 +125,10 @@ function foo16() { //// [blockScopedVariablesUseBeforeDef.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; function foo0() { var a = x; var x; @@ -190,6 +194,7 @@ function foo9() { } return class_2; }()), + __setFunctionName(_a, "y"), _a.a = x, _a); var x; @@ -211,6 +216,7 @@ function foo11() { } return class_3; }()), + __setFunctionName(_a, "y"), _a.a = x, _a); } diff --git a/tests/baselines/reference/classExpressionWithDecorator1.errors.txt b/tests/baselines/reference/classExpressionWithDecorator1.errors.txt index 10f0d8aa37684..9139704c18cf2 100644 --- a/tests/baselines/reference/classExpressionWithDecorator1.errors.txt +++ b/tests/baselines/reference/classExpressionWithDecorator1.errors.txt @@ -1,10 +1,7 @@ -tests/cases/compiler/classExpressionWithDecorator1.ts(1,9): error TS1109: Expression expected. -tests/cases/compiler/classExpressionWithDecorator1.ts(1,10): error TS2304: Cannot find name 'decorate'. +tests/cases/compiler/classExpressionWithDecorator1.ts(1,9): error TS1206: Decorators are not valid here. -==== tests/cases/compiler/classExpressionWithDecorator1.ts (2 errors) ==== +==== tests/cases/compiler/classExpressionWithDecorator1.ts (1 errors) ==== var v = @decorate class C { static p = 1 }; ~ -!!! error TS1109: Expression expected. - ~~~~~~~~ -!!! error TS2304: Cannot find name 'decorate'. \ No newline at end of file +!!! error TS1206: Decorators are not valid here. \ No newline at end of file diff --git a/tests/baselines/reference/classExpressionWithDecorator1.js b/tests/baselines/reference/classExpressionWithDecorator1.js index e96bc7d46d2cb..aedf550c02568 100644 --- a/tests/baselines/reference/classExpressionWithDecorator1.js +++ b/tests/baselines/reference/classExpressionWithDecorator1.js @@ -2,20 +2,11 @@ var v = @decorate class C { static p = 1 }; //// [classExpressionWithDecorator1.js] -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var v = ; -var C = /** @class */ (function () { - function C() { - } - C.p = 1; - C = __decorate([ - decorate - ], C); - return C; -}()); -; +var _a; +var v = (_a = /** @class */ (function () { + function C() { + } + return C; + }()), + _a.p = 1, + _a); diff --git a/tests/baselines/reference/classExpressionWithDecorator1.types b/tests/baselines/reference/classExpressionWithDecorator1.types index b153eabefa969..27922b1ae7b8b 100644 --- a/tests/baselines/reference/classExpressionWithDecorator1.types +++ b/tests/baselines/reference/classExpressionWithDecorator1.types @@ -1,9 +1,9 @@ === tests/cases/compiler/classExpressionWithDecorator1.ts === var v = @decorate class C { static p = 1 }; ->v : any -> : any +>v : typeof C +>@decorate class C { static p = 1 } : typeof C >decorate : any ->C : C +>C : typeof C >p : number >1 : 1 diff --git a/tests/baselines/reference/classStaticBlock18(target=es2015).js b/tests/baselines/reference/classStaticBlock18(target=es2015).js index 7269e6f67a78d..f80ae863cca61 100644 --- a/tests/baselines/reference/classStaticBlock18(target=es2015).js +++ b/tests/baselines/reference/classStaticBlock18(target=es2015).js @@ -15,6 +15,10 @@ function foo () { //// [classStaticBlock18.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; function foo() { var _a; return _a = class { @@ -24,6 +28,7 @@ function foo() { var _a; const c = (_a = class { }, + __setFunctionName(_a, "c"), _a.bar = 2, (() => { // do diff --git a/tests/baselines/reference/classStaticBlock18(target=es5).js b/tests/baselines/reference/classStaticBlock18(target=es5).js index 48597ad94cc17..814e8b9735d76 100644 --- a/tests/baselines/reference/classStaticBlock18(target=es5).js +++ b/tests/baselines/reference/classStaticBlock18(target=es5).js @@ -15,6 +15,10 @@ function foo () { //// [classStaticBlock18.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; function foo() { var _a; return _a = /** @class */ (function () { @@ -30,6 +34,7 @@ function foo() { } return class_2; }()), + __setFunctionName(_a, "c"), _a.bar = 2, (function () { // do diff --git a/tests/baselines/reference/decoratorOnArrowFunction.errors.txt b/tests/baselines/reference/decoratorOnArrowFunction.errors.txt index 14bde1e49bf27..a764f935b485f 100644 --- a/tests/baselines/reference/decoratorOnArrowFunction.errors.txt +++ b/tests/baselines/reference/decoratorOnArrowFunction.errors.txt @@ -1,16 +1,13 @@ -tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,9): error TS1109: Expression expected. -tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,16): error TS1146: Declaration expected. -tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,17): error TS1128: Declaration or statement expected. +tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,16): error TS1109: Expression expected. +tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,17): error TS1005: ';' expected. -==== tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts (3 errors) ==== +==== tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts (2 errors) ==== declare function dec(target: T): T; var F = @dec () => { - ~ -!!! error TS1109: Expression expected. -!!! error TS1146: Declaration expected. +!!! error TS1109: Expression expected. ~~ -!!! error TS1128: Declaration or statement expected. +!!! error TS1005: ';' expected. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnArrowFunction.types b/tests/baselines/reference/decoratorOnArrowFunction.types index 84ca4a9ffbe88..0da7f5780272c 100644 --- a/tests/baselines/reference/decoratorOnArrowFunction.types +++ b/tests/baselines/reference/decoratorOnArrowFunction.types @@ -5,7 +5,6 @@ declare function dec(target: T): T; var F = @dec () => { >F : any -> : any >dec () : unknown >dec : (target: T) => T } diff --git a/tests/baselines/reference/decoratorOnClass8.es6.js b/tests/baselines/reference/decoratorOnClass8.es6.js index 88dd41e7b6065..813c0eaa22133 100644 --- a/tests/baselines/reference/decoratorOnClass8.es6.js +++ b/tests/baselines/reference/decoratorOnClass8.es6.js @@ -13,8 +13,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -let default_1 = class default_1 { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); }; +var _a; +let default_1 = (_a = class { +}, __setFunctionName(_a, "default_1"), + _a); default_1.y = 1; default_1 = __decorate([ dec diff --git a/tests/baselines/reference/decoratorOnClassProperty13.js b/tests/baselines/reference/decoratorOnClassProperty13.js index ec6d69e73971b..3ce4ead68fa39 100644 --- a/tests/baselines/reference/decoratorOnClassProperty13.js +++ b/tests/baselines/reference/decoratorOnClassProperty13.js @@ -1,8 +1,8 @@ //// [decoratorOnClassProperty13.ts] -declare function dec(target: any, propertyKey: string, desc: PropertyDescriptor): void; - -class C { - @dec accessor prop; +declare function dec(target: any, propertyKey: string, desc: PropertyDescriptor): void; + +class C { + @dec accessor prop; } //// [decoratorOnClassProperty13.js] diff --git a/tests/baselines/reference/decoratorOnFunctionExpression.errors.txt b/tests/baselines/reference/decoratorOnFunctionExpression.errors.txt index 71aae3e13eb23..e705d8e4d071c 100644 --- a/tests/baselines/reference/decoratorOnFunctionExpression.errors.txt +++ b/tests/baselines/reference/decoratorOnFunctionExpression.errors.txt @@ -1,13 +1,16 @@ -tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,9): error TS1109: Expression expected. +tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,13): error TS1109: Expression expected. +tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,14): error TS1005: ',' expected. tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,23): error TS1003: Identifier expected. -==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts (2 errors) ==== +==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts (3 errors) ==== declare function dec(target: T): T; var F = @dec function () { - ~ + !!! error TS1109: Expression expected. + ~~~~~~~~ +!!! error TS1005: ',' expected. ~ !!! error TS1003: Identifier expected. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnFunctionExpression.symbols b/tests/baselines/reference/decoratorOnFunctionExpression.symbols index 43880c9d4ca0c..f1abe4f828bbe 100644 --- a/tests/baselines/reference/decoratorOnFunctionExpression.symbols +++ b/tests/baselines/reference/decoratorOnFunctionExpression.symbols @@ -9,5 +9,5 @@ declare function dec(target: T): T; var F = @dec function () { >F : Symbol(F, Decl(decoratorOnFunctionExpression.ts, 2, 3)) >dec : Symbol(dec, Decl(decoratorOnFunctionExpression.ts, 0, 0)) -> : Symbol((Missing), Decl(decoratorOnFunctionExpression.ts, 2, 7)) +> : Symbol((Missing), Decl(decoratorOnFunctionExpression.ts, 2, 12)) } diff --git a/tests/baselines/reference/decoratorOnFunctionExpression.types b/tests/baselines/reference/decoratorOnFunctionExpression.types index bd92cb4a1d69b..1009df12d89c0 100644 --- a/tests/baselines/reference/decoratorOnFunctionExpression.types +++ b/tests/baselines/reference/decoratorOnFunctionExpression.types @@ -5,7 +5,6 @@ declare function dec(target: T): T; var F = @dec function () { >F : any -> : any >dec : (target: T) => T > : () => void } diff --git a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js index bcaa79bd05a58..357ef7c064478 100644 --- a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js +++ b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js @@ -46,6 +46,10 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; var _a; exports.__esModule = true; exports.Test = exports.WithTags = exports.FooItem = exports.noPrivates = void 0; @@ -57,6 +61,7 @@ exports.noPrivates = (_a = /** @class */ (function () { class_1.prototype.tags = function () { }; return class_1; }()), + __setFunctionName(_a, "noPrivates"), _a.ps = -1, _a); // altered repro from #15066 to add private property diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2015).js new file mode 100644 index 0000000000000..b6cf760f47a8e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2015).js @@ -0,0 +1,48 @@ +//// [esDecorators-classDeclaration-accessors-nonStatic.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) get method1() { return 0; } + @dec(12) set method1(value) {} + @dec(21) get ["method2"]() { return 0; } + @dec(22) set ["method2"](value) {} + @dec(31) get [method3]() { return 0; } + @dec(32) set [method3](value) {} +} + + +//// [esDecorators-classDeclaration-accessors-nonStatic.js] +const method3 = "method3"; +let C = (() => { + var _a; + var _b, _c; + let _instanceExtraInitializers = []; + let _get_method1_decorators; + let _set_method1_decorators; + let _get_member_decorators; + let _set_member_decorators; + let _get_member_decorators_1; + let _set_member_decorators_1; + return _a = class C { + get method1() { return 0; } + set method1(value) { } + get ["method2"]() { return 0; } + set ["method2"](value) { } + get [(_get_method1_decorators = [dec(11)], _set_method1_decorators = [dec(12)], _get_member_decorators = [dec(21)], _set_member_decorators = [dec(22)], _get_member_decorators_1 = [dec(31)], _b = __propKey(method3))]() { return 0; } + set [(_set_member_decorators_1 = [dec(32)], _c = __propKey(method3))](value) { } + constructor() { + __runInitializers(this, _instanceExtraInitializers); + } + }, + (() => { + __esDecorate(_a, null, _get_method1_decorators, { kind: "getter", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_method1_decorators, { kind: "setter", name: "method1", static: false, private: false, access: { set(value) { this.method1 = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_member_decorators, { kind: "getter", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_member_decorators, { kind: "setter", name: "method2", static: false, private: false, access: { set(value) { this["method2"] = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_member_decorators_1, { kind: "getter", name: _b, static: false, private: false, access: { get() { return this[_b]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_member_decorators_1, { kind: "setter", name: _c, static: false, private: false, access: { set(value) { this[_c] = value; } } }, null, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2022).js new file mode 100644 index 0000000000000..cc4f94ea5ff4c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2022).js @@ -0,0 +1,46 @@ +//// [esDecorators-classDeclaration-accessors-nonStatic.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) get method1() { return 0; } + @dec(12) set method1(value) {} + @dec(21) get ["method2"]() { return 0; } + @dec(22) set ["method2"](value) {} + @dec(31) get [method3]() { return 0; } + @dec(32) set [method3](value) {} +} + + +//// [esDecorators-classDeclaration-accessors-nonStatic.js] +const method3 = "method3"; +let C = (() => { + var _a, _b; + let _instanceExtraInitializers = []; + let _get_method1_decorators; + let _set_method1_decorators; + let _get_member_decorators; + let _set_member_decorators; + let _get_member_decorators_1; + let _set_member_decorators_1; + return class C { + static { + __esDecorate(this, null, _get_method1_decorators, { kind: "getter", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_method1_decorators, { kind: "setter", name: "method1", static: false, private: false, access: { set(value) { this.method1 = value; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_member_decorators, { kind: "getter", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_member_decorators, { kind: "setter", name: "method2", static: false, private: false, access: { set(value) { this["method2"] = value; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_member_decorators_1, { kind: "getter", name: _a, static: false, private: false, access: { get() { return this[_a]; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_member_decorators_1, { kind: "setter", name: _b, static: false, private: false, access: { set(value) { this[_b] = value; } } }, null, _instanceExtraInitializers); + } + get method1() { return 0; } + set method1(value) { } + get ["method2"]() { return 0; } + set ["method2"](value) { } + get [(_get_method1_decorators = [dec(11)], _set_method1_decorators = [dec(12)], _get_member_decorators = [dec(21)], _set_member_decorators = [dec(22)], _get_member_decorators_1 = [dec(31)], _a = __propKey(method3))]() { return 0; } + set [(_set_member_decorators_1 = [dec(32)], _b = __propKey(method3))](value) { } + constructor() { + __runInitializers(this, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es5).js new file mode 100644 index 0000000000000..7eca234366d4e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es5).js @@ -0,0 +1,66 @@ +//// [esDecorators-classDeclaration-accessors-nonStatic.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) get method1() { return 0; } + @dec(12) set method1(value) {} + @dec(21) get ["method2"]() { return 0; } + @dec(22) set ["method2"](value) {} + @dec(31) get [method3]() { return 0; } + @dec(32) set [method3](value) {} +} + + +//// [esDecorators-classDeclaration-accessors-nonStatic.js] +var _this = this; +var method3 = "method3"; +var C = function () { + var _a; + var _b, _c; + var _instanceExtraInitializers = []; + var _get_method1_decorators; + var _set_method1_decorators; + var _get_member_decorators; + var _set_member_decorators; + var _get_member_decorators_1; + var _set_member_decorators_1; + return _a = /** @class */ (function () { + function C() { + __runInitializers(this, _instanceExtraInitializers); + } + Object.defineProperty(C.prototype, "method1", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C.prototype, "method2", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C.prototype, (_get_method1_decorators = [dec(11)], _set_method1_decorators = [dec(12)], _get_member_decorators = [dec(21)], _set_member_decorators = [dec(22)], _get_member_decorators_1 = [dec(31)], _b = __propKey(method3)), { + get: function () { return 0; }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C.prototype, (_set_member_decorators_1 = [dec(32)], _c = __propKey(method3)), { + set: function (value) { }, + enumerable: false, + configurable: true + }); + return C; + }()), + (function () { + __esDecorate(_a, null, _get_method1_decorators, { kind: "getter", name: "method1", static: false, private: false, access: { get: function () { return this.method1; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_method1_decorators, { kind: "setter", name: "method1", static: false, private: false, access: { set: function (value) { this.method1 = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_member_decorators, { kind: "getter", name: "method2", static: false, private: false, access: { get: function () { return this["method2"]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_member_decorators, { kind: "setter", name: "method2", static: false, private: false, access: { set: function (value) { this["method2"] = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_member_decorators_1, { kind: "getter", name: _b, static: false, private: false, access: { get: function () { return this[_b]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_member_decorators_1, { kind: "setter", name: _c, static: false, private: false, access: { set: function (value) { this[_c] = value; } } }, null, _instanceExtraInitializers); + })(), + _a; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).js new file mode 100644 index 0000000000000..30c466a744261 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).js @@ -0,0 +1,31 @@ +//// [esDecorators-classDeclaration-accessors-nonStatic.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) get method1() { return 0; } + @dec(12) set method1(value) {} + @dec(21) get ["method2"]() { return 0; } + @dec(22) set ["method2"](value) {} + @dec(31) get [method3]() { return 0; } + @dec(32) set [method3](value) {} +} + + +//// [esDecorators-classDeclaration-accessors-nonStatic.js] +const method3 = "method3"; +class C { + @dec(11) + get method1() { return 0; } + @dec(12) + set method1(value) { } + @dec(21) + get ["method2"]() { return 0; } + @dec(22) + set ["method2"](value) { } + @dec(31) + get [method3]() { return 0; } + @dec(32) + set [method3](value) { } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2015).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2015).errors.txt new file mode 100644 index 0000000000000..9a9fc92842f44 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2015).errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(8,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(9,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(10,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(11,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts (6 errors) ==== + declare let dec: any; + + const method3 = "method3"; + + abstract class C { + @dec(11) abstract get method1(): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(12) abstract set method1(value); + ~ +!!! error TS1206: Decorators are not valid here. + @dec(21) abstract get ["method2"](): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(22) abstract set ["method2"](value); + ~ +!!! error TS1206: Decorators are not valid here. + @dec(31) abstract get [method3](): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(32) abstract set [method3](value); + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2015).js new file mode 100644 index 0000000000000..a69890e6af08c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2015).js @@ -0,0 +1,19 @@ +//// [esDecorators-classDeclaration-accessors-nonStaticAbstract.ts] +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(11) abstract get method1(): number; + @dec(12) abstract set method1(value); + @dec(21) abstract get ["method2"](): number; + @dec(22) abstract set ["method2"](value); + @dec(31) abstract get [method3](): number; + @dec(32) abstract set [method3](value); +} + + +//// [esDecorators-classDeclaration-accessors-nonStaticAbstract.js] +const method3 = "method3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2022).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2022).errors.txt new file mode 100644 index 0000000000000..9a9fc92842f44 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2022).errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(8,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(9,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(10,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(11,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts (6 errors) ==== + declare let dec: any; + + const method3 = "method3"; + + abstract class C { + @dec(11) abstract get method1(): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(12) abstract set method1(value); + ~ +!!! error TS1206: Decorators are not valid here. + @dec(21) abstract get ["method2"](): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(22) abstract set ["method2"](value); + ~ +!!! error TS1206: Decorators are not valid here. + @dec(31) abstract get [method3](): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(32) abstract set [method3](value); + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2022).js new file mode 100644 index 0000000000000..a69890e6af08c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es2022).js @@ -0,0 +1,19 @@ +//// [esDecorators-classDeclaration-accessors-nonStaticAbstract.ts] +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(11) abstract get method1(): number; + @dec(12) abstract set method1(value); + @dec(21) abstract get ["method2"](): number; + @dec(22) abstract set ["method2"](value); + @dec(31) abstract get [method3](): number; + @dec(32) abstract set [method3](value); +} + + +//// [esDecorators-classDeclaration-accessors-nonStaticAbstract.js] +const method3 = "method3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es5).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es5).errors.txt new file mode 100644 index 0000000000000..9a9fc92842f44 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es5).errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(8,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(9,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(10,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(11,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts (6 errors) ==== + declare let dec: any; + + const method3 = "method3"; + + abstract class C { + @dec(11) abstract get method1(): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(12) abstract set method1(value); + ~ +!!! error TS1206: Decorators are not valid here. + @dec(21) abstract get ["method2"](): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(22) abstract set ["method2"](value); + ~ +!!! error TS1206: Decorators are not valid here. + @dec(31) abstract get [method3](): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(32) abstract set [method3](value); + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es5).js new file mode 100644 index 0000000000000..94bb8f522aeff --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=es5).js @@ -0,0 +1,22 @@ +//// [esDecorators-classDeclaration-accessors-nonStaticAbstract.ts] +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(11) abstract get method1(): number; + @dec(12) abstract set method1(value); + @dec(21) abstract get ["method2"](): number; + @dec(22) abstract set ["method2"](value); + @dec(31) abstract get [method3](): number; + @dec(32) abstract set [method3](value); +} + + +//// [esDecorators-classDeclaration-accessors-nonStaticAbstract.js] +var method3 = "method3"; +var C = /** @class */ (function () { + function C() { + } + return C; +}()); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=esnext).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=esnext).errors.txt new file mode 100644 index 0000000000000..9a9fc92842f44 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=esnext).errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(8,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(9,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(10,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts(11,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts (6 errors) ==== + declare let dec: any; + + const method3 = "method3"; + + abstract class C { + @dec(11) abstract get method1(): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(12) abstract set method1(value); + ~ +!!! error TS1206: Decorators are not valid here. + @dec(21) abstract get ["method2"](): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(22) abstract set ["method2"](value); + ~ +!!! error TS1206: Decorators are not valid here. + @dec(31) abstract get [method3](): number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(32) abstract set [method3](value); + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=esnext).js new file mode 100644 index 0000000000000..a69890e6af08c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticAbstract(target=esnext).js @@ -0,0 +1,19 @@ +//// [esDecorators-classDeclaration-accessors-nonStaticAbstract.ts] +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(11) abstract get method1(): number; + @dec(12) abstract set method1(value); + @dec(21) abstract get ["method2"](): number; + @dec(22) abstract set ["method2"](value); + @dec(31) abstract get [method3](): number; + @dec(32) abstract set [method3](value); +} + + +//// [esDecorators-classDeclaration-accessors-nonStaticAbstract.js] +const method3 = "method3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js new file mode 100644 index 0000000000000..8b4fa553e28b4 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js @@ -0,0 +1,34 @@ +//// [esDecorators-classDeclaration-accessors-nonStaticPrivate.ts] +declare let dec: any; + +class C { + @dec(1) get #method1() { return 0; } + @dec(2) set #method1(value) {} +} + + +//// [esDecorators-classDeclaration-accessors-nonStaticPrivate.js] +let C = (() => { + var _C_instances, _a, _C_method1_get, _C_method1_set; + let _instanceExtraInitializers = []; + let _private_get_method1_decorators; + let _private_get_method1_descriptor; + let _private_set_method1_decorators; + let _private_set_method1_descriptor; + return _a = class C { + constructor() { + _C_instances.add(this); + __runInitializers(this, _instanceExtraInitializers); + } + }, + _C_instances = new WeakSet(), + _C_method1_get = function _C_method1_get() { return _private_get_method1_descriptor.get.call(this); }, + _C_method1_set = function _C_method1_set(value) { return _private_set_method1_descriptor.set.call(this, value); }, + (() => { + _private_get_method1_decorators = [dec(1)]; + _private_set_method1_decorators = [dec(2)]; + __esDecorate(_a, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_method1_get); } } }, null, _instanceExtraInitializers); + __esDecorate(_a, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true, access: { set(value) { __classPrivateFieldSet(this, _C_instances, value, "a", _C_method1_set); } } }, null, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js new file mode 100644 index 0000000000000..9df2cdace1ccb --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js @@ -0,0 +1,30 @@ +//// [esDecorators-classDeclaration-accessors-nonStaticPrivate.ts] +declare let dec: any; + +class C { + @dec(1) get #method1() { return 0; } + @dec(2) set #method1(value) {} +} + + +//// [esDecorators-classDeclaration-accessors-nonStaticPrivate.js] +let C = (() => { + let _instanceExtraInitializers = []; + let _private_get_method1_decorators; + let _private_get_method1_descriptor; + let _private_set_method1_decorators; + let _private_set_method1_descriptor; + return class C { + static { + _private_get_method1_decorators = [dec(1)]; + _private_set_method1_decorators = [dec(2)]; + __esDecorate(this, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true, access: { get() { return this.#method1; } } }, null, _instanceExtraInitializers); + __esDecorate(this, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true, access: { set(value) { this.#method1 = value; } } }, null, _instanceExtraInitializers); + } + get #method1() { return _private_get_method1_descriptor.get.call(this); } + set #method1(value) { return _private_set_method1_descriptor.set.call(this, value); } + constructor() { + __runInitializers(this, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).js new file mode 100644 index 0000000000000..2532e1cfc46e2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-accessors-nonStaticPrivate.ts] +declare let dec: any; + +class C { + @dec(1) get #method1() { return 0; } + @dec(2) set #method1(value) {} +} + + +//// [esDecorators-classDeclaration-accessors-nonStaticPrivate.js] +class C { + @dec(1) + get #method1() { return 0; } + @dec(2) + set #method1(value) { } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2015).js new file mode 100644 index 0000000000000..ab4333e46c377 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2015).js @@ -0,0 +1,46 @@ +//// [esDecorators-classDeclaration-accessors-static.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) static get method1() { return 0; } + @dec(12) static set method1(value) {} + @dec(21) static get ["method2"]() { return 0; } + @dec(22) static set ["method2"](value) {} + @dec(31) static get [method3]() { return 0; } + @dec(32) static set [method3](value) {} +} + + +//// [esDecorators-classDeclaration-accessors-static.js] +const method3 = "method3"; +let C = (() => { + var _a; + var _b, _c; + let _staticExtraInitializers = []; + let _static_get_method1_decorators; + let _static_set_method1_decorators; + let _static_get_member_decorators; + let _static_set_member_decorators; + let _static_get_member_decorators_1; + let _static_set_member_decorators_1; + return _a = class C { + static get method1() { return 0; } + static set method1(value) { } + static get ["method2"]() { return 0; } + static set ["method2"](value) { } + static get [(_static_get_method1_decorators = [dec(11)], _static_set_method1_decorators = [dec(12)], _static_get_member_decorators = [dec(21)], _static_set_member_decorators = [dec(22)], _static_get_member_decorators_1 = [dec(31)], _b = __propKey(method3))]() { return 0; } + static set [(_static_set_member_decorators_1 = [dec(32)], _c = __propKey(method3))](value) { } + }, + (() => { + __esDecorate(_a, null, _static_get_method1_decorators, { kind: "getter", name: "method1", static: true, private: false, access: { get() { return this.method1; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_method1_decorators, { kind: "setter", name: "method1", static: true, private: false, access: { set(value) { this.method1 = value; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_member_decorators, { kind: "getter", name: "method2", static: true, private: false, access: { get() { return this["method2"]; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_member_decorators, { kind: "setter", name: "method2", static: true, private: false, access: { set(value) { this["method2"] = value; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_member_decorators_1, { kind: "getter", name: _b, static: true, private: false, access: { get() { return this[_b]; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_member_decorators_1, { kind: "setter", name: _c, static: true, private: false, access: { set(value) { this[_c] = value; } } }, null, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2022).js new file mode 100644 index 0000000000000..08ef8ac77cef7 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2022).js @@ -0,0 +1,44 @@ +//// [esDecorators-classDeclaration-accessors-static.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) static get method1() { return 0; } + @dec(12) static set method1(value) {} + @dec(21) static get ["method2"]() { return 0; } + @dec(22) static set ["method2"](value) {} + @dec(31) static get [method3]() { return 0; } + @dec(32) static set [method3](value) {} +} + + +//// [esDecorators-classDeclaration-accessors-static.js] +const method3 = "method3"; +let C = (() => { + var _a, _b; + let _staticExtraInitializers = []; + let _static_get_method1_decorators; + let _static_set_method1_decorators; + let _static_get_member_decorators; + let _static_set_member_decorators; + let _static_get_member_decorators_1; + let _static_set_member_decorators_1; + return class C { + static { + __esDecorate(this, null, _static_get_method1_decorators, { kind: "getter", name: "method1", static: true, private: false, access: { get() { return this.method1; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_set_method1_decorators, { kind: "setter", name: "method1", static: true, private: false, access: { set(value) { this.method1 = value; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_get_member_decorators, { kind: "getter", name: "method2", static: true, private: false, access: { get() { return this["method2"]; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_set_member_decorators, { kind: "setter", name: "method2", static: true, private: false, access: { set(value) { this["method2"] = value; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_get_member_decorators_1, { kind: "getter", name: _a, static: true, private: false, access: { get() { return this[_a]; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_set_member_decorators_1, { kind: "setter", name: _b, static: true, private: false, access: { set(value) { this[_b] = value; } } }, null, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static get method1() { return 0; } + static set method1(value) { } + static get ["method2"]() { return 0; } + static set ["method2"](value) { } + static get [(_static_get_method1_decorators = [dec(11)], _static_set_method1_decorators = [dec(12)], _static_get_member_decorators = [dec(21)], _static_set_member_decorators = [dec(22)], _static_get_member_decorators_1 = [dec(31)], _a = __propKey(method3))]() { return 0; } + static set [(_static_set_member_decorators_1 = [dec(32)], _b = __propKey(method3))](value) { } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es5).js new file mode 100644 index 0000000000000..158f68a9338c5 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es5).js @@ -0,0 +1,66 @@ +//// [esDecorators-classDeclaration-accessors-static.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) static get method1() { return 0; } + @dec(12) static set method1(value) {} + @dec(21) static get ["method2"]() { return 0; } + @dec(22) static set ["method2"](value) {} + @dec(31) static get [method3]() { return 0; } + @dec(32) static set [method3](value) {} +} + + +//// [esDecorators-classDeclaration-accessors-static.js] +var _this = this; +var method3 = "method3"; +var C = function () { + var _a; + var _b, _c; + var _staticExtraInitializers = []; + var _static_get_method1_decorators; + var _static_set_method1_decorators; + var _static_get_member_decorators; + var _static_set_member_decorators; + var _static_get_member_decorators_1; + var _static_set_member_decorators_1; + return _a = /** @class */ (function () { + function C() { + } + Object.defineProperty(C, "method1", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C, "method2", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C, (_static_get_method1_decorators = [dec(11)], _static_set_method1_decorators = [dec(12)], _static_get_member_decorators = [dec(21)], _static_set_member_decorators = [dec(22)], _static_get_member_decorators_1 = [dec(31)], _b = __propKey(method3)), { + get: function () { return 0; }, + enumerable: false, + configurable: true + }); + Object.defineProperty(C, (_static_set_member_decorators_1 = [dec(32)], _c = __propKey(method3)), { + set: function (value) { }, + enumerable: false, + configurable: true + }); + return C; + }()), + (function () { + __esDecorate(_a, null, _static_get_method1_decorators, { kind: "getter", name: "method1", static: true, private: false, access: { get: function () { return this.method1; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_method1_decorators, { kind: "setter", name: "method1", static: true, private: false, access: { set: function (value) { this.method1 = value; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_member_decorators, { kind: "getter", name: "method2", static: true, private: false, access: { get: function () { return this["method2"]; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_member_decorators, { kind: "setter", name: "method2", static: true, private: false, access: { set: function (value) { this["method2"] = value; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_member_decorators_1, { kind: "getter", name: _b, static: true, private: false, access: { get: function () { return this[_b]; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_member_decorators_1, { kind: "setter", name: _c, static: true, private: false, access: { set: function (value) { this[_c] = value; } } }, null, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _a; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=esnext).js new file mode 100644 index 0000000000000..3a0729fc9f5b1 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=esnext).js @@ -0,0 +1,31 @@ +//// [esDecorators-classDeclaration-accessors-static.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) static get method1() { return 0; } + @dec(12) static set method1(value) {} + @dec(21) static get ["method2"]() { return 0; } + @dec(22) static set ["method2"](value) {} + @dec(31) static get [method3]() { return 0; } + @dec(32) static set [method3](value) {} +} + + +//// [esDecorators-classDeclaration-accessors-static.js] +const method3 = "method3"; +class C { + @dec(11) + static get method1() { return 0; } + @dec(12) + static set method1(value) { } + @dec(21) + static get ["method2"]() { return 0; } + @dec(22) + static set ["method2"](value) { } + @dec(31) + static get [method3]() { return 0; } + @dec(32) + static set [method3](value) { } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js new file mode 100644 index 0000000000000..b39532b5aa70c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js @@ -0,0 +1,66 @@ +//// [esDecorators-classDeclaration-accessors-staticPrivate.ts] +declare let dec: any; + +class C { + @dec(1) static get #method1() { return 0; } + @dec(2) static set #method1(value) {} +} + +// TODO: We should translate these to weakmaps when < ESNext +@dec +class D { + static get #method1() { return 0; } + static set #method1(value) {} + static { + this.#method1; + this.#method1 = 1; + } +} + + +//// [esDecorators-classDeclaration-accessors-staticPrivate.js] +let C = (() => { + var _a, _C_method1_get, _C_method1_set; + let _staticExtraInitializers = []; + let _static_private_get_method1_decorators; + let _static_private_get_method1_descriptor; + let _static_private_set_method1_decorators; + let _static_private_set_method1_descriptor; + return _a = class C { + }, + _C_method1_get = function _C_method1_get() { return _static_private_get_method1_descriptor.get.call(this); }, + _C_method1_set = function _C_method1_set(value) { return _static_private_set_method1_descriptor.set.call(this, value); }, + (() => { + _static_private_get_method1_decorators = [dec(1)]; + _static_private_set_method1_decorators = [dec(2)]; + __esDecorate(_a, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_method1_get); } } }, null, _staticExtraInitializers); + __esDecorate(_a, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _a, value, "a", _C_method1_set); } } }, null, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _a; +})(); +let D = (() => { + var _a, _method1_get, _method1_set; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = (_a = class { + }, + _method1_get = function _method1_get() { return 0; }, + _method1_set = function _method1_set(value) { }, + __setFunctionName(_a, "D"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(), + (() => { + __classPrivateFieldGet(_classThis, _a, "a", _method1_get); + __classPrivateFieldSet(_classThis, _a, 1, "a", _method1_set); + })(), + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js new file mode 100644 index 0000000000000..abed35212288e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js @@ -0,0 +1,61 @@ +//// [esDecorators-classDeclaration-accessors-staticPrivate.ts] +declare let dec: any; + +class C { + @dec(1) static get #method1() { return 0; } + @dec(2) static set #method1(value) {} +} + +// TODO: We should translate these to weakmaps when < ESNext +@dec +class D { + static get #method1() { return 0; } + static set #method1(value) {} + static { + this.#method1; + this.#method1 = 1; + } +} + + +//// [esDecorators-classDeclaration-accessors-staticPrivate.js] +let C = (() => { + let _staticExtraInitializers = []; + let _static_private_get_method1_decorators; + let _static_private_get_method1_descriptor; + let _static_private_set_method1_decorators; + let _static_private_set_method1_descriptor; + return class C { + static { + _static_private_get_method1_decorators = [dec(1)]; + _static_private_set_method1_decorators = [dec(2)]; + __esDecorate(this, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true, access: { get() { return this.#method1; } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true, access: { set(value) { this.#method1 = value; } } }, null, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static get #method1() { return _static_private_get_method1_descriptor.get.call(this); } + static set #method1(value) { return _static_private_set_method1_descriptor.set.call(this, value); } + }; +})(); +let D = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + } + static get #method1() { return 0; } + static set #method1(value) { } + static { + _classThis.#method1; + _classThis.#method1 = 1; + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).js new file mode 100644 index 0000000000000..a83b666bdec00 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).js @@ -0,0 +1,37 @@ +//// [esDecorators-classDeclaration-accessors-staticPrivate.ts] +declare let dec: any; + +class C { + @dec(1) static get #method1() { return 0; } + @dec(2) static set #method1(value) {} +} + +// TODO: We should translate these to weakmaps when < ESNext +@dec +class D { + static get #method1() { return 0; } + static set #method1(value) {} + static { + this.#method1; + this.#method1 = 1; + } +} + + +//// [esDecorators-classDeclaration-accessors-staticPrivate.js] +class C { + @dec(1) + static get #method1() { return 0; } + @dec(2) + static set #method1(value) { } +} +// TODO: We should translate these to weakmaps when < ESNext +@dec +class D { + static get #method1() { return 0; } + static set #method1(value) { } + static { + this.#method1; + this.#method1 = 1; + } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.1.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.1.js new file mode 100644 index 0000000000000..9451ccfeba1a7 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.1.js @@ -0,0 +1,50 @@ +//// [esDecorators-classDeclaration-classSuper.1.ts] +declare var dec: any; + +declare class Base { + static method(...args: any[]): void; +} + +const method = "method"; + +@dec +class C extends Base { + static { + super.method(); + super["method"](); + super[method](); + + super.method``; + super["method"]``; + super[method]``; + } +} + + +//// [esDecorators-classDeclaration-classSuper.1.js] +const method = "method"; +let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Base; + var C = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + } + static { + Reflect.get(_classSuper, "method", _classThis).call(_classThis); + Reflect.get(_classSuper, "method", _classThis).call(_classThis); + Reflect.get(_classSuper, method, _classThis).call(_classThis); + Reflect.get(_classSuper, "method", _classThis).bind(_classThis) ``; + Reflect.get(_classSuper, "method", _classThis).bind(_classThis) ``; + Reflect.get(_classSuper, method, _classThis).bind(_classThis) ``; + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js new file mode 100644 index 0000000000000..8dc5819457713 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js @@ -0,0 +1,90 @@ +//// [esDecorators-classDeclaration-classSuper.2.ts] +declare var dec: any; + +// class expression in extends should not get an assigned name +@dec +class C1 extends class { } { + static { + super.name; + } +} + +// function expression in extends should not get an assigned name +@dec +class C2 extends (function() {} as any) { + static { + super.name; + } +} + +// arrow function in extends should not get an assigned name +@dec +class C3 extends ((() => {}) as any) { + static { + super.name; + } +} + + +//// [esDecorators-classDeclaration-classSuper.2.js] +let C1 = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = (0, class { + }); + var C1 = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C1 = _classThis = _classDescriptor.value; + } + static { + Reflect.get(_classSuper, "name", _classThis); + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C1; +})(); +let C2 = (() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + let _classSuper_1 = (0, function () { }); + var C2 = class extends _classSuper_1 { + static { + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + C2 = _classThis_1 = _classDescriptor_1.value; + } + static { + Reflect.get(_classSuper_1, "name", _classThis_1); + } + static { + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return C2; +})(); +let C3 = (() => { + let _classDecorators_2 = [dec]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + let _classSuper_2 = (0, (() => { })); + var C3 = class extends _classSuper_2 { + static { + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + C3 = _classThis_2 = _classDescriptor_2.value; + } + static { + Reflect.get(_classSuper_2, "name", _classThis_2); + } + static { + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + }; + return C3; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.3.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.3.js new file mode 100644 index 0000000000000..91afab35232c0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.3.js @@ -0,0 +1,94 @@ +//// [esDecorators-classDeclaration-classSuper.3.ts] +declare var dec: any; + +declare class Base { + static x: number; +} + +const x = "x"; + +@dec +class C extends Base { + static { + super.x; + super.x = 1; + super.x += 1; + super.x++; + super.x--; + ++super.x; + --super.x; + ({ x: super.x } = { x: 1 }); + [super.x] = [1]; + + super["x"]; + super["x"] = 1; + super["x"] += 1; + super["x"]++; + super["x"]--; + ++super["x"]; + --super["x"]; + ({ x: super["x"] } = { x: 1 }); + [super["x"]] = [1]; + + super[x]; + super[x] = 1; + super[x] += 1; + super[x]++; + super[x]--; + ++super[x]; + --super[x]; + ({ x: super[x] } = { x: 1 }); + [super[x]] = [1]; + } +} + + +//// [esDecorators-classDeclaration-classSuper.3.js] +const x = "x"; +let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Base; + var C = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + } + static { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; + Reflect.get(_classSuper, "x", _classThis); + Reflect.set(_classSuper, "x", 1, _classThis); + Reflect.set(_classSuper, "x", Reflect.get(_classSuper, "x", _classThis) + 1, _classThis); + Reflect.set(_classSuper, "x", (_a = Reflect.get(_classSuper, "x", _classThis), _a++, _a), _classThis); + Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _b--, _b), _classThis); + Reflect.set(_classSuper, "x", (_c = Reflect.get(_classSuper, "x", _classThis), ++_c), _classThis); + Reflect.set(_classSuper, "x", (_d = Reflect.get(_classSuper, "x", _classThis), --_d), _classThis); + ({ x: ({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value } = { x: 1 }); + [({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value] = [1]; + Reflect.get(_classSuper, "x", _classThis); + Reflect.set(_classSuper, "x", 1, _classThis); + Reflect.set(_classSuper, "x", Reflect.get(_classSuper, "x", _classThis) + 1, _classThis); + Reflect.set(_classSuper, "x", (_e = Reflect.get(_classSuper, "x", _classThis), _e++, _e), _classThis); + Reflect.set(_classSuper, "x", (_f = Reflect.get(_classSuper, "x", _classThis), _f--, _f), _classThis); + Reflect.set(_classSuper, "x", (_g = Reflect.get(_classSuper, "x", _classThis), ++_g), _classThis); + Reflect.set(_classSuper, "x", (_h = Reflect.get(_classSuper, "x", _classThis), --_h), _classThis); + ({ x: ({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value } = { x: 1 }); + [({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value] = [1]; + Reflect.get(_classSuper, x, _classThis); + Reflect.set(_classSuper, x, 1, _classThis); + Reflect.set(_classSuper, _j = x, Reflect.get(_classSuper, _j, _classThis) + 1, _classThis); + Reflect.set(_classSuper, _k = x, (_l = Reflect.get(_classSuper, _k, _classThis), _l++, _l), _classThis); + Reflect.set(_classSuper, _m = x, (_o = Reflect.get(_classSuper, _m, _classThis), _o--, _o), _classThis); + Reflect.set(_classSuper, _p = x, (_q = Reflect.get(_classSuper, _p, _classThis), ++_q), _classThis); + Reflect.set(_classSuper, _r = x, (_s = Reflect.get(_classSuper, _r, _classThis), --_s), _classThis); + ({ x: ({ set value(_a) { Reflect.set(_classSuper, x, _a, _classThis); } }).value } = { x: 1 }); + [({ set value(_a) { Reflect.set(_classSuper, x, _a, _classThis); } }).value] = [1]; + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.4.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.4.js new file mode 100644 index 0000000000000..17e2f994b417f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.4.js @@ -0,0 +1,45 @@ +//// [esDecorators-classDeclaration-classSuper.4.ts] +declare var dec: any; + +declare class Base { + static method(...args: any[]): number; +} + +const method = "method"; + +@dec +class C extends Base { + static a = super.method(); + static b = super["method"](); + static c = super[method](); + static d = super.method``; + static e = super["method"]``; + static f = super[method]``; +} + + +//// [esDecorators-classDeclaration-classSuper.4.js] +const method = "method"; +let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Base; + var C = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + } + static a = Reflect.get(_classSuper, "method", _classThis).call(_classThis); + static b = Reflect.get(_classSuper, "method", _classThis).call(_classThis); + static c = Reflect.get(_classSuper, method, _classThis).call(_classThis); + static d = Reflect.get(_classSuper, "method", _classThis).bind(_classThis) ``; + static e = Reflect.get(_classSuper, "method", _classThis).bind(_classThis) ``; + static f = Reflect.get(_classSuper, method, _classThis).bind(_classThis) ``; + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.5.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.5.js new file mode 100644 index 0000000000000..ece713a51fa0a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.5.js @@ -0,0 +1,183 @@ +//// [esDecorators-classDeclaration-classSuper.5.ts] +declare var dec: any; + +declare class Base { + static x: number; +} + +const x = "x"; + +@dec +class C1 extends Base { + static a = super.x; + static b = super.x = 1; + static c = super.x += 1; + static d = super.x++; + static e = super.x--; + static f = ++super.x; + static g = --super.x; + static h = ({ x: super.x } = { x: 1 }); + static i = [super.x] = [1]; +} + +@dec +class C2 extends Base { + static a = super["x"]; + static b = super["x"] = 1; + static c = super["x"] += 1; + static d = super["x"]++; + static e = super["x"]--; + static f = ++super["x"]; + static g = --super["x"]; + static h = ({ x: super["x"] } = { x: 1 }); + static i = [super["x"]] = [1]; +} + +@dec +class C3 extends Base { + static a = super[x]; + static b = super[x] = 1; + static c = super[x] += 1; + static d = super[x]++; + static e = super[x]--; + static f = ++super[x]; + static g = --super[x]; + static h = ({ x: super[x] } = { x: 1 }); + static i = [super[x]] = [1]; +} + + +//// [esDecorators-classDeclaration-classSuper.5.js] +const x = "x"; +let C1 = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Base; + var C1 = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C1 = _classThis = _classDescriptor.value; + } + static a = Reflect.get(_classSuper, "x", _classThis); + static b = (() => { + var _a; + return Reflect.set(_classSuper, "x", _a = 1, _classThis), _a; + })(); + static c = (() => { + var _a; + return Reflect.set(_classSuper, "x", _a = Reflect.get(_classSuper, "x", _classThis) + 1, _classThis), _a; + })(); + static d = (() => { + var _a, _b; + return Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _a = _b++, _b), _classThis), _a; + })(); + static e = (() => { + var _a, _b; + return Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _a = _b--, _b), _classThis), _a; + })(); + static f = (() => { + var _a, _b; + return Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _a = ++_b), _classThis), _a; + })(); + static g = (() => { + var _a, _b; + return Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _a = --_b), _classThis), _a; + })(); + static h = ({ x: ({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value } = { x: 1 }); + static i = [({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value] = [1]; + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C1; +})(); +let C2 = (() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + let _classSuper_1 = Base; + var C2 = class extends _classSuper_1 { + static { + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + C2 = _classThis_1 = _classDescriptor_1.value; + } + static a = Reflect.get(_classSuper_1, "x", _classThis_1); + static b = (() => { + var _a; + return Reflect.set(_classSuper_1, "x", _a = 1, _classThis_1), _a; + })(); + static c = (() => { + var _a; + return Reflect.set(_classSuper_1, "x", _a = Reflect.get(_classSuper_1, "x", _classThis_1) + 1, _classThis_1), _a; + })(); + static d = (() => { + var _a, _b; + return Reflect.set(_classSuper_1, "x", (_b = Reflect.get(_classSuper_1, "x", _classThis_1), _a = _b++, _b), _classThis_1), _a; + })(); + static e = (() => { + var _a, _b; + return Reflect.set(_classSuper_1, "x", (_b = Reflect.get(_classSuper_1, "x", _classThis_1), _a = _b--, _b), _classThis_1), _a; + })(); + static f = (() => { + var _a, _b; + return Reflect.set(_classSuper_1, "x", (_b = Reflect.get(_classSuper_1, "x", _classThis_1), _a = ++_b), _classThis_1), _a; + })(); + static g = (() => { + var _a, _b; + return Reflect.set(_classSuper_1, "x", (_b = Reflect.get(_classSuper_1, "x", _classThis_1), _a = --_b), _classThis_1), _a; + })(); + static h = ({ x: ({ set value(_a) { Reflect.set(_classSuper_1, "x", _a, _classThis_1); } }).value } = { x: 1 }); + static i = [({ set value(_a) { Reflect.set(_classSuper_1, "x", _a, _classThis_1); } }).value] = [1]; + static { + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return C2; +})(); +let C3 = (() => { + let _classDecorators_2 = [dec]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + let _classSuper_2 = Base; + var C3 = class extends _classSuper_2 { + static { + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + C3 = _classThis_2 = _classDescriptor_2.value; + } + static a = Reflect.get(_classSuper_2, x, _classThis_2); + static b = (() => { + var _a; + return Reflect.set(_classSuper_2, x, _a = 1, _classThis_2), _a; + })(); + static c = (() => { + var _a, _b; + return Reflect.set(_classSuper_2, _a = x, _b = Reflect.get(_classSuper_2, _a, _classThis_2) + 1, _classThis_2), _b; + })(); + static d = (() => { + var _a, _b, _c; + return Reflect.set(_classSuper_2, _a = x, (_c = Reflect.get(_classSuper_2, _a, _classThis_2), _b = _c++, _c), _classThis_2), _b; + })(); + static e = (() => { + var _a, _b, _c; + return Reflect.set(_classSuper_2, _a = x, (_c = Reflect.get(_classSuper_2, _a, _classThis_2), _b = _c--, _c), _classThis_2), _b; + })(); + static f = (() => { + var _a, _b, _c; + return Reflect.set(_classSuper_2, _a = x, (_c = Reflect.get(_classSuper_2, _a, _classThis_2), _b = ++_c), _classThis_2), _b; + })(); + static g = (() => { + var _a, _b, _c; + return Reflect.set(_classSuper_2, _a = x, (_c = Reflect.get(_classSuper_2, _a, _classThis_2), _b = --_c), _classThis_2), _b; + })(); + static h = ({ x: ({ set value(_a) { Reflect.set(_classSuper_2, x, _a, _classThis_2); } }).value } = { x: 1 }); + static i = [({ set value(_a) { Reflect.set(_classSuper_2, x, _a, _classThis_2); } }).value] = [1]; + static { + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + }; + return C3; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js new file mode 100644 index 0000000000000..f4d5ea287bb4d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js @@ -0,0 +1,53 @@ +//// [esDecorators-classDeclaration-classSuper.6.ts] +declare var dec: any; + +declare class Base { + static method(...args: any[]): number; + method(...args: any[]): number; +} + +// none of the following should result in caching `super` +@dec +class C extends Base { + static m() { super.method(); } + static get x() { return super.method(); } + static set x(v: number) { super.method(); } + + constructor() { + super(); + super.method(); + } + + a = super.method(); + m() { super.method(); } + get x() { return super.method(); } + set x(v: number) { super.method(); } +} + + +//// [esDecorators-classDeclaration-classSuper.6.js] +let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class extends Base { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + static m() { super.method(); } + static get x() { return super.method(); } + static set x(v) { super.method(); } + constructor() { + super(); + super.method(); + } + a = super.method(); + m() { super.method(); } + get x() { return super.method(); } + set x(v) { super.method(); } + }; + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js new file mode 100644 index 0000000000000..ff66e271963eb --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js @@ -0,0 +1,42 @@ +//// [esDecorators-classDeclaration-classThisReference.ts] +declare let dec: any; + +@dec +class C { + static { this; } + static x: any = this; + static accessor a: any = this; + static m() { this; } + static get g() { return this; } +} + + +//// [esDecorators-classDeclaration-classThisReference.js] +let C = (() => { + var _a, _a_accessor_storage; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = (_a = class { + static get a() { return __classPrivateFieldGet(_a, _a, "f", _a_accessor_storage); } + static set a(value) { __classPrivateFieldSet(_a, _a, value, "f", _a_accessor_storage); } + static m() { this; } + static get g() { return this; } + }, + __setFunctionName(_a, "C"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + })(), + (() => { + _classThis; + })(), + _a.x = _classThis, + _a_accessor_storage = { value: _classThis }, + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js new file mode 100644 index 0000000000000..edf91c79bbf4b --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js @@ -0,0 +1,37 @@ +//// [esDecorators-classDeclaration-classThisReference.ts] +declare let dec: any; + +@dec +class C { + static { this; } + static x: any = this; + static accessor a: any = this; + static m() { this; } + static get g() { return this; } +} + + +//// [esDecorators-classDeclaration-classThisReference.js] +let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + } + static { _classThis; } + static x = _classThis; + static #a_accessor_storage = _classThis; + static get a() { return this.#a_accessor_storage; } + static set a(value) { this.#a_accessor_storage = value; } + static m() { this; } + static get g() { return this; } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=esnext).js new file mode 100644 index 0000000000000..aa3766a440877 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=esnext).js @@ -0,0 +1,22 @@ +//// [esDecorators-classDeclaration-classThisReference.ts] +declare let dec: any; + +@dec +class C { + static { this; } + static x: any = this; + static accessor a: any = this; + static m() { this; } + static get g() { return this; } +} + + +//// [esDecorators-classDeclaration-classThisReference.js] +@dec +class C { + static { this; } + static x = this; + static accessor a = this; + static m() { this; } + static get g() { return this; } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js new file mode 100644 index 0000000000000..36f2719b9f521 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js @@ -0,0 +1,46 @@ +//// [esDecorators-classDeclaration-classThisReference.es5.ts] +declare let dec: any; + +@dec +class C { + static { this; } + static x: any = this; + static m() { this; } + static get g() { return this; } +} + + +//// [esDecorators-classDeclaration-classThisReference.es5.js] +var _this = this; +var C = function () { + var _a; + var _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + var C = (_a = /** @class */ (function () { + function class_1() { + } + class_1.m = function () { this; }; + Object.defineProperty(class_1, "g", { + get: function () { return this; }, + enumerable: false, + configurable: true + }); + return class_1; + }()), + __setFunctionName(_a, "C"), + (function () { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + })(), + (function () { + _classThis; + })(), + _a.x = _classThis, + (function () { + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..250aec399b15e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js @@ -0,0 +1,39 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) field1 = 1; + @dec(2) ["field2"] = 2; + @dec(3) [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStatic.js] +const field3 = "field3"; +let C = (() => { + var _a, _b; + var _c; + let _instanceExtraInitializers = []; + let _field1_decorators; + let _field1_initializers = []; + let _member_decorators; + let _member_initializers = []; + let _member_decorators_1; + let _member_initializers_1 = []; + return _b = class C { + constructor() { + this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); + this["field2"] = __runInitializers(this, _member_initializers, 2); + this[_a] = __runInitializers(this, _member_initializers_1, 3); + } + }, + _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _c = __propKey(field3)), + (() => { + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _c, static: false, private: false, access: { get() { return this[_c]; }, set(value) { this[_c] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + })(), + _b; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..e2c30d41af173 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js @@ -0,0 +1,54 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) field1 = 1; + @dec(2) ["field2"] = 2; + @dec(3) [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStatic.js] +const field3 = "field3"; +let C = (() => { + var _a, _b; + var _c; + let _instanceExtraInitializers = []; + let _field1_decorators; + let _field1_initializers = []; + let _member_decorators; + let _member_initializers = []; + let _member_decorators_1; + let _member_initializers_1 = []; + return _b = class C { + constructor() { + Object.defineProperty(this, "field1", { + enumerable: true, + configurable: true, + writable: true, + value: (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)) + }); + Object.defineProperty(this, "field2", { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(this, _member_initializers, 2) + }); + Object.defineProperty(this, _a, { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(this, _member_initializers_1, 3) + }); + } + }, + _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _c = __propKey(field3)), + (() => { + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _c, static: false, private: false, access: { get() { return this[_c]; }, set(value) { this[_c] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + })(), + _b; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..8c3b19e83a625 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js @@ -0,0 +1,38 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) field1 = 1; + @dec(2) ["field2"] = 2; + @dec(3) [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStatic.js] +const field3 = "field3"; +let C = (() => { + var _a; + var _b; + let _instanceExtraInitializers = []; + let _field1_decorators; + let _field1_initializers = []; + let _member_decorators; + let _member_initializers = []; + let _member_decorators_1; + let _member_initializers_1 = []; + return class C { + constructor() { + this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); + this["field2"] = __runInitializers(this, _member_initializers, 2); + this[_a] = __runInitializers(this, _member_initializers_1, 3); + } + static { _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _b = __propKey(field3)); } + static { + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..77bb180279ac6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js @@ -0,0 +1,34 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) field1 = 1; + @dec(2) ["field2"] = 2; + @dec(3) [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStatic.js] +const field3 = "field3"; +let C = (() => { + var _a; + let _instanceExtraInitializers = []; + let _field1_decorators; + let _field1_initializers = []; + let _member_decorators; + let _member_initializers = []; + let _member_decorators_1; + let _member_initializers_1 = []; + return class C { + static { + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + } + field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); + ["field2"] = __runInitializers(this, _member_initializers, 2); + [(_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3))] = __runInitializers(this, _member_initializers_1, 3); + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..c397533589005 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js @@ -0,0 +1,40 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) field1 = 1; + @dec(2) ["field2"] = 2; + @dec(3) [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStatic.js] +var field3 = "field3"; +var C = function () { + var _a, _b; + var _c; + var _instanceExtraInitializers = []; + var _field1_decorators; + var _field1_initializers = []; + var _member_decorators; + var _member_initializers = []; + var _member_decorators_1; + var _member_initializers_1 = []; + return _b = /** @class */ (function () { + function C() { + this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); + this["field2"] = __runInitializers(this, _member_initializers, 2); + this[_a] = __runInitializers(this, _member_initializers_1, 3); + } + return C; + }()), + _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _c = __propKey(field3)), + (function () { + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _c, static: false, private: false, access: { get: function () { return this[_c]; }, set: function (value) { this[_c] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + })(), + _b; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..774a8015c6d28 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js @@ -0,0 +1,55 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) field1 = 1; + @dec(2) ["field2"] = 2; + @dec(3) [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStatic.js] +var field3 = "field3"; +var C = function () { + var _a, _b; + var _c; + var _instanceExtraInitializers = []; + var _field1_decorators; + var _field1_initializers = []; + var _member_decorators; + var _member_initializers = []; + var _member_decorators_1; + var _member_initializers_1 = []; + return _b = /** @class */ (function () { + function C() { + Object.defineProperty(this, "field1", { + enumerable: true, + configurable: true, + writable: true, + value: (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)) + }); + Object.defineProperty(this, "field2", { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(this, _member_initializers, 2) + }); + Object.defineProperty(this, _a, { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(this, _member_initializers_1, 3) + }); + } + return C; + }()), + _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _c = __propKey(field3)), + (function () { + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _c, static: false, private: false, access: { get: function () { return this[_c]; }, set: function (value) { this[_c] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + })(), + _b; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..8c3b19e83a625 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js @@ -0,0 +1,38 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) field1 = 1; + @dec(2) ["field2"] = 2; + @dec(3) [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStatic.js] +const field3 = "field3"; +let C = (() => { + var _a; + var _b; + let _instanceExtraInitializers = []; + let _field1_decorators; + let _field1_initializers = []; + let _member_decorators; + let _member_initializers = []; + let _member_decorators_1; + let _member_initializers_1 = []; + return class C { + constructor() { + this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); + this["field2"] = __runInitializers(this, _member_initializers, 2); + this[_a] = __runInitializers(this, _member_initializers_1, 3); + } + static { _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _b = __propKey(field3)); } + static { + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..32f2d7a3f9127 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=true).js @@ -0,0 +1,22 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) field1 = 1; + @dec(2) ["field2"] = 2; + @dec(3) [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStatic.js] +const field3 = "field3"; +class C { + @dec(1) + field1 = 1; + @dec(2) + ["field2"] = 2; + @dec(3) + [field3] = 3; +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2015).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2015).errors.txt new file mode 100644 index 0000000000000..e70b0b8398bfe --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2015).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + abstract class C { + @dec(1) abstract field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) abstract ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) abstract [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2015).js new file mode 100644 index 0000000000000..14e80d6d0bdef --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2015).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAbstract.ts] +declare let dec: any; + +const field3 = "field3"; + +abstract class C { + @dec(1) abstract field1: number; + @dec(2) abstract ["field2"]: number; + @dec(3) abstract [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAbstract.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2022).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2022).errors.txt new file mode 100644 index 0000000000000..e70b0b8398bfe --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2022).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + abstract class C { + @dec(1) abstract field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) abstract ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) abstract [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2022).js new file mode 100644 index 0000000000000..14e80d6d0bdef --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es2022).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAbstract.ts] +declare let dec: any; + +const field3 = "field3"; + +abstract class C { + @dec(1) abstract field1: number; + @dec(2) abstract ["field2"]: number; + @dec(3) abstract [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAbstract.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es5).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es5).errors.txt new file mode 100644 index 0000000000000..e70b0b8398bfe --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + abstract class C { + @dec(1) abstract field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) abstract ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) abstract [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es5).js new file mode 100644 index 0000000000000..7845d48e7647b --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=es5).js @@ -0,0 +1,19 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAbstract.ts] +declare let dec: any; + +const field3 = "field3"; + +abstract class C { + @dec(1) abstract field1: number; + @dec(2) abstract ["field2"]: number; + @dec(3) abstract [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAbstract.js] +var field3 = "field3"; +var C = /** @class */ (function () { + function C() { + } + return C; +}()); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=esnext).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=esnext).errors.txt new file mode 100644 index 0000000000000..e70b0b8398bfe --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=esnext).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + abstract class C { + @dec(1) abstract field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) abstract ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) abstract [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=esnext).js new file mode 100644 index 0000000000000..14e80d6d0bdef --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstract(target=esnext).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAbstract.ts] +declare let dec: any; + +const field3 = "field3"; + +abstract class C { + @dec(1) abstract field1: number; + @dec(2) abstract ["field2"]: number; + @dec(3) abstract [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAbstract.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2015).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2015).errors.txt new file mode 100644 index 0000000000000..105be5795dce9 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2015).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + abstract class C { + @dec(1) abstract accessor field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) abstract accessor ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) abstract accessor [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2015).js new file mode 100644 index 0000000000000..70c3113ebb57e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2015).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts] +declare let dec: any; + +const field3 = "field3"; + +abstract class C { + @dec(1) abstract accessor field1: number; + @dec(2) abstract accessor ["field2"]: number; + @dec(3) abstract accessor [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2022).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2022).errors.txt new file mode 100644 index 0000000000000..105be5795dce9 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2022).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + abstract class C { + @dec(1) abstract accessor field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) abstract accessor ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) abstract accessor [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2022).js new file mode 100644 index 0000000000000..70c3113ebb57e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=es2022).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts] +declare let dec: any; + +const field3 = "field3"; + +abstract class C { + @dec(1) abstract accessor field1: number; + @dec(2) abstract accessor ["field2"]: number; + @dec(3) abstract accessor [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=esnext).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=esnext).errors.txt new file mode 100644 index 0000000000000..105be5795dce9 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=esnext).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + abstract class C { + @dec(1) abstract accessor field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) abstract accessor ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) abstract accessor [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=esnext).js new file mode 100644 index 0000000000000..70c3113ebb57e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor(target=esnext).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts] +declare let dec: any; + +const field3 = "field3"; + +abstract class C { + @dec(1) abstract accessor field1: number; + @dec(2) abstract accessor ["field2"]: number; + @dec(3) abstract accessor [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js new file mode 100644 index 0000000000000..c004d51c86084 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js @@ -0,0 +1,44 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAccessor.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) accessor field1 = 1; + @dec(2) accessor ["field2"] = 2; + @dec(3) accessor [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAccessor.js] +const field3 = "field3"; +let C = (() => { + var _a, _C_field1_accessor_storage, _C__a_accessor_storage, _C__b_accessor_storage; + var _b; + let _instanceExtraInitializers = []; + let _field1_decorators; + let _field1_initializers = []; + let _member_decorators; + let _member_initializers = []; + let _member_decorators_1; + let _member_initializers_1 = []; + return _a = class C { + constructor() { + _C_field1_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1))); + _C__a_accessor_storage.set(this, __runInitializers(this, _member_initializers, 2)); + _C__b_accessor_storage.set(this, __runInitializers(this, _member_initializers_1, 3)); + } + get field1() { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); } + set field1(value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); } + get [(_C_field1_accessor_storage = new WeakMap(), _C__a_accessor_storage = new WeakMap(), _C__b_accessor_storage = new WeakMap(), "field2")]() { return __classPrivateFieldGet(this, _C__a_accessor_storage, "f"); } + set ["field2"](value) { __classPrivateFieldSet(this, _C__a_accessor_storage, value, "f"); } + get [(_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _b = __propKey(field3))]() { return __classPrivateFieldGet(this, _C__b_accessor_storage, "f"); } + set [_b](value) { __classPrivateFieldSet(this, _C__b_accessor_storage, value, "f"); } + }, + (() => { + __esDecorate(_a, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators_1, { kind: "accessor", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js new file mode 100644 index 0000000000000..f6d49eb9bed93 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js @@ -0,0 +1,40 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAccessor.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) accessor field1 = 1; + @dec(2) accessor ["field2"] = 2; + @dec(3) accessor [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAccessor.js] +const field3 = "field3"; +let C = (() => { + var _a; + let _instanceExtraInitializers = []; + let _field1_decorators; + let _field1_initializers = []; + let _member_decorators; + let _member_initializers = []; + let _member_decorators_1; + let _member_initializers_1 = []; + return class C { + static { + __esDecorate(this, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators_1, { kind: "accessor", name: _a, static: false, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + } + #field1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); + get field1() { return this.#field1_accessor_storage; } + set field1(value) { this.#field1_accessor_storage = value; } + #_a_accessor_storage = __runInitializers(this, _member_initializers, 2); + get ["field2"]() { return this.#_a_accessor_storage; } + set ["field2"](value) { this.#_a_accessor_storage = value; } + #_b_accessor_storage = __runInitializers(this, _member_initializers_1, 3); + get [(_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3))]() { return this.#_b_accessor_storage; } + set [_a](value) { this.#_b_accessor_storage = value; } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).js new file mode 100644 index 0000000000000..b080f6abdd798 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).js @@ -0,0 +1,22 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAccessor.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) accessor field1 = 1; + @dec(2) accessor ["field2"] = 2; + @dec(3) accessor [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAccessor.js] +const field3 = "field3"; +class C { + @dec(1) + accessor field1 = 1; + @dec(2) + accessor ["field2"] = 2; + @dec(3) + accessor [field3] = 3; +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2015).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2015).errors.txt new file mode 100644 index 0000000000000..2aac382517ac2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2015).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + class C { + @dec(1) declare field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) declare ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) declare [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2015).js new file mode 100644 index 0000000000000..8b5ce15c1b290 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2015).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAmbient.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) declare field1: number; + @dec(2) declare ["field2"]: number; + @dec(3) declare [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAmbient.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2022).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2022).errors.txt new file mode 100644 index 0000000000000..2aac382517ac2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2022).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + class C { + @dec(1) declare field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) declare ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) declare [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2022).js new file mode 100644 index 0000000000000..8b5ce15c1b290 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es2022).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAmbient.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) declare field1: number; + @dec(2) declare ["field2"]: number; + @dec(3) declare [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAmbient.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es5).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es5).errors.txt new file mode 100644 index 0000000000000..2aac382517ac2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + class C { + @dec(1) declare field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) declare ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) declare [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es5).js new file mode 100644 index 0000000000000..13821ee777d9f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=es5).js @@ -0,0 +1,19 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAmbient.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) declare field1: number; + @dec(2) declare ["field2"]: number; + @dec(3) declare [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAmbient.js] +var field3 = "field3"; +var C = /** @class */ (function () { + function C() { + } + return C; +}()); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=esnext).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=esnext).errors.txt new file mode 100644 index 0000000000000..2aac382517ac2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=esnext).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + class C { + @dec(1) declare field1: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) declare ["field2"]: number; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) declare [field3]: number; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=esnext).js new file mode 100644 index 0000000000000..8b5ce15c1b290 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAmbient(target=esnext).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAmbient.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) declare field1: number; + @dec(2) declare ["field2"]: number; + @dec(3) declare [field3]: number; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticAmbient.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js new file mode 100644 index 0000000000000..ecfc2cf7d04d9 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js @@ -0,0 +1,26 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivate.ts] +declare let dec: any; + +class C { + @dec #field1 = 0; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticPrivate.js] +let C = (() => { + var _C_field1, _a; + let _instanceExtraInitializers = []; + let _private_field1_decorators; + let _private_field1_initializers = []; + return _a = class C { + constructor() { + _C_field1.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0))); + } + }, + _C_field1 = new WeakMap(), + (() => { + _private_field1_decorators = [dec]; + __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_field1, "f"); }, set(value) { __classPrivateFieldSet(this, _C_field1, value, "f"); } } }, _private_field1_initializers, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js new file mode 100644 index 0000000000000..0f2e296033937 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js @@ -0,0 +1,21 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivate.ts] +declare let dec: any; + +class C { + @dec #field1 = 0; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticPrivate.js] +let C = (() => { + let _instanceExtraInitializers = []; + let _private_field1_decorators; + let _private_field1_initializers = []; + return class C { + static { + _private_field1_decorators = [dec]; + __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _private_field1_initializers, _instanceExtraInitializers); + } + #field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0)); + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).js new file mode 100644 index 0000000000000..5fe4f40e25afc --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivate.ts] +declare let dec: any; + +class C { + @dec #field1 = 0; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticPrivate.js] +class C { + @dec + #field1 = 0; +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js new file mode 100644 index 0000000000000..97c911d9de41d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js @@ -0,0 +1,31 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.ts] +declare let dec: any; + +class C { + @dec accessor #field1 = 0; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.js] +let C = (() => { + var _C_instances, _a, _C_field1_get, _C_field1_set, _C_field1_accessor_storage; + let _instanceExtraInitializers = []; + let _private_field1_decorators; + let _private_field1_initializers = []; + let _private_field1_descriptor; + return _a = class C { + constructor() { + _C_instances.add(this); + _C_field1_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0))); + } + }, + _C_instances = new WeakSet(), + _C_field1_accessor_storage = new WeakMap(), + _C_field1_get = function _C_field1_get() { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, + _C_field1_set = function _C_field1_set(value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, + (() => { + _private_field1_decorators = [dec]; + __esDecorate(_a, _private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, "#field1"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, "#field1") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _C_instances, value, "a", _C_field1_set); } } }, _private_field1_initializers, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js new file mode 100644 index 0000000000000..91430205ea234 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js @@ -0,0 +1,24 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.ts] +declare let dec: any; + +class C { + @dec accessor #field1 = 0; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.js] +let C = (() => { + let _instanceExtraInitializers = []; + let _private_field1_decorators; + let _private_field1_initializers = []; + let _private_field1_descriptor; + return class C { + static { + _private_field1_decorators = [dec]; + __esDecorate(this, _private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _private_field1_initializers, _instanceExtraInitializers); + } + #field1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0)); + get #field1() { return this.#field1_accessor_storage; } + set #field1(value) { this.#field1_accessor_storage = value; } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).js new file mode 100644 index 0000000000000..269b8f73feea7 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.ts] +declare let dec: any; + +class C { + @dec accessor #field1 = 0; +} + + +//// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.js] +class C { + @dec + accessor #field1 = 0; +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..807b64ece17d2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js @@ -0,0 +1,38 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static field1 = 1; + @dec(2) static ["field2"] = 2; + @dec(3) static [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-static.js] +const field3 = "field3"; +let C = (() => { + var _a, _b; + var _c; + let _staticExtraInitializers = []; + let _static_field1_decorators; + let _static_field1_initializers = []; + let _static_member_decorators; + let _static_member_initializers = []; + let _static_member_decorators_1; + let _static_member_initializers_1 = []; + return _a = class C { + }, + _b = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _c = __propKey(field3)), + (() => { + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _c, static: true, private: false, access: { get() { return this[_c]; }, set(value) { this[_c] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _a.field1 = __runInitializers(_a, _static_field1_initializers, 1), + _a["field2"] = __runInitializers(_a, _static_member_initializers, 2), + _a[_b] = __runInitializers(_a, _static_member_initializers_1, 3), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..87877a0493194 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js @@ -0,0 +1,53 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static field1 = 1; + @dec(2) static ["field2"] = 2; + @dec(3) static [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-static.js] +const field3 = "field3"; +let C = (() => { + var _a, _b; + var _c; + let _staticExtraInitializers = []; + let _static_field1_decorators; + let _static_field1_initializers = []; + let _static_member_decorators; + let _static_member_initializers = []; + let _static_member_decorators_1; + let _static_member_initializers_1 = []; + return _a = class C { + }, + _b = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _c = __propKey(field3)), + (() => { + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _c, static: true, private: false, access: { get() { return this[_c]; }, set(value) { this[_c] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + Object.defineProperty(_a, "field1", { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(_a, _static_field1_initializers, 1) + }), + Object.defineProperty(_a, "field2", { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(_a, _static_member_initializers, 2) + }), + Object.defineProperty(_a, _b, { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(_a, _static_member_initializers_1, 3) + }), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..f006eb3f426ff --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js @@ -0,0 +1,37 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static field1 = 1; + @dec(2) static ["field2"] = 2; + @dec(3) static [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-static.js] +const field3 = "field3"; +let C = (() => { + var _a; + var _b; + let _staticExtraInitializers = []; + let _static_field1_decorators; + let _static_field1_initializers = []; + let _static_member_decorators; + let _static_member_initializers = []; + let _static_member_decorators_1; + let _static_member_initializers_1 = []; + return class C { + static { _a = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _b = __propKey(field3)); } + static { + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static { this.field1 = __runInitializers(this, _static_field1_initializers, 1); } + static { this["field2"] = __runInitializers(this, _static_member_initializers, 2); } + static { this[_a] = __runInitializers(this, _static_member_initializers_1, 3); } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..c01dec58b98b0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js @@ -0,0 +1,35 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static field1 = 1; + @dec(2) static ["field2"] = 2; + @dec(3) static [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-static.js] +const field3 = "field3"; +let C = (() => { + var _a; + let _staticExtraInitializers = []; + let _static_field1_decorators; + let _static_field1_initializers = []; + let _static_member_decorators; + let _static_member_initializers = []; + let _static_member_decorators_1; + let _static_member_initializers_1 = []; + return class C { + static { + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static field1 = __runInitializers(this, _static_field1_initializers, 1); + static ["field2"] = __runInitializers(this, _static_member_initializers, 2); + static [(_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3))] = __runInitializers(this, _static_member_initializers_1, 3); + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..39eb794d1dc74 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js @@ -0,0 +1,42 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static field1 = 1; + @dec(2) static ["field2"] = 2; + @dec(3) static [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-static.js] +var _this = this; +var field3 = "field3"; +var C = function () { + var _a, _b; + var _c; + var _staticExtraInitializers = []; + var _static_field1_decorators; + var _static_field1_initializers = []; + var _static_member_decorators; + var _static_member_initializers = []; + var _static_member_decorators_1; + var _static_member_initializers_1 = []; + return _a = /** @class */ (function () { + function C() { + } + return C; + }()), + _b = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _c = __propKey(field3)), + (function () { + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _c, static: true, private: false, access: { get: function () { return this[_c]; }, set: function (value) { this[_c] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _a.field1 = __runInitializers(_a, _static_field1_initializers, 1), + _a["field2"] = __runInitializers(_a, _static_member_initializers, 2), + _a[_b] = __runInitializers(_a, _static_member_initializers_1, 3), + _a; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..91b96fe98affc --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js @@ -0,0 +1,57 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static field1 = 1; + @dec(2) static ["field2"] = 2; + @dec(3) static [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-static.js] +var _this = this; +var field3 = "field3"; +var C = function () { + var _a, _b; + var _c; + var _staticExtraInitializers = []; + var _static_field1_decorators; + var _static_field1_initializers = []; + var _static_member_decorators; + var _static_member_initializers = []; + var _static_member_decorators_1; + var _static_member_initializers_1 = []; + return _a = /** @class */ (function () { + function C() { + } + return C; + }()), + _b = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _c = __propKey(field3)), + (function () { + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _c, static: true, private: false, access: { get: function () { return this[_c]; }, set: function (value) { this[_c] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + Object.defineProperty(_a, "field1", { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(_a, _static_field1_initializers, 1) + }), + Object.defineProperty(_a, "field2", { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(_a, _static_member_initializers, 2) + }), + Object.defineProperty(_a, _b, { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(_a, _static_member_initializers_1, 3) + }), + _a; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..f006eb3f426ff --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js @@ -0,0 +1,37 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static field1 = 1; + @dec(2) static ["field2"] = 2; + @dec(3) static [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-static.js] +const field3 = "field3"; +let C = (() => { + var _a; + var _b; + let _staticExtraInitializers = []; + let _static_field1_decorators; + let _static_field1_initializers = []; + let _static_member_decorators; + let _static_member_initializers = []; + let _static_member_decorators_1; + let _static_member_initializers_1 = []; + return class C { + static { _a = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _b = __propKey(field3)); } + static { + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static { this.field1 = __runInitializers(this, _static_field1_initializers, 1); } + static { this["field2"] = __runInitializers(this, _static_member_initializers, 2); } + static { this[_a] = __runInitializers(this, _static_member_initializers_1, 3); } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..1d6d9881a7512 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=true).js @@ -0,0 +1,22 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static field1 = 1; + @dec(2) static ["field2"] = 2; + @dec(3) static [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-static.js] +const field3 = "field3"; +class C { + @dec(1) + static field1 = 1; + @dec(2) + static ["field2"] = 2; + @dec(3) + static [field3] = 3; +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js new file mode 100644 index 0000000000000..8254b87c13e4f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js @@ -0,0 +1,78 @@ +//// [esDecorators-classDeclaration-fields-staticAccessor.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static accessor field1 = 1; + @dec(2) static accessor ["field2"] = 2; + @dec(3) static accessor [field3] = 3; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor field1 = 1; + static { + this.field1; + this.field1 = 1; + } +} + +//// [esDecorators-classDeclaration-fields-staticAccessor.js] +const field3 = "field3"; +let C = (() => { + var _a, _C_field1_accessor_storage, _C__a_accessor_storage, _C__b_accessor_storage; + var _b; + let _staticExtraInitializers = []; + let _static_field1_decorators; + let _static_field1_initializers = []; + let _static_member_decorators; + let _static_member_initializers = []; + let _static_member_decorators_1; + let _static_member_initializers_1 = []; + return _a = class C { + static get field1() { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); } + static set field1(value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); } + static get ["field2"]() { return __classPrivateFieldGet(_a, _a, "f", _C__a_accessor_storage); } + static set ["field2"](value) { __classPrivateFieldSet(_a, _a, value, "f", _C__a_accessor_storage); } + static get [(_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _b = __propKey(field3))]() { return __classPrivateFieldGet(_a, _a, "f", _C__b_accessor_storage); } + static set [_b](value) { __classPrivateFieldSet(_a, _a, value, "f", _C__b_accessor_storage); } + }, + (() => { + __esDecorate(_a, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators_1, { kind: "accessor", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _C_field1_accessor_storage = { value: __runInitializers(_a, _static_field1_initializers, 1) }, + _C__a_accessor_storage = { value: __runInitializers(_a, _static_member_initializers, 2) }, + _C__b_accessor_storage = { value: __runInitializers(_a, _static_member_initializers_1, 3) }, + _a; +})(); +let D = (() => { + var _a, _field1_1_accessor_storage; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = (_a = class { + static get field1() { return __classPrivateFieldGet(_a, _a, "f", _field1_1_accessor_storage); } + static set field1(value) { __classPrivateFieldSet(_a, _a, value, "f", _field1_1_accessor_storage); } + }, + __setFunctionName(_a, "D"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(), + _field1_1_accessor_storage = { value: 1 }, + (() => { + _classThis.field1; + _classThis.field1 = 1; + })(), + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js new file mode 100644 index 0000000000000..adca99d7b40cf --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js @@ -0,0 +1,73 @@ +//// [esDecorators-classDeclaration-fields-staticAccessor.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static accessor field1 = 1; + @dec(2) static accessor ["field2"] = 2; + @dec(3) static accessor [field3] = 3; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor field1 = 1; + static { + this.field1; + this.field1 = 1; + } +} + +//// [esDecorators-classDeclaration-fields-staticAccessor.js] +const field3 = "field3"; +let C = (() => { + var _a; + let _staticExtraInitializers = []; + let _static_field1_decorators; + let _static_field1_initializers = []; + let _static_member_decorators; + let _static_member_initializers = []; + let _static_member_decorators_1; + let _static_member_initializers_1 = []; + return class C { + static { + __esDecorate(this, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(this, null, _static_member_decorators_1, { kind: "accessor", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static #field1_accessor_storage = __runInitializers(this, _static_field1_initializers, 1); + static get field1() { return this.#field1_accessor_storage; } + static set field1(value) { this.#field1_accessor_storage = value; } + static #_a_accessor_storage = __runInitializers(this, _static_member_initializers, 2); + static get ["field2"]() { return this.#_a_accessor_storage; } + static set ["field2"](value) { this.#_a_accessor_storage = value; } + static #_b_accessor_storage = __runInitializers(this, _static_member_initializers_1, 3); + static get [(_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3))]() { return this.#_b_accessor_storage; } + static set [_a](value) { this.#_b_accessor_storage = value; } + }; +})(); +let D = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + } + static #field1_1_accessor_storage = 1; + static get field1() { return this.#field1_1_accessor_storage; } + static set field1(value) { this.#field1_1_accessor_storage = value; } + static { + _classThis.field1; + _classThis.field1 = 1; + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).js new file mode 100644 index 0000000000000..ff13b33e216f5 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).js @@ -0,0 +1,40 @@ +//// [esDecorators-classDeclaration-fields-staticAccessor.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static accessor field1 = 1; + @dec(2) static accessor ["field2"] = 2; + @dec(3) static accessor [field3] = 3; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor field1 = 1; + static { + this.field1; + this.field1 = 1; + } +} + +//// [esDecorators-classDeclaration-fields-staticAccessor.js] +const field3 = "field3"; +class C { + @dec(1) + static accessor field1 = 1; + @dec(2) + static accessor ["field2"] = 2; + @dec(3) + static accessor [field3] = 3; +} +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor field1 = 1; + static { + this.field1; + this.field1 = 1; + } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2015).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2015).errors.txt new file mode 100644 index 0000000000000..07b48d6189ab6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2015).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + class C { + @dec(1) static declare field1 = 1; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) static declare ["field2"] = 2; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) static declare [field3] = 3; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2015).js new file mode 100644 index 0000000000000..36697eb3f8b5f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2015).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-staticAmbient.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static declare field1 = 1; + @dec(2) static declare ["field2"] = 2; + @dec(3) static declare [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-staticAmbient.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2022).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2022).errors.txt new file mode 100644 index 0000000000000..07b48d6189ab6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2022).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + class C { + @dec(1) static declare field1 = 1; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) static declare ["field2"] = 2; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) static declare [field3] = 3; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2022).js new file mode 100644 index 0000000000000..36697eb3f8b5f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es2022).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-staticAmbient.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static declare field1 = 1; + @dec(2) static declare ["field2"] = 2; + @dec(3) static declare [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-staticAmbient.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es5).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es5).errors.txt new file mode 100644 index 0000000000000..07b48d6189ab6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + class C { + @dec(1) static declare field1 = 1; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) static declare ["field2"] = 2; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) static declare [field3] = 3; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es5).js new file mode 100644 index 0000000000000..60006b6666e2e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=es5).js @@ -0,0 +1,19 @@ +//// [esDecorators-classDeclaration-fields-staticAmbient.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static declare field1 = 1; + @dec(2) static declare ["field2"] = 2; + @dec(3) static declare [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-staticAmbient.js] +var field3 = "field3"; +var C = /** @class */ (function () { + function C() { + } + return C; +}()); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=esnext).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=esnext).errors.txt new file mode 100644 index 0000000000000..07b48d6189ab6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=esnext).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(6,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(7,5): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts(8,5): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts (3 errors) ==== + declare let dec: any; + + const field3 = "field3"; + + class C { + @dec(1) static declare field1 = 1; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(2) static declare ["field2"] = 2; + ~ +!!! error TS1206: Decorators are not valid here. + @dec(3) static declare [field3] = 3; + ~ +!!! error TS1206: Decorators are not valid here. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=esnext).js new file mode 100644 index 0000000000000..36697eb3f8b5f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAmbient(target=esnext).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-fields-staticAmbient.ts] +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static declare field1 = 1; + @dec(2) static declare ["field2"] = 2; + @dec(3) static declare [field3] = 3; +} + + +//// [esDecorators-classDeclaration-fields-staticAmbient.js] +const field3 = "field3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js new file mode 100644 index 0000000000000..53b17a40a61b8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js @@ -0,0 +1,58 @@ +//// [esDecorators-classDeclaration-fields-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #field1 = 0; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} + + +//// [esDecorators-classDeclaration-fields-staticPrivate.js] +let C = (() => { + var _a, _C_field1; + let _staticExtraInitializers = []; + let _static_private_field1_decorators; + let _static_private_field1_initializers = []; + return _a = class C { + }, + (() => { + _static_private_field1_decorators = [dec]; + __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "f", _C_field1); }, set(value) { __classPrivateFieldSet(this, _a, value, "f", _C_field1); } } }, _static_private_field1_initializers, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _C_field1 = { value: __runInitializers(_a, _static_private_field1_initializers, 0) }, + _a; +})(); +let D = (() => { + var _a, _field1; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = (_a = class { + }, + __setFunctionName(_a, "D"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(), + _field1 = { value: 0 }, + (() => { + __classPrivateFieldGet(_classThis, _a, "f", _field1); + __classPrivateFieldSet(_classThis, _a, 1, "f", _field1); + })(), + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js new file mode 100644 index 0000000000000..8959dbfb2d9cb --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js @@ -0,0 +1,53 @@ +//// [esDecorators-classDeclaration-fields-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #field1 = 0; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} + + +//// [esDecorators-classDeclaration-fields-staticPrivate.js] +let C = (() => { + let _staticExtraInitializers = []; + let _static_private_field1_decorators; + let _static_private_field1_initializers = []; + return class C { + static { + _static_private_field1_decorators = [dec]; + __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _static_private_field1_initializers, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static #field1 = __runInitializers(this, _static_private_field1_initializers, 0); + }; +})(); +let D = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + } + static #field1 = 0; + static { + _classThis.#field1; + _classThis.#field1 = 1; + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).js new file mode 100644 index 0000000000000..b66d18b13d777 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).js @@ -0,0 +1,32 @@ +//// [esDecorators-classDeclaration-fields-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #field1 = 0; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} + + +//// [esDecorators-classDeclaration-fields-staticPrivate.js] +class C { + @dec + static #field1 = 0; +} +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js new file mode 100644 index 0000000000000..1aa74449e16b7 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js @@ -0,0 +1,63 @@ +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.ts] +declare let dec: any; + +class C { + @dec static accessor #field1 = 0; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} + + +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.js] +let C = (() => { + var _a, _C_field1_get, _C_field1_set, _C_field1_accessor_storage; + let _staticExtraInitializers = []; + let _static_private_field1_decorators; + let _static_private_field1_initializers = []; + let _static_private_field1_descriptor; + return _a = class C { + }, + _C_field1_get = function _C_field1_get() { return __classPrivateFieldGet(this, _a, "f", _C_field1_accessor_storage); }, + _C_field1_set = function _C_field1_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C_field1_accessor_storage); }, + (() => { + _static_private_field1_decorators = [dec]; + __esDecorate(_a, _static_private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); }, "#field1"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); }, "#field1") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _a, value, "a", _C_field1_set); } } }, _static_private_field1_initializers, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _C_field1_accessor_storage = { value: __runInitializers(_a, _static_private_field1_initializers, 0) }, + _a; +})(); +let D = (() => { + var _a, _field1_get, _field1_set, _field1_1_accessor_storage; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = (_a = class { + }, + _field1_get = function _field1_get() { return __classPrivateFieldGet(this, _a, "f", _field1_1_accessor_storage); }, + _field1_set = function _field1_set(value) { __classPrivateFieldSet(this, _a, value, "f", _field1_1_accessor_storage); }, + __setFunctionName(_a, "D"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(), + _field1_1_accessor_storage = { value: 0 }, + (() => { + __classPrivateFieldGet(_classThis, _a, "a", _field1_get); + __classPrivateFieldSet(_classThis, _a, 1, "a", _field1_set); + })(), + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js new file mode 100644 index 0000000000000..ef6ddc1457e66 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js @@ -0,0 +1,58 @@ +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.ts] +declare let dec: any; + +class C { + @dec static accessor #field1 = 0; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} + + +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.js] +let C = (() => { + let _staticExtraInitializers = []; + let _static_private_field1_decorators; + let _static_private_field1_initializers = []; + let _static_private_field1_descriptor; + return class C { + static { + _static_private_field1_decorators = [dec]; + __esDecorate(this, _static_private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _static_private_field1_initializers, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static #field1_accessor_storage = __runInitializers(this, _static_private_field1_initializers, 0); + static get #field1() { return this.#field1_accessor_storage; } + static set #field1(value) { this.#field1_accessor_storage = value; } + }; +})(); +let D = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + } + static #field1_1_accessor_storage = 0; + static get #field1() { return this.#field1_1_accessor_storage; } + static set #field1(value) { this.#field1_1_accessor_storage = value; } + static { + _classThis.#field1; + _classThis.#field1 = 1; + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).js new file mode 100644 index 0000000000000..6be42f08705c0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).js @@ -0,0 +1,32 @@ +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.ts] +declare let dec: any; + +class C { + @dec static accessor #field1 = 0; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} + + +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.js] +class C { + @dec + static accessor #field1 = 0; +} +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2015).js new file mode 100644 index 0000000000000..904b891226597 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2015).js @@ -0,0 +1,36 @@ +//// [esDecorators-classDeclaration-methods-nonStatic.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) method1() {} + @dec(2) ["method2"]() {} + @dec(3) [method3]() {} +} + + +//// [esDecorators-classDeclaration-methods-nonStatic.js] +const method3 = "method3"; +let C = (() => { + var _a; + var _b; + let _instanceExtraInitializers = []; + let _method1_decorators; + let _member_decorators; + let _member_decorators_1; + return _a = class C { + method1() { } + ["method2"]() { } + [(_method1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _b = __propKey(method3))]() { } + constructor() { + __runInitializers(this, _instanceExtraInitializers); + } + }, + (() => { + __esDecorate(_a, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators_1, { kind: "method", name: _b, static: false, private: false, access: { get() { return this[_b]; } } }, null, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2022).js new file mode 100644 index 0000000000000..fb2d3cd62780f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2022).js @@ -0,0 +1,34 @@ +//// [esDecorators-classDeclaration-methods-nonStatic.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) method1() {} + @dec(2) ["method2"]() {} + @dec(3) [method3]() {} +} + + +//// [esDecorators-classDeclaration-methods-nonStatic.js] +const method3 = "method3"; +let C = (() => { + var _a; + let _instanceExtraInitializers = []; + let _method1_decorators; + let _member_decorators; + let _member_decorators_1; + return class C { + static { + __esDecorate(this, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators_1, { kind: "method", name: _a, static: false, private: false, access: { get() { return this[_a]; } } }, null, _instanceExtraInitializers); + } + method1() { } + ["method2"]() { } + [(_method1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(method3))]() { } + constructor() { + __runInitializers(this, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es5).js new file mode 100644 index 0000000000000..158758a269154 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es5).js @@ -0,0 +1,38 @@ +//// [esDecorators-classDeclaration-methods-nonStatic.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) method1() {} + @dec(2) ["method2"]() {} + @dec(3) [method3]() {} +} + + +//// [esDecorators-classDeclaration-methods-nonStatic.js] +var _this = this; +var method3 = "method3"; +var C = function () { + var _a; + var _b; + var _instanceExtraInitializers = []; + var _method1_decorators; + var _member_decorators; + var _member_decorators_1; + return _a = /** @class */ (function () { + function C() { + __runInitializers(this, _instanceExtraInitializers); + } + C.prototype.method1 = function () { }; + C.prototype["method2"] = function () { }; + C.prototype[(_method1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _b = __propKey(method3))] = function () { }; + return C; + }()), + (function () { + __esDecorate(_a, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false, access: { get: function () { return this.method1; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false, access: { get: function () { return this["method2"]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators_1, { kind: "method", name: _b, static: false, private: false, access: { get: function () { return this[_b]; } } }, null, _instanceExtraInitializers); + })(), + _a; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=esnext).js new file mode 100644 index 0000000000000..c97983d5a60a2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=esnext).js @@ -0,0 +1,22 @@ +//// [esDecorators-classDeclaration-methods-nonStatic.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) method1() {} + @dec(2) ["method2"]() {} + @dec(3) [method3]() {} +} + + +//// [esDecorators-classDeclaration-methods-nonStatic.js] +const method3 = "method3"; +class C { + @dec(1) + method1() { } + @dec(2) + ["method2"]() { } + @dec(3) + [method3]() { } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2015).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2015).errors.txt new file mode 100644 index 0000000000000..d924ddceb821f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2015).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(6,5): error TS1249: A decorator can only decorate a method implementation, not an overload. +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(7,5): error TS1249: A decorator can only decorate a method implementation, not an overload. +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(8,5): error TS1249: A decorator can only decorate a method implementation, not an overload. + + +==== tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts (3 errors) ==== + declare let dec: any; + + const method3 = "method3"; + + abstract class C { + @dec(1) abstract method1(): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + @dec(2) abstract ["method2"](): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + @dec(3) abstract [method3](): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2015).js new file mode 100644 index 0000000000000..b408db0e0e6da --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2015).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-methods-nonStaticAbstract.ts] +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(1) abstract method1(): void; + @dec(2) abstract ["method2"](): void; + @dec(3) abstract [method3](): void; +} + + +//// [esDecorators-classDeclaration-methods-nonStaticAbstract.js] +const method3 = "method3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2022).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2022).errors.txt new file mode 100644 index 0000000000000..d924ddceb821f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2022).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(6,5): error TS1249: A decorator can only decorate a method implementation, not an overload. +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(7,5): error TS1249: A decorator can only decorate a method implementation, not an overload. +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(8,5): error TS1249: A decorator can only decorate a method implementation, not an overload. + + +==== tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts (3 errors) ==== + declare let dec: any; + + const method3 = "method3"; + + abstract class C { + @dec(1) abstract method1(): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + @dec(2) abstract ["method2"](): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + @dec(3) abstract [method3](): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2022).js new file mode 100644 index 0000000000000..b408db0e0e6da --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es2022).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-methods-nonStaticAbstract.ts] +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(1) abstract method1(): void; + @dec(2) abstract ["method2"](): void; + @dec(3) abstract [method3](): void; +} + + +//// [esDecorators-classDeclaration-methods-nonStaticAbstract.js] +const method3 = "method3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es5).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es5).errors.txt new file mode 100644 index 0000000000000..d924ddceb821f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es5).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(6,5): error TS1249: A decorator can only decorate a method implementation, not an overload. +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(7,5): error TS1249: A decorator can only decorate a method implementation, not an overload. +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(8,5): error TS1249: A decorator can only decorate a method implementation, not an overload. + + +==== tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts (3 errors) ==== + declare let dec: any; + + const method3 = "method3"; + + abstract class C { + @dec(1) abstract method1(): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + @dec(2) abstract ["method2"](): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + @dec(3) abstract [method3](): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es5).js new file mode 100644 index 0000000000000..4f34c59c10870 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=es5).js @@ -0,0 +1,19 @@ +//// [esDecorators-classDeclaration-methods-nonStaticAbstract.ts] +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(1) abstract method1(): void; + @dec(2) abstract ["method2"](): void; + @dec(3) abstract [method3](): void; +} + + +//// [esDecorators-classDeclaration-methods-nonStaticAbstract.js] +var method3 = "method3"; +var C = /** @class */ (function () { + function C() { + } + return C; +}()); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=esnext).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=esnext).errors.txt new file mode 100644 index 0000000000000..d924ddceb821f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=esnext).errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(6,5): error TS1249: A decorator can only decorate a method implementation, not an overload. +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(7,5): error TS1249: A decorator can only decorate a method implementation, not an overload. +tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts(8,5): error TS1249: A decorator can only decorate a method implementation, not an overload. + + +==== tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts (3 errors) ==== + declare let dec: any; + + const method3 = "method3"; + + abstract class C { + @dec(1) abstract method1(): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + @dec(2) abstract ["method2"](): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + @dec(3) abstract [method3](): void; + ~ +!!! error TS1249: A decorator can only decorate a method implementation, not an overload. + } + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=esnext).js new file mode 100644 index 0000000000000..b408db0e0e6da --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticAbstract(target=esnext).js @@ -0,0 +1,16 @@ +//// [esDecorators-classDeclaration-methods-nonStaticAbstract.ts] +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(1) abstract method1(): void; + @dec(2) abstract ["method2"](): void; + @dec(3) abstract [method3](): void; +} + + +//// [esDecorators-classDeclaration-methods-nonStaticAbstract.js] +const method3 = "method3"; +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2015).js new file mode 100644 index 0000000000000..a13d61ebf7891 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2015).js @@ -0,0 +1,28 @@ +//// [esDecorators-classDeclaration-methods-nonStaticPrivate.ts] +declare let dec: any; + +class C { + @dec #method1() {} +} + + +//// [esDecorators-classDeclaration-methods-nonStaticPrivate.js] +let C = (() => { + var _C_instances, _a, _C_method1_get; + let _instanceExtraInitializers = []; + let _private_method1_decorators; + let _private_method1_descriptor; + return _a = class C { + constructor() { + _C_instances.add(this); + __runInitializers(this, _instanceExtraInitializers); + } + }, + _C_instances = new WeakSet(), + _C_method1_get = function _C_method1_get() { return _private_method1_descriptor.value; }, + (() => { + _private_method1_decorators = [dec]; + __esDecorate(_a, _private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _private_method1_decorators, { kind: "method", name: "#method1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_method1_get); } } }, null, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2022).js new file mode 100644 index 0000000000000..138c345236288 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2022).js @@ -0,0 +1,24 @@ +//// [esDecorators-classDeclaration-methods-nonStaticPrivate.ts] +declare let dec: any; + +class C { + @dec #method1() {} +} + + +//// [esDecorators-classDeclaration-methods-nonStaticPrivate.js] +let C = (() => { + let _instanceExtraInitializers = []; + let _private_method1_decorators; + let _private_method1_descriptor; + return class C { + static { + _private_method1_decorators = [dec]; + __esDecorate(this, _private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _private_method1_decorators, { kind: "method", name: "#method1", static: false, private: true, access: { get() { return this.#method1; } } }, null, _instanceExtraInitializers); + } + get #method1() { return _private_method1_descriptor.value; } + constructor() { + __runInitializers(this, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).js new file mode 100644 index 0000000000000..84caf1e1139ba --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-methods-nonStaticPrivate.ts] +declare let dec: any; + +class C { + @dec #method1() {} +} + + +//// [esDecorators-classDeclaration-methods-nonStaticPrivate.js] +class C { + @dec + #method1() { } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2015).js new file mode 100644 index 0000000000000..b740294efdbe8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2015).js @@ -0,0 +1,34 @@ +//// [esDecorators-classDeclaration-methods-static.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) static method1() {} + @dec(2) static ["method2"]() {} + @dec(3) static [method3]() {} +} + + +//// [esDecorators-classDeclaration-methods-static.js] +const method3 = "method3"; +let C = (() => { + var _a; + var _b; + let _staticExtraInitializers = []; + let _static_method1_decorators; + let _static_member_decorators; + let _static_member_decorators_1; + return _a = class C { + static method1() { } + static ["method2"]() { } + static [(_static_method1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _b = __propKey(method3))]() { } + }, + (() => { + __esDecorate(_a, null, _static_method1_decorators, { kind: "method", name: "method1", static: true, private: false, access: { get() { return this.method1; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators, { kind: "method", name: "method2", static: true, private: false, access: { get() { return this["method2"]; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators_1, { kind: "method", name: _b, static: true, private: false, access: { get() { return this[_b]; } } }, null, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2022).js new file mode 100644 index 0000000000000..f3d17d5e49550 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2022).js @@ -0,0 +1,32 @@ +//// [esDecorators-classDeclaration-methods-static.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) static method1() {} + @dec(2) static ["method2"]() {} + @dec(3) static [method3]() {} +} + + +//// [esDecorators-classDeclaration-methods-static.js] +const method3 = "method3"; +let C = (() => { + var _a; + let _staticExtraInitializers = []; + let _static_method1_decorators; + let _static_member_decorators; + let _static_member_decorators_1; + return class C { + static { + __esDecorate(this, null, _static_method1_decorators, { kind: "method", name: "method1", static: true, private: false, access: { get() { return this.method1; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_member_decorators, { kind: "method", name: "method2", static: true, private: false, access: { get() { return this["method2"]; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_member_decorators_1, { kind: "method", name: _a, static: true, private: false, access: { get() { return this[_a]; } } }, null, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static method1() { } + static ["method2"]() { } + static [(_static_method1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(method3))]() { } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es5).js new file mode 100644 index 0000000000000..3c770a54e39d8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es5).js @@ -0,0 +1,38 @@ +//// [esDecorators-classDeclaration-methods-static.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) static method1() {} + @dec(2) static ["method2"]() {} + @dec(3) static [method3]() {} +} + + +//// [esDecorators-classDeclaration-methods-static.js] +var _this = this; +var method3 = "method3"; +var C = function () { + var _a; + var _b; + var _staticExtraInitializers = []; + var _static_method1_decorators; + var _static_member_decorators; + var _static_member_decorators_1; + return _a = /** @class */ (function () { + function C() { + } + C.method1 = function () { }; + C["method2"] = function () { }; + C[(_static_method1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _b = __propKey(method3))] = function () { }; + return C; + }()), + (function () { + __esDecorate(_a, null, _static_method1_decorators, { kind: "method", name: "method1", static: true, private: false, access: { get: function () { return this.method1; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators, { kind: "method", name: "method2", static: true, private: false, access: { get: function () { return this["method2"]; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators_1, { kind: "method", name: _b, static: true, private: false, access: { get: function () { return this[_b]; } } }, null, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _a; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=esnext).js new file mode 100644 index 0000000000000..61a37f8533c27 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=esnext).js @@ -0,0 +1,22 @@ +//// [esDecorators-classDeclaration-methods-static.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) static method1() {} + @dec(2) static ["method2"]() {} + @dec(3) static [method3]() {} +} + + +//// [esDecorators-classDeclaration-methods-static.js] +const method3 = "method3"; +class C { + @dec(1) + static method1() { } + @dec(2) + static ["method2"]() { } + @dec(3) + static [method3]() { } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js new file mode 100644 index 0000000000000..aa7cb96ea1339 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js @@ -0,0 +1,48 @@ +//// [esDecorators-classDeclaration-methods-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #method1() {} +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #method1() {} +} + + +//// [esDecorators-classDeclaration-methods-staticPrivate.js] +let C = (() => { + var _a, _C_method1_get; + let _staticExtraInitializers = []; + let _static_private_method1_decorators; + let _static_private_method1_descriptor; + return _a = class C { + }, + _C_method1_get = function _C_method1_get() { return _static_private_method1_descriptor.value; }, + (() => { + _static_private_method1_decorators = [dec]; + __esDecorate(_a, _static_private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _static_private_method1_decorators, { kind: "method", name: "#method1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_method1_get); } } }, null, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _a; +})(); +let D = (() => { + var _a, _method1; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = (_a = class { + }, + _method1 = function _method1() { }, + __setFunctionName(_a, "D"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js new file mode 100644 index 0000000000000..f3822685d063c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js @@ -0,0 +1,43 @@ +//// [esDecorators-classDeclaration-methods-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #method1() {} +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #method1() {} +} + + +//// [esDecorators-classDeclaration-methods-staticPrivate.js] +let C = (() => { + let _staticExtraInitializers = []; + let _static_private_method1_decorators; + let _static_private_method1_descriptor; + return class C { + static { + _static_private_method1_decorators = [dec]; + __esDecorate(this, _static_private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _static_private_method1_decorators, { kind: "method", name: "#method1", static: true, private: true, access: { get() { return this.#method1; } } }, null, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static get #method1() { return _static_private_method1_descriptor.value; } + }; +})(); +let D = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + static #method1() { } + }; + return D; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).js new file mode 100644 index 0000000000000..49d9a495c3256 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).js @@ -0,0 +1,24 @@ +//// [esDecorators-classDeclaration-methods-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #method1() {} +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #method1() {} +} + + +//// [esDecorators-classDeclaration-methods-staticPrivate.js] +class C { + @dec + static #method1() { } +} +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #method1() { } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js new file mode 100644 index 0000000000000..de59c5dd16f42 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js @@ -0,0 +1,27 @@ +//// [esDecorators-classDeclaration-multipleDecorators.ts] +declare let dec1: any, dec2: any; + +@dec1 +@dec2 +class C { +} + + +//// [esDecorators-classDeclaration-multipleDecorators.js] +let C = (() => { + var _a; + let _classDecorators = [dec1, dec2]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = (_a = class { + }, + __setFunctionName(_a, "C"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2022).js new file mode 100644 index 0000000000000..703dd15e67560 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2022).js @@ -0,0 +1,24 @@ +//// [esDecorators-classDeclaration-multipleDecorators.ts] +declare let dec1: any, dec2: any; + +@dec1 +@dec2 +class C { +} + + +//// [esDecorators-classDeclaration-multipleDecorators.js] +let C = (() => { + let _classDecorators = [dec1, dec2]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js new file mode 100644 index 0000000000000..659a955fe38e0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js @@ -0,0 +1,31 @@ +//// [esDecorators-classDeclaration-multipleDecorators.ts] +declare let dec1: any, dec2: any; + +@dec1 +@dec2 +class C { +} + + +//// [esDecorators-classDeclaration-multipleDecorators.js] +var _this = this; +var C = function () { + var _a; + var _classDecorators = [dec1, dec2]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + var C = (_a = /** @class */ (function () { + function class_1() { + } + return class_1; + }()), + __setFunctionName(_a, "C"), + (function () { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=esnext).js new file mode 100644 index 0000000000000..6e3e8fea328b9 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=esnext).js @@ -0,0 +1,14 @@ +//// [esDecorators-classDeclaration-multipleDecorators.ts] +declare let dec1: any, dec2: any; + +@dec1 +@dec2 +class C { +} + + +//// [esDecorators-classDeclaration-multipleDecorators.js] +@dec1 +@dec2 +class C { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es2015).js new file mode 100644 index 0000000000000..3f93aff1faa0c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es2015).js @@ -0,0 +1,41 @@ +//// [esDecorators-classDeclaration-nonStatic-methods.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec + method1() {} + + @dec + ["method2"]() {} + + @dec + [method3]() {} +} + + +//// [esDecorators-classDeclaration-nonStatic-methods.js] +const method3 = "method3"; +let C = (() => { + var _a; + var _b; + let _instanceExtraInitializers = []; + let _method1_decorators; + let _member_decorators; + let _member_decorators_1; + return _a = class C { + method1() { } + [(_method1_decorators = [dec], _member_decorators = [dec], "method2")]() { } + [(_member_decorators_1 = [dec], _b = __propKey(method3))]() { } + constructor() { + __runInitializers(this, _instanceExtraInitializers); + } + }, + (() => { + __esDecorate(_a, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators_1, { kind: "method", name: _b, static: false, private: false, access: { get() { return this[_b]; } } }, null, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es2022).js new file mode 100644 index 0000000000000..c0aacbd263843 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es2022).js @@ -0,0 +1,39 @@ +//// [esDecorators-classDeclaration-nonStatic-methods.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec + method1() {} + + @dec + ["method2"]() {} + + @dec + [method3]() {} +} + + +//// [esDecorators-classDeclaration-nonStatic-methods.js] +const method3 = "method3"; +let C = (() => { + var _a; + let _instanceExtraInitializers = []; + let _method1_decorators; + let _member_decorators; + let _member_decorators_1; + return class C { + static { + __esDecorate(this, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators_1, { kind: "method", name: _a, static: false, private: false, access: { get() { return this[_a]; } } }, null, _instanceExtraInitializers); + } + method1() { } + [(_method1_decorators = [dec], _member_decorators = [dec], "method2")]() { } + [(_member_decorators_1 = [dec], _a = __propKey(method3))]() { } + constructor() { + __runInitializers(this, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es5).js new file mode 100644 index 0000000000000..dfe79fd0f75ff --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=es5).js @@ -0,0 +1,43 @@ +//// [esDecorators-classDeclaration-nonStatic-methods.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec + method1() {} + + @dec + ["method2"]() {} + + @dec + [method3]() {} +} + + +//// [esDecorators-classDeclaration-nonStatic-methods.js] +var _this = this; +var method3 = "method3"; +var C = function () { + var _a; + var _b; + var _instanceExtraInitializers = []; + var _method1_decorators; + var _member_decorators; + var _member_decorators_1; + return _a = /** @class */ (function () { + function C() { + __runInitializers(this, _instanceExtraInitializers); + } + C.prototype.method1 = function () { }; + C.prototype[(_method1_decorators = [dec], _member_decorators = [dec], "method2")] = function () { }; + C.prototype[(_member_decorators_1 = [dec], _b = __propKey(method3))] = function () { }; + return C; + }()), + (function () { + __esDecorate(_a, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false, access: { get: function () { return this.method1; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false, access: { get: function () { return this["method2"]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators_1, { kind: "method", name: _b, static: false, private: false, access: { get: function () { return this[_b]; } } }, null, _instanceExtraInitializers); + })(), + _a; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=esnext).js new file mode 100644 index 0000000000000..d509c408a598d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-nonStatic-methods(target=esnext).js @@ -0,0 +1,27 @@ +//// [esDecorators-classDeclaration-nonStatic-methods.ts] +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec + method1() {} + + @dec + ["method2"]() {} + + @dec + [method3]() {} +} + + +//// [esDecorators-classDeclaration-nonStatic-methods.js] +const method3 = "method3"; +class C { + @dec + method1() { } + @dec + ["method2"]() { } + @dec + [method3]() { } +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2015).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2015).errors.txt new file mode 100644 index 0000000000000..2ef4cd37f1d07 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2015).errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(4,17): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(5,12): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(6,11): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(7,19): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(8,18): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(12,17): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(13,12): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(14,11): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(15,19): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(16,18): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts (10 errors) ==== + declare let dec: any; + + class C { + constructor(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + } + + (class C { + constructor(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + }); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2015).js new file mode 100644 index 0000000000000..9fcaca27c306a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2015).js @@ -0,0 +1,34 @@ +//// [esDecorators-classDeclaration-parameterDecorators.ts] +declare let dec: any; + +class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +} + +(class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +}); + +//// [esDecorators-classDeclaration-parameterDecorators.js] +class C { + constructor(x) { } + method(x) { } + set x(x) { } + static method(x) { } + static set x(x) { } +} +(class C { + constructor(x) { } + method(x) { } + set x(x) { } + static method(x) { } + static set x(x) { } +}); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2022).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2022).errors.txt new file mode 100644 index 0000000000000..2ef4cd37f1d07 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2022).errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(4,17): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(5,12): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(6,11): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(7,19): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(8,18): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(12,17): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(13,12): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(14,11): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(15,19): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(16,18): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts (10 errors) ==== + declare let dec: any; + + class C { + constructor(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + } + + (class C { + constructor(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + }); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2022).js new file mode 100644 index 0000000000000..9fcaca27c306a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es2022).js @@ -0,0 +1,34 @@ +//// [esDecorators-classDeclaration-parameterDecorators.ts] +declare let dec: any; + +class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +} + +(class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +}); + +//// [esDecorators-classDeclaration-parameterDecorators.js] +class C { + constructor(x) { } + method(x) { } + set x(x) { } + static method(x) { } + static set x(x) { } +} +(class C { + constructor(x) { } + method(x) { } + set x(x) { } + static method(x) { } + static set x(x) { } +}); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es5).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es5).errors.txt new file mode 100644 index 0000000000000..2ef4cd37f1d07 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es5).errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(4,17): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(5,12): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(6,11): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(7,19): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(8,18): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(12,17): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(13,12): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(14,11): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(15,19): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(16,18): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts (10 errors) ==== + declare let dec: any; + + class C { + constructor(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + } + + (class C { + constructor(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + }); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es5).js new file mode 100644 index 0000000000000..9be181527df66 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=es5).js @@ -0,0 +1,54 @@ +//// [esDecorators-classDeclaration-parameterDecorators.ts] +declare let dec: any; + +class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +} + +(class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +}); + +//// [esDecorators-classDeclaration-parameterDecorators.js] +var C = /** @class */ (function () { + function C(x) { + } + C.prototype.method = function (x) { }; + Object.defineProperty(C.prototype, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + C.method = function (x) { }; + Object.defineProperty(C, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + return C; +}()); +(/** @class */ (function () { + function C(x) { + } + C.prototype.method = function (x) { }; + Object.defineProperty(C.prototype, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + C.method = function (x) { }; + Object.defineProperty(C, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + return C; +}())); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=esnext).errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=esnext).errors.txt new file mode 100644 index 0000000000000..2ef4cd37f1d07 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=esnext).errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(4,17): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(5,12): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(6,11): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(7,19): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(8,18): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(12,17): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(13,12): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(14,11): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(15,19): error TS1206: Decorators are not valid here. +tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts(16,18): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts (10 errors) ==== + declare let dec: any; + + class C { + constructor(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + } + + (class C { + constructor(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static method(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + static set x(@dec x: any) {} + ~ +!!! error TS1206: Decorators are not valid here. + }); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=esnext).js new file mode 100644 index 0000000000000..7b3a073d14a34 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterDecorators(target=esnext).js @@ -0,0 +1,54 @@ +//// [esDecorators-classDeclaration-parameterDecorators.ts] +declare let dec: any; + +class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +} + +(class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +}); + +//// [esDecorators-classDeclaration-parameterDecorators.js] +class C { + constructor( + @dec + x) { } + method( + @dec + x) { } + set x( + @dec + x) { } + static method( + @dec + x) { } + static set x( + @dec + x) { } +} +(class C { + constructor( + @dec + x) { } + method( + @dec + x) { } + set x( + @dec + x) { } + static method( + @dec + x) { } + static set x( + @dec + x) { } +}); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js new file mode 100644 index 0000000000000..74361899566fe --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js @@ -0,0 +1,80 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-setFunctionName.ts] //// + +//// [a.ts] +declare let dec: any; + +@dec class C {} + +export {} + +//// [b.ts] +declare let dec: any; + +@dec export class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class {} + + +//// [a.js] +let C = (() => { + var _a; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = (_a = class { + }, + __setFunctionName(_a, "C"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +})(); +export {}; +//// [b.js] +export let C = (() => { + var _a; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = (_a = class { + }, + __setFunctionName(_a, "C"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +})(); +//// [c.js] +export default (() => { + var _a; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var default_1 = (_a = class { + }, + (() => { + __setFunctionName(_a, "default"); + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + default_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return default_1; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2022).js new file mode 100644 index 0000000000000..10ed29d837f5d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2022).js @@ -0,0 +1,72 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-setFunctionName.ts] //// + +//// [a.ts] +declare let dec: any; + +@dec class C {} + +export {} + +//// [b.ts] +declare let dec: any; + +@dec export class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class {} + + +//// [a.js] +let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); +export {}; +//// [b.js] +export let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); +//// [c.js] +export default (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var default_1 = class { + static { + __setFunctionName(this, "default"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + default_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return default_1; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js new file mode 100644 index 0000000000000..7025c94593f20 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js @@ -0,0 +1,99 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-setFunctionName.ts] //// + +//// [a.ts] +declare let dec: any; + +@dec class C {} + +export {} + +//// [b.ts] +declare let dec: any; + +@dec export class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class {} + + +//// [a.js] +"use strict"; +var _this = this; +Object.defineProperty(exports, "__esModule", { value: true }); +var C = function () { + var _a; + var _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + var C = (_a = /** @class */ (function () { + function class_1() { + } + return class_1; + }()), + __setFunctionName(_a, "C"), + (function () { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +}(); +//// [b.js] +"use strict"; +var _this = this; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.C = void 0; +var C = exports.C = function () { + var _a; + var _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + var C = (_a = /** @class */ (function () { + function class_1() { + } + return class_1; + }()), + __setFunctionName(_a, "C"), + (function () { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +}(); +//// [c.js] +"use strict"; +var _this = this; +Object.defineProperty(exports, "__esModule", { value: true }); +var default_1 = function () { + var _a; + var _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + var default_1 = (_a = /** @class */ (function () { + function class_1() { + } + return class_1; + }()), + (function () { + __setFunctionName(_a, "default_1"); + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + default_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return default_1; +}(); +exports.default = default_1; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=esnext).js new file mode 100644 index 0000000000000..6c0889fa38717 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=esnext).js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-setFunctionName.ts] //// + +//// [a.ts] +declare let dec: any; + +@dec class C {} + +export {} + +//// [b.ts] +declare let dec: any; + +@dec export class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class {} + + +//// [a.js] +@dec +class C { +} +export {}; +//// [b.js] +@dec +export class C { +} +//// [c.js] +@dec +export default class { +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName1.js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName1.js new file mode 100644 index 0000000000000..2f0656c9ea6a8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName1.js @@ -0,0 +1,72 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-setFunctionName1.ts] //// + +//// [a.ts] +declare let dec: any; + +@dec class C {} + +export {} + +//// [b.ts] +declare let dec: any; + +@dec export class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class C {} + +//// [c.ts] +declare let dec: any; + +@dec export default class {} + + +//// [a.js] +let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); +export {}; +//// [b.js] +export let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); +//// [c.js] +export default (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var default_1 = class { + static { + __setFunctionName(this, "default"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, _classExtraInitializers); + default_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return default_1; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js new file mode 100644 index 0000000000000..c4e911df534b6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js @@ -0,0 +1,26 @@ +//// [esDecorators-classDeclaration-simpleTransformation.ts] +declare let dec: any; + +@dec +class C { +} + + +//// [esDecorators-classDeclaration-simpleTransformation.js] +let C = (() => { + var _a; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = (_a = class { + }, + __setFunctionName(_a, "C"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2022).js new file mode 100644 index 0000000000000..7ca8fa9a2aa31 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2022).js @@ -0,0 +1,23 @@ +//// [esDecorators-classDeclaration-simpleTransformation.ts] +declare let dec: any; + +@dec +class C { +} + + +//// [esDecorators-classDeclaration-simpleTransformation.js] +let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js new file mode 100644 index 0000000000000..f8cdccd2c4a09 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js @@ -0,0 +1,30 @@ +//// [esDecorators-classDeclaration-simpleTransformation.ts] +declare let dec: any; + +@dec +class C { +} + + +//// [esDecorators-classDeclaration-simpleTransformation.js] +var _this = this; +var C = function () { + var _a; + var _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + var C = (_a = /** @class */ (function () { + function class_1() { + } + return class_1; + }()), + __setFunctionName(_a, "C"), + (function () { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=esnext).js new file mode 100644 index 0000000000000..a2ce1a1cc6043 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=esnext).js @@ -0,0 +1,12 @@ +//// [esDecorators-classDeclaration-simpleTransformation.ts] +declare let dec: any; + +@dec +class C { +} + + +//// [esDecorators-classDeclaration-simpleTransformation.js] +@dec +class C { +} diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.1.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.1.js new file mode 100644 index 0000000000000..62052f9a6415a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.1.js @@ -0,0 +1,49 @@ +//// [esDecorators-classExpression-classSuper.1.ts] +declare var dec: any; + +declare class Base { + static method(...args: any[]): void; +} + +const method = "method"; + +(@dec +class C extends Base { + static { + super.method(); + super["method"](); + super[method](); + + super.method``; + super["method"]``; + super[method]``; + } +}); + +//// [esDecorators-classExpression-classSuper.1.js] +const method = "method"; +((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Base; + var C = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + } + static { + Reflect.get(_classSuper, "method", _classThis).call(_classThis); + Reflect.get(_classSuper, "method", _classThis).call(_classThis); + Reflect.get(_classSuper, method, _classThis).call(_classThis); + Reflect.get(_classSuper, "method", _classThis).bind(_classThis) ``; + Reflect.get(_classSuper, "method", _classThis).bind(_classThis) ``; + Reflect.get(_classSuper, method, _classThis).bind(_classThis) ``; + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.2.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.2.js new file mode 100644 index 0000000000000..41eb73230895e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.2.js @@ -0,0 +1,93 @@ +//// [esDecorators-classExpression-classSuper.2.ts] +declare var dec: any; + +// class expression in extends should not get an assigned name +(@dec +class C1 extends class { } { + static { + super.name; + } +}); + +// function expression in extends should not get an assigned name +(@dec +class C2 extends (function() {} as any) { + static { + super.name; + } +}); + +// arrow function in extends should not get an assigned name +(@dec +class C3 extends ((() => {}) as any) { + static { + super.name; + } +}); + + +//// [esDecorators-classExpression-classSuper.2.js] +// class expression in extends should not get an assigned name +((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = (0, class { + }); + var C1 = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C1 = _classThis = _classDescriptor.value; + } + static { + Reflect.get(_classSuper, "name", _classThis); + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C1; +})()); +// function expression in extends should not get an assigned name +((() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + let _classSuper_1 = (0, function () { }); + var C2 = class extends _classSuper_1 { + static { + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + C2 = _classThis_1 = _classDescriptor_1.value; + } + static { + Reflect.get(_classSuper_1, "name", _classThis_1); + } + static { + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return C2; +})()); +// arrow function in extends should not get an assigned name +((() => { + let _classDecorators_2 = [dec]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + let _classSuper_2 = (0, (() => { })); + var C3 = class extends _classSuper_2 { + static { + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + C3 = _classThis_2 = _classDescriptor_2.value; + } + static { + Reflect.get(_classSuper_2, "name", _classThis_2); + } + static { + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + }; + return C3; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.3.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.3.js new file mode 100644 index 0000000000000..9d5d40c528b23 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.3.js @@ -0,0 +1,94 @@ +//// [esDecorators-classExpression-classSuper.3.ts] +declare var dec: any; + +declare class Base { + static x: number; +} + +const x = "x"; + +(@dec +class C extends Base { + static { + super.x; + super.x = 1; + super.x += 1; + super.x++; + super.x--; + ++super.x; + --super.x; + ({ x: super.x } = { x: 1 }); + [super.x] = [1]; + + super["x"]; + super["x"] = 1; + super["x"] += 1; + super["x"]++; + super["x"]--; + ++super["x"]; + --super["x"]; + ({ x: super["x"] } = { x: 1 }); + [super["x"]] = [1]; + + super[x]; + super[x] = 1; + super[x] += 1; + super[x]++; + super[x]--; + ++super[x]; + --super[x]; + ({ x: super[x] } = { x: 1 }); + [super[x]] = [1]; + } +}); + + +//// [esDecorators-classExpression-classSuper.3.js] +const x = "x"; +((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Base; + var C = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + } + static { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; + Reflect.get(_classSuper, "x", _classThis); + Reflect.set(_classSuper, "x", 1, _classThis); + Reflect.set(_classSuper, "x", Reflect.get(_classSuper, "x", _classThis) + 1, _classThis); + Reflect.set(_classSuper, "x", (_a = Reflect.get(_classSuper, "x", _classThis), _a++, _a), _classThis); + Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _b--, _b), _classThis); + Reflect.set(_classSuper, "x", (_c = Reflect.get(_classSuper, "x", _classThis), ++_c), _classThis); + Reflect.set(_classSuper, "x", (_d = Reflect.get(_classSuper, "x", _classThis), --_d), _classThis); + ({ x: ({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value } = { x: 1 }); + [({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value] = [1]; + Reflect.get(_classSuper, "x", _classThis); + Reflect.set(_classSuper, "x", 1, _classThis); + Reflect.set(_classSuper, "x", Reflect.get(_classSuper, "x", _classThis) + 1, _classThis); + Reflect.set(_classSuper, "x", (_e = Reflect.get(_classSuper, "x", _classThis), _e++, _e), _classThis); + Reflect.set(_classSuper, "x", (_f = Reflect.get(_classSuper, "x", _classThis), _f--, _f), _classThis); + Reflect.set(_classSuper, "x", (_g = Reflect.get(_classSuper, "x", _classThis), ++_g), _classThis); + Reflect.set(_classSuper, "x", (_h = Reflect.get(_classSuper, "x", _classThis), --_h), _classThis); + ({ x: ({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value } = { x: 1 }); + [({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value] = [1]; + Reflect.get(_classSuper, x, _classThis); + Reflect.set(_classSuper, x, 1, _classThis); + Reflect.set(_classSuper, _j = x, Reflect.get(_classSuper, _j, _classThis) + 1, _classThis); + Reflect.set(_classSuper, _k = x, (_l = Reflect.get(_classSuper, _k, _classThis), _l++, _l), _classThis); + Reflect.set(_classSuper, _m = x, (_o = Reflect.get(_classSuper, _m, _classThis), _o--, _o), _classThis); + Reflect.set(_classSuper, _p = x, (_q = Reflect.get(_classSuper, _p, _classThis), ++_q), _classThis); + Reflect.set(_classSuper, _r = x, (_s = Reflect.get(_classSuper, _r, _classThis), --_s), _classThis); + ({ x: ({ set value(_a) { Reflect.set(_classSuper, x, _a, _classThis); } }).value } = { x: 1 }); + [({ set value(_a) { Reflect.set(_classSuper, x, _a, _classThis); } }).value] = [1]; + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.4.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.4.js new file mode 100644 index 0000000000000..a8f581e410a51 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.4.js @@ -0,0 +1,45 @@ +//// [esDecorators-classExpression-classSuper.4.ts] +declare var dec: any; + +declare class Base { + static method(...args: any[]): number; +} + +const method = "method"; + +(@dec +class C extends Base { + static a = super.method(); + static b = super["method"](); + static c = super[method](); + static d = super.method``; + static e = super["method"]``; + static f = super[method]``; +}); + + +//// [esDecorators-classExpression-classSuper.4.js] +const method = "method"; +((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Base; + var C = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + } + static a = Reflect.get(_classSuper, "method", _classThis).call(_classThis); + static b = Reflect.get(_classSuper, "method", _classThis).call(_classThis); + static c = Reflect.get(_classSuper, method, _classThis).call(_classThis); + static d = Reflect.get(_classSuper, "method", _classThis).bind(_classThis) ``; + static e = Reflect.get(_classSuper, "method", _classThis).bind(_classThis) ``; + static f = Reflect.get(_classSuper, method, _classThis).bind(_classThis) ``; + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.5.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.5.js new file mode 100644 index 0000000000000..9b59a45c16cc0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.5.js @@ -0,0 +1,183 @@ +//// [esDecorators-classExpression-classSuper.5.ts] +declare var dec: any; + +declare class Base { + static x: number; +} + +const x = "x"; + +(@dec +class C1 extends Base { + static a = super.x; + static b = super.x = 1; + static c = super.x += 1; + static d = super.x++; + static e = super.x--; + static f = ++super.x; + static g = --super.x; + static h = ({ x: super.x } = { x: 1 }); + static i = [super.x] = [1]; +}); + +(@dec +class C2 extends Base { + static a = super["x"]; + static b = super["x"] = 1; + static c = super["x"] += 1; + static d = super["x"]++; + static e = super["x"]--; + static f = ++super["x"]; + static g = --super["x"]; + static h = ({ x: super["x"] } = { x: 1 }); + static i = [super["x"]] = [1]; +}); + +(@dec +class C3 extends Base { + static a = super[x]; + static b = super[x] = 1; + static c = super[x] += 1; + static d = super[x]++; + static e = super[x]--; + static f = ++super[x]; + static g = --super[x]; + static h = ({ x: super[x] } = { x: 1 }); + static i = [super[x]] = [1]; +}); + + +//// [esDecorators-classExpression-classSuper.5.js] +const x = "x"; +((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Base; + var C1 = class extends _classSuper { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C1 = _classThis = _classDescriptor.value; + } + static a = Reflect.get(_classSuper, "x", _classThis); + static b = (() => { + var _a; + return Reflect.set(_classSuper, "x", _a = 1, _classThis), _a; + })(); + static c = (() => { + var _a; + return Reflect.set(_classSuper, "x", _a = Reflect.get(_classSuper, "x", _classThis) + 1, _classThis), _a; + })(); + static d = (() => { + var _a, _b; + return Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _a = _b++, _b), _classThis), _a; + })(); + static e = (() => { + var _a, _b; + return Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _a = _b--, _b), _classThis), _a; + })(); + static f = (() => { + var _a, _b; + return Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _a = ++_b), _classThis), _a; + })(); + static g = (() => { + var _a, _b; + return Reflect.set(_classSuper, "x", (_b = Reflect.get(_classSuper, "x", _classThis), _a = --_b), _classThis), _a; + })(); + static h = ({ x: ({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value } = { x: 1 }); + static i = [({ set value(_a) { Reflect.set(_classSuper, "x", _a, _classThis); } }).value] = [1]; + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C1; +})()); +((() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + let _classSuper_1 = Base; + var C2 = class extends _classSuper_1 { + static { + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + C2 = _classThis_1 = _classDescriptor_1.value; + } + static a = Reflect.get(_classSuper_1, "x", _classThis_1); + static b = (() => { + var _a; + return Reflect.set(_classSuper_1, "x", _a = 1, _classThis_1), _a; + })(); + static c = (() => { + var _a; + return Reflect.set(_classSuper_1, "x", _a = Reflect.get(_classSuper_1, "x", _classThis_1) + 1, _classThis_1), _a; + })(); + static d = (() => { + var _a, _b; + return Reflect.set(_classSuper_1, "x", (_b = Reflect.get(_classSuper_1, "x", _classThis_1), _a = _b++, _b), _classThis_1), _a; + })(); + static e = (() => { + var _a, _b; + return Reflect.set(_classSuper_1, "x", (_b = Reflect.get(_classSuper_1, "x", _classThis_1), _a = _b--, _b), _classThis_1), _a; + })(); + static f = (() => { + var _a, _b; + return Reflect.set(_classSuper_1, "x", (_b = Reflect.get(_classSuper_1, "x", _classThis_1), _a = ++_b), _classThis_1), _a; + })(); + static g = (() => { + var _a, _b; + return Reflect.set(_classSuper_1, "x", (_b = Reflect.get(_classSuper_1, "x", _classThis_1), _a = --_b), _classThis_1), _a; + })(); + static h = ({ x: ({ set value(_a) { Reflect.set(_classSuper_1, "x", _a, _classThis_1); } }).value } = { x: 1 }); + static i = [({ set value(_a) { Reflect.set(_classSuper_1, "x", _a, _classThis_1); } }).value] = [1]; + static { + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return C2; +})()); +((() => { + let _classDecorators_2 = [dec]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + let _classSuper_2 = Base; + var C3 = class extends _classSuper_2 { + static { + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + C3 = _classThis_2 = _classDescriptor_2.value; + } + static a = Reflect.get(_classSuper_2, x, _classThis_2); + static b = (() => { + var _a; + return Reflect.set(_classSuper_2, x, _a = 1, _classThis_2), _a; + })(); + static c = (() => { + var _a, _b; + return Reflect.set(_classSuper_2, _a = x, _b = Reflect.get(_classSuper_2, _a, _classThis_2) + 1, _classThis_2), _b; + })(); + static d = (() => { + var _a, _b, _c; + return Reflect.set(_classSuper_2, _a = x, (_c = Reflect.get(_classSuper_2, _a, _classThis_2), _b = _c++, _c), _classThis_2), _b; + })(); + static e = (() => { + var _a, _b, _c; + return Reflect.set(_classSuper_2, _a = x, (_c = Reflect.get(_classSuper_2, _a, _classThis_2), _b = _c--, _c), _classThis_2), _b; + })(); + static f = (() => { + var _a, _b, _c; + return Reflect.set(_classSuper_2, _a = x, (_c = Reflect.get(_classSuper_2, _a, _classThis_2), _b = ++_c), _classThis_2), _b; + })(); + static g = (() => { + var _a, _b, _c; + return Reflect.set(_classSuper_2, _a = x, (_c = Reflect.get(_classSuper_2, _a, _classThis_2), _b = --_c), _classThis_2), _b; + })(); + static h = ({ x: ({ set value(_a) { Reflect.set(_classSuper_2, x, _a, _classThis_2); } }).value } = { x: 1 }); + static i = [({ set value(_a) { Reflect.set(_classSuper_2, x, _a, _classThis_2); } }).value] = [1]; + static { + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + }; + return C3; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.6.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.6.js new file mode 100644 index 0000000000000..05177b84057d1 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.6.js @@ -0,0 +1,54 @@ +//// [esDecorators-classExpression-classSuper.6.ts] +declare var dec: any; + +declare class Base { + static method(...args: any[]): number; + method(...args: any[]): number; +} + +// none of the following should result in caching `super` +(@dec +class C extends Base { + static m() { super.method(); } + static get x() { return super.method(); } + static set x(v: number) { super.method(); } + + constructor() { + super(); + super.method(); + } + + a = super.method(); + m() { super.method(); } + get x() { return super.method(); } + set x(v: number) { super.method(); } +}); + + +//// [esDecorators-classExpression-classSuper.6.js] +// none of the following should result in caching `super` +((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class extends Base { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + static m() { super.method(); } + static get x() { return super.method(); } + static set x(v) { super.method(); } + constructor() { + super(); + super.method(); + } + a = super.method(); + m() { super.method(); } + get x() { return super.method(); } + set x(v) { super.method(); } + }; + return C; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js new file mode 100644 index 0000000000000..b02a1b95fc953 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js @@ -0,0 +1,152 @@ +//// [esDecorators-classExpression-namedEvaluation.1.ts] +declare let dec: any; + +let x: any; + +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `=` AssignmentExpression + +x = @dec class { }; +x = class { @dec y: any; }; + +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `&&=` AssignmentExpression + +x &&= @dec class { }; +x &&= class { @dec y: any; }; + +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `||=` AssignmentExpression + +x ||= @dec class { }; +x ||= class { @dec y: any; }; + +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `??=` AssignmentExpression + +x ??= @dec class { }; +x ??= class { @dec y: any; }; + + +//// [esDecorators-classExpression-namedEvaluation.1.js] +let x; +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `=` AssignmentExpression +x = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; +})(); +x = (() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; +})(); +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `&&=` AssignmentExpression +x &&= (() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var class_2 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + class_2 = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return class_2; +})(); +x &&= (() => { + let _instanceExtraInitializers_1 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + }; +})(); +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `||=` AssignmentExpression +x ||= (() => { + let _classDecorators_2 = [dec]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + var class_3 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + class_3 = _classThis_2 = _classDescriptor_2.value; + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + }; + return class_3; +})(); +x ||= (() => { + let _instanceExtraInitializers_2 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + } + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + }; +})(); +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `??=` AssignmentExpression +x ??= (() => { + let _classDecorators_3 = [dec]; + let _classDescriptor_3; + let _classExtraInitializers_3 = []; + let _classThis_3; + var class_4 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_3 = { value: this }, _classDecorators_3, { kind: "class", name: this.name }, null, _classExtraInitializers_3); + class_4 = _classThis_3 = _classDescriptor_3.value; + __runInitializers(_classThis_3, _classExtraInitializers_3); + } + }; + return class_4; +})(); +x ??= (() => { + let _instanceExtraInitializers_3 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_3); + } + y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers)); + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js new file mode 100644 index 0000000000000..dc4b5348e85fd --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js @@ -0,0 +1,362 @@ +//// [esDecorators-classExpression-namedEvaluation.10.ts] +declare let dec: any, f: any; + +// 10.2.1.3 RS: EvaluateBody +// Initializer : `=` AssignmentExpression + +{ class C { static x = @dec class {}; } } +{ class C { static "x" = @dec class {}; } } +{ class C { static 0 = @dec class {}; } } +{ class C { static ["x"] = @dec class {}; } } +{ class C { static [0] = @dec class {}; } } +// @ts-ignore +{ class C { static [f()] = @dec class {}; } } + +// __proto__ is not special in a class field +{ class C { static __proto__ = @dec class {}; } } +{ class C { static "__proto__" = @dec class {}; } } + +{ class C { static x = class { @dec y: any }; } } +{ class C { static "x" = class { @dec y: any }; } } +{ class C { static 0 = class { @dec y: any }; } } +{ class C { static ["x"] = class { @dec y: any }; } } +{ class C { static [0] = class { @dec y: any }; } } +// @ts-ignore +{ class C { static [f()] = @dec class {}; } } + +// __proto__ is not special in a class field +{ class C { static __proto__ = class { @dec y: any }; } } +{ class C { static "__proto__" = class { @dec y: any }; } } + +// ensure nested named evaluation happens when field is also transformed +{ class C { @dec static x = @dec class {}; } } + + +//// [esDecorators-classExpression-namedEvaluation.10.js] +var _a, _b; +// 10.2.1.3 RS: EvaluateBody +// Initializer : `=` AssignmentExpression +{ + class C { + static x = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; + })(); + } +} +{ + class C { + static "x" = (() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var class_2 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + class_2 = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return class_2; + })(); + } +} +{ + class C { + static 0 = (() => { + let _classDecorators_2 = [dec]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + var class_3 = class { + static { + __setFunctionName(this, "0"); + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + class_3 = _classThis_2 = _classDescriptor_2.value; + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + }; + return class_3; + })(); + } +} +{ + class C { + static ["x"] = (() => { + let _classDecorators_3 = [dec]; + let _classDescriptor_3; + let _classExtraInitializers_3 = []; + let _classThis_3; + var class_4 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_3 = { value: this }, _classDecorators_3, { kind: "class", name: this.name }, null, _classExtraInitializers_3); + class_4 = _classThis_3 = _classDescriptor_3.value; + __runInitializers(_classThis_3, _classExtraInitializers_3); + } + }; + return class_4; + })(); + } +} +{ + class C { + static [0] = (() => { + let _classDecorators_4 = [dec]; + let _classDescriptor_4; + let _classExtraInitializers_4 = []; + let _classThis_4; + var class_5 = class { + static { + __setFunctionName(this, "0"); + __esDecorate(null, _classDescriptor_4 = { value: this }, _classDecorators_4, { kind: "class", name: this.name }, null, _classExtraInitializers_4); + class_5 = _classThis_4 = _classDescriptor_4.value; + __runInitializers(_classThis_4, _classExtraInitializers_4); + } + }; + return class_5; + })(); + } +} +// @ts-ignore +{ + class C { + static [_a = __propKey(f())] = (() => { + let _classDecorators_5 = [dec]; + let _classDescriptor_5; + let _classExtraInitializers_5 = []; + let _classThis_5; + var class_6 = class { + static { + __setFunctionName(this, _a); + __esDecorate(null, _classDescriptor_5 = { value: this }, _classDecorators_5, { kind: "class", name: this.name }, null, _classExtraInitializers_5); + class_6 = _classThis_5 = _classDescriptor_5.value; + __runInitializers(_classThis_5, _classExtraInitializers_5); + } + }; + return class_6; + })(); + } +} +// __proto__ is not special in a class field +{ + class C { + static __proto__ = (() => { + let _classDecorators_6 = [dec]; + let _classDescriptor_6; + let _classExtraInitializers_6 = []; + let _classThis_6; + var class_7 = class { + static { + __setFunctionName(this, "__proto__"); + __esDecorate(null, _classDescriptor_6 = { value: this }, _classDecorators_6, { kind: "class", name: this.name }, null, _classExtraInitializers_6); + class_7 = _classThis_6 = _classDescriptor_6.value; + __runInitializers(_classThis_6, _classExtraInitializers_6); + } + }; + return class_7; + })(); + } +} +{ + class C { + static "__proto__" = (() => { + let _classDecorators_7 = [dec]; + let _classDescriptor_7; + let _classExtraInitializers_7 = []; + let _classThis_7; + var class_8 = class { + static { + __setFunctionName(this, "__proto__"); + __esDecorate(null, _classDescriptor_7 = { value: this }, _classDecorators_7, { kind: "class", name: this.name }, null, _classExtraInitializers_7); + class_8 = _classThis_7 = _classDescriptor_7.value; + __runInitializers(_classThis_7, _classExtraInitializers_7); + } + }; + return class_8; + })(); + } +} +{ + class C { + static x = (() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; + })(); + } +} +{ + class C { + static "x" = (() => { + let _instanceExtraInitializers_1 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + }; + })(); + } +} +{ + class C { + static 0 = (() => { + let _instanceExtraInitializers_2 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "0"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + } + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + }; + })(); + } +} +{ + class C { + static ["x"] = (() => { + let _instanceExtraInitializers_3 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_3); + } + y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers)); + }; + })(); + } +} +{ + class C { + static [0] = (() => { + let _instanceExtraInitializers_4 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "0"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_4); + } + y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers)); + }; + })(); + } +} +// @ts-ignore +{ + class C { + static [_b = __propKey(f())] = (() => { + let _classDecorators_8 = [dec]; + let _classDescriptor_8; + let _classExtraInitializers_8 = []; + let _classThis_8; + var class_9 = class { + static { + __setFunctionName(this, _b); + __esDecorate(null, _classDescriptor_8 = { value: this }, _classDecorators_8, { kind: "class", name: this.name }, null, _classExtraInitializers_8); + class_9 = _classThis_8 = _classDescriptor_8.value; + __runInitializers(_classThis_8, _classExtraInitializers_8); + } + }; + return class_9; + })(); + } +} +// __proto__ is not special in a class field +{ + class C { + static __proto__ = (() => { + let _instanceExtraInitializers_5 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "__proto__"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_5); + } + y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers)); + }; + })(); + } +} +{ + class C { + static "__proto__" = (() => { + let _instanceExtraInitializers_6 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "__proto__"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_6); + } + y = (__runInitializers(this, _instanceExtraInitializers_6), __runInitializers(this, _y_initializers)); + }; + })(); + } +} +// ensure nested named evaluation happens when field is also transformed +{ + let C = (() => { + let _staticExtraInitializers = []; + let _static_x_decorators; + let _static_x_initializers = []; + return class C { + static { + _static_x_decorators = [dec]; + __esDecorate(null, null, _static_x_decorators, { kind: "field", name: "x", static: true, private: false, access: { get() { return this.x; }, set(value) { this.x = value; } } }, _static_x_initializers, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static x = __runInitializers(this, _static_x_initializers, (() => { + let _classDecorators_9 = [dec]; + let _classDescriptor_9; + let _classExtraInitializers_9 = []; + let _classThis_9; + var class_10 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_9 = { value: this }, _classDecorators_9, { kind: "class", name: this.name }, null, _classExtraInitializers_9); + class_10 = _classThis_9 = _classDescriptor_9.value; + __runInitializers(_classThis_9, _classExtraInitializers_9); + } + }; + return class_10; + })()); + }; + })(); +} diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js new file mode 100644 index 0000000000000..2100490d4e6f7 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js @@ -0,0 +1,70 @@ +//// [esDecorators-classExpression-namedEvaluation.11.ts] +declare let dec: any; + +// No NamedEvaluation, no class name + +(@dec class {}); +(class { @dec y: any }); + +// No NamedEvaluation, class name + +(@dec class C {}); +(class C { @dec y: any }); + + +//// [esDecorators-classExpression-namedEvaluation.11.js] +// No NamedEvaluation, no class name +((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, ""); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; +})()); +((() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; +})()); +// No NamedEvaluation, class name +((() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var C = class { + static { + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + C = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return C; +})()); +((() => { + let _instanceExtraInitializers_1 = []; + let _y_decorators; + let _y_initializers = []; + return class C { + static { + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + }; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js new file mode 100644 index 0000000000000..124c7da15caa6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js @@ -0,0 +1,253 @@ +//// [esDecorators-classExpression-namedEvaluation.2.ts] +declare let dec: any; + +let x: any, f: any; + +// 13.2.5.5 RS: PropertyDefinitionEvaluation +// PropertyAssignment : PropertyName `:` AssignmentExpression + +({ x: @dec class { } }); +({ x: class { @dec y: any; } }); + +({ "x": @dec class { } }); +({ "x": class { @dec y: any; } }); + +({ 0: @dec class { } }); +({ 0: class { @dec y: any; } }); + +({ ["x"]: @dec class { } }); +({ ["x"]: class { @dec y: any; } }); + +({ [0]: @dec class { } }); +({ [0]: class { @dec y: any; } }); + +({ [f()]: @dec class { } }); +({ [f()]: class { @dec y: any; } }); + +// __proto__ setters do not perform NamedEvaluation +({ __proto__: @dec class { } }); +({ "__proto__": @dec class { } }); + +// "__proto__" in a computed property name *does* perform NamedEvaluation +({ ["__proto__"]: @dec class { } }); + +//// [esDecorators-classExpression-namedEvaluation.2.js] +var _a, _b; +let x, f; +// 13.2.5.5 RS: PropertyDefinitionEvaluation +// PropertyAssignment : PropertyName `:` AssignmentExpression +({ x: (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; + })() }); +({ x: (() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; + })() }); +({ "x": (() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var class_2 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + class_2 = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return class_2; + })() }); +({ "x": (() => { + let _instanceExtraInitializers_1 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + }; + })() }); +({ 0: (() => { + let _classDecorators_2 = [dec]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + var class_3 = class { + static { + __setFunctionName(this, "0"); + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + class_3 = _classThis_2 = _classDescriptor_2.value; + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + }; + return class_3; + })() }); +({ 0: (() => { + let _instanceExtraInitializers_2 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "0"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + } + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + }; + })() }); +({ ["x"]: (() => { + let _classDecorators_3 = [dec]; + let _classDescriptor_3; + let _classExtraInitializers_3 = []; + let _classThis_3; + var class_4 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_3 = { value: this }, _classDecorators_3, { kind: "class", name: this.name }, null, _classExtraInitializers_3); + class_4 = _classThis_3 = _classDescriptor_3.value; + __runInitializers(_classThis_3, _classExtraInitializers_3); + } + }; + return class_4; + })() }); +({ ["x"]: (() => { + let _instanceExtraInitializers_3 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_3); + } + y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers)); + }; + })() }); +({ [0]: (() => { + let _classDecorators_4 = [dec]; + let _classDescriptor_4; + let _classExtraInitializers_4 = []; + let _classThis_4; + var class_5 = class { + static { + __setFunctionName(this, "0"); + __esDecorate(null, _classDescriptor_4 = { value: this }, _classDecorators_4, { kind: "class", name: this.name }, null, _classExtraInitializers_4); + class_5 = _classThis_4 = _classDescriptor_4.value; + __runInitializers(_classThis_4, _classExtraInitializers_4); + } + }; + return class_5; + })() }); +({ [0]: (() => { + let _instanceExtraInitializers_4 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "0"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_4); + } + y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers)); + }; + })() }); +({ [_a = __propKey(f())]: (() => { + let _classDecorators_5 = [dec]; + let _classDescriptor_5; + let _classExtraInitializers_5 = []; + let _classThis_5; + var class_6 = class { + static { + __setFunctionName(this, _a); + __esDecorate(null, _classDescriptor_5 = { value: this }, _classDecorators_5, { kind: "class", name: this.name }, null, _classExtraInitializers_5); + class_6 = _classThis_5 = _classDescriptor_5.value; + __runInitializers(_classThis_5, _classExtraInitializers_5); + } + }; + return class_6; + })() }); +({ [_b = __propKey(f())]: (() => { + let _instanceExtraInitializers_5 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, _b); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_5); + } + y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers)); + }; + })() }); +// __proto__ setters do not perform NamedEvaluation +({ __proto__: (() => { + let _classDecorators_6 = [dec]; + let _classDescriptor_6; + let _classExtraInitializers_6 = []; + let _classThis_6; + var class_7 = class { + static { + __setFunctionName(this, ""); + __esDecorate(null, _classDescriptor_6 = { value: this }, _classDecorators_6, { kind: "class", name: this.name }, null, _classExtraInitializers_6); + class_7 = _classThis_6 = _classDescriptor_6.value; + __runInitializers(_classThis_6, _classExtraInitializers_6); + } + }; + return class_7; + })() }); +({ "__proto__": (() => { + let _classDecorators_7 = [dec]; + let _classDescriptor_7; + let _classExtraInitializers_7 = []; + let _classThis_7; + var class_8 = class { + static { + __setFunctionName(this, ""); + __esDecorate(null, _classDescriptor_7 = { value: this }, _classDecorators_7, { kind: "class", name: this.name }, null, _classExtraInitializers_7); + class_8 = _classThis_7 = _classDescriptor_7.value; + __runInitializers(_classThis_7, _classExtraInitializers_7); + } + }; + return class_8; + })() }); +// "__proto__" in a computed property name *does* perform NamedEvaluation +({ ["__proto__"]: (() => { + let _classDecorators_8 = [dec]; + let _classDescriptor_8; + let _classExtraInitializers_8 = []; + let _classThis_8; + var class_9 = class { + static { + __setFunctionName(this, "__proto__"); + __esDecorate(null, _classDescriptor_8 = { value: this }, _classDecorators_8, { kind: "class", name: this.name }, null, _classExtraInitializers_8); + class_9 = _classThis_8 = _classDescriptor_8.value; + __runInitializers(_classThis_8, _classExtraInitializers_8); + } + }; + return class_9; + })() }); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js new file mode 100644 index 0000000000000..a2116183619df --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js @@ -0,0 +1,120 @@ +//// [esDecorators-classExpression-namedEvaluation.3.ts] +declare let dec: any; + +// 14.3.1.2 RS: Evaluation +// LexicalBinding : BindingIdentifier Initializer + +{ let x = @dec class { }; } +{ let x = class { @dec y: any; }; } + +{ const x = @dec class { }; } +{ const x = class { @dec y: any; }; } + +// 14.3.2.1 RS: Evaluation +// VariableDeclaration : BindingIdentifier Initializer + +{ var x2 = @dec class { }; } +{ var x1 = class { @dec y: any; }; } + + +//// [esDecorators-classExpression-namedEvaluation.3.js] +// 14.3.1.2 RS: Evaluation +// LexicalBinding : BindingIdentifier Initializer +{ + let x = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; + })(); +} +{ + let x = (() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; + })(); +} +{ + const x = (() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var class_2 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + class_2 = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return class_2; + })(); +} +{ + const x = (() => { + let _instanceExtraInitializers_1 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + }; + })(); +} +// 14.3.2.1 RS: Evaluation +// VariableDeclaration : BindingIdentifier Initializer +{ + var x2 = (() => { + let _classDecorators_2 = [dec]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + var class_3 = class { + static { + __setFunctionName(this, "x2"); + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + class_3 = _classThis_2 = _classDescriptor_2.value; + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + }; + return class_3; + })(); +} +{ + var x1 = (() => { + let _instanceExtraInitializers_2 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x1"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + } + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + }; + })(); +} diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js new file mode 100644 index 0000000000000..90181ec29d0c6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js @@ -0,0 +1,121 @@ +//// [esDecorators-classExpression-namedEvaluation.4.ts] +declare let dec: any, obj: any; + +// 8.6.3 RS: IteratorBindingInitialization +// SingleNameBinding : BindingIdentifier Initializer? + +{ const [x = @dec class { }] = obj; } +{ const [x = class { @dec y: any; }] = obj; } + +// 14.3.3.3 RS: KeyedBindingInitialization +// SingleNameBinding : BindingIdentifier Initializer? + +{ const { x = @dec class { } } = obj; } +{ const { x = class { @dec y: any; } } = obj; } + +{ const { y: x = @dec class { } } = obj; } +{ const { y: x = class { @dec y: any; } } = obj; } + + + +//// [esDecorators-classExpression-namedEvaluation.4.js] +// 8.6.3 RS: IteratorBindingInitialization +// SingleNameBinding : BindingIdentifier Initializer? +{ + const [x = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; + })()] = obj; +} +{ + const [x = (() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; + })()] = obj; +} +// 14.3.3.3 RS: KeyedBindingInitialization +// SingleNameBinding : BindingIdentifier Initializer? +{ + const { x = (() => { + let _classDecorators_1 = [dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var class_2 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + class_2 = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return class_2; + })() } = obj; +} +{ + const { x = (() => { + let _instanceExtraInitializers_1 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + }; + })() } = obj; +} +{ + const { y: x = (() => { + let _classDecorators_2 = [dec]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + var class_3 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + class_3 = _classThis_2 = _classDescriptor_2.value; + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + }; + return class_3; + })() } = obj; +} +{ + const { y: x = (() => { + let _instanceExtraInitializers_2 = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + } + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + }; + })() } = obj; +} diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js new file mode 100644 index 0000000000000..4aa3617ce7592 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js @@ -0,0 +1,41 @@ +//// [esDecorators-classExpression-namedEvaluation.5.ts] +declare let dec: any, obj: any, x: any; + +// 13.15.5.3 RS: PropertyDestructuringAssignmentEvaluation +// AssignmentProperty : IdentifierReference Initializer? + +({ x = @dec class { } } = obj); +({ x = class { @dec y: any; } } = obj); + + +//// [esDecorators-classExpression-namedEvaluation.5.js] +// 13.15.5.3 RS: PropertyDestructuringAssignmentEvaluation +// AssignmentProperty : IdentifierReference Initializer? +({ x = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; + })() } = obj); +({ x = (() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; + })() } = obj); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js new file mode 100644 index 0000000000000..f6b928e8e12d2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js @@ -0,0 +1,41 @@ +//// [esDecorators-classExpression-namedEvaluation.6.ts] +declare let dec: any, obj: any, x: any; + +// 13.15.5.6 RS: KeyedDestructuringAssignmentEvaluation +// AssignmentElement : DestructuringAssignmentTarget Initializer? + +({ y: x = @dec class { } } = obj); +({ y: x = class { @dec y: any; } } = obj); + + +//// [esDecorators-classExpression-namedEvaluation.6.js] +// 13.15.5.6 RS: KeyedDestructuringAssignmentEvaluation +// AssignmentElement : DestructuringAssignmentTarget Initializer? +({ y: x = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; + })() } = obj); +({ y: x = (() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; + })() } = obj); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js new file mode 100644 index 0000000000000..9ce49f1b34d02 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js @@ -0,0 +1,41 @@ +//// [esDecorators-classExpression-namedEvaluation.7.ts] +declare let dec: any, obj: any, x: any; + +// 13.15.5.6 RS: KeyedDestructuringAssignmentEvaluation +// AssignmentElement : DestructuringAssignmentTarget Initializer? + +[x = @dec class { }] = obj; +[x = class { @dec y: any; }] = obj; + + +//// [esDecorators-classExpression-namedEvaluation.7.js] +// 13.15.5.6 RS: KeyedDestructuringAssignmentEvaluation +// AssignmentElement : DestructuringAssignmentTarget Initializer? +[x = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, "x"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; + })()] = obj; +[x = (() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "x"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; + })()] = obj; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js new file mode 100644 index 0000000000000..54212a869465f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js @@ -0,0 +1,52 @@ +//// [tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.8.ts] //// + +//// [a.ts] +declare let dec: any; + +// 16.2.3.7 RS: Evaluation +// ExportDeclaration : `export` `default` AssignmentExpression `;` + +export default (@dec class { }); + +//// [b.ts] +declare let dec: any; + +// 16.2.3.7 RS: Evaluation +// ExportDeclaration : `export` `default` AssignmentExpression `;` + +export default (class { @dec y: any }); + +//// [a.js] +// 16.2.3.7 RS: Evaluation +// ExportDeclaration : `export` `default` AssignmentExpression `;` +export default ((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, "default"); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; +})()); +//// [b.js] +// 16.2.3.7 RS: Evaluation +// ExportDeclaration : `export` `default` AssignmentExpression `;` +export default ((() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + __setFunctionName(this, "default"); + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js new file mode 100644 index 0000000000000..fff136d45fd88 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js @@ -0,0 +1,43 @@ +//// [tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.9.ts] //// + +//// [a.ts] +declare let dec: any; + +export = @dec class { }; + +//// [b.ts] +declare let dec: any; + +export = class { @dec y: any }; + +//// [a.js] +"use strict"; +module.exports = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + __setFunctionName(this, ""); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1; +})(); +//// [b.js] +"use strict"; +module.exports = (() => { + let _instanceExtraInitializers = []; + let _y_decorators; + let _y_initializers = []; + return class { + static { + _y_decorators = [dec]; + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + }; +})(); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).errors.txt b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).errors.txt new file mode 100644 index 0000000000000..ca3cef9902828 --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).errors.txt @@ -0,0 +1,51 @@ +error TS5052: Option 'emitDecoratorMetadata' cannot be specified without specifying option 'experimentalDecorators'. + + +!!! error TS5052: Option 'emitDecoratorMetadata' cannot be specified without specifying option 'experimentalDecorators'. +==== tests/cases/conformance/esDecorators/esDecorators-emitDecoratorMetadata.ts (0 errors) ==== + declare let dec: any; + + @dec + class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; + } + + (@dec class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; + }); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js new file mode 100644 index 0000000000000..9c1668add8878 --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js @@ -0,0 +1,149 @@ +//// [esDecorators-emitDecoratorMetadata.ts] +declare let dec: any; + +@dec +class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +} + +(@dec class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +}); + +//// [esDecorators-emitDecoratorMetadata.js] +let C = (() => { + var _a; + let _classDecorators = [dec, __metadata("design:paramtypes", [Number])]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_method_decorators; + let _static_set_x_decorators; + let _static_y_decorators; + let _static_y_initializers = []; + let _method_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + var C = (_a = class { + constructor(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + } + method(x) { } + set x(x) { } + static method(x) { } + static set x(x) { } + }, + __setFunctionName(_a, "C"), + (() => { + _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _y_decorators = [dec, __metadata("design:type", Number)]; + _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _static_y_decorators = [dec, __metadata("design:type", Number)]; + __esDecorate(_a, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + })(), + _a.y = __runInitializers(_classThis, _static_y_initializers), + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +})(); +((() => { + var _a; + let _classDecorators_1 = [dec, __metadata("design:paramtypes", [Number])]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + let _staticExtraInitializers_1 = []; + let _instanceExtraInitializers_1 = []; + let _static_method_decorators; + let _static_set_x_decorators; + let _static_y_decorators; + let _static_y_initializers = []; + let _method_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + var C = (_a = class { + constructor(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + } + method(x) { } + set x(x) { } + static method(x) { } + static set x(x) { } + }, + __setFunctionName(_a, "C"), + (() => { + _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _y_decorators = [dec, __metadata("design:type", Number)]; + _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _static_y_decorators = [dec, __metadata("design:type", Number)]; + __esDecorate(_a, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers_1); + __esDecorate(_a, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers_1); + __esDecorate(_a, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers_1); + __esDecorate(_a, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers_1); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(null, _classDescriptor_1 = { value: _a }, _classDecorators_1, { kind: "class", name: _a.name }, null, _classExtraInitializers_1); + C = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _staticExtraInitializers_1); + })(), + _a.y = __runInitializers(_classThis_1, _static_y_initializers), + (() => { + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(), + _a); + return C; +})()); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).errors.txt b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).errors.txt new file mode 100644 index 0000000000000..ca3cef9902828 --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).errors.txt @@ -0,0 +1,51 @@ +error TS5052: Option 'emitDecoratorMetadata' cannot be specified without specifying option 'experimentalDecorators'. + + +!!! error TS5052: Option 'emitDecoratorMetadata' cannot be specified without specifying option 'experimentalDecorators'. +==== tests/cases/conformance/esDecorators/esDecorators-emitDecoratorMetadata.ts (0 errors) ==== + declare let dec: any; + + @dec + class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; + } + + (@dec class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; + }); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js new file mode 100644 index 0000000000000..c668d395b8cb6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js @@ -0,0 +1,141 @@ +//// [esDecorators-emitDecoratorMetadata.ts] +declare let dec: any; + +@dec +class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +} + +(@dec class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +}); + +//// [esDecorators-emitDecoratorMetadata.js] +let C = (() => { + let _classDecorators = [dec, __metadata("design:paramtypes", [Number])]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_method_decorators; + let _static_set_x_decorators; + let _static_y_decorators; + let _static_y_initializers = []; + let _method_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + var C = class { + static { + _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _y_decorators = [dec, __metadata("design:type", Number)]; + _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _static_y_decorators = [dec, __metadata("design:type", Number)]; + __esDecorate(this, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + } + constructor(x) { } + method(x) { } + set x(x) { } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + static method(x) { } + static set x(x) { } + static y = __runInitializers(_classThis, _static_y_initializers); + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C; +})(); +((() => { + let _classDecorators_1 = [dec, __metadata("design:paramtypes", [Number])]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + let _staticExtraInitializers_1 = []; + let _instanceExtraInitializers_1 = []; + let _static_method_decorators; + let _static_set_x_decorators; + let _static_y_decorators; + let _static_y_initializers = []; + let _method_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + var C = class { + static { + _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _y_decorators = [dec, __metadata("design:type", Number)]; + _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _static_y_decorators = [dec, __metadata("design:type", Number)]; + __esDecorate(this, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers_1); + __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers_1); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers_1); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers_1); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + C = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _staticExtraInitializers_1); + } + constructor(x) { } + method(x) { } + set x(x) { } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + static method(x) { } + static set x(x) { } + static y = __runInitializers(_classThis_1, _static_y_initializers); + static { + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return C; +})()); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).errors.txt b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).errors.txt new file mode 100644 index 0000000000000..ca3cef9902828 --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).errors.txt @@ -0,0 +1,51 @@ +error TS5052: Option 'emitDecoratorMetadata' cannot be specified without specifying option 'experimentalDecorators'. + + +!!! error TS5052: Option 'emitDecoratorMetadata' cannot be specified without specifying option 'experimentalDecorators'. +==== tests/cases/conformance/esDecorators/esDecorators-emitDecoratorMetadata.ts (0 errors) ==== + declare let dec: any; + + @dec + class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; + } + + (@dec class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; + }); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js new file mode 100644 index 0000000000000..f6268749c264a --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js @@ -0,0 +1,168 @@ +//// [esDecorators-emitDecoratorMetadata.ts] +declare let dec: any; + +@dec +class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +} + +(@dec class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +}); + +//// [esDecorators-emitDecoratorMetadata.js] +var _this = this; +var C = function () { + var _a; + var _classDecorators = [dec, __metadata("design:paramtypes", [Number])]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + var _staticExtraInitializers = []; + var _instanceExtraInitializers = []; + var _static_method_decorators; + var _static_set_x_decorators; + var _static_y_decorators; + var _static_y_initializers = []; + var _method_decorators; + var _set_x_decorators; + var _y_decorators; + var _y_initializers = []; + var C = (_a = /** @class */ (function () { + function class_1(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + } + class_1.prototype.method = function (x) { }; + Object.defineProperty(class_1.prototype, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + class_1.method = function (x) { }; + Object.defineProperty(class_1, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + return class_1; + }()), + __setFunctionName(_a, "C"), + (function () { + _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _y_decorators = [dec, __metadata("design:type", Number)]; + _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _static_y_decorators = [dec, __metadata("design:type", Number)]; + __esDecorate(_a, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get: function () { return this.method; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set: function (value) { this.x = value; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get: function () { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set: function (value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + })(), + _a.y = __runInitializers(_classThis, _static_y_initializers), + (function () { + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return C; +}(); +((function () { + var _a; + var _classDecorators_1 = [dec, __metadata("design:paramtypes", [Number])]; + var _classDescriptor_1; + var _classExtraInitializers_1 = []; + var _classThis_1; + var _staticExtraInitializers_1 = []; + var _instanceExtraInitializers_1 = []; + var _static_method_decorators; + var _static_set_x_decorators; + var _static_y_decorators; + var _static_y_initializers = []; + var _method_decorators; + var _set_x_decorators; + var _y_decorators; + var _y_initializers = []; + var C = (_a = /** @class */ (function () { + function class_2(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + } + class_2.prototype.method = function (x) { }; + Object.defineProperty(class_2.prototype, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + class_2.method = function (x) { }; + Object.defineProperty(class_2, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + return class_2; + }()), + __setFunctionName(_a, "C"), + (function () { + _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _y_decorators = [dec, __metadata("design:type", Number)]; + _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; + _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; + _static_y_decorators = [dec, __metadata("design:type", Number)]; + __esDecorate(_a, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get: function () { return this.method; } } }, null, _staticExtraInitializers_1); + __esDecorate(_a, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set: function (value) { this.x = value; } } }, null, _staticExtraInitializers_1); + __esDecorate(_a, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get: function () { return this.method; } } }, null, _instanceExtraInitializers_1); + __esDecorate(_a, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set: function (value) { this.x = value; } } }, null, _instanceExtraInitializers_1); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(null, _classDescriptor_1 = { value: _a }, _classDecorators_1, { kind: "class", name: _a.name }, null, _classExtraInitializers_1); + C = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _staticExtraInitializers_1); + })(), + _a.y = __runInitializers(_classThis_1, _static_y_initializers), + (function () { + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(), + _a); + return C; +})()); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).errors.txt b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).errors.txt new file mode 100644 index 0000000000000..ca3cef9902828 --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).errors.txt @@ -0,0 +1,51 @@ +error TS5052: Option 'emitDecoratorMetadata' cannot be specified without specifying option 'experimentalDecorators'. + + +!!! error TS5052: Option 'emitDecoratorMetadata' cannot be specified without specifying option 'experimentalDecorators'. +==== tests/cases/conformance/esDecorators/esDecorators-emitDecoratorMetadata.ts (0 errors) ==== + declare let dec: any; + + @dec + class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; + } + + (@dec class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; + }); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).js new file mode 100644 index 0000000000000..c8888fa2878a2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).js @@ -0,0 +1,108 @@ +//// [esDecorators-emitDecoratorMetadata.ts] +declare let dec: any; + +@dec +class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +} + +(@dec class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +}); + +//// [esDecorators-emitDecoratorMetadata.js] +@dec +@__metadata("design:paramtypes", [Number]) +class C { + constructor(x) { } + @dec + @__metadata("design:type", Function) + @__metadata("design:paramtypes", [Number]) + @__metadata("design:returntype", void 0) + method(x) { } + @dec + @__metadata("design:type", Number) + @__metadata("design:paramtypes", [Number]) + set x(x) { } + @dec + @__metadata("design:type", Number) + y; + @dec + @__metadata("design:type", Function) + @__metadata("design:paramtypes", [Number]) + @__metadata("design:returntype", void 0) + static method(x) { } + @dec + @__metadata("design:type", Number) + @__metadata("design:paramtypes", [Number]) + static set x(x) { } + @dec + @__metadata("design:type", Number) + static y; +} +( +@dec +@__metadata("design:paramtypes", [Number]) +class C { + constructor(x) { } + @dec + @__metadata("design:type", Function) + @__metadata("design:paramtypes", [Number]) + @__metadata("design:returntype", void 0) + method(x) { } + @dec + @__metadata("design:type", Number) + @__metadata("design:paramtypes", [Number]) + set x(x) { } + @dec + @__metadata("design:type", Number) + y; + @dec + @__metadata("design:type", Function) + @__metadata("design:paramtypes", [Number]) + @__metadata("design:returntype", void 0) + static method(x) { } + @dec + @__metadata("design:type", Number) + @__metadata("design:paramtypes", [Number]) + static set x(x) { } + @dec + @__metadata("design:type", Number) + static y; +}); diff --git a/tests/baselines/reference/generatorTypeCheck39.errors.txt b/tests/baselines/reference/generatorTypeCheck39.errors.txt index 740c363436848..ab50f4c87438f 100644 --- a/tests/baselines/reference/generatorTypeCheck39.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck39.errors.txt @@ -1,16 +1,13 @@ -tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(6,11): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(7,13): error TS1163: A 'yield' expression is only allowed in a generator body. -==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts (2 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts (1 errors) ==== function decorator(x: any) { return y => { }; } function* g() { @decorator(yield 0) class C { - ~ -!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. x = yield 0; ~~~~~ !!! error TS1163: A 'yield' expression is only allowed in a generator body. diff --git a/tests/baselines/reference/generatorTypeCheck59.errors.txt b/tests/baselines/reference/generatorTypeCheck59.errors.txt deleted file mode 100644 index 87a640112d091..0000000000000 --- a/tests/baselines/reference/generatorTypeCheck59.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts(4,9): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. - - -==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts (1 errors) ==== - function* g() { - class C { - @(yield "") - m() { } - ~ -!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. - }; - } \ No newline at end of file diff --git a/tests/baselines/reference/generatorTypeCheck61.errors.txt b/tests/baselines/reference/generatorTypeCheck61.errors.txt deleted file mode 100644 index e6eda81186a3d..0000000000000 --- a/tests/baselines/reference/generatorTypeCheck61.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts(3,11): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. - - -==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts (1 errors) ==== - function * g() { - @(yield 0) - class C {}; - ~ -!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. - } \ No newline at end of file diff --git a/tests/baselines/reference/manyCompilerErrorsInTheTwoFiles.errors.txt b/tests/baselines/reference/manyCompilerErrorsInTheTwoFiles.errors.txt index 265c339afc2f5..3a7a49aa502bb 100644 --- a/tests/baselines/reference/manyCompilerErrorsInTheTwoFiles.errors.txt +++ b/tests/baselines/reference/manyCompilerErrorsInTheTwoFiles.errors.txt @@ -1,35 +1,27 @@ -tests/cases/compiler/a.ts:1:11 - error TS1109: Expression expected. - -1 const a =!@#!@$ -   ~ tests/cases/compiler/a.ts:1:12 - error TS18026: '#!' can only be used at the start of a file. 1 const a =!@#!@$     -tests/cases/compiler/a.ts:1:14 - error TS1109: Expression expected. +tests/cases/compiler/a.ts:1:13 - error TS1134: Variable declaration expected. 1 const a =!@#!@$ -   ~ -tests/cases/compiler/a.ts:2:12 - error TS1109: Expression expected. +   ~ +tests/cases/compiler/a.ts:1:16 - error TS1109: Expression expected. -2 const b = !@#!@#!@#! -   ~ +1 const a =!@#!@$ +    tests/cases/compiler/a.ts:2:13 - error TS18026: '#!' can only be used at the start of a file. 2 const b = !@#!@#!@#!     -tests/cases/compiler/a.ts:2:15 - error TS1109: Expression expected. +tests/cases/compiler/a.ts:2:14 - error TS1134: Variable declaration expected. 2 const b = !@#!@#!@#! -   ~ +   ~ tests/cases/compiler/a.ts:2:16 - error TS18026: '#!' can only be used at the start of a file. 2 const b = !@#!@#!@#!     -tests/cases/compiler/a.ts:2:18 - error TS1109: Expression expected. - -2 const b = !@#!@#!@#! -   ~ tests/cases/compiler/a.ts:2:19 - error TS18026: '#!' can only be used at the start of a file. 2 const b = !@#!@#!@#! @@ -84,25 +76,21 @@   ~~~~~ -==== tests/cases/compiler/a.ts (18 errors) ==== +==== tests/cases/compiler/a.ts (16 errors) ==== const a =!@#!@$ - ~ -!!! error TS1109: Expression expected. !!! error TS18026: '#!' can only be used at the start of a file. - ~ + ~ +!!! error TS1134: Variable declaration expected. + !!! error TS1109: Expression expected. const b = !@#!@#!@#! - ~ -!!! error TS1109: Expression expected. !!! error TS18026: '#!' can only be used at the start of a file. - ~ -!!! error TS1109: Expression expected. + ~ +!!! error TS1134: Variable declaration expected. !!! error TS18026: '#!' can only be used at the start of a file. - ~ -!!! error TS1109: Expression expected. !!! error TS18026: '#!' can only be used at the start of a file. OK! @@ -137,8 +125,8 @@ limit ~~~~~ !!! error TS2304: Cannot find name 'limit'. -Found 21 errors in 2 files. +Found 19 errors in 2 files. Errors Files - 18 tests/cases/compiler/a.ts:1 + 16 tests/cases/compiler/a.ts:1 3 tests/cases/compiler/b.ts:1 diff --git a/tests/baselines/reference/manyCompilerErrorsInTheTwoFiles.types b/tests/baselines/reference/manyCompilerErrorsInTheTwoFiles.types index fc6bf68b72f0c..56a8609b7e7c2 100644 --- a/tests/baselines/reference/manyCompilerErrorsInTheTwoFiles.types +++ b/tests/baselines/reference/manyCompilerErrorsInTheTwoFiles.types @@ -1,23 +1,18 @@ === tests/cases/compiler/a.ts === const a =!@#!@$ >a : boolean ->! : boolean -> : any -> : any ->! : boolean +>!@ : boolean > : any +>!@$ : boolean >$ : any const b = !@#!@#!@#! >b : boolean ->! : boolean -> : any -> : any ->! : boolean -> : any +>!@ : boolean > : any ->! : boolean +>!@ : boolean > : any +>!@ : boolean > : any >!OK! : boolean diff --git a/tests/baselines/reference/privateNameFieldClassExpression.js b/tests/baselines/reference/privateNameFieldClassExpression.js index b62835d6fe036..2fbcbf36fc7f3 100644 --- a/tests/baselines/reference/privateNameFieldClassExpression.js +++ b/tests/baselines/reference/privateNameFieldClassExpression.js @@ -15,6 +15,10 @@ class B { //// [privateNameFieldClassExpression.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; var _B_foo, _B_foo2; class B { constructor() { @@ -24,6 +28,7 @@ class B { console.log("hello"); } }, + __setFunctionName(_a, "#foo"), _a.test = 123, _a)); _B_foo2.set(this, (_b = class Foo { diff --git a/tests/baselines/reference/privateNameStaticFieldClassExpression.js b/tests/baselines/reference/privateNameStaticFieldClassExpression.js index 7b159cdaebed2..68650833542e1 100644 --- a/tests/baselines/reference/privateNameStaticFieldClassExpression.js +++ b/tests/baselines/reference/privateNameStaticFieldClassExpression.js @@ -28,6 +28,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function ( if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; var _a, _B_foo, _B_foo2, _b, _c; class B { m() { @@ -44,6 +48,7 @@ _B_foo = { value: (_b = class { new (__classPrivateFieldGet(B, _a, "f", _B_foo2))(); } }, + __setFunctionName(_b, "#foo"), _b.test = 123, _b) }; _B_foo2 = { value: (_c = class Foo { diff --git a/tests/baselines/reference/privateNameStaticFieldNoInitializer(target=es2015).js b/tests/baselines/reference/privateNameStaticFieldNoInitializer(target=es2015).js index a53922b5e74a4..63cbcdcbbf885 100644 --- a/tests/baselines/reference/privateNameStaticFieldNoInitializer(target=es2015).js +++ b/tests/baselines/reference/privateNameStaticFieldNoInitializer(target=es2015).js @@ -9,9 +9,14 @@ class C2 { //// [privateNameStaticFieldNoInitializer.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; var _a, _C_x, _b, _C2_x; const C = (_a = class { }, + __setFunctionName(_a, "C"), _C_x = { value: void 0 }, _a); class C2 { diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json new file mode 100644 index 0000000000000..e1bc61fff7489 --- /dev/null +++ b/tests/baselines/reference/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "annotateTransforms": true + } +} diff --git a/tests/baselines/reference/staticFieldWithInterfaceContext.js b/tests/baselines/reference/staticFieldWithInterfaceContext.js index f8886b4812e00..4f404fded40b1 100644 --- a/tests/baselines/reference/staticFieldWithInterfaceContext.js +++ b/tests/baselines/reference/staticFieldWithInterfaceContext.js @@ -27,12 +27,17 @@ let [ c11 = class { static x = { a: "a" } } ]: I[] = [class { static x = { a: "a //// [staticFieldWithInterfaceContext.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; var c = (_a = /** @class */ (function () { function class_1() { } return class_1; }()), + __setFunctionName(_a, "c"), // should typecheck the same as the last line _a.x = { a: "a" }, _a); @@ -44,6 +49,7 @@ var c2 = (_c = /** @class */ (function () { return class_2; }()), _b = ex, + __setFunctionName(_c, "c2"), _c[_b] = { a: "a" }, _c); c[ex] = { a: "a" }; @@ -62,6 +68,7 @@ var c3 = { c: (_d = /** @class */ (function () { } return class_4; }()), + __setFunctionName(_d, "c"), _d.x = { a: "a" }, _d) }.c; var _r = {}.c, c4 = _r === void 0 ? (_e = /** @class */ (function () { @@ -69,6 +76,7 @@ var _r = {}.c, c4 = _r === void 0 ? (_e = /** @class */ (function () { } return class_5; }()), + __setFunctionName(_e, "c4"), _e.x = { a: "a" }, _e) : _r; var _s = { c: (_g = /** @class */ (function () { @@ -76,12 +84,14 @@ var _s = { c: (_g = /** @class */ (function () { } return class_6; }()), + __setFunctionName(_g, "c"), _g.x = { a: "a" }, _g) }.c, c5 = _s === void 0 ? (_f = /** @class */ (function () { function class_7() { } return class_7; }()), + __setFunctionName(_f, "c5"), _f.x = { a: "a" }, _f) : _s; var c6 = [(_h = /** @class */ (function () { @@ -103,6 +113,7 @@ var _t = [][0], c8 = _t === void 0 ? (_k = /** @class */ (function () { } return class_10; }()), + __setFunctionName(_k, "c8"), _k.x = { a: "a" }, _k) : _t; var _u = [][0], c9 = _u === void 0 ? (_l = /** @class */ (function () { @@ -110,6 +121,7 @@ var _u = [][0], c9 = _u === void 0 ? (_l = /** @class */ (function () { } return class_11; }()), + __setFunctionName(_l, "c9"), _l.x = { a: "a" }, _l) : _u; var _v = [(_o = /** @class */ (function () { @@ -123,6 +135,7 @@ var _v = [(_o = /** @class */ (function () { } return class_13; }()), + __setFunctionName(_m, "c10"), _m.x = { a: "a" }, _m) : _v; var _w = [(_q = /** @class */ (function () { @@ -136,5 +149,6 @@ var _w = [(_q = /** @class */ (function () { } return class_15; }()), + __setFunctionName(_p, "c11"), _p.x = { a: "a" }, _p) : _w; diff --git a/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js b/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js index e6ca9fc6ac387..91d216fbf5bdf 100644 --- a/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js +++ b/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js @@ -1,6 +1,11 @@ +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; var _a; const MyClass = (_a = class { }, + __setFunctionName(_a, "MyClass"), /*comment*/ _a.newField = "x", _a); diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js b/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js index d6571f1f2e3e3..45efca0ae06af 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js @@ -31,17 +31,19 @@ Output:: >> Screen clear [12:00:15 AM] Starting compilation in watch mode... +error TS2318: Cannot find global type 'ClassDecoratorContext'. + a.ts:1:1 - error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'. 1 import {B} from './b'   ~~~~~~~~~~~~~~~~~~~~~ -a.ts:3:14 - error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. +a.ts:2:1 - error TS1238: Unable to resolve signature of class decorator when called as an expression. -3 export class A { -   ~ +2 @((_) => {}) +  ~~~~~~~~~~~~ -[12:00:20 AM] Found 2 errors. Watching for file changes. +[12:00:20 AM] Found 3 errors. Watching for file changes. @@ -87,20 +89,61 @@ export class B { //// [/a.js] -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; +var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { extraInitializers.push(f); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (!result) continue; + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.push(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.push(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.key, descriptor); }; -import './b'; -let A = class A { - constructor(p) { } +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; }; -A = __decorate([ - ((_) => { }) -], A); -export { A }; +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; +import './b'; +export let A = (() => { + var _a; + let _classDecorators = [((_) => { })]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var A = (_a = class { + constructor(p) { } + }, + __setFunctionName(_a, "A"), + (() => { + __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); + A = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(), + _a); + return A; +})(); diff --git a/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts index b578f8f2399b4..9dec1b36dc29c 100644 --- a/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts +++ b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts @@ -1,4 +1,6 @@ -//@target: ES6 +// @target: ES6 +// @experimentalDecorators: true + function decorator(x: any) { return y => { }; } diff --git a/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts index 81aacecd7a30f..0e50d826ad0e8 100644 --- a/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts +++ b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck59.ts @@ -1,4 +1,5 @@ -//@target: ES6 +// @target: ES6 +// @experimentalDecorators: true function* g() { class C { @(yield "") diff --git a/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts index 31c36e2a626d3..0fd01bb078927 100644 --- a/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts +++ b/tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts @@ -1,4 +1,5 @@ -//@target: ES6 +// @target: ES6 +// @experimentalDecorators: true function * g() { @(yield 0) class C {}; diff --git a/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStatic.ts b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStatic.ts new file mode 100644 index 0000000000000..3488a160942a6 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStatic.ts @@ -0,0 +1,16 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) get method1() { return 0; } + @dec(12) set method1(value) {} + @dec(21) get ["method2"]() { return 0; } + @dec(22) set ["method2"](value) {} + @dec(31) get [method3]() { return 0; } + @dec(32) set [method3](value) {} +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts new file mode 100644 index 0000000000000..54b90038314cd --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticAbstract.ts @@ -0,0 +1,16 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(11) abstract get method1(): number; + @dec(12) abstract set method1(value); + @dec(21) abstract get ["method2"](): number; + @dec(22) abstract set ["method2"](value); + @dec(31) abstract get [method3](): number; + @dec(32) abstract set [method3](value); +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticPrivate.ts b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticPrivate.ts new file mode 100644 index 0000000000000..3cf554161d3a6 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-nonStaticPrivate.ts @@ -0,0 +1,10 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec(1) get #method1() { return 0; } + @dec(2) set #method1(value) {} +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-static.ts b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-static.ts new file mode 100644 index 0000000000000..e8bbbd7ed6826 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-static.ts @@ -0,0 +1,16 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(11) static get method1() { return 0; } + @dec(12) static set method1(value) {} + @dec(21) static get ["method2"]() { return 0; } + @dec(22) static set ["method2"](value) {} + @dec(31) static get [method3]() { return 0; } + @dec(32) static set [method3](value) {} +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-staticPrivate.ts b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-staticPrivate.ts new file mode 100644 index 0000000000000..e234c85818b89 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-staticPrivate.ts @@ -0,0 +1,21 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec(1) static get #method1() { return 0; } + @dec(2) static set #method1(value) {} +} + +// TODO: We should translate these to weakmaps when < ESNext +@dec +class D { + static get #method1() { return 0; } + static set #method1(value) {} + static { + this.#method1; + this.#method1 = 1; + } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.1.ts b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.1.ts new file mode 100644 index 0000000000000..25682194a8669 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.1.ts @@ -0,0 +1,24 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static method(...args: any[]): void; +} + +const method = "method"; + +@dec +class C extends Base { + static { + super.method(); + super["method"](); + super[method](); + + super.method``; + super["method"]``; + super[method]``; + } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.2.ts b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.2.ts new file mode 100644 index 0000000000000..2e4c0b99d5ecf --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.2.ts @@ -0,0 +1,29 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +// class expression in extends should not get an assigned name +@dec +class C1 extends class { } { + static { + super.name; + } +} + +// function expression in extends should not get an assigned name +@dec +class C2 extends (function() {} as any) { + static { + super.name; + } +} + +// arrow function in extends should not get an assigned name +@dec +class C3 extends ((() => {}) as any) { + static { + super.name; + } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.3.ts b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.3.ts new file mode 100644 index 0000000000000..06783f6c01fb8 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.3.ts @@ -0,0 +1,46 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static x: number; +} + +const x = "x"; + +@dec +class C extends Base { + static { + super.x; + super.x = 1; + super.x += 1; + super.x++; + super.x--; + ++super.x; + --super.x; + ({ x: super.x } = { x: 1 }); + [super.x] = [1]; + + super["x"]; + super["x"] = 1; + super["x"] += 1; + super["x"]++; + super["x"]--; + ++super["x"]; + --super["x"]; + ({ x: super["x"] } = { x: 1 }); + [super["x"]] = [1]; + + super[x]; + super[x] = 1; + super[x] += 1; + super[x]++; + super[x]--; + ++super[x]; + --super[x]; + ({ x: super[x] } = { x: 1 }); + [super[x]] = [1]; + } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.4.ts b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.4.ts new file mode 100644 index 0000000000000..15e91abd5d405 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.4.ts @@ -0,0 +1,21 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static method(...args: any[]): number; +} + +const method = "method"; + +@dec +class C extends Base { + static a = super.method(); + static b = super["method"](); + static c = super[method](); + static d = super.method``; + static e = super["method"]``; + static f = super[method]``; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.5.ts b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.5.ts new file mode 100644 index 0000000000000..c40b77ebc7320 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.5.ts @@ -0,0 +1,50 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static x: number; +} + +const x = "x"; + +@dec +class C1 extends Base { + static a = super.x; + static b = super.x = 1; + static c = super.x += 1; + static d = super.x++; + static e = super.x--; + static f = ++super.x; + static g = --super.x; + static h = ({ x: super.x } = { x: 1 }); + static i = [super.x] = [1]; +} + +@dec +class C2 extends Base { + static a = super["x"]; + static b = super["x"] = 1; + static c = super["x"] += 1; + static d = super["x"]++; + static e = super["x"]--; + static f = ++super["x"]; + static g = --super["x"]; + static h = ({ x: super["x"] } = { x: 1 }); + static i = [super["x"]] = [1]; +} + +@dec +class C3 extends Base { + static a = super[x]; + static b = super[x] = 1; + static c = super[x] += 1; + static d = super[x]++; + static e = super[x]--; + static f = ++super[x]; + static g = --super[x]; + static h = ({ x: super[x] } = { x: 1 }); + static i = [super[x]] = [1]; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.6.ts b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.6.ts new file mode 100644 index 0000000000000..7b5718d0c7e15 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/classSuper/esDecorators-classDeclaration-classSuper.6.ts @@ -0,0 +1,28 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static method(...args: any[]): number; + method(...args: any[]): number; +} + +// none of the following should result in caching `super` +@dec +class C extends Base { + static m() { super.method(); } + static get x() { return super.method(); } + static set x(v: number) { super.method(); } + + constructor() { + super(); + super.method(); + } + + a = super.method(); + m() { super.method(); } + get x() { return super.method(); } + set x(v: number) { super.method(); } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.es5.ts b/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.es5.ts new file mode 100644 index 0000000000000..95a6d1ec3db14 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.es5.ts @@ -0,0 +1,13 @@ +// @target: es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +@dec +class C { + static { this; } + static x: any = this; + static m() { this; } + static get g() { return this; } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.ts b/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.ts new file mode 100644 index 0000000000000..905f0c64a2db7 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.ts @@ -0,0 +1,14 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +@dec +class C { + static { this; } + static x: any = this; + static accessor a: any = this; + static m() { this; } + static get g() { return this; } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-multipleDecorators.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-multipleDecorators.ts new file mode 100644 index 0000000000000..f18c8353c3acc --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-multipleDecorators.ts @@ -0,0 +1,10 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec1: any, dec2: any; + +@dec1 +@dec2 +class C { +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts new file mode 100644 index 0000000000000..431ebe35558a6 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterDecorators.ts @@ -0,0 +1,21 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +} + +(class C { + constructor(@dec x: any) {} + method(@dec x: any) {} + set x(@dec x: any) {} + static method(@dec x: any) {} + static set x(@dec x: any) {} +}); \ No newline at end of file diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-setFunctionName.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-setFunctionName.ts new file mode 100644 index 0000000000000..b479b27785e45 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-setFunctionName.ts @@ -0,0 +1,25 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +// @filename: a.ts +declare let dec: any; + +@dec class C {} + +export {} + +// @filename: b.ts +declare let dec: any; + +@dec export class C {} + +// @filename: c.ts +declare let dec: any; + +@dec export default class C {} + +// @filename: c.ts +declare let dec: any; + +@dec export default class {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-simpleTransformation.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-simpleTransformation.ts new file mode 100644 index 0000000000000..bc617053bc4c8 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-simpleTransformation.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +@dec +class C { +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStatic.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStatic.ts new file mode 100644 index 0000000000000..931aaec011a65 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStatic.ts @@ -0,0 +1,14 @@ +// @target: esnext, es2022, es2015, es5 +// @useDefineForClassFields: * +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) field1 = 1; + @dec(2) ["field2"] = 2; + @dec(3) [field3] = 3; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts new file mode 100644 index 0000000000000..574a70749f9ab --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstract.ts @@ -0,0 +1,13 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const field3 = "field3"; + +abstract class C { + @dec(1) abstract field1: number; + @dec(2) abstract ["field2"]: number; + @dec(3) abstract [field3]: number; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts new file mode 100644 index 0000000000000..4a66ca3e6cb57 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAbstractAccessor.ts @@ -0,0 +1,13 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const field3 = "field3"; + +abstract class C { + @dec(1) abstract accessor field1: number; + @dec(2) abstract accessor ["field2"]: number; + @dec(3) abstract accessor [field3]: number; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAccessor.ts new file mode 100644 index 0000000000000..9dd76382ba0ed --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAccessor.ts @@ -0,0 +1,13 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) accessor field1 = 1; + @dec(2) accessor ["field2"] = 2; + @dec(3) accessor [field3] = 3; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts new file mode 100644 index 0000000000000..b05b106d55e71 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticAmbient.ts @@ -0,0 +1,13 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) declare field1: number; + @dec(2) declare ["field2"]: number; + @dec(3) declare [field3]: number; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticPrivate.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticPrivate.ts new file mode 100644 index 0000000000000..33426ff4e3ae2 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticPrivate.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec #field1 = 0; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.ts new file mode 100644 index 0000000000000..7bcff4dbc09d9 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec accessor #field1 = 0; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-static.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-static.ts new file mode 100644 index 0000000000000..15c0abf6ac801 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-static.ts @@ -0,0 +1,14 @@ +// @target: esnext, es2022, es2015, es5 +// @useDefineForClassFields: * +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static field1 = 1; + @dec(2) static ["field2"] = 2; + @dec(3) static [field3] = 3; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAccessor.ts new file mode 100644 index 0000000000000..3445fc0c0cfd7 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAccessor.ts @@ -0,0 +1,23 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static accessor field1 = 1; + @dec(2) static accessor ["field2"] = 2; + @dec(3) static accessor [field3] = 3; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor field1 = 1; + static { + this.field1; + this.field1 = 1; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts new file mode 100644 index 0000000000000..ba6dafed12b24 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAmbient.ts @@ -0,0 +1,13 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const field3 = "field3"; + +class C { + @dec(1) static declare field1 = 1; + @dec(2) static declare ["field2"] = 2; + @dec(3) static declare [field3] = 3; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivate.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivate.ts new file mode 100644 index 0000000000000..439e8085533b6 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivate.ts @@ -0,0 +1,19 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec static #field1 = 0; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivateAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivateAccessor.ts new file mode 100644 index 0000000000000..132f60d5184c9 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivateAccessor.ts @@ -0,0 +1,19 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec static accessor #field1 = 0; +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static accessor #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStatic.ts b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStatic.ts new file mode 100644 index 0000000000000..76a14f3a955d8 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStatic.ts @@ -0,0 +1,13 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) method1() {} + @dec(2) ["method2"]() {} + @dec(3) [method3]() {} +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts new file mode 100644 index 0000000000000..505dbddf11499 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticAbstract.ts @@ -0,0 +1,13 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const method3 = "method3"; + +abstract class C { + @dec(1) abstract method1(): void; + @dec(2) abstract ["method2"](): void; + @dec(3) abstract [method3](): void; +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticPrivate.ts b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticPrivate.ts new file mode 100644 index 0000000000000..152dbdf827de4 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-nonStaticPrivate.ts @@ -0,0 +1,9 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec #method1() {} +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-static.ts b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-static.ts new file mode 100644 index 0000000000000..6368795854661 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-static.ts @@ -0,0 +1,13 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +const method3 = "method3"; + +class C { + @dec(1) static method1() {} + @dec(2) static ["method2"]() {} + @dec(3) static [method3]() {} +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-staticPrivate.ts b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-staticPrivate.ts new file mode 100644 index 0000000000000..6f04817aaa383 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-staticPrivate.ts @@ -0,0 +1,15 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec static #method1() {} +} + +// TODO: We should translate static private to weakmaps when < ESNext +@dec +class D { + static #method1() {} +} diff --git a/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.1.ts b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.1.ts new file mode 100644 index 0000000000000..169a4cb4c8a40 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.1.ts @@ -0,0 +1,24 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static method(...args: any[]): void; +} + +const method = "method"; + +(@dec +class C extends Base { + static { + super.method(); + super["method"](); + super[method](); + + super.method``; + super["method"]``; + super[method]``; + } +}); \ No newline at end of file diff --git a/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.2.ts b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.2.ts new file mode 100644 index 0000000000000..727ec2644617e --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.2.ts @@ -0,0 +1,29 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +// class expression in extends should not get an assigned name +(@dec +class C1 extends class { } { + static { + super.name; + } +}); + +// function expression in extends should not get an assigned name +(@dec +class C2 extends (function() {} as any) { + static { + super.name; + } +}); + +// arrow function in extends should not get an assigned name +(@dec +class C3 extends ((() => {}) as any) { + static { + super.name; + } +}); diff --git a/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.3.ts b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.3.ts new file mode 100644 index 0000000000000..b896d3e1e58e8 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.3.ts @@ -0,0 +1,46 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static x: number; +} + +const x = "x"; + +(@dec +class C extends Base { + static { + super.x; + super.x = 1; + super.x += 1; + super.x++; + super.x--; + ++super.x; + --super.x; + ({ x: super.x } = { x: 1 }); + [super.x] = [1]; + + super["x"]; + super["x"] = 1; + super["x"] += 1; + super["x"]++; + super["x"]--; + ++super["x"]; + --super["x"]; + ({ x: super["x"] } = { x: 1 }); + [super["x"]] = [1]; + + super[x]; + super[x] = 1; + super[x] += 1; + super[x]++; + super[x]--; + ++super[x]; + --super[x]; + ({ x: super[x] } = { x: 1 }); + [super[x]] = [1]; + } +}); diff --git a/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.4.ts b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.4.ts new file mode 100644 index 0000000000000..53281d6ea2b62 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.4.ts @@ -0,0 +1,21 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static method(...args: any[]): number; +} + +const method = "method"; + +(@dec +class C extends Base { + static a = super.method(); + static b = super["method"](); + static c = super[method](); + static d = super.method``; + static e = super["method"]``; + static f = super[method]``; +}); diff --git a/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.5.ts b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.5.ts new file mode 100644 index 0000000000000..1de9ebacae1ed --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.5.ts @@ -0,0 +1,50 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static x: number; +} + +const x = "x"; + +(@dec +class C1 extends Base { + static a = super.x; + static b = super.x = 1; + static c = super.x += 1; + static d = super.x++; + static e = super.x--; + static f = ++super.x; + static g = --super.x; + static h = ({ x: super.x } = { x: 1 }); + static i = [super.x] = [1]; +}); + +(@dec +class C2 extends Base { + static a = super["x"]; + static b = super["x"] = 1; + static c = super["x"] += 1; + static d = super["x"]++; + static e = super["x"]--; + static f = ++super["x"]; + static g = --super["x"]; + static h = ({ x: super["x"] } = { x: 1 }); + static i = [super["x"]] = [1]; +}); + +(@dec +class C3 extends Base { + static a = super[x]; + static b = super[x] = 1; + static c = super[x] += 1; + static d = super[x]++; + static e = super[x]--; + static f = ++super[x]; + static g = --super[x]; + static h = ({ x: super[x] } = { x: 1 }); + static i = [super[x]] = [1]; +}); diff --git a/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.6.ts b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.6.ts new file mode 100644 index 0000000000000..4081caf772540 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/classSuper/esDecorators-classExpression-classSuper.6.ts @@ -0,0 +1,28 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +declare class Base { + static method(...args: any[]): number; + method(...args: any[]): number; +} + +// none of the following should result in caching `super` +(@dec +class C extends Base { + static m() { super.method(); } + static get x() { return super.method(); } + static set x(v: number) { super.method(); } + + constructor() { + super(); + super.method(); + } + + a = super.method(); + m() { super.method(); } + get x() { return super.method(); } + set x(v: number) { super.method(); } +}); diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.1.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.1.ts new file mode 100644 index 0000000000000..e8114efe9f347 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.1.ts @@ -0,0 +1,30 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true +declare let dec: any; + +let x: any; + +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `=` AssignmentExpression + +x = @dec class { }; +x = class { @dec y: any; }; + +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `&&=` AssignmentExpression + +x &&= @dec class { }; +x &&= class { @dec y: any; }; + +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `||=` AssignmentExpression + +x ||= @dec class { }; +x ||= class { @dec y: any; }; + +// 13.15.2 RS: Evaluation +// AssignmentExpression : LeftHandSideExpression `??=` AssignmentExpression + +x ??= @dec class { }; +x ??= class { @dec y: any; }; diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.10.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.10.ts new file mode 100644 index 0000000000000..141cb86e3ffa5 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.10.ts @@ -0,0 +1,35 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any, f: any; + +// 10.2.1.3 RS: EvaluateBody +// Initializer : `=` AssignmentExpression + +{ class C { static x = @dec class {}; } } +{ class C { static "x" = @dec class {}; } } +{ class C { static 0 = @dec class {}; } } +{ class C { static ["x"] = @dec class {}; } } +{ class C { static [0] = @dec class {}; } } +// @ts-ignore +{ class C { static [f()] = @dec class {}; } } + +// __proto__ is not special in a class field +{ class C { static __proto__ = @dec class {}; } } +{ class C { static "__proto__" = @dec class {}; } } + +{ class C { static x = class { @dec y: any }; } } +{ class C { static "x" = class { @dec y: any }; } } +{ class C { static 0 = class { @dec y: any }; } } +{ class C { static ["x"] = class { @dec y: any }; } } +{ class C { static [0] = class { @dec y: any }; } } +// @ts-ignore +{ class C { static [f()] = @dec class {}; } } + +// __proto__ is not special in a class field +{ class C { static __proto__ = class { @dec y: any }; } } +{ class C { static "__proto__" = class { @dec y: any }; } } + +// ensure nested named evaluation happens when field is also transformed +{ class C { @dec static x = @dec class {}; } } diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.11.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.11.ts new file mode 100644 index 0000000000000..71436b4440d37 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.11.ts @@ -0,0 +1,15 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +// No NamedEvaluation, no class name + +(@dec class {}); +(class { @dec y: any }); + +// No NamedEvaluation, class name + +(@dec class C {}); +(class C { @dec y: any }); diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.2.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.2.ts new file mode 100644 index 0000000000000..20b3e9d34aaf3 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.2.ts @@ -0,0 +1,34 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true +declare let dec: any; + +let x: any, f: any; + +// 13.2.5.5 RS: PropertyDefinitionEvaluation +// PropertyAssignment : PropertyName `:` AssignmentExpression + +({ x: @dec class { } }); +({ x: class { @dec y: any; } }); + +({ "x": @dec class { } }); +({ "x": class { @dec y: any; } }); + +({ 0: @dec class { } }); +({ 0: class { @dec y: any; } }); + +({ ["x"]: @dec class { } }); +({ ["x"]: class { @dec y: any; } }); + +({ [0]: @dec class { } }); +({ [0]: class { @dec y: any; } }); + +({ [f()]: @dec class { } }); +({ [f()]: class { @dec y: any; } }); + +// __proto__ setters do not perform NamedEvaluation +({ __proto__: @dec class { } }); +({ "__proto__": @dec class { } }); + +// "__proto__" in a computed property name *does* perform NamedEvaluation +({ ["__proto__"]: @dec class { } }); \ No newline at end of file diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.3.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.3.ts new file mode 100644 index 0000000000000..4b275c2ddec9d --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.3.ts @@ -0,0 +1,19 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true +declare let dec: any; + +// 14.3.1.2 RS: Evaluation +// LexicalBinding : BindingIdentifier Initializer + +{ let x = @dec class { }; } +{ let x = class { @dec y: any; }; } + +{ const x = @dec class { }; } +{ const x = class { @dec y: any; }; } + +// 14.3.2.1 RS: Evaluation +// VariableDeclaration : BindingIdentifier Initializer + +{ var x2 = @dec class { }; } +{ var x1 = class { @dec y: any; }; } diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.4.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.4.ts new file mode 100644 index 0000000000000..58ef4cf58f0b5 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.4.ts @@ -0,0 +1,20 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true +declare let dec: any, obj: any; + +// 8.6.3 RS: IteratorBindingInitialization +// SingleNameBinding : BindingIdentifier Initializer? + +{ const [x = @dec class { }] = obj; } +{ const [x = class { @dec y: any; }] = obj; } + +// 14.3.3.3 RS: KeyedBindingInitialization +// SingleNameBinding : BindingIdentifier Initializer? + +{ const { x = @dec class { } } = obj; } +{ const { x = class { @dec y: any; } } = obj; } + +{ const { y: x = @dec class { } } = obj; } +{ const { y: x = class { @dec y: any; } } = obj; } + diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.5.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.5.ts new file mode 100644 index 0000000000000..c365e8fbf04d4 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.5.ts @@ -0,0 +1,10 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true +declare let dec: any, obj: any, x: any; + +// 13.15.5.3 RS: PropertyDestructuringAssignmentEvaluation +// AssignmentProperty : IdentifierReference Initializer? + +({ x = @dec class { } } = obj); +({ x = class { @dec y: any; } } = obj); diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.6.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.6.ts new file mode 100644 index 0000000000000..2460b9fe6aa15 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.6.ts @@ -0,0 +1,10 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true +declare let dec: any, obj: any, x: any; + +// 13.15.5.6 RS: KeyedDestructuringAssignmentEvaluation +// AssignmentElement : DestructuringAssignmentTarget Initializer? + +({ y: x = @dec class { } } = obj); +({ y: x = class { @dec y: any; } } = obj); diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.7.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.7.ts new file mode 100644 index 0000000000000..1dc196ad7089f --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.7.ts @@ -0,0 +1,10 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true +declare let dec: any, obj: any, x: any; + +// 13.15.5.6 RS: KeyedDestructuringAssignmentEvaluation +// AssignmentElement : DestructuringAssignmentTarget Initializer? + +[x = @dec class { }] = obj; +[x = class { @dec y: any; }] = obj; diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.8.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.8.ts new file mode 100644 index 0000000000000..9beed27890565 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.8.ts @@ -0,0 +1,19 @@ +// @target: es2022 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +// @filename: a.ts +declare let dec: any; + +// 16.2.3.7 RS: Evaluation +// ExportDeclaration : `export` `default` AssignmentExpression `;` + +export default (@dec class { }); + +// @filename: b.ts +declare let dec: any; + +// 16.2.3.7 RS: Evaluation +// ExportDeclaration : `export` `default` AssignmentExpression `;` + +export default (class { @dec y: any }); \ No newline at end of file diff --git a/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.9.ts b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.9.ts new file mode 100644 index 0000000000000..e953ebdd79685 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/namedEvaluation/esDecorators-classExpression-namedEvaluation.9.ts @@ -0,0 +1,14 @@ +// @target: es2022 +// @module: commonjs +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +// @filename: a.ts +declare let dec: any; + +export = @dec class { }; + +// @filename: b.ts +declare let dec: any; + +export = class { @dec y: any }; \ No newline at end of file diff --git a/tests/cases/conformance/esDecorators/esDecorators-emitDecoratorMetadata.ts b/tests/cases/conformance/esDecorators/esDecorators-emitDecoratorMetadata.ts new file mode 100644 index 0000000000000..90178600c27fe --- /dev/null +++ b/tests/cases/conformance/esDecorators/esDecorators-emitDecoratorMetadata.ts @@ -0,0 +1,51 @@ +// @target: esnext, es2022, es2015, es5 +// @noEmitHelpers: true +// @emitDecoratorMetadata: true +// @noTypesAndSymbols: true + +declare let dec: any; + +@dec +class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +} + +(@dec class C { + constructor(x: number) {} + + @dec + method(x: number) {} + + @dec + set x(x: number) {} + + @dec + y: number; + + @dec + static method(x: number) {} + + @dec + static set x(x: number) {} + + @dec + static y: number; +}); \ No newline at end of file diff --git a/tests/cases/fourslash/codefixEnableExperimentalDecorators_blankCompilerOptionsInJsconfig.ts b/tests/cases/fourslash/codefixEnableExperimentalDecorators_blankCompilerOptionsInJsconfig.ts deleted file mode 100644 index 0f52d496b700a..0000000000000 --- a/tests/cases/fourslash/codefixEnableExperimentalDecorators_blankCompilerOptionsInJsconfig.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -// @Filename: /dir/a.ts -////declare const decorator: any; -////class A { -//// @decorator method() {}; -////}; - -// @Filename: /dir/jsconfig.json -////{ -//// "compilerOptions": { -//// } -////} - -goTo.file("/dir/a.ts"); -verify.codeFix({ - description: "Enable the 'experimentalDecorators' option in your configuration file", - newFileContent: { - "/dir/jsconfig.json": -`{ - "compilerOptions": { - "experimentalDecorators": true - } -}`, - }, -}); diff --git a/tests/cases/fourslash/codefixEnableExperimentalDecorators_blankCompilerOptionsInTsconfig.ts b/tests/cases/fourslash/codefixEnableExperimentalDecorators_blankCompilerOptionsInTsconfig.ts deleted file mode 100644 index 48bc32e58213c..0000000000000 --- a/tests/cases/fourslash/codefixEnableExperimentalDecorators_blankCompilerOptionsInTsconfig.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -// @Filename: /dir/a.ts -////declare const decorator: any; -////class A { -//// @decorator method() {}; -////}; - -// @Filename: /dir/tsconfig.json -////{ -//// "compilerOptions": { -//// } -////} - -goTo.file("/dir/a.ts"); -verify.codeFix({ - description: "Enable the 'experimentalDecorators' option in your configuration file", - newFileContent: { - "/dir/tsconfig.json": -`{ - "compilerOptions": { - "experimentalDecorators": true - } -}`, - }, -}); diff --git a/tests/cases/fourslash/codefixEnableExperimentalDecorators_disabledInCompilerOptionsInJsconfig.ts b/tests/cases/fourslash/codefixEnableExperimentalDecorators_disabledInCompilerOptionsInJsconfig.ts deleted file mode 100644 index 2b0809fe8c8b5..0000000000000 --- a/tests/cases/fourslash/codefixEnableExperimentalDecorators_disabledInCompilerOptionsInJsconfig.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// - -// @Filename: /dir/a.ts -////declare const decorator: any; -////class A { -//// @decorator method() {}; -////}; - -// @Filename: /dir/jsconfig.json -////{ -//// "compilerOptions": { -//// "experimentalDecorators": false, -//// } -////} - -goTo.file("/dir/a.ts"); -verify.codeFix({ - description: "Enable the 'experimentalDecorators' option in your configuration file", - newFileContent: { - "/dir/jsconfig.json": -`{ - "compilerOptions": { - "experimentalDecorators": true, - } -}`, - }, -}); diff --git a/tests/cases/fourslash/codefixEnableExperimentalDecorators_disabledInCompilerOptionsInTsconfig.ts b/tests/cases/fourslash/codefixEnableExperimentalDecorators_disabledInCompilerOptionsInTsconfig.ts deleted file mode 100644 index 056e7e15a4885..0000000000000 --- a/tests/cases/fourslash/codefixEnableExperimentalDecorators_disabledInCompilerOptionsInTsconfig.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// - -// @Filename: /dir/a.ts -////declare const decorator: any; -////class A { -//// @decorator method() {}; -////}; - -// @Filename: /dir/tsconfig.json -////{ -//// "compilerOptions": { -//// "experimentalDecorators": false, -//// } -////} - -goTo.file("/dir/a.ts"); -verify.codeFix({ - description: "Enable the 'experimentalDecorators' option in your configuration file", - newFileContent: { - "/dir/tsconfig.json": -`{ - "compilerOptions": { - "experimentalDecorators": true, - } -}`, - }, -}); diff --git a/tests/cases/fourslash/codefixEnableExperimentalDecorators_missingCompilerOptionsInJsconfig.ts b/tests/cases/fourslash/codefixEnableExperimentalDecorators_missingCompilerOptionsInJsconfig.ts deleted file mode 100644 index d3370433b6a6a..0000000000000 --- a/tests/cases/fourslash/codefixEnableExperimentalDecorators_missingCompilerOptionsInJsconfig.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -// @Filename: /dir/a.ts -////declare const decorator: any; -////class A { -//// @decorator method() {}; -////}; - -// @Filename: /dir/jsconfig.json -////{ -////} - -goTo.file("/dir/a.ts"); -verify.codeFix({ - description: "Enable the 'experimentalDecorators' option in your configuration file", - newFileContent: { - "/dir/jsconfig.json": -`{ - "compilerOptions": { - "experimentalDecorators": true - } -}`, - }, -}); diff --git a/tests/cases/fourslash/codefixEnableExperimentalDecorators_missingCompilerOptionsInTsconfig.ts b/tests/cases/fourslash/codefixEnableExperimentalDecorators_missingCompilerOptionsInTsconfig.ts deleted file mode 100644 index de51cafee224e..0000000000000 --- a/tests/cases/fourslash/codefixEnableExperimentalDecorators_missingCompilerOptionsInTsconfig.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -// @Filename: /dir/a.ts -////declare const decorator: any; -////class A { -//// @decorator method() {}; -////}; - -// @Filename: /dir/tsconfig.json -////{ -////} - -goTo.file("/dir/a.ts"); -verify.codeFix({ - description: "Enable the 'experimentalDecorators' option in your configuration file", - newFileContent: { - "/dir/tsconfig.json": -`{ - "compilerOptions": { - "experimentalDecorators": true - } -}`, - }, -}); diff --git a/tests/cases/fourslash/codefixEnableExperimentalDecorators_noTsconfig.ts b/tests/cases/fourslash/codefixEnableExperimentalDecorators_noTsconfig.ts deleted file mode 100644 index 8430fd0734b72..0000000000000 --- a/tests/cases/fourslash/codefixEnableExperimentalDecorators_noTsconfig.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -// @Filename: /dir/a.ts -////declare const decorator: any; -////class A { -//// @decorator method() {}; -////}; - -goTo.file("/dir/a.ts"); -verify.not.codeFixAvailable(); From 86e0cd2e6b0bd7b14dd454fd6410f1b661621d24 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 19 Sep 2022 19:39:59 -0400 Subject: [PATCH 11/51] Evaluation tests and bug fixes --- src/compiler/checker.ts | 56 +- src/compiler/factory/emitHelpers.ts | 12 +- src/compiler/transformers/esDecorators.ts | 7 +- src/testRunner/tsconfig.json | 1 + .../unittests/evaluation/esDecorators.ts | 1939 +++++++++++++++++ ...-accessors-staticPrivate(target=es2015).js | 2 +- ...-accessors-staticPrivate(target=es2022).js | 2 +- ...ecorators-classDeclaration-classSuper.1.js | 2 +- ...ecorators-classDeclaration-classSuper.2.js | 6 +- ...ecorators-classDeclaration-classSuper.3.js | 2 +- ...ecorators-classDeclaration-classSuper.4.js | 2 +- ...ecorators-classDeclaration-classSuper.5.js | 6 +- ...ecorators-classDeclaration-classSuper.6.js | 2 +- ...ation-classThisReference(target=es2015).js | 2 +- ...ation-classThisReference(target=es2022).js | 2 +- ...classDeclaration-classThisReference.es5.js | 2 +- ...on-fields-staticAccessor(target=es2015).js | 2 +- ...on-fields-staticAccessor(target=es2022).js | 2 +- ...ion-fields-staticPrivate(target=es2015).js | 2 +- ...ion-fields-staticPrivate(target=es2022).js | 2 +- ...ds-staticPrivateAccessor(target=es2015).js | 2 +- ...ds-staticPrivateAccessor(target=es2022).js | 2 +- ...on-methods-staticPrivate(target=es2015).js | 2 +- ...on-methods-staticPrivate(target=es2022).js | 2 +- ...ation-multipleDecorators(target=es2015).js | 2 +- ...ation-multipleDecorators(target=es2022).js | 2 +- ...laration-multipleDecorators(target=es5).js | 2 +- ...laration-setFunctionName(target=es2015).js | 6 +- ...laration-setFunctionName(target=es2022).js | 6 +- ...Declaration-setFunctionName(target=es5).js | 6 +- ...ion-simpleTransformation(target=es2015).js | 2 +- ...ion-simpleTransformation(target=es2022).js | 2 +- ...ration-simpleTransformation(target=es5).js | 2 +- ...Decorators-classExpression-classSuper.1.js | 2 +- ...Decorators-classExpression-classSuper.2.js | 6 +- ...Decorators-classExpression-classSuper.3.js | 2 +- ...Decorators-classExpression-classSuper.4.js | 2 +- ...Decorators-classExpression-classSuper.5.js | 6 +- ...Decorators-classExpression-classSuper.6.js | 2 +- ...ators-classExpression-namedEvaluation.1.js | 8 +- ...tors-classExpression-namedEvaluation.10.js | 20 +- ...tors-classExpression-namedEvaluation.11.js | 4 +- ...ators-classExpression-namedEvaluation.2.js | 18 +- ...ators-classExpression-namedEvaluation.3.js | 6 +- ...ators-classExpression-namedEvaluation.4.js | 6 +- ...ators-classExpression-namedEvaluation.5.js | 2 +- ...ators-classExpression-namedEvaluation.6.js | 2 +- ...ators-classExpression-namedEvaluation.7.js | 2 +- ...ators-classExpression-namedEvaluation.8.js | 2 +- ...ators-classExpression-namedEvaluation.9.js | 2 +- ...rs-emitDecoratorMetadata(target=es2015).js | 4 +- ...rs-emitDecoratorMetadata(target=es2022).js | 4 +- ...ators-emitDecoratorMetadata(target=es5).js | 4 +- 53 files changed, 2086 insertions(+), 109 deletions(-) create mode 100644 src/testRunner/unittests/evaluation/esDecorators.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d1f157a1d9da1..9bdd19c05a169 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1263,10 +1263,11 @@ namespace ts { return addDeprecatedSuggestionWorker(declaration, diagnostic); } - function createSymbol(flags: SymbolFlags, name: __String, checkFlags?: CheckFlags) { + function createSymbol(flags: SymbolFlags, name: __String, checkFlags?: CheckFlags, type?: Type) { symbolCount++; const symbol = (new Symbol(flags | SymbolFlags.Transient, name) as TransientSymbol); symbol.checkFlags = checkFlags || 0; + if (type) symbol.type = type; return symbol; } @@ -37371,6 +37372,30 @@ namespace ts { break; case SyntaxKind.PropertyDeclaration: + if (!legacyDecorators) { + headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; + const expectedType = getTypeOfNode(node.parent); + const param = createSymbol(SymbolFlags.FunctionScopedVariable, "value" as __String, /*checkFlags*/ undefined, expectedType); + const initializerSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], expectedType); + if (hasAccessorModifier(node.parent)) { + const getSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, emptyArray, expectedType); + const setSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], voidType); + const members = createSymbolTable([ + createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "get" as __String, /*checkFlags*/ undefined, getSignatureType), + createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "set" as __String, /*checkFlags*/ undefined, setSignatureType), + createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "init" as __String, /*checkFlags*/ undefined, initializerSignatureType) + ]); + + const descriptorType = createAnonymousType(/*symbol*/ undefined, members, emptyArray, emptyArray, emptyArray); + expectedReturnType = getUnionType([descriptorType, voidType]); + } + else { + expectedReturnType = getUnionType([initializerSignatureType, voidType]); + } + break; + } + // falls through + case SyntaxKind.Parameter: headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; @@ -37380,22 +37405,31 @@ namespace ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; - const methodType = getTypeOfNode(node.parent); - expectedReturnType = getUnionType([ - legacyDecorators ? createTypedPropertyDescriptorType(methodType) : methodType, - voidType - ]); + const expectedType = legacyDecorators ? + createTypedPropertyDescriptorType(getTypeOfNode(node.parent)) : + getOrCreateTypeFromSignature(getSignatureFromDeclaration(node.parent as MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration)); + expectedReturnType = getUnionType([expectedType, voidType]); break; default: return Debug.failBadSyntaxKind(node.parent); } - checkTypeAssignableTo( - returnType, - expectedReturnType, - node, - headMessage); + checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage); + } + + function createFunctionType( + typeParameters: readonly TypeParameter[] | undefined, + thisParameter: Symbol | undefined, + parameters: readonly Symbol[], + returnType: Type, + typePredicate?: TypePredicate, + minArgumentCount: number = parameters.length, + flags: SignatureFlags = SignatureFlags.None + ) { + const decl = factory.createFunctionTypeNode(/*typeParameters*/ undefined, emptyArray, factory.createKeywordTypeNode(SyntaxKind.AnyKeyword)); + const signature = createSignature(decl, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, flags); + return getOrCreateTypeFromSignature(signature); } /** diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index 4e086749d7ae4..e57833235e0ea 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -646,19 +646,20 @@ namespace ts { priority: 2, text: ` var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f && typeof f !== "function") throw new TypeError("Function expected"); return f; } + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _; + var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { extraInitializers.push(f); }; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { - if (!result) continue; + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.push(_); @@ -668,7 +669,8 @@ namespace ts { else descriptor[key] = _; } } - if (target) Object.defineProperty(target, contextIn.key, descriptor); + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; };` }; diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index f0d17b017c8bf..80d4800831e54 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -704,9 +704,10 @@ namespace ts { const classExpression = factory.createClassExpression(/*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, heritageClauses, members); const classReferenceDeclaration = factory.createVariableDeclaration(classReference, /*exclamationToken*/ undefined, /*type*/ undefined, classExpression); const classReferenceVarDeclList = factory.createVariableDeclarationList([classReferenceDeclaration]); + const returnExpr = classInfo.classThis ? factory.createAssignment(classReference, classInfo.classThis) : classReference; classDefinitionStatements.push( factory.createVariableStatement(/*modifiers*/ undefined, classReferenceVarDeclList), - factory.createReturnStatement(classReference), + factory.createReturnStatement(returnExpr), ); } else { @@ -928,12 +929,12 @@ namespace ts { propertyName = { computed: false, name: member.name }; } else if (isPropertyNameLiteral(member.name)) { - propertyName = { computed: true, name: member.name }; + propertyName = { computed: true, name: factory.createStringLiteralFromNode(member.name) }; } else { const expression = member.name.expression; if (isPropertyNameLiteral(expression) && !isIdentifier(expression)) { - propertyName = { computed: true, name: expression }; + propertyName = { computed: true, name: factory.createStringLiteralFromNode(expression) }; } else { enterName(); diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index b7c699fcea611..9dd2a5859fb94 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -92,6 +92,7 @@ "unittests/evaluation/autoAccessors.ts", "unittests/evaluation/awaiter.ts", "unittests/evaluation/destructuring.ts", + "unittests/evaluation/esDecorators.ts", "unittests/evaluation/externalModules.ts", "unittests/evaluation/forAwaitOf.ts", "unittests/evaluation/forOf.ts", diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts new file mode 100644 index 0000000000000..a44070e1220f9 --- /dev/null +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -0,0 +1,1939 @@ +describe("unittests:: evaluation:: esDecorators", () => { + const options: ts.CompilerOptions = { target: ts.ScriptTarget.ES2022 }; + const exec = (array: TemplateStringsArray) => evaluator.evaluateTypeScript(array[0], options); + + describe("target", () => { + describe("for: class", () => { + it("is initial constructor", () => { + const { target, C } = exec` + export let target; + export @((t, c) => { target = t }) class C { + } + `; + assert.strictEqual(target, C); + }); + }); + describe("for: method", () => { + it("is initial method", () => { + const { target, C } = exec` + export let target; + export class C { + @((t, c) => { target = t }) + static method() {} + } + `; + assert.strictEqual(target, C.method); + }); + }); + describe("for: getter", () => { + it("is initial getter", () => { + const { target, C } = exec` + export let target; + export class C { + @((t, c) => { target = t }) + static get x() { return 1; } + } + `; + assert.strictEqual(target, Object.getOwnPropertyDescriptor(C, "x")!.get); + }); + }); + describe("for: setter", () => { + it("is initial setter", () => { + const { target, C } = exec` + export let target; + export class C { + @((t, c) => { target = t }) + static set x(v: number) { } + } + `; + assert.strictEqual(target, Object.getOwnPropertyDescriptor(C, "x")!.set); + }); + }); + describe("for: field", () => { + it("is undefined", () => { + const { target } = exec` + export let target; + export class C { + @((t, c) => { target = t }) + static x: number; + } + `; + assert.isUndefined(target); + }); + }); + describe("for: auto-accessor", () => { + it("is { get, set } for initial getter/setter", () => { + const { target, C } = exec` + export let target; + export class C { + @((t, c) => { target = t }) + static accessor x: number; + } + `; + assert.isObject(target); + assert.deepEqual(Object.keys(target), ["get", "set"]); + assert.strictEqual(target.get, Object.getOwnPropertyDescriptor(C, "x")!.get); + assert.strictEqual(target.set, Object.getOwnPropertyDescriptor(C, "x")!.set); + }); + }); + }); + + describe("context", () => { + describe("for: class", () => { + it("is object", () => { + const { context } = exec` + export let context; + export @((t, c) => { context = c; }) class C { + } + `; + assert.isObject(context); + }); + }); + describe("for: method", () => { + it("is object", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static method() {} + } + `; + assert.isObject(context); + }); + }); + describe("for: getter", () => { + it("is object", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get x() { return 1; } + } + `; + assert.isObject(context); + }); + }); + describe("for: setter", () => { + it("is object", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set x(v: number) {} + } + `; + assert.isObject(context); + }); + }); + describe("for: field", () => { + it("is object", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static x: number; + } + `; + assert.isObject(context); + }); + }); + describe("for: auto-accessor", () => { + it("is object", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor x: number; + } + `; + assert.isObject(context); + }); + }); + describe(".kind", () => { + describe("for: class", () => { + it("is 'class'", () => { + const { context } = exec` + export let context; + export @((t, c) => { context = c; }) class C { + } + `; + assert.strictEqual(context.kind, "class"); + }); + }); + describe("for: method", () => { + it("is 'method'", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static method() {} + } + `; + assert.strictEqual(context.kind, "method"); + }); + }); + describe("for: getter", () => { + it("is 'getter'", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get x() { return 1; } + } + `; + assert.strictEqual(context.kind, "getter"); + }); + }); + describe("for: setter", () => { + it("is 'setter'", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set x(v: number) {} + } + `; + assert.strictEqual(context.kind, "setter"); + }); + }); + describe("for: field", () => { + it("is 'field'", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static x: number; + } + `; + assert.strictEqual(context.kind, "field"); + }); + }); + describe("for: auto-accessor", () => { + it("is 'accessor'", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor x: number; + } + `; + assert.strictEqual(context.kind, "accessor"); + }); + }); + }); + describe(".name", () => { + describe("for: class", () => { + it("is initial class name", () => { + const { context } = exec` + export let context; + export @((t, c) => { context = c; }) class C { + } + `; + assert.strictEqual(context.name, "C"); + }); + it("is 'default' when initial class is unnamed default export", () => { + const { context } = exec` + export let context; + export default @((t, c) => { context = c; }) class { + } + `; + assert.strictEqual(context.name, "default"); + }); + }); + describe("for: method", () => { + it("is initial method name string when identifier", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static method() {} + } + `; + assert.strictEqual(context.name, "method"); + }); + it("is initial method name string when computed non-symbol", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static [1]() {} + } + `; + assert.strictEqual(context.name, "1"); + }); + it("is initial method name symbol when symbol", () => { + const { context, sym } = exec` + export const sym = Symbol(); + export let context; + export class C { + @((t, c) => { context = c; }) + static [sym]() {} + } + `; + assert.strictEqual(context.name, sym); + }); + it("is initial method name description string when private", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static #method() {} + } + `; + assert.strictEqual(context.name, "#method"); + }); + }); + describe("for: getter", () => { + it("is initial method name string when identifier", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get x() { return 1; } + } + `; + assert.strictEqual(context.name, "x"); + }); + it("is initial method name string when computed non-symbol", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get [1]() { return 1; } + } + `; + assert.strictEqual(context.name, "1"); + }); + it("is initial method name symbol when symbol", () => { + const { context, sym } = exec` + export const sym = Symbol(); + export let context; + export class C { + @((t, c) => { context = c; }) + static get [sym]() { return 1; } + } + `; + assert.strictEqual(context.name, sym); + }); + it("is initial method name description string when private", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get #x() { return 1; } + } + `; + assert.strictEqual(context.name, "#x"); + }); + }); + describe("for: setter", () => { + it("is initial method name string when identifier", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set x(v: number) { } + } + `; + assert.strictEqual(context.name, "x"); + }); + it("is initial method name string when computed non-symbol", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set [1](v: number) { } + } + `; + assert.strictEqual(context.name, "1"); + }); + it("is initial method name symbol when symbol", () => { + const { context, sym } = exec` + export const sym = Symbol(); + export let context; + export class C { + @((t, c) => { context = c; }) + static set [sym](v: number) { } + } + `; + assert.strictEqual(context.name, sym); + }); + it("is initial method name description string when private", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set #x(v: number) { } + } + `; + assert.strictEqual(context.name, "#x"); + }); + }); + describe("for: field", () => { + it("is initial field name string when identifier", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static x: number; + } + `; + assert.strictEqual(context.name, "x"); + }); + it("is initial field name string when computed non-symbol", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static [1]: number; + } + `; + assert.strictEqual(context.name, "1"); + }); + it("is initial field name symbol when symbol", () => { + const { context, sym } = exec` + export const sym = Symbol(); + export let context; + export class C { + @((t, c) => { context = c; }) + static [sym]: number; + } + `; + assert.strictEqual(context.name, sym); + }); + it("is initial field name description string when private", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static #x: number; + } + `; + assert.strictEqual(context.name, "#x"); + }); + }); + describe("for: auto-accessor", () => { + it("is initial field name string when identifier", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor x: number; + } + `; + assert.strictEqual(context.name, "x"); + }); + it("is initial field name string when computed non-symbol", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor [1]: number; + } + `; + assert.strictEqual(context.name, "1"); + }); + it("is initial field name symbol when symbol", () => { + const { context, sym } = exec` + export const sym = Symbol(); + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor [sym]: number; + } + `; + assert.strictEqual(context.name, sym); + }); + it("is initial field name description string when private", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor #x: number; + } + `; + assert.strictEqual(context.name, "#x"); + }); + }); + }); + describe(".static", () => { + describe("for: class", () => { + it("is not set", () => { + const { context } = exec` + export let context; + export @((t, c) => { context = c; }) class C { + } + `; + assert.doesNotHaveAnyKeys(context, ["static"]); + }); + }); + describe("for: method", () => { + it("when static: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static method() {} + } + `; + assert.isTrue(context.static); + }); + it("when instance: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + method() {} + } + `; + assert.isFalse(context.static); + }); + }); + describe("for: getter", () => { + it("when static: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get x() { return 1; } + } + `; + assert.isTrue(context.static); + }); + it("when instance: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + get x() { return 1; } + } + `; + assert.isFalse(context.static); + }); + }); + describe("for: setter", () => { + it("when static: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set x(v: number) {} + } + `; + assert.isTrue(context.static); + }); + it("when instance: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + set x(v: number) {} + } + `; + assert.isFalse(context.static); + }); + }); + describe("for: field", () => { + it("when static: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static x: number; + } + `; + assert.isTrue(context.static); + }); + it("when instance: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + x: number; + } + `; + assert.isFalse(context.static); + }); + }); + describe("for: auto-accessor", () => { + it("when static: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor x: number; + } + `; + assert.isTrue(context.static); + }); + it("when instance: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + accessor x: number; + } + `; + assert.isFalse(context.static); + }); + }); + }); + describe(".private", () => { + describe("for: class", () => { + it("is not set", () => { + const { context } = exec` + export let context; + export @((t, c) => { context = c; }) class C {} + `; + assert.doesNotHaveAnyKeys(context, ["private"]); + }); + }); + describe("for: method", () => { + it("when private: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + #method() {} + } + `; + assert.isTrue(context.private); + }); + it("when public: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + method() {} + } + `; + assert.isFalse(context.private); + }); + }); + describe("for: getter", () => { + it("when private: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + get #x() { return 1; } + } + `; + assert.isTrue(context.private); + }); + it("when public: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + get x() { return 1; } + } + `; + assert.isFalse(context.private); + }); + }); + describe("for: setter", () => { + it("when private: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + set #x(v: number) {} + } + `; + assert.isTrue(context.private); + }); + it("when public: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + set x(v: number) {} + } + `; + assert.isFalse(context.private); + }); + }); + describe("for: field", () => { + it("when private: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + #x: number; + } + `; + assert.isTrue(context.private); + }); + it("when public: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + x: number; + } + `; + assert.isFalse(context.private); + }); + }); + describe("for: auto-accessor", () => { + it("when private: is true", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + accessor #x: number; + } + `; + assert.isTrue(context.private); + }); + it("when public: is false", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + accessor x: number; + } + `; + assert.isFalse(context.private); + }); + }); + }); + describe(".access", () => { + describe("for: class", () => { + it("is not set", () => { + const { context } = exec` + export let context; + export @((t, c) => { context = c; }) class C { + } + `; + assert.doesNotHaveAnyKeys(context, ["access"]); + }); + }); + describe("for: method", () => { + it("is { get }", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static method() {} + } + `; + assert.isObject(context.access); + assert.hasAllKeys(context.access, ["get"]); + assert.isFunction(context.access.get); + }); + it("accesses value using 'this'", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static method() {} + } + `; + assert.strictEqual(context.access.get.call(C), C.method); + + const obj = { method() {} }; + assert.strictEqual(context.access.get.call(obj), obj.method); + }); + it("can access value for private name", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static #method() {} + } + `; + assert.isFunction(context.access.get.call(C)); + + const obj = { ["#method"]() {} }; + assert.throws(() => context.access.get.call(obj)); + }); + }); + describe("for: getter", () => { + it("is { get }", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get x() { return 1; } + } + `; + assert.isObject(context.access); + assert.hasAllKeys(context.access, ["get"]); + assert.isFunction(context.access.get); + }); + it("accesses value using 'this'", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get x() { return 1; } + } + `; + assert.strictEqual(context.access.get.call(C), 1); + + const obj = { x: 2 }; + assert.strictEqual(context.access.get.call(obj), 2); + }); + it("can access value for private name", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get #x() { return 1; } + } + `; + assert.strictEqual(context.access.get.call(C), 1); + + const obj = { "#x": 2 }; + assert.throws(() => context.access.get.call(obj)); + }); + }); + describe("for: setter", () => { + it("is { set }", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set x(v: number) {} + } + `; + assert.isObject(context.access); + assert.hasAllKeys(context.access, ["set"]); + assert.isFunction(context.access.set); + }); + it("accesses value using 'this'", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set x(v: number) { this.y = v; } + static y: number; + } + `; + context.access.set.call(C, 1); + assert.strictEqual(C.y, 1); + + const obj = { x: 2 }; + context.access.set.call(obj, 3); + assert.strictEqual(obj.x, 3); + }); + it("can access value for private name", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set #x(v: number) {} + } + `; + context.access.set.call(C, 1); + + const obj = { "#x": 2 }; + assert.throws(() => context.access.set.call(obj, 3)); + }); + }); + describe("for: field", () => { + it("is { get, set }", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static x: number; + } + `; + assert.isObject(context.access); + assert.hasAllKeys(context.access, ["get", "set"]); + assert.isFunction(context.access.get); + assert.isFunction(context.access.set); + }); + it("accesses value using 'this'", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static x: number = 1; + } + `; + + assert.strictEqual(context.access.get.call(C), 1); + context.access.set.call(C, 2); + assert.strictEqual(C.x, 2); + + const obj = { x: 2 }; + assert.strictEqual(context.access.get.call(obj), 2); + context.access.set.call(obj, 3); + assert.strictEqual(obj.x, 3); + }); + it("can access value for private name", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static #x: number = 1; + static getX() { return this.#x; } + } + `; + + assert.strictEqual(context.access.get.call(C), 1); + context.access.set.call(C, 2); + assert.strictEqual(C.getX(), 2); + + const obj = { "#x": 2 }; + assert.throws(() => context.access.get.call(obj)); + assert.throws(() => context.access.set.call(obj, 3)); + }); + }); + describe("for: auto-accessor", () => { + it("is { get, set }", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor x: number; + } + `; + assert.hasAllKeys(context.access, ["get", "set"]); + assert.isFunction(context.access.get); + assert.isFunction(context.access.set); + }); + it("accesses value using 'this'", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor x: number = 1; + } + `; + + assert.strictEqual(context.access.get.call(C), 1); + context.access.set.call(C, 2); + assert.strictEqual(C.x, 2); + + const obj = { x: 2 }; + assert.strictEqual(context.access.get.call(obj), 2); + context.access.set.call(obj, 3); + assert.strictEqual(obj.x, 3); + }); + it("can access value for private name", () => { + const { context, C } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor #x: number = 1; + static getX() { return this.#x; } + } + `; + + assert.strictEqual(context.access.get.call(C), 1); + context.access.set.call(C, 2); + assert.strictEqual(C.getX(), 2); + + const obj = { "#x": 2 }; + assert.throws(() => context.access.get.call(obj)); + assert.throws(() => context.access.set.call(obj, 3)); + }); + }); + }); + describe(".addInitializer", () => { + describe("for: class", () => { + it("is function", () => { + const { context } = exec` + export let context; + export @((t, c) => { context = c; }) class C { + } + `; + assert.isFunction(context.addInitializer); + }); + it("can add multiple", () => { + const { order } = exec` + export const order = []; + export @((t, c) => { + c.addInitializer(() => { order.push("a"); }); + c.addInitializer(() => { order.push("b"); }); + }) class C { + } + `; + assert.deepEqual(order, ["a", "b"]); + }); + it("argument must be function", () => { + // Currently underspecified. Proposed here: https://github.com/tc39/ecma262/pull/2417#discussion_r873163887 + const { main } = exec` + export const main = value => { + @((t, c) => { c.addInitializer(value); }) class C { + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(/*value*/ undefined)); + assert.throws(() => main(123)); + assert.throws(() => main("abc")); + }); + it("cannot call after decoration", () => { + const { context } = exec` + export let context; + @((t, c) => { context = c; }) class C { + } + `; + assert.throws(() => context.addInitializer(() => { })); + }); + }); + describe("for: method", () => { + it("is function", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static method() {} + } + `; + assert.isFunction(context.addInitializer); + }); + it("can add multiple", () => { + const { order } = exec` + export const order = []; + export class C { + @((t, c) => { + c.addInitializer(() => { order.push("a"); }); + c.addInitializer(() => { order.push("b"); }); + }) + static method() {} + } + `; + assert.deepEqual(order, ["a", "b"]); + }); + it("argument must be function", () => { + // Currently underspecified. Proposed here: https://github.com/tc39/ecma262/pull/2417#discussion_r873163887 + const { main } = exec` + export const main = value => { + class C { + @((t, c) => { c.addInitializer(value); }) + static method() {} + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(/*value*/ undefined)); + assert.throws(() => main(123)); + assert.throws(() => main("abc")); + }); + it("cannot call after decoration", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static method() {} + } + `; + assert.throws(() => context.addInitializer(() => { })); + }); + describe("when: static", () => { + it("extra initializers run once", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + static method() {} + } + export const main = () => { new C(); } + `; + main(); + main(); + assert.deepEqual(order, ["extra"]); + }); + }); + describe("when: instance", () => { + it("extra initializers run each time constructor runs", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + method() {} + } + export const main = () => { new C(); } + `; + assert.deepEqual(order, []); + main(); + main(); + assert.deepEqual(order, ["extra", "extra"]); + }); + }); + }); + describe("for: getter", () => { + it("is function", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get x() { return 1; } + } + `; + assert.isFunction(context.addInitializer); + }); + it("can add multiple", () => { + const { order } = exec` + export const order = []; + export class C { + @((t, c) => { + c.addInitializer(() => { order.push("a"); }); + c.addInitializer(() => { order.push("b"); }); + }) + static get x() { return 1; } + } + `; + assert.deepEqual(order, ["a", "b"]); + }); + it("argument must be function", () => { + // Currently underspecified. Proposed here: https://github.com/tc39/ecma262/pull/2417#discussion_r873163887 + const { main } = exec` + export const main = value => { + class C { + @((t, c) => { c.addInitializer(value); }) + static get x() { return 1; } + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(/*value*/ undefined)); + assert.throws(() => main(123)); + assert.throws(() => main("abc")); + }); + it("cannot call after decoration", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static get x() { return 1; } + } + `; + assert.throws(() => context.addInitializer(() => { })); + }); + describe("when: static", () => { + it("extra initializers run once", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + static get x() { return 1; } + } + export const main = () => { new C(); } + `; + main(); + main(); + assert.deepEqual(order, ["extra"]); + }); + }); + describe("when: instance", () => { + it("extra initializers run each time constructor runs", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + get x() { return 1; } + } + export const main = () => { new C(); } + `; + assert.deepEqual(order, []); + main(); + main(); + assert.deepEqual(order, ["extra", "extra"]); + }); + }); + }); + describe("for: setter", () => { + it("is function", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set x(v: number) {} + } + `; + assert.isFunction(context.addInitializer); + }); + it("can add multiple", () => { + const { order } = exec` + export const order = []; + export class C { + @((t, c) => { + c.addInitializer(() => { order.push("a"); }); + c.addInitializer(() => { order.push("b"); }); + }) + static set x(v: number) {} + } + `; + assert.deepEqual(order, ["a", "b"]); + }); + it("argument must be function", () => { + // Currently underspecified. Proposed here: https://github.com/tc39/ecma262/pull/2417#discussion_r873163887 + const { main } = exec` + export const main = value => { + class C { + @((t, c) => { c.addInitializer(value); }) + static set x(v: number) {} + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(/*value*/ undefined)); + assert.throws(() => main(123)); + assert.throws(() => main("abc")); + }); + it("cannot call after decoration", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static set x(v: number) {} + } + `; + assert.throws(() => context.addInitializer(() => { })); + }); + describe("when: static", () => { + it("extra initializers run once", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + static set x(v: number) {} + } + export const main = () => { new C(); } + `; + main(); + main(); + assert.deepEqual(order, ["extra"]); + }); + }); + describe("when: instance", () => { + it("extra initializers run each time constructor runs", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + set x(v: number) {} + } + export const main = () => { new C(); } + `; + assert.deepEqual(order, []); + main(); + main(); + assert.deepEqual(order, ["extra", "extra"]); + }); + }); + }); + describe("for: field", () => { + it("is function", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static x: number; + } + `; + assert.isFunction(context.addInitializer); + }); + it("can add multiple", () => { + const { order } = exec` + export const order = []; + export class C { + @((t, c) => { + c.addInitializer(() => { order.push("a"); }); + c.addInitializer(() => { order.push("b"); }); + }) + static x: number; + } + `; + assert.deepEqual(order, ["a", "b"]); + }); + it("argument must be function", () => { + // Currently underspecified. Proposed here: https://github.com/tc39/ecma262/pull/2417#discussion_r873163887 + const { main } = exec` + export const main = value => { + class C { + @((t, c) => { c.addInitializer(value); }) + static x: number; + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(/*value*/ undefined)); + assert.throws(() => main(123)); + assert.throws(() => main("abc")); + }); + it("cannot call after decoration", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static x: number; + } + `; + assert.throws(() => context.addInitializer(() => { })); + }); + describe("when: static", () => { + it("extra initializers run once", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + static x: number; + } + export const main = () => { new C(); } + `; + main(); + main(); + assert.deepEqual(order, ["extra"]); + }); + }); + describe("when: instance", () => { + it("extra initializers run each time constructor runs", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + x: number; + } + export const main = () => { new C(); } + `; + assert.deepEqual(order, []); + main(); + main(); + assert.deepEqual(order, ["extra", "extra"]); + }); + }); + }); + describe("for: auto-accessor", () => { + it("is function", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor x: number; + } + `; + assert.isFunction(context.addInitializer); + }); + it("can add multiple", () => { + const { order } = exec` + export const order = []; + export class C { + @((t, c) => { + c.addInitializer(() => { order.push("a"); }); + c.addInitializer(() => { order.push("b"); }); + }) + static accessor x: number; + } + `; + assert.deepEqual(order, ["a", "b"]); + }); + it("argument must be function", () => { + // Currently underspecified. Proposed here: https://github.com/tc39/ecma262/pull/2417#discussion_r873163887 + const { main } = exec` + export const main = value => { + class C { + @((t, c) => { c.addInitializer(value); }) + static accessor x: number; + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(/*value*/ undefined)); + assert.throws(() => main(123)); + assert.throws(() => main("abc")); + }); + it("cannot call after decoration", () => { + const { context } = exec` + export let context; + export class C { + @((t, c) => { context = c; }) + static accessor x: number; + } + `; + assert.throws(() => context.addInitializer(() => { })); + }); + describe("when: static", () => { + it("extra initializers run once", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + static accessor x: number; + } + export const main = () => { new C(); } + `; + main(); + main(); + assert.deepEqual(order, ["extra"]); + }); + }); + describe("when: instance", () => { + it("extra initializers run each time constructor runs", () => { + const { order, main } = exec` + export const order = []; + class C { + @((t, c) => { c.addInitializer(() => { order.push("extra"); }); }) + accessor x: number; + } + export const main = () => { new C(); } + `; + assert.deepEqual(order, []); + main(); + main(); + assert.deepEqual(order, ["extra", "extra"]); + }); + }); + }); + }); + }); + + describe("decorator evaluation", () => { + describe("for: class", () => { + it("may return undefined", () => { + const { main } = exec` + export const main = () => { + @((t, c) => undefined) class C { + } + }; + `; + assert.doesNotThrow(main); + }); + it("may return a different function", () => { + const { C1, C2 } = exec` + export class C1 {} + export @((t, c) => C1) class C2 { + } + `; + assert.strictEqual(C2, C1); + }); + it("may not return non-function, non-undefined", () => { + const { main } = exec` + export const main = value => { + @((t, c) => value) class C2 { + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(1)); + assert.throws(() => main("abc")); + }); + }); + describe("for: method", () => { + it("may return undefined", () => { + const { main } = exec` + export const main = () => { + class C { + @((t, c) => undefined) + static method() {} + } + }; + `; + assert.doesNotThrow(main); + }); + it("may return a different function", () => { + const { C, replacement } = exec` + export function replacement() {} + export class C { + @((t, c) => replacement) method() {} + } + `; + assert.strictEqual(C.prototype.method, replacement); + }); + it("may not return non-function, non-undefined", () => { + const { main } = exec` + export const main = value => { + class C { + @((t, c) => value) method() {} + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(1)); + assert.throws(() => main("abc")); + }); + }); + describe("for: getter", () => { + it("may return undefined", () => { + const { main } = exec` + export const main = () => { + class C { + @((t, c) => undefined) + static get x() { return 1; } + } + }; + `; + assert.doesNotThrow(main); + }); + it("may return a different function", () => { + const { C, replacement } = exec` + export function replacement() { return 2; } + export class C { + @((t, c) => replacement) + static get x() { return 1; } + } + `; + assert.strictEqual(Object.getOwnPropertyDescriptor(C, "x")!.get, replacement); + }); + it("may not return non-function, non-undefined", () => { + const { main } = exec` + export const main = value => { + class C { + @((t, c) => value) + get x() { return 1; } + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(1)); + assert.throws(() => main("abc")); + }); + }); + describe("for: setter", () => { + it("may return undefined", () => { + const { main } = exec` + export const main = () => { + class C { + @((t, c) => undefined) + static set x(v: number) {} + } + }; + `; + assert.doesNotThrow(main); + }); + it("may return a different function", () => { + const { C, replacement } = exec` + export function replacement() { return 2; } + export class C { + @((t, c) => replacement) + static set x(v: number) {} + } + `; + assert.strictEqual(Object.getOwnPropertyDescriptor(C, "x")!.set, replacement); + }); + it("may not return non-function, non-undefined", () => { + const { main } = exec` + export const main = value => { + class C { + @((t, c) => value) + static set x(v: number) {} + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(1)); + assert.throws(() => main("abc")); + }); + }); + describe("for: field", () => { + it("may return undefined", () => { + const { main } = exec` + export const main = () => { + class C { + @((t, c) => undefined) + static x: number; + } + }; + `; + assert.doesNotThrow(main); + }); + it("may return function to inject initializer pipe-through function", () => { + const { C } = exec` + export class C { + @((t, c) => x => x + 1) + static x: number = 1; + } + `; + assert.strictEqual(C.x, 2); + }); + it("multiple initializer pipe-throughs applied in reverse order", () => { + const { C } = exec` + function initializer(x) { return x + 1; } + export class C { + @((t, c) => x => [...x, 3]) + @((t, c) => x => [...x, 2]) + static x: number[] = [1]; + } + `; + assert.deepEqual(C.x, [1, 2, 3]); + }); + it("may not return non-function, non-undefined", () => { + const { main } = exec` + export const main = value => { + class C { + @((t, c) => value) + static x: number; + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(1)); + assert.throws(() => main("abc")); + }); + }); + describe("for: auto-accessor", () => { + it("may return undefined", () => { + const { main } = exec` + export const main = () => { + class C { + @((t, c) => undefined) + static accessor x: number; + } + }; + `; + assert.doesNotThrow(main); + }); + it("may return { get } to replace getter", () => { + const { C, replacement } = exec` + export function replacement() { return 2; } + export class C { + @((t, c) => ({ get: replacement })) + static accessor x: number; + } + `; + assert.strictEqual(Object.getOwnPropertyDescriptor(C, "x")!.get, replacement); + assert.isFunction(Object.getOwnPropertyDescriptor(C, "x")!.set); + }); + it("may return { set } to replace setter", () => { + const { C, replacement } = exec` + export function replacement(v: number) { } + export class C { + @((t, c) => ({ set: replacement })) + static accessor x: number; + } + `; + assert.strictEqual(Object.getOwnPropertyDescriptor(C, "x")!.set, replacement); + assert.isFunction(Object.getOwnPropertyDescriptor(C, "x")!.get); + }); + it("may return { init } to inject initializer pipe-through function ", () => { + const { C } = exec` + export class C { + @((t, c) => ({ init: x => x + 1 })) + static accessor x: number = 1; + } + `; + assert.strictEqual(C.x, 2); + }); + it("multiple initializer pipe-throughs applied in reverse order", () => { + const { C } = exec` + function initializer(x) { return x + 1; } + export class C { + @((t, c) => ({ init: x => [...x, 3] })) + @((t, c) => ({ init: x => [...x, 2] })) + static accessor x: number[] = [1]; + } + `; + assert.deepEqual(C.x, [1, 2, 3]); + }); + it("may not return non-object, non-undefined", () => { + const { main } = exec` + export const main = value => { + class C { + @((t, c) => value) + static accessor x: number; + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(1)); + assert.throws(() => main("abc")); + }); + it("may not return { get } with non-function, non-undefined", () => { + const { main } = exec` + export const main = value => { + class C { + @((t, c) => ({ get: value })) + static accessor x: number; + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(1)); + assert.throws(() => main("abc")); + }); + it("may not return { set } with non-function, non-undefined", () => { + const { main } = exec` + export const main = value => { + class C { + @((t, c) => ({ set: value })) + static accessor x: number; + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(1)); + assert.throws(() => main("abc")); + }); + it("may not return { init } with non-function, non-undefined", () => { + const { main } = exec` + export const main = value => { + class C { + @((t, c) => ({ init: value })) + static accessor x: number; + } + }; + `; + assert.throws(() => main(/*value*/ null)); // eslint-disable-line no-null/no-null + assert.throws(() => main(1)); + assert.throws(() => main("abc")); + }); + }); + }); + + it("class definition evaluation order", () => { + const { order } = exec` + export const order = []; + + class Base { + constructor() { + order.push("superclass construction"); + } + } + + @(order.push("class decorator evaluation 1"), ((t, c) => { + order.push("class decorator application 1"); + c.addInitializer(() => { + order.push("class extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("class extra initializer evaluation 1b"); + }); + })) + @(order.push("class decorator evaluation 2"), ((t, c) => { + order.push("class decorator application 2"); + c.addInitializer(() => { + order.push("class extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("class extra initializer evaluation 2b"); + }); + })) + class Derived extends (order.push("heritage clause evaluation"), Base) { + static { + order.push("static block evaluation"); + } + + @(order.push("static field decorator evaluation 1"), ((t, c) => { + order.push("static field decorator application 1"); + c.addInitializer(() => { + order.push("static field extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("static field extra initializer evaluation 1b"); + }); + return x => { + order.push("static field injected initializer evaluation 1"); + return x; + }; + })) + @(order.push("static field decorator evaluation 2"), ((t, c) => { + order.push("static field decorator application 2"); + c.addInitializer(() => { + order.push("static field extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("static field extra initializer evaluation 2b"); + }); + return x => { + order.push("static field injected initializer evaluation 2"); + return x; + }; + })) + static x = order.push("static field initializer evaluation"); + + static [(order.push("static computed property name evaluation"), "y")]() {} + + @(order.push("instance field decorator evaluation 1"), ((t, c) => { + order.push("instance field decorator application 1"); + c.addInitializer(() => { + order.push("instance field extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("instance field extra initializer evaluation 1b"); + }); + return x => { + order.push("instance field injected initializer evaluation 1"); + return x; + }; + })) + @(order.push("instance field decorator evaluation 2"), ((t, c) => { + order.push("instance field decorator application 2"); + c.addInitializer(() => { + order.push("instance field extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("instance field extra initializer evaluation 2b"); + }); + return x => { + order.push("instance field injected initializer evaluation 2"); + return x; + }; + })) + a = order.push("instance field initializer evaluation"); + + [(order.push("instance computed property name evaluation"), "b")]() {} + + constructor() { + order.push("pre-super constructor evaluation"); + super(); + order.push("post-super constructor evaluation"); + } + + @(order.push("static method decorator evaluation 1"), ((t, c) => { + order.push("static method decorator application 1"); + c.addInitializer(() => { + order.push("static method extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("static method extra initializer evaluation 1b"); + }); + })) + @(order.push("static method decorator evaluation 2"), ((t, c) => { + order.push("static method decorator application 2"); + c.addInitializer(() => { + order.push("static method extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("static method extra initializer evaluation 2b"); + }); + })) + static z() {} + + @(order.push("instance method decorator evaluation 1"), ((t, c) => { + order.push("instance method decorator application 1"); + c.addInitializer(() => { + order.push("instance method extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("instance method extra initializer evaluation 1b"); + }); + })) + @(order.push("instance method decorator evaluation 2"), ((t, c) => { + order.push("instance method decorator application 2"); + c.addInitializer(() => { + order.push("instance method extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("instance method extra initializer evaluation 2b"); + }); + })) + c() {} + } + + order.push("instance construction"); + new Derived(); + order.push("done"); + `; + + // TODO: static private method and field evaluation order when that is supported. + assert.deepEqual(order, [ + // first, we evaluate the class decorator expressions and heritage clause in document order: + "class decorator evaluation 1", + "class decorator evaluation 2", + "heritage clause evaluation", + + // next, we evaluate decorators interleaved with computed property names in document order: + "static field decorator evaluation 1", + "static field decorator evaluation 2", + "static computed property name evaluation", + "instance field decorator evaluation 1", + "instance field decorator evaluation 2", + "instance computed property name evaluation", + "static method decorator evaluation 1", + "static method decorator evaluation 2", + "instance method decorator evaluation 1", + "instance method decorator evaluation 2", + // NOTE: at this point, all of the class elements have been collected. + + // next, for each static method, in document order, we apply that method's decorators in reverse order: + "static method decorator application 2", + "static method decorator application 1", + // NOTE: at this point, all non-private static methods are defined on the class. + + // next, for each instance method, in document order, we apply that method's decorators in reverse order: + "instance method decorator application 2", + "instance method decorator application 1", + // NOTE: at this point, all non-private instance methods are defined on the prototype. + + // next, for each static field, in document order, we apply that field's decorators in reverse order: + "static field decorator application 2", + "static field decorator application 1", + // NOTE: at this point, static fields have not yet been applied + + // next, for each instance field, in document order, we apply that field's decorators in reverse order: + "instance field decorator application 2", + "instance field decorator application 1", + // NOTE: at this point, instance fields have not yet been applied + + // next, apply class decorators in reverse order: + "class decorator application 2", + "class decorator application 1", + // NOTE: at this point, any constructor replacement has occurred. + // NOTE: at this point the local class binding (i.e., the class name) has been initialized and can be + // referenced + // NOTE: at this point, static private methods will be installed (TODO: on the replacement class) + + // next, static extra initializers are applied in the order they were added (i.e., methods before fields, + // reverse order of decorator evaluation) and are applied to the replacement class. + "static method extra initializer evaluation 2a", + "static method extra initializer evaluation 2b", + "static method extra initializer evaluation 1a", + "static method extra initializer evaluation 1b", + "static field extra initializer evaluation 2a", + "static field extra initializer evaluation 2b", + "static field extra initializer evaluation 1a", + "static field extra initializer evaluation 1b", + + // next, static initializers (i.e., fields, auto-accessors, and static blocks) are evaluated in document + // order and applied to the replacement class: + "static block evaluation", + "static field initializer evaluation", + "static field injected initializer evaluation 2", + "static field injected initializer evaluation 1", + // NOTE: at this point, static private fields will be installed (TODO: on the replacement class) + + // finally, class extra initializers are applied in the order they were added (i.e., methods before fields, + // reverse order of decorator evaluation). + "class extra initializer evaluation 2a", + "class extra initializer evaluation 2b", + "class extra initializer evaluation 1a", + "class extra initializer evaluation 1b", + // NOTE: at this point, class definition evaluation has finished. + + // now we move on to construction: + "instance construction", + + // first, statements before `super()` are evaluated: + "pre-super constructor evaluation", + // NOTE: at this point `this` is still not yet bound. + + // next, statements in the superclass constructor are evaluated: + "superclass construction", + // NOTE: as we return from the `super()` call, we start instance field initialization. + // NOTE: at this point, `this` is bound. + // NOTE: at this point, instance private methods are installed. + + // next, instance extra initializers are applied in the order they were added (i.e., methods before fields, + // reverse order of decorator evaluation). + "instance method extra initializer evaluation 2a", + "instance method extra initializer evaluation 2b", + "instance method extra initializer evaluation 1a", + "instance method extra initializer evaluation 1b", + "instance field extra initializer evaluation 2a", + "instance field extra initializer evaluation 2b", + "instance field extra initializer evaluation 1a", + "instance field extra initializer evaluation 1b", + + // next, instance initializers (i.e., fields, auto-accessors, and static blocks) are evaluated in document + // order: + "instance field initializer evaluation", + "instance field injected initializer evaluation 2", + "instance field injected initializer evaluation 1", + // NOTE: at this point, instance private fields will be installed. + + // finally, statements in the constructor after the call to `super()` are evaluated: + "post-super constructor evaluation", + + // and now evaluation has completed: + "done" + ]); + }); +}); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js index b39532b5aa70c..d62babf06827e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js @@ -62,5 +62,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js index abed35212288e..ee49275288548 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js @@ -57,5 +57,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.1.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.1.js index 9451ccfeba1a7..1fc2933e85b42 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.1.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.1.js @@ -46,5 +46,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js index 8dc5819457713..9ee976f86a971 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js @@ -46,7 +46,7 @@ let C1 = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C1; + return C1 = _classThis; })(); let C2 = (() => { let _classDecorators_1 = [dec]; @@ -66,7 +66,7 @@ let C2 = (() => { __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return C2; + return C2 = _classThis_1; })(); let C3 = (() => { let _classDecorators_2 = [dec]; @@ -86,5 +86,5 @@ let C3 = (() => { __runInitializers(_classThis_2, _classExtraInitializers_2); } }; - return C3; + return C3 = _classThis_2; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.3.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.3.js index 91afab35232c0..d970c0bf48412 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.3.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.3.js @@ -90,5 +90,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.4.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.4.js index 17e2f994b417f..33451269c0573 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.4.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.4.js @@ -41,5 +41,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.5.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.5.js index ece713a51fa0a..f2085eac5ee9c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.5.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.5.js @@ -91,7 +91,7 @@ let C1 = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C1; + return C1 = _classThis; })(); let C2 = (() => { let _classDecorators_1 = [dec]; @@ -135,7 +135,7 @@ let C2 = (() => { __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return C2; + return C2 = _classThis_1; })(); let C3 = (() => { let _classDecorators_2 = [dec]; @@ -179,5 +179,5 @@ let C3 = (() => { __runInitializers(_classThis_2, _classExtraInitializers_2); } }; - return C3; + return C3 = _classThis_2; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js index f4d5ea287bb4d..5e1dde0ab4600 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js @@ -49,5 +49,5 @@ let C = (() => { get x() { return super.method(); } set x(v) { super.method(); } }; - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js index ff66e271963eb..b293db33e431a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js @@ -38,5 +38,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js index edf91c79bbf4b..ae5a4e716bebb 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js @@ -33,5 +33,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js index 36f2719b9f521..caf175ef39d1c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js @@ -42,5 +42,5 @@ var C = function () { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js index 8254b87c13e4f..1814487613742 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js @@ -74,5 +74,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js index adca99d7b40cf..d8feed7d30f58 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js @@ -69,5 +69,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js index 53b17a40a61b8..4fc6eb5b91e23 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js @@ -54,5 +54,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js index 8959dbfb2d9cb..a7e2456c8c855 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js @@ -49,5 +49,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js index 1aa74449e16b7..1023b707da2ea 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js @@ -59,5 +59,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js index ef6ddc1457e66..6bccec306cdef 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js @@ -54,5 +54,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js index aa7cb96ea1339..b2ee71f58ae22 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js @@ -44,5 +44,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js index f3822685d063c..8c8cf49019236 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js @@ -39,5 +39,5 @@ let D = (() => { } static #method1() { } }; - return D; + return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js index de59c5dd16f42..2d9739fa68855 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js @@ -23,5 +23,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2022).js index 703dd15e67560..df55f69d019fd 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2022).js @@ -20,5 +20,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js index 659a955fe38e0..bf989b883d1ea 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js @@ -27,5 +27,5 @@ var C = function () { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js index 74361899566fe..7f96b632067fd 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js @@ -39,7 +39,7 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; })(); export {}; //// [b.js] @@ -58,7 +58,7 @@ export let C = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; })(); //// [c.js] export default (() => { @@ -76,5 +76,5 @@ export default (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return default_1; + return default_1 = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2022).js index 10ed29d837f5d..09eac0a5b6171 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2022).js @@ -36,7 +36,7 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })(); export {}; //// [b.js] @@ -52,7 +52,7 @@ export let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })(); //// [c.js] export default (() => { @@ -68,5 +68,5 @@ export default (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return default_1; + return default_1 = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js index 7025c94593f20..038b6bdcefd0b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js @@ -45,7 +45,7 @@ var C = function () { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; }(); //// [b.js] "use strict"; @@ -70,7 +70,7 @@ var C = exports.C = function () { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; }(); //// [c.js] "use strict"; @@ -94,6 +94,6 @@ var default_1 = function () { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return default_1; + return default_1 = _classThis; }(); exports.default = default_1; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js index c4e911df534b6..f864ee9fe6658 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js @@ -22,5 +22,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2022).js index 7ca8fa9a2aa31..898d229014ae0 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2022).js @@ -19,5 +19,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js index f8cdccd2c4a09..649622daccf12 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js @@ -26,5 +26,5 @@ var C = function () { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; }(); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.1.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.1.js index 62052f9a6415a..55a3de265b4e2 100644 --- a/tests/baselines/reference/esDecorators-classExpression-classSuper.1.js +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.1.js @@ -45,5 +45,5 @@ const method = "method"; __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.2.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.2.js index 41eb73230895e..8ffd58e86ffc8 100644 --- a/tests/baselines/reference/esDecorators-classExpression-classSuper.2.js +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.2.js @@ -47,7 +47,7 @@ class C3 extends ((() => {}) as any) { __runInitializers(_classThis, _classExtraInitializers); } }; - return C1; + return C1 = _classThis; })()); // function expression in extends should not get an assigned name ((() => { @@ -68,7 +68,7 @@ class C3 extends ((() => {}) as any) { __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return C2; + return C2 = _classThis_1; })()); // arrow function in extends should not get an assigned name ((() => { @@ -89,5 +89,5 @@ class C3 extends ((() => {}) as any) { __runInitializers(_classThis_2, _classExtraInitializers_2); } }; - return C3; + return C3 = _classThis_2; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.3.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.3.js index 9d5d40c528b23..ac9ea3a19cbbb 100644 --- a/tests/baselines/reference/esDecorators-classExpression-classSuper.3.js +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.3.js @@ -90,5 +90,5 @@ const x = "x"; __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.4.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.4.js index a8f581e410a51..2b901f0137f24 100644 --- a/tests/baselines/reference/esDecorators-classExpression-classSuper.4.js +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.4.js @@ -41,5 +41,5 @@ const method = "method"; __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.5.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.5.js index 9b59a45c16cc0..41327501b796a 100644 --- a/tests/baselines/reference/esDecorators-classExpression-classSuper.5.js +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.5.js @@ -91,7 +91,7 @@ const x = "x"; __runInitializers(_classThis, _classExtraInitializers); } }; - return C1; + return C1 = _classThis; })()); ((() => { let _classDecorators_1 = [dec]; @@ -135,7 +135,7 @@ const x = "x"; __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return C2; + return C2 = _classThis_1; })()); ((() => { let _classDecorators_2 = [dec]; @@ -179,5 +179,5 @@ const x = "x"; __runInitializers(_classThis_2, _classExtraInitializers_2); } }; - return C3; + return C3 = _classThis_2; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-classSuper.6.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.6.js index 05177b84057d1..d40daa28ff70e 100644 --- a/tests/baselines/reference/esDecorators-classExpression-classSuper.6.js +++ b/tests/baselines/reference/esDecorators-classExpression-classSuper.6.js @@ -50,5 +50,5 @@ class C extends Base { get x() { return super.method(); } set x(v) { super.method(); } }; - return C; + return C = _classThis; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js index b02a1b95fc953..680835e999340 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js @@ -45,7 +45,7 @@ x = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })(); x = (() => { let _instanceExtraInitializers = []; @@ -75,7 +75,7 @@ x &&= (() => { __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return class_2; + return class_2 = _classThis_1; })(); x &&= (() => { let _instanceExtraInitializers_1 = []; @@ -105,7 +105,7 @@ x ||= (() => { __runInitializers(_classThis_2, _classExtraInitializers_2); } }; - return class_3; + return class_3 = _classThis_2; })(); x ||= (() => { let _instanceExtraInitializers_2 = []; @@ -135,7 +135,7 @@ x ??= (() => { __runInitializers(_classThis_3, _classExtraInitializers_3); } }; - return class_4; + return class_4 = _classThis_3; })(); x ??= (() => { let _instanceExtraInitializers_3 = []; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js index dc4b5348e85fd..e25a5327c4254 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js @@ -51,7 +51,7 @@ var _a, _b; __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })(); } } @@ -70,7 +70,7 @@ var _a, _b; __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return class_2; + return class_2 = _classThis_1; })(); } } @@ -89,7 +89,7 @@ var _a, _b; __runInitializers(_classThis_2, _classExtraInitializers_2); } }; - return class_3; + return class_3 = _classThis_2; })(); } } @@ -108,7 +108,7 @@ var _a, _b; __runInitializers(_classThis_3, _classExtraInitializers_3); } }; - return class_4; + return class_4 = _classThis_3; })(); } } @@ -127,7 +127,7 @@ var _a, _b; __runInitializers(_classThis_4, _classExtraInitializers_4); } }; - return class_5; + return class_5 = _classThis_4; })(); } } @@ -147,7 +147,7 @@ var _a, _b; __runInitializers(_classThis_5, _classExtraInitializers_5); } }; - return class_6; + return class_6 = _classThis_5; })(); } } @@ -167,7 +167,7 @@ var _a, _b; __runInitializers(_classThis_6, _classExtraInitializers_6); } }; - return class_7; + return class_7 = _classThis_6; })(); } } @@ -186,7 +186,7 @@ var _a, _b; __runInitializers(_classThis_7, _classExtraInitializers_7); } }; - return class_8; + return class_8 = _classThis_7; })(); } } @@ -291,7 +291,7 @@ var _a, _b; __runInitializers(_classThis_8, _classExtraInitializers_8); } }; - return class_9; + return class_9 = _classThis_8; })(); } } @@ -355,7 +355,7 @@ var _a, _b; __runInitializers(_classThis_9, _classExtraInitializers_9); } }; - return class_10; + return class_10 = _classThis_9; })()); }; })(); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js index 2100490d4e6f7..71a518e184d4f 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js @@ -27,7 +27,7 @@ declare let dec: any; __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })()); ((() => { let _instanceExtraInitializers = []; @@ -54,7 +54,7 @@ declare let dec: any; __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return C; + return C = _classThis_1; })()); ((() => { let _instanceExtraInitializers_1 = []; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js index 124c7da15caa6..f56b5dc381bd9 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js @@ -49,7 +49,7 @@ let x, f; __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })() }); ({ x: (() => { let _instanceExtraInitializers = []; @@ -77,7 +77,7 @@ let x, f; __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return class_2; + return class_2 = _classThis_1; })() }); ({ "x": (() => { let _instanceExtraInitializers_1 = []; @@ -105,7 +105,7 @@ let x, f; __runInitializers(_classThis_2, _classExtraInitializers_2); } }; - return class_3; + return class_3 = _classThis_2; })() }); ({ 0: (() => { let _instanceExtraInitializers_2 = []; @@ -133,7 +133,7 @@ let x, f; __runInitializers(_classThis_3, _classExtraInitializers_3); } }; - return class_4; + return class_4 = _classThis_3; })() }); ({ ["x"]: (() => { let _instanceExtraInitializers_3 = []; @@ -161,7 +161,7 @@ let x, f; __runInitializers(_classThis_4, _classExtraInitializers_4); } }; - return class_5; + return class_5 = _classThis_4; })() }); ({ [0]: (() => { let _instanceExtraInitializers_4 = []; @@ -189,7 +189,7 @@ let x, f; __runInitializers(_classThis_5, _classExtraInitializers_5); } }; - return class_6; + return class_6 = _classThis_5; })() }); ({ [_b = __propKey(f())]: (() => { let _instanceExtraInitializers_5 = []; @@ -218,7 +218,7 @@ let x, f; __runInitializers(_classThis_6, _classExtraInitializers_6); } }; - return class_7; + return class_7 = _classThis_6; })() }); ({ "__proto__": (() => { let _classDecorators_7 = [dec]; @@ -233,7 +233,7 @@ let x, f; __runInitializers(_classThis_7, _classExtraInitializers_7); } }; - return class_8; + return class_8 = _classThis_7; })() }); // "__proto__" in a computed property name *does* perform NamedEvaluation ({ ["__proto__"]: (() => { @@ -249,5 +249,5 @@ let x, f; __runInitializers(_classThis_8, _classExtraInitializers_8); } }; - return class_9; + return class_9 = _classThis_8; })() }); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js index a2116183619df..4c9c7312c7f9c 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js @@ -34,7 +34,7 @@ declare let dec: any; __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })(); } { @@ -66,7 +66,7 @@ declare let dec: any; __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return class_2; + return class_2 = _classThis_1; })(); } { @@ -100,7 +100,7 @@ declare let dec: any; __runInitializers(_classThis_2, _classExtraInitializers_2); } }; - return class_3; + return class_3 = _classThis_2; })(); } { diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js index 90181ec29d0c6..bb343971e86e1 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js @@ -35,7 +35,7 @@ declare let dec: any, obj: any; __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })()] = obj; } { @@ -69,7 +69,7 @@ declare let dec: any, obj: any; __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return class_2; + return class_2 = _classThis_1; })() } = obj; } { @@ -101,7 +101,7 @@ declare let dec: any, obj: any; __runInitializers(_classThis_2, _classExtraInitializers_2); } }; - return class_3; + return class_3 = _classThis_2; })() } = obj; } { diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js index 4aa3617ce7592..3b2a69fbde964 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js @@ -24,7 +24,7 @@ declare let dec: any, obj: any, x: any; __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })() } = obj); ({ x = (() => { let _instanceExtraInitializers = []; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js index f6b928e8e12d2..ec0375e58e64c 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js @@ -24,7 +24,7 @@ declare let dec: any, obj: any, x: any; __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })() } = obj); ({ y: x = (() => { let _instanceExtraInitializers = []; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js index 9ce49f1b34d02..dbc094f55ce93 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js @@ -24,7 +24,7 @@ declare let dec: any, obj: any, x: any; __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })()] = obj; [x = (() => { let _instanceExtraInitializers = []; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js index 54212a869465f..565472908171c 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js @@ -32,7 +32,7 @@ export default ((() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })()); //// [b.js] // 16.2.3.7 RS: Evaluation diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js index fff136d45fd88..1a2ea638154dd 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js @@ -25,7 +25,7 @@ module.exports = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return class_1; + return class_1 = _classThis; })(); //// [b.js] "use strict"; diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js index 9c1668add8878..9a3f8352e3788 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js @@ -95,7 +95,7 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; })(); ((() => { var _a; @@ -145,5 +145,5 @@ let C = (() => { __runInitializers(_classThis_1, _classExtraInitializers_1); })(), _a); - return C; + return C = _classThis_1; })()); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js index c668d395b8cb6..27136e1394dbd 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js @@ -91,7 +91,7 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - return C; + return C = _classThis; })(); ((() => { let _classDecorators_1 = [dec, __metadata("design:paramtypes", [Number])]; @@ -137,5 +137,5 @@ let C = (() => { __runInitializers(_classThis_1, _classExtraInitializers_1); } }; - return C; + return C = _classThis_1; })()); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js index f6268749c264a..8e6820d7c631f 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js @@ -105,7 +105,7 @@ var C = function () { __runInitializers(_classThis, _classExtraInitializers); })(), _a); - return C; + return C = _classThis; }(); ((function () { var _a; @@ -164,5 +164,5 @@ var C = function () { __runInitializers(_classThis_1, _classExtraInitializers_1); })(), _a); - return C; + return C = _classThis_1; })()); From 8c33a18b6947d8b4838d57904f41ed8c6dee8347 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 20 Sep 2022 13:01:43 -0400 Subject: [PATCH 12/51] Set script target for esDecorator evaluator tests to ES2021 --- src/testRunner/unittests/evaluation/esDecorators.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts index a44070e1220f9..319df818631a1 100644 --- a/src/testRunner/unittests/evaluation/esDecorators.ts +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -1,5 +1,5 @@ describe("unittests:: evaluation:: esDecorators", () => { - const options: ts.CompilerOptions = { target: ts.ScriptTarget.ES2022 }; + const options: ts.CompilerOptions = { target: ts.ScriptTarget.ES2021 }; const exec = (array: TemplateStringsArray) => evaluator.evaluateTypeScript(array[0], options); describe("target", () => { From 63df46d922a5b75bcaf01aa28abeb3551746308e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 28 Sep 2022 17:29:57 -0400 Subject: [PATCH 13/51] Support static private elements with class decorators --- src/compiler/debug.ts | 2 +- src/compiler/emitter.ts | 15 +- src/compiler/factory/emitHelpers.ts | 10 +- src/compiler/factory/emitNode.ts | 23 +- src/compiler/factory/nodeFactory.ts | 4 +- src/compiler/factory/utilities.ts | 2 +- src/compiler/program.ts | 2 +- src/compiler/transformers/classFields.ts | 776 +++++++++--------- src/compiler/transformers/es2015.ts | 6 +- src/compiler/transformers/esDecorators.ts | 190 +++-- src/compiler/transformers/module/module.ts | 14 +- src/compiler/transformers/ts.ts | 4 +- src/compiler/transformers/utilities.ts | 69 ++ src/compiler/types.ts | 20 +- src/compiler/utilities.ts | 8 + .../unittests/evaluation/esDecorators.ts | 15 + .../reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- .../reference/decoratorOnClass8.es6.js | 7 +- ...-accessors-staticPrivate(target=es2015).js | 36 +- ...-accessors-staticPrivate(target=es2022).js | 10 +- ...-accessors-staticPrivate(target=esnext).js | 2 - ...ation-classThisReference(target=es2015).js | 41 +- ...ation-classThisReference(target=es2022).js | 14 +- ...classDeclaration-classThisReference.es5.js | 48 +- ...nonStaticPrivateAccessor(target=es2015).js | 8 +- ...nonStaticPrivateAccessor(target=es2022).js | 4 +- ...on-fields-staticAccessor(target=es2015).js | 38 +- ...on-fields-staticAccessor(target=es2022).js | 9 +- ...on-fields-staticAccessor(target=esnext).js | 2 - ...ion-fields-staticPrivate(target=es2015).js | 34 +- ...ion-fields-staticPrivate(target=es2022).js | 9 +- ...ion-fields-staticPrivate(target=esnext).js | 2 - ...ds-staticPrivateAccessor(target=es2015).js | 46 +- ...ds-staticPrivateAccessor(target=es2022).js | 16 +- ...ds-staticPrivateAccessor(target=esnext).js | 2 - ...on-methods-staticPrivate(target=es2015).js | 22 +- ...on-methods-staticPrivate(target=es2022).js | 5 +- ...on-methods-staticPrivate(target=esnext).js | 2 - ...ation-multipleDecorators(target=es2015).js | 18 +- ...laration-multipleDecorators(target=es5).js | 24 +- ...laration-setFunctionName(target=es2015).js | 54 +- ...Declaration-setFunctionName(target=es5).js | 72 +- ...ion-simpleTransformation(target=es2015).js | 18 +- ...ration-simpleTransformation(target=es5).js | 24 +- ...rs-emitDecoratorMetadata(target=es2015).js | 99 ++- ...rs-emitDecoratorMetadata(target=es2022).js | 28 +- ...ators-emitDecoratorMetadata(target=es5).js | 129 ++- ...rs-emitDecoratorMetadata(target=esnext).js | 26 - .../reference/privateNameMethodAccess.js | 10 +- .../privateNameMethodsDerivedClasses.js | 2 +- ...tes-diagnostics-and-emit-for-decorators.js | 20 +- ...eOfThisInStaticMembers12(target=es2022).js | 12 +- ...eOfThisInStaticMembers12(target=esnext).js | 12 +- ...lassDeclaration-accessors-staticPrivate.ts | 1 - ...-classDeclaration-fields-staticAccessor.ts | 1 - ...s-classDeclaration-fields-staticPrivate.ts | 1 - ...eclaration-fields-staticPrivateAccessor.ts | 1 - ...-classDeclaration-methods-staticPrivate.ts | 1 - 59 files changed, 1099 insertions(+), 975 deletions(-) diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index 70893ceb29bc1..a4f900f45e141 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -625,7 +625,7 @@ namespace ts { ]; for (const ctor of nodeConstructors) { - if (!hasProperty(ctor, "__debugKind")) { + if (!hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4dccc9da4791d..24eb3edacb9fc 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1243,7 +1243,7 @@ namespace ts { } function beforeEmitNode(node: Node) { - if (preserveSourceNewlines && (getEmitFlags(node) & EmitFlags.IgnoreSourceNewlines)) { + if (preserveSourceNewlines && (getInternalEmitFlags(node) & InternalEmitFlags.IgnoreSourceNewlines)) { preserveSourceNewlines = false; } } @@ -2576,7 +2576,7 @@ namespace ts { } function emitCallExpression(node: CallExpression) { - const indirectCall = getEmitFlags(node) & EmitFlags.IndirectCall; + const indirectCall = getInternalEmitFlags(node) & InternalEmitFlags.IndirectCall; if (indirectCall) { writePunctuation("("); writeLiteral("0"); @@ -2601,7 +2601,7 @@ namespace ts { } function emitTaggedTemplateExpression(node: TaggedTemplateExpression) { - const indirectCall = getEmitFlags(node) & EmitFlags.IndirectCall; + const indirectCall = getInternalEmitFlags(node) & InternalEmitFlags.IndirectCall; if (indirectCall) { writePunctuation("("); writeLiteral("0"); @@ -5413,7 +5413,14 @@ namespace ts { Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node as ImportDeclaration | ExportDeclaration); case SyntaxKind.FunctionDeclaration: - case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassDeclaration: { + Debug.assert(!prefix && !suffix && !privateName); + const name = (node as ClassDeclaration | FunctionDeclaration).name; + if (name && !isGeneratedIdentifier(name)) { + return generateNameForNode(name, /*privateName*/ false, flags, prefix, suffix); + } + return generateNameForExportDefault(); + } case SyntaxKind.ExportAssignment: Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index e57833235e0ea..a34b50ea5ed92 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -1,5 +1,11 @@ /* @internal */ namespace ts { + export const enum PrivateIdentifierKind { + Field = "f", + Method = "m", + Accessor = "a" + } + /** * Describes the decorator context object passed to a native ECMAScript decorator for a class. */ @@ -88,8 +94,8 @@ namespace ts { export function createEmitHelperFactory(context: TransformationContext): EmitHelperFactory { const factory = context.factory; - const immutableTrue = memoize(() => setEmitFlags(factory.createTrue(), EmitFlags.Immutable)); - const immutableFalse = memoize(() => setEmitFlags(factory.createFalse(), EmitFlags.Immutable)); + const immutableTrue = memoize(() => setInternalEmitFlags(factory.createTrue(), InternalEmitFlags.Immutable)); + const immutableFalse = memoize(() => setInternalEmitFlags(factory.createFalse(), InternalEmitFlags.Immutable)); return { getUnscopedHelperName, diff --git a/src/compiler/factory/emitNode.ts b/src/compiler/factory/emitNode.ts index 19ebfd53ba2ba..113c29dc44357 100644 --- a/src/compiler/factory/emitNode.ts +++ b/src/compiler/factory/emitNode.ts @@ -21,7 +21,7 @@ namespace ts { node.emitNode = {} as EmitNode; } else { - Debug.assert(!(node.emitNode.flags & EmitFlags.Immutable), "Invalid attempt to mutate an immutable node."); + Debug.assert(!(node.emitNode.internalFlags & InternalEmitFlags.Immutable), "Invalid attempt to mutate an immutable node."); } return node.emitNode; } @@ -75,6 +75,25 @@ namespace ts { return node; } + /** + * Sets flags that control emit behavior of a node. + */ + /* @internal */ + export function setInternalEmitFlags(node: T, emitFlags: InternalEmitFlags) { + getOrCreateEmitNode(node).internalFlags = emitFlags; + return node; + } + + /** + * Sets flags that control emit behavior of a node. + */ + /* @internal */ + export function addInternalEmitFlags(node: T, emitFlags: InternalEmitFlags) { + const emitNode = getOrCreateEmitNode(node); + emitNode.internalFlags = emitNode.internalFlags | emitFlags; + return node; + } + /** * Gets a custom text range to use when emitting source maps. */ @@ -276,7 +295,7 @@ namespace ts { /* @internal */ export function ignoreSourceNewlines(node: T): T { - getOrCreateEmitNode(node).flags |= EmitFlags.IgnoreSourceNewlines; + getOrCreateEmitNode(node).internalFlags |= InternalEmitFlags.IgnoreSourceNewlines; return node; } diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index f2d2c922e474f..acbac83b5e66e 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -6893,6 +6893,7 @@ namespace ts { function mergeEmitNode(sourceEmitNode: EmitNode, destEmitNode: EmitNode | undefined) { const { flags, + internalFlags, leadingComments, trailingComments, commentRange, @@ -6907,7 +6908,8 @@ namespace ts { // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. if (leadingComments) destEmitNode.leadingComments = addRange(leadingComments.slice(), destEmitNode.leadingComments); if (trailingComments) destEmitNode.trailingComments = addRange(trailingComments.slice(), destEmitNode.trailingComments); - if (flags) destEmitNode.flags = flags & ~EmitFlags.Immutable; + if (flags) destEmitNode.flags = flags; + if (internalFlags) destEmitNode.internalFlags = internalFlags & ~InternalEmitFlags.Immutable; if (commentRange) destEmitNode.commentRange = commentRange; if (sourceMapRange) destEmitNode.sourceMapRange = sourceMapRange; if (tokenSourceMapRanges) destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges!); diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 9d0a472f3768d..02a806cc05ee1 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -529,7 +529,7 @@ namespace ts { nodeFactory.createStringLiteral(externalHelpersModuleNameText), /*assertClause*/ undefined ); - addEmitFlags(externalHelpersImportDeclaration, EmitFlags.NeverApplyImportHelper); + addInternalEmitFlags(externalHelpersImportDeclaration, InternalEmitFlags.NeverApplyImportHelper); return externalHelpersImportDeclaration; } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 5b48d317db7df..131e566ddca8d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2568,7 +2568,7 @@ namespace ts { function createSyntheticImport(text: string, file: SourceFile) { const externalHelpersModuleReference = factory.createStringLiteral(text); const importDecl = factory.createImportDeclaration(/*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference, /*assertClause*/ undefined); - addEmitFlags(importDecl, EmitFlags.NeverApplyImportHelper); + addInternalEmitFlags(importDecl, InternalEmitFlags.NeverApplyImportHelper); setParent(externalHelpersModuleReference, importDecl); setParent(importDecl, file); // explicitly unset the synthesized flag on these declarations so the checker API will answer questions about them diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index ddef477f079dc..af4425a93f3e3 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -13,12 +13,6 @@ namespace ts { ClassStaticThisOrSuperReference = 1 << 1, } - export const enum PrivateIdentifierKind { - Field = "f", - Method = "m", - Accessor = "a" - } - interface PrivateIdentifierInfoBase { /** * brandCheckIdentifier can contain: @@ -61,10 +55,6 @@ namespace ts { interface PrivateIdentifierInstanceFieldInfo extends PrivateIdentifierInfoBase { kind: PrivateIdentifierKind.Field; isStatic: false; - /** - * Defined for ease of access when in a union with PrivateIdentifierStaticFieldInfo. - */ - variableName: undefined; } interface PrivateIdentifierStaticFieldInfo extends PrivateIdentifierInfoBase { @@ -76,42 +66,40 @@ namespace ts { variableName: Identifier; } - type PrivateIdentifierInfo = - | PrivateIdentifierMethodInfo - | PrivateIdentifierInstanceFieldInfo - | PrivateIdentifierStaticFieldInfo - | PrivateIdentifierAccessorInfo; - - interface PrivateIdentifierEnvironment { + interface PrivateEnvironmentData { /** * Used for prefixing generated variable names. */ className?: Identifier; + /** * Used for brand check on private methods. */ weakSetName?: Identifier; - /** - * A mapping of private names to information needed for transformation. - */ - identifiers?: UnderscoreEscapedMap; - /** - * A mapping of generated private names to information needed for transformation. - */ - generatedIdentifiers?: ESMap; } + interface UntransformedPrivateIdentifierInfo { + kind: "untransformed"; + } + + type PrivateIdentifierInfo = + | PrivateIdentifierMethodInfo + | PrivateIdentifierInstanceFieldInfo + | PrivateIdentifierStaticFieldInfo + | PrivateIdentifierAccessorInfo + | UntransformedPrivateIdentifierInfo; + interface ClassLexicalEnvironment { facts: ClassFacts; /** * Used for brand checks on static members, and `this` references in static initializers */ classConstructor: Identifier | undefined; + classThis: Identifier | undefined; /** * Used for `super` references in static initializers. */ superClassReference: Identifier | undefined; - privateIdentifierEnvironment: PrivateIdentifierEnvironment | undefined; } const enum ClassFacts { @@ -122,6 +110,9 @@ namespace ts { NeedsSubstitutionForThisInClassStaticField = 1 << 3, } + type LexicalEnv = LexicalEnvironment; + type PrivateEnv = PrivateEnvironment; + /** * Transforms ECMAScript Class Syntax. * TypeScript parameter property syntax is transformed in the TypeScript transformer. @@ -177,6 +168,7 @@ namespace ts { const previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; + let shouldTransformPrivateStaticElementsInFile = false; let enabledSubstitutions: ClassPropertySubstitutionFlags; let classAliases: Identifier[]; @@ -193,18 +185,24 @@ namespace ts { */ let pendingStatements: Statement[] | undefined; - const classLexicalEnvironmentStack: (ClassLexicalEnvironment | undefined)[] = []; - const classLexicalEnvironmentMap = new Map(); + let lexicalEnvironment: LexicalEnv | undefined; + const lexicalEnvironmentMap = new Map(); - let currentClassLexicalEnvironment: ClassLexicalEnvironment | undefined; let currentClassContainer: ClassLikeDeclaration | undefined; - let currentComputedPropertyNameClassLexicalEnvironment: ClassLexicalEnvironment | undefined; let currentStaticPropertyDeclarationOrStaticBlock: PropertyDeclaration | ClassStaticBlockDeclaration | undefined; + let shouldSubstituteThisWithClassThis = false; + let previousShouldSubstituteThisWithClassThis = false; return chainBundle(context, transformSourceFile); function transformSourceFile(node: SourceFile) { - if (node.isDeclarationFile || !shouldTransformAnything) { + if (node.isDeclarationFile) { + return node; + } + + lexicalEnvironment = undefined; + shouldTransformPrivateStaticElementsInFile = !!(getInternalEmitFlags(node) & InternalEmitFlags.TransformPrivateStaticElements); + if (!shouldTransformAnything && !shouldTransformPrivateStaticElementsInFile) { return node; } @@ -402,13 +400,6 @@ namespace ts { return setOriginalNode(factory.createIdentifier(""), node); } - type PrivateIdentifierInExpression = BinaryExpression & { readonly left: PrivateIdentifier, readonly token: InKeyword }; - - function isPrivateIdentifierInExpression(node: BinaryExpression): node is PrivateIdentifierInExpression { - return isPrivateIdentifier(node.left) - && node.operatorToken.kind === SyntaxKind.InKeyword; - } - /** * Visits `#id in expr` */ @@ -475,7 +466,10 @@ namespace ts { if (isIdentifier(node.name) && node.initializer && isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { - const referencedName = factory.createStringLiteralFromNode(node.name); + const original = getOriginalNode(node.initializer, isClassLike); + const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? + factory.createStringLiteral("default") : + factory.createStringLiteralFromNode(node.name); const name = visitNode(node.name, visitor, isBindingName); const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); return factory.updateVariableDeclaration(node, name, /*exclamationToken*/ undefined, /*type*/ undefined, initializer); @@ -504,7 +498,10 @@ namespace ts { if (!node.dotDotDotToken && isIdentifier(node.name) && node.initializer && isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { - const referencedName = factory.createStringLiteralFromNode(node.name); + const original = getOriginalNode(node.initializer, isClassLike); + const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? + factory.createStringLiteral("default") : + factory.createStringLiteralFromNode(node.name); const propertyName = visitNode(node.propertyName, visitor, isPropertyName); const name = visitNode(node.name, visitor, isBindingName); const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); @@ -559,10 +556,16 @@ namespace ts { return fallbackVisitor(node); } + function shouldTransformClassElementToWeakMap(node: PrivateIdentifierMethodDeclaration | PrivateIdentifierAccessorDeclaration | PrivateIdentifierPropertyDeclaration) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) return true; + if (hasStaticModifier(node) && getInternalEmitFlags(node) & InternalEmitFlags.TransformPrivateStaticElements) return true; + return false; + } + function visitMethodOrAccessorDeclaration(node: MethodDeclaration | AccessorDeclaration) { Debug.assert(!hasDecorators(node)); - if (!shouldTransformPrivateElementsOrClassStaticBlocks || !isPrivateIdentifier(node.name)) { + if (!isPrivateIdentifierClassElementDeclaration(node) || !shouldTransformClassElementToWeakMap(node)) { return visitEachChild(node, classElementVisitor, context); } @@ -681,7 +684,7 @@ namespace ts { } function transformPrivateFieldInitializer(node: PrivateIdentifierPropertyDeclaration) { - if (shouldTransformPrivateElementsOrClassStaticBlocks) { + if (shouldTransformClassElementToWeakMap(node)) { // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. const info = accessPrivateIdentifier(node.name); Debug.assert(info, "Undeclared private name for property declaration."); @@ -769,7 +772,8 @@ namespace ts { function visitPropertyDeclaration(node: PropertyDeclaration) { // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function // will in turn call `transformFieldInitializer` as needed. - if (shouldTransformAutoAccessors && isAutoAccessorPropertyDeclaration(node)) { + if (isAutoAccessorPropertyDeclaration(node) && (shouldTransformAutoAccessors || + hasStaticModifier(node) && getInternalEmitFlags(node) & InternalEmitFlags.TransformPrivateStaticElements)) { return transformAutoAccessor(node); } @@ -783,7 +787,7 @@ namespace ts { function createPrivateIdentifierAccessHelper(info: PrivateIdentifierInfo, receiver: Expression): Expression { setCommentRange(receiver, moveRangePos(receiver, -1)); - switch(info.kind) { + switch (info.kind) { case PrivateIdentifierKind.Accessor: return context.getEmitHelperFactory().createClassPrivateFieldGetHelper( receiver, @@ -803,15 +807,18 @@ namespace ts { receiver, info.brandCheckIdentifier, info.kind, - info.variableName + info.isStatic ? info.variableName : undefined ); + case "untransformed": + return Debug.fail("Access helpers should not be created for untransformed private elements"); + default: Debug.assertNever(info, "Unknown private element type"); } } function visitPropertyAccessExpression(node: PropertyAccessExpression) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifier(node.name)) { + if (isPrivateIdentifier(node.name)) { const privateIdentifierInfo = accessPrivateIdentifier(node.name); if (privateIdentifierInfo) { return setTextRange( @@ -827,8 +834,8 @@ namespace ts { isSuperProperty(node) && isIdentifier(node.name) && currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - const { classConstructor, superClassReference, facts } = currentClassLexicalEnvironment; + lexicalEnvironment?.data) { + const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & ClassFacts.ClassWasDecorated) { return visitInvalidSuperProperty(node); } @@ -851,8 +858,8 @@ namespace ts { if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - const { classConstructor, superClassReference, facts } = currentClassLexicalEnvironment; + lexicalEnvironment?.data) { + const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & ClassFacts.ClassWasDecorated) { return visitInvalidSuperProperty(node); } @@ -876,8 +883,8 @@ namespace ts { if (node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken) { const operand = skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && - isPrivateIdentifierPropertyAccessExpression(operand)) { + + if (isPrivateIdentifierPropertyAccessExpression(operand)) { let info: PrivateIdentifierInfo | undefined; if (info = accessPrivateIdentifier(operand.name)) { const receiver = visitNode(operand.expression, visitor, isExpression); @@ -904,7 +911,7 @@ namespace ts { else if (shouldTransformSuperInStaticInitializers && isSuperProperty(operand) && currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { + lexicalEnvironment?.data) { // converts `++super.a` into `(Reflect.set(_baseTemp, "a", (_a = Reflect.get(_baseTemp, "a", _classTemp), _b = ++_a), _classTemp), _b)` // converts `++super[f()]` into `(Reflect.set(_baseTemp, _a = f(), (_b = Reflect.get(_baseTemp, _a, _classTemp), _c = ++_b), _classTemp), _c)` // converts `--super.a` into `(Reflect.set(_baseTemp, "a", (_a = Reflect.get(_baseTemp, "a", _classTemp), _b = --_a), _classTemp), _b)` @@ -913,7 +920,7 @@ namespace ts { // converts `super[f()]++` into `(Reflect.set(_baseTemp, _a = f(), (_b = Reflect.get(_baseTemp, _a, _classTemp), _c = _b++), _classTemp), _c)` // converts `super.a--` into `(Reflect.set(_baseTemp, "a", (_a = Reflect.get(_baseTemp, "a", _classTemp), _b = _a--), _classTemp), _b)` // converts `super[f()]--` into `(Reflect.set(_baseTemp, _a = f(), (_b = Reflect.get(_baseTemp, _a, _classTemp), _c = _b--), _classTemp), _c)` - const { classConstructor, superClassReference, facts } = currentClassLexicalEnvironment; + const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & ClassFacts.ClassWasDecorated) { const expression = visitInvalidSuperProperty(operand); return isPrefixUnaryExpression(node) ? @@ -986,8 +993,8 @@ namespace ts { } function visitCallExpression(node: CallExpression) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && - isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (isPrivateIdentifierPropertyAccessExpression(node.expression) && + accessPrivateIdentifier(node.expression.name)) { // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. @@ -1012,14 +1019,14 @@ namespace ts { if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment?.classConstructor) { + lexicalEnvironment?.data?.classConstructor) { // super.x() // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` const invocation = factory.createFunctionCallCall( visitNode(node.expression, visitor, isExpression), - currentClassLexicalEnvironment.classConstructor, + lexicalEnvironment.data.classConstructor, visitNodes(node.arguments, visitor, isExpression) ); setOriginalNode(invocation, node); @@ -1031,8 +1038,8 @@ namespace ts { } function visitTaggedTemplateExpression(node: TaggedTemplateExpression) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && - isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (isPrivateIdentifierPropertyAccessExpression(node.tag) && + accessPrivateIdentifier(node.tag.name)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. const { thisArg, target } = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion); return factory.updateTaggedTemplateExpression( @@ -1049,12 +1056,12 @@ namespace ts { if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) && currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment?.classConstructor) { + lexicalEnvironment?.data?.classConstructor) { // converts `` super.f`x` `` into `` Reflect.get(_baseTemp, "f", _classTemp).bind(_classTemp)`x` `` const invocation = factory.createFunctionBindCall( visitNode(node.tag, visitor, isExpression), - currentClassLexicalEnvironment.classConstructor, + lexicalEnvironment.data.classConstructor, [] ); setOriginalNode(invocation, node); @@ -1070,11 +1077,11 @@ namespace ts { } function transformClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration) { - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - if (currentClassLexicalEnvironment) { - classLexicalEnvironmentMap.set(getOriginalNodeId(node), currentClassLexicalEnvironment); - } + if (lexicalEnvironment) { + lexicalEnvironmentMap.set(getOriginalNode(node), lexicalEnvironment); + } + if (shouldTransformPrivateElementsOrClassStaticBlocks) { startLexicalEnvironment(); let statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd( node, @@ -1104,8 +1111,10 @@ namespace ts { } } } + const hasTransformableStatics = - shouldTransformPrivateElementsOrClassStaticBlocks && + (shouldTransformPrivateElementsOrClassStaticBlocks || + !!(getInternalEmitFlags(node) && InternalEmitFlags.TransformPrivateStaticElements)) && some(staticPropertiesOrClassStaticBlocks, node => isClassStaticBlockDeclaration(node) || isPrivateIdentifierClassElementDeclaration(node) || @@ -1168,7 +1177,10 @@ namespace ts { case SyntaxKind.QuestionQuestionEqualsToken: if (isIdentifier(node.left) && isAnonymousClassDeclarationNeedingAssignedName(node.right)) { - const referencedName = factory.createStringLiteralFromNode(node.left); + const original = getOriginalNode(node.right, isClassLike); + const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? + factory.createStringLiteral("default") : + factory.createStringLiteralFromNode(node.left); const left = visitNode(node.left, visitor, isExpression); const right = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); return factory.updateBinaryExpression(node, left, node.operatorToken, right); @@ -1176,8 +1188,7 @@ namespace ts { break; } - if (shouldTransformPrivateElementsOrClassStaticBlocks && - isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (isPrivateIdentifierPropertyAccessExpression(node.left)) { // obj.#x = ... const info = accessPrivateIdentifier(node.left.name); if (info) { @@ -1193,12 +1204,12 @@ namespace ts { else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { + lexicalEnvironment?.data) { // super.x = ... // super[x] = ... // super.x += ... // super.x -= ... - const { classConstructor, superClassReference, facts } = currentClassLexicalEnvironment; + const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & ClassFacts.ClassWasDecorated) { return factory.updateBinaryExpression( node, @@ -1265,8 +1276,7 @@ namespace ts { } } } - if (shouldTransformPrivateElementsOrClassStaticBlocks && - isPrivateIdentifierInExpression(node)) { + if (isPrivateIdentifierInExpression(node)) { // #x in obj return transformPrivateIdentifierInInExpression(node); } @@ -1364,8 +1374,11 @@ namespace ts { info.brandCheckIdentifier, right, info.kind, - info.variableName + info.isStatic ? info.variableName : undefined ); + case "untransformed": + return Debug.fail("Access helpers should not be created for untransformed private elements"); + default: Debug.assertNever(info, "Unknown private element type"); } @@ -1383,7 +1396,9 @@ namespace ts { } for (const member of node.members) { if (!isStatic(member)) continue; - if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && + (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && + shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= ClassFacts.NeedsClassConstructorReference; } if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) { @@ -1404,7 +1419,7 @@ namespace ts { } function visitExpressionWithTypeArgumentsInHeritageClause(node: ExpressionWithTypeArguments) { - const facts = currentClassLexicalEnvironment?.facts || ClassFacts.None; + const facts = lexicalEnvironment?.data?.facts || ClassFacts.None; if (facts & ClassFacts.NeedsClassSuperReference) { const temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); getClassLexicalEnvironment().superClassReference = temp; @@ -1423,19 +1438,23 @@ namespace ts { function visitInNewClassLexicalEnvironment(node: T, referencedName: Expression | undefined, visitor: (node: T, facts: ClassFacts, referencedName: Expression | undefined) => U) { const savedCurrentClassContainer = currentClassContainer; const savedPendingExpressions = pendingExpressions; + const savedLexicalEnvironment = lexicalEnvironment; currentClassContainer = node; pendingExpressions = undefined; startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { + const shouldAlwaysTransformPrivateStaticElements = getInternalEmitFlags(node) & InternalEmitFlags.TransformPrivateStaticElements; + if (shouldTransformPrivateElementsOrClassStaticBlocks || shouldAlwaysTransformPrivateStaticElements) { const name = getNameOfDeclaration(node); if (name && isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = name; + getPrivateIdentifierEnvironment().data.className = name; } + } + if (shouldTransformPrivateElementsOrClassStaticBlocks) { const privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); if (some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass( + getPrivateIdentifierEnvironment().data.weakSetName = createHoistedVariableForClass( "instances", privateInstanceMethodsAndAccessors[0].name ); @@ -1453,6 +1472,7 @@ namespace ts { const result = visitor(node, facts, referencedName); endClassLexicalEnvironment(); + Debug.assert(lexicalEnvironment === savedLexicalEnvironment); currentClassContainer = savedCurrentClassContainer; pendingExpressions = savedPendingExpressions; return result; @@ -1468,9 +1488,28 @@ namespace ts { // then we need to allocate a temp variable to hold on to that reference. let pendingClassReferenceAssignment: BinaryExpression | undefined; if (facts & ClassFacts.NeedsClassConstructorReference) { - const temp = factory.createTempVariable(hoistVariableDeclaration, /*reservedInNestedScopes*/ true); - getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); - pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); + // If we aren't transforming class static blocks, then we can't reuse `_classThis` since in + // `class C { ... static { _classThis = ... } }; _classThis = C` the outer assignment would occur *after* + // class static blocks evaluate and would overwrite the replacement constructor produced by class + // decorators. + + // If we are transforming class static blocks, then we can reuse `_classThis` since the assignment + // will be evaluated *before* the transformed static blocks are evaluated and thus won't overwrite + // the replacement constructor. + + if (shouldTransformPrivateElementsOrClassStaticBlocks && node.emitNode?.classThis) { + getClassLexicalEnvironment().classConstructor = node.emitNode.classThis; + pendingClassReferenceAssignment = factory.createAssignment(node.emitNode.classThis, factory.getInternalName(node)); + } + else { + const temp = factory.createTempVariable(hoistVariableDeclaration, /*reservedInNestedScopes*/ true); + getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); + pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); + } + + if (node.emitNode?.classThis) { + getClassLexicalEnvironment().classThis = node.emitNode.classThis; + } } const modifiers = visitNodes(node.modifiers, visitor, isModifierLike); @@ -1501,7 +1540,7 @@ namespace ts { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks || getInternalEmitFlags(node) & InternalEmitFlags.TransformPrivateStaticElements) { // Emit static property assignment. Because classDeclaration is lexically evaluated, // it is safe to emit static property assignment after classDeclaration // From ES6 specification: @@ -1530,27 +1569,44 @@ namespace ts { // class declaration transformation. The VariableStatement visitor will insert // these statements after the class expression variable statement. const isDecoratedClassDeclaration = !!(facts & ClassFacts.ClassWasDecorated); - const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node); - const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithConstructorReference; + let temp: Identifier | undefined; function createClassTempVar() { + // If we aren't transforming class static blocks, then we can't reuse `_classThis` since in + // `_classThis = class { ... static { _classThis = ... } }` the outer assignment would occur *after* + // class static blocks evaluate and would overwrite the replacement constructor produced by class + // decorators. + + // If we are transforming class static blocks, then we can reuse `_classThis` since the assignment + // will be evaluated *before* the transformed static blocks are evaluated and thus won't overwrite + // the replacement constructor. + + if (shouldTransformPrivateElementsOrClassStaticBlocks && node.emitNode?.classThis) { + return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis; + } + const classCheckFlags = resolver.getNodeCheckFlags(node); const isClassWithConstructorReference = classCheckFlags & NodeCheckFlags.ClassWithConstructorReference; const requiresBlockScopedVar = classCheckFlags & NodeCheckFlags.BlockScopedBindingInLoop; - return factory.createTempVariable(requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration, !!isClassWithConstructorReference); + const temp = factory.createTempVariable(requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration, !!isClassWithConstructorReference); + getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); + return temp; + } + + if (node.emitNode?.classThis) { + getClassLexicalEnvironment().classThis = node.emitNode.classThis; } if (facts & ClassFacts.NeedsClassConstructorReference) { - temp = createClassTempVar(); - getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); + temp ??= createClassTempVar(); } const modifiers = visitNodes(node.modifiers, visitor, isModifierLike); const heritageClauses = visitNodes(node.heritageClauses, heritageClauseVisitor, isHeritageClause); const { members, prologue } = transformClassMembers(node); - const classExpression = factory.updateClassExpression( + let classExpression = factory.updateClassExpression( node, modifiers, node.name, @@ -1567,7 +1623,7 @@ namespace ts { // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` // and not also transforming static blocks. const hasTransformableStatics = - shouldTransformPrivateElementsOrClassStaticBlocks && + (shouldTransformPrivateElementsOrClassStaticBlocks || getInternalEmitFlags(node) & InternalEmitFlags.TransformPrivateStaticElements) && some(staticPropertiesOrClassStaticBlocks, node => isClassStaticBlockDeclaration(node) || isPrivateIdentifierClassElementDeclaration(node) || @@ -1578,34 +1634,50 @@ namespace ts { Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); // Write any pending expressions from elided or moved computed property names - if (pendingStatements && pendingExpressions && some(pendingExpressions)) { - pendingStatements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); + if (some(pendingExpressions)) { + addRange(pendingStatements, map(pendingExpressions, factory.createExpressionStatement)); } - if (pendingStatements && some(staticPropertiesOrClassStaticBlocks)) { - addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); + if (referencedName) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + const setNameExpression = emitHelpers().createSetFunctionNameHelper(temp ?? node.emitNode?.classThis ?? factory.getInternalName(node), referencedName); + pendingStatements.push(factory.createExpressionStatement(setNameExpression)); + } + else { + const setNameExpression = emitHelpers().createSetFunctionNameHelper(factory.createThis(), referencedName); + classExpression = factory.updateClassExpression( + classExpression, + classExpression.modifiers, + classExpression.name, + classExpression.typeParameters, + classExpression.heritageClauses, [ + factory.createClassStaticBlockDeclaration( + factory.createBlock([ + factory.createExpressionStatement(setNameExpression) + ]) + ), + ...classExpression.members + ] + ); + } } - if (referencedName) { - temp ??= createClassTempVar(); + if (some(staticPropertiesOrClassStaticBlocks)) { + addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, node.emitNode?.classThis ?? factory.getInternalName(node)); } if (temp) { - expressions.push(startOnNewLine(factory.createAssignment(temp, classExpression))); - if (referencedName) { - expressions.push(emitHelpers().createSetFunctionNameHelper(temp, referencedName)); - } - expressions.push(startOnNewLine(temp)); + expressions.push(factory.createAssignment(temp, classExpression)); + } + else if (shouldTransformPrivateElementsOrClassStaticBlocks && node.emitNode?.classThis) { + expressions.push(factory.createAssignment(node.emitNode.classThis, classExpression)); } else { expressions.push(classExpression); - if (prologue) { - startOnNewLine(classExpression); - } } } else { - temp ||= createClassTempVar(); + temp ??= createClassTempVar(); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. enableSubstitutionForClassAliases(); @@ -1614,25 +1686,26 @@ namespace ts { classAliases[getOriginalNodeId(node)] = alias; } - // To preserve the behavior of the old emitter, we explicitly indent - // the body of a class with static initializers. - setEmitFlags(classExpression, EmitFlags.Indented | getEmitFlags(classExpression)); - expressions.push(startOnNewLine(factory.createAssignment(temp, classExpression))); + expressions.push(factory.createAssignment(temp, classExpression)); // Add any pending expressions leftover from elided or relocated computed property names - addRange(expressions, map(pendingExpressions, startOnNewLine)); + addRange(expressions, pendingExpressions); if (referencedName) { - expressions.push(startOnNewLine(emitHelpers().createSetFunctionNameHelper(temp, referencedName))); + expressions.push(emitHelpers().createSetFunctionNameHelper(temp, referencedName)); } addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); - expressions.push(startOnNewLine(temp)); + expressions.push(factory.cloneNode(temp)); } } else { expressions.push(classExpression); - if (prologue) { - startOnNewLine(classExpression); - } + } + + if (expressions.length > 1) { + // To preserve the behavior of the old emitter, we explicitly indent + // the body of a class with static initializers. + addEmitFlags(classExpression, EmitFlags.Indented); + expressions.forEach(startOnNewLine); } return factory.inlineExpressions(expressions); @@ -1647,21 +1720,35 @@ namespace ts { } function transformClassMembers(node: ClassDeclaration | ClassExpression) { + const shouldTransformPrivateStaticElementsInClass = !!(getInternalEmitFlags(node) & InternalEmitFlags.TransformPrivateStaticElements); + // Declare private names - if (shouldTransformPrivateElementsOrClassStaticBlocks) { + if (shouldTransformPrivateElementsOrClassStaticBlocks || shouldTransformPrivateStaticElementsInFile) { for (const member of node.members) { if (isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); + if (shouldTransformClassElementToWeakMap(member)) { + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); + } + else { + const privateEnv = getPrivateIdentifierEnvironment(); + setPrivateIdentifier(privateEnv, member.name, { kind: "untransformed" }); + } } } - if (some(getPrivateInstanceMethodsAndAccessors(node))) { - createBrandCheckWeakSetForPrivateMethods(); + + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + if (some(getPrivateInstanceMethodsAndAccessors(node))) { + createBrandCheckWeakSetForPrivateMethods(); + } } - if (shouldTransformAutoAccessors) { + + if (shouldTransformAutoAccessors && (shouldTransformPrivateElementsOrClassStaticBlocks || shouldTransformPrivateStaticElementsInClass)) { for (const member of node.members) { if (isAutoAccessorPropertyDeclaration(member)) { - const storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); - addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + if (shouldTransformAutoAccessors || shouldTransformPrivateStaticElementsInClass && hasStaticModifier(member) && isPrivateIdentifier(member.name)) { + const storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } } } } @@ -1719,7 +1806,7 @@ namespace ts { } function createBrandCheckWeakSetForPrivateMethods() { - const { weakSetName } = getPrivateIdentifierEnvironment(); + const { weakSetName } = getPrivateIdentifierEnvironment().data; Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); getPendingExpressions().push( @@ -1884,7 +1971,7 @@ namespace ts { const receiver = factory.createThis(); // private methods can be called in property initializers, they should execute first. - addMethodStatements(statements, privateMethodsAndAccessors, receiver); + addInstanceMethodStatements(statements, privateMethodsAndAccessors, receiver); addPropertyOrClassStaticBlockStatements(statements, properties, receiver); // Add existing statements after the initial prologues and super call @@ -1930,7 +2017,7 @@ namespace ts { */ function addPropertyOrClassStaticBlockStatements(statements: Statement[], properties: readonly (PropertyDeclaration | ClassStaticBlockDeclaration)[], receiver: LeftHandSideExpression) { for (const property of properties) { - if (isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { + if (isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields && !(getInternalEmitFlags(property) & InternalEmitFlags.TransformPrivateStaticElements)) { continue; } @@ -1999,11 +2086,11 @@ namespace ts { function transformProperty(property: PropertyDeclaration, receiver: LeftHandSideExpression) { const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; const transformed = transformPropertyWorker(property, receiver); - if (transformed && hasStaticModifier(property) && currentClassLexicalEnvironment?.facts) { + if (transformed && hasStaticModifier(property) && lexicalEnvironment?.data?.facts) { // capture the lexical environment for the member setOriginalNode(transformed, property); addEmitFlags(transformed, EmitFlags.AdviseOnEmitNode); - classLexicalEnvironmentMap.set(getOriginalNodeId(transformed), currentClassLexicalEnvironment); + lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment); } currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; return transformed; @@ -2041,7 +2128,7 @@ namespace ts { referencedName ? child => namedEvaluationVisitor(child, referencedName!) : visitor; - if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifier(propertyName)) { + if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property as PrivateIdentifierPropertyDeclaration)) { const privateIdentifierInfo = accessPrivateIdentifier(propertyName); if (privateIdentifierInfo) { if (privateIdentifierInfo.kind === PrivateIdentifierKind.Field) { @@ -2112,20 +2199,13 @@ namespace ts { // substitute `this` in a static field initializer context.enableSubstitution(SyntaxKind.ThisKeyword); - - // these push a new lexical environment that is not the class lexical environment context.enableEmitNotification(SyntaxKind.FunctionDeclaration); context.enableEmitNotification(SyntaxKind.FunctionExpression); context.enableEmitNotification(SyntaxKind.Constructor); - - // these push a new lexical environment that is not the class lexical environment, except - // when they have a computed property name context.enableEmitNotification(SyntaxKind.GetAccessor); context.enableEmitNotification(SyntaxKind.SetAccessor); context.enableEmitNotification(SyntaxKind.MethodDeclaration); context.enableEmitNotification(SyntaxKind.PropertyDeclaration); - - // class lexical environments are restored when entering a computed property name context.enableEmitNotification(SyntaxKind.ComputedPropertyName); } } @@ -2137,12 +2217,12 @@ namespace ts { * @param methods An array of method declarations. * @param receiver The receiver on which each method should be assigned. */ - function addMethodStatements(statements: Statement[], methods: readonly (MethodDeclaration | AccessorDeclaration | AutoAccessorPropertyDeclaration)[], receiver: LeftHandSideExpression) { + function addInstanceMethodStatements(statements: Statement[], methods: readonly (MethodDeclaration | AccessorDeclaration | AutoAccessorPropertyDeclaration)[], receiver: LeftHandSideExpression) { if (!shouldTransformPrivateElementsOrClassStaticBlocks || !some(methods)) { return; } - const { weakSetName } = getPrivateIdentifierEnvironment(); + const { weakSetName } = getPrivateIdentifierEnvironment().data; Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); statements.push( factory.createExpressionStatement( @@ -2163,139 +2243,6 @@ namespace ts { visitNode(node.argumentExpression, visitor, isExpression)); } - function onEmitNode(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) { - const original = getOriginalNode(node); - if (original.id) { - const classLexicalEnvironment = classLexicalEnvironmentMap.get(original.id); - if (classLexicalEnvironment) { - const savedClassLexicalEnvironment = currentClassLexicalEnvironment; - const savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; - currentClassLexicalEnvironment = classLexicalEnvironment; - currentComputedPropertyNameClassLexicalEnvironment = classLexicalEnvironment; - previousOnEmitNode(hint, node, emitCallback); - currentClassLexicalEnvironment = savedClassLexicalEnvironment; - currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; - return; - } - } - - switch (node.kind) { - case SyntaxKind.FunctionExpression: - if (isArrowFunction(original) || getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { - break; - } - - // falls through - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.Constructor: { - const savedClassLexicalEnvironment = currentClassLexicalEnvironment; - const savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; - currentClassLexicalEnvironment = undefined; - currentComputedPropertyNameClassLexicalEnvironment = undefined; - previousOnEmitNode(hint, node, emitCallback); - currentClassLexicalEnvironment = savedClassLexicalEnvironment; - currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; - return; - } - - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.PropertyDeclaration: { - const savedClassLexicalEnvironment = currentClassLexicalEnvironment; - const savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; - currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; - currentClassLexicalEnvironment = undefined; - previousOnEmitNode(hint, node, emitCallback); - currentClassLexicalEnvironment = savedClassLexicalEnvironment; - currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; - return; - } - case SyntaxKind.ComputedPropertyName: { - const savedClassLexicalEnvironment = currentClassLexicalEnvironment; - const savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; - currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; - currentComputedPropertyNameClassLexicalEnvironment = undefined; - previousOnEmitNode(hint, node, emitCallback); - currentClassLexicalEnvironment = savedClassLexicalEnvironment; - currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; - return; - } - } - previousOnEmitNode(hint, node, emitCallback); - } - - /** - * Hooks node substitutions. - * - * @param hint The context for the emitter. - * @param node The node to substitute. - */ - function onSubstituteNode(hint: EmitHint, node: Node) { - node = previousOnSubstituteNode(hint, node); - if (hint === EmitHint.Expression) { - return substituteExpression(node as Expression); - } - return node; - } - - function substituteExpression(node: Expression) { - switch (node.kind) { - case SyntaxKind.Identifier: - return substituteExpressionIdentifier(node as Identifier); - case SyntaxKind.ThisKeyword: - return substituteThisExpression(node as ThisExpression); - } - return node; - } - - function substituteThisExpression(node: ThisExpression) { - if (enabledSubstitutions & ClassPropertySubstitutionFlags.ClassStaticThisOrSuperReference && currentClassLexicalEnvironment) { - const { facts, classConstructor } = currentClassLexicalEnvironment; - if (facts & ClassFacts.ClassWasDecorated) { - return factory.createParenthesizedExpression(factory.createVoidZero()); - } - if (classConstructor) { - return setTextRange( - setOriginalNode( - factory.cloneNode(classConstructor), - node, - ), - node - ); - } - } - return node; - } - - function substituteExpressionIdentifier(node: Identifier): Expression { - return trySubstituteClassAlias(node) || node; - } - - function trySubstituteClassAlias(node: Identifier): Expression | undefined { - if (enabledSubstitutions & ClassPropertySubstitutionFlags.ClassAliases) { - if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.ConstructorReferenceInClass) { - // Due to the emit for class decorators, any reference to the class from inside of the class body - // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind - // behavior of class names in ES6. - // Also, when emitting statics for class expressions, we must substitute a class alias for - // constructor references in static property initializers. - const declaration = resolver.getReferencedValueDeclaration(node); - if (declaration) { - const classAlias = classAliases[declaration.id!]; // TODO: GH#18217 - if (classAlias) { - const clone = factory.cloneNode(classAlias); - setSourceMapRange(clone, node); - setCommentRange(clone, node); - return clone; - } - } - } - } - - return undefined; - } - /** * If the name is a computed property, this function transforms it, then either returns an expression which caches the * value of the result or the expression itself if the value is either unused or safe to inline into multiple locations @@ -2325,32 +2272,30 @@ namespace ts { } function startClassLexicalEnvironment() { - classLexicalEnvironmentStack.push(currentClassLexicalEnvironment); - currentClassLexicalEnvironment = undefined; + lexicalEnvironment = { previous: lexicalEnvironment, data: undefined }; } function endClassLexicalEnvironment() { - currentClassLexicalEnvironment = classLexicalEnvironmentStack.pop(); + lexicalEnvironment = lexicalEnvironment?.previous; } - function getClassLexicalEnvironment() { - return currentClassLexicalEnvironment ||= { + function getClassLexicalEnvironment(): ClassLexicalEnvironment { + Debug.assert(lexicalEnvironment); + return lexicalEnvironment.data ??= { facts: ClassFacts.None, classConstructor: undefined, + classThis: undefined, superClassReference: undefined, - privateIdentifierEnvironment: undefined, + // privateIdentifierEnvironment: undefined, }; } - function getPrivateIdentifierEnvironment() { - const lex = getClassLexicalEnvironment(); - lex.privateIdentifierEnvironment ||= { + function getPrivateIdentifierEnvironment(): PrivateEnv { + Debug.assert(lexicalEnvironment); + return lexicalEnvironment.privateEnv ??= newPrivateEnvironment({ className: undefined, weakSetName: undefined, - identifiers: undefined, - generatedIdentifiers: undefined, - }; - return lex.privateIdentifierEnvironment; + }); } function getPendingExpressions() { @@ -2361,7 +2306,7 @@ namespace ts { node: PropertyDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined @@ -2387,20 +2332,21 @@ namespace ts { _node: PropertyDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined ) { if (isStatic) { - Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + const brandCheckIdentifier = + Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment"); const variableName = createHoistedVariableForPrivateName(name); setPrivateIdentifier(privateEnv, name, { kind: PrivateIdentifierKind.Field, - brandCheckIdentifier: lex.classConstructor, - variableName, isStatic: true, + brandCheckIdentifier, + variableName, isValid, }); } @@ -2409,9 +2355,8 @@ namespace ts { setPrivateIdentifier(privateEnv, name, { kind: PrivateIdentifierKind.Field, - brandCheckIdentifier: weakMapName, - variableName: undefined, isStatic: false, + brandCheckIdentifier: weakMapName, isValid, }); @@ -2430,15 +2375,15 @@ namespace ts { _node: MethodDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined ) { const methodName = createHoistedVariableForPrivateName(name); const brandCheckIdentifier = isStatic ? - Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : - Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment") : + Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); setPrivateIdentifier(privateEnv, name, { kind: PrivateIdentifierKind.Method, @@ -2453,15 +2398,15 @@ namespace ts { _node: GetAccessorDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined ) { const getterName = createHoistedVariableForPrivateName(name, "_get"); const brandCheckIdentifier = isStatic ? - Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : - Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment") : + Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); if (previousInfo?.kind === PrivateIdentifierKind.Accessor && previousInfo.isStatic === isStatic && !previousInfo.getterName) { previousInfo.getterName = getterName; @@ -2482,17 +2427,18 @@ namespace ts { _node: SetAccessorDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined ) { const setterName = createHoistedVariableForPrivateName(name, "_set"); const brandCheckIdentifier = isStatic ? - Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : - Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment") : + Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); - if (previousInfo?.kind === PrivateIdentifierKind.Accessor && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + if (previousInfo?.kind === PrivateIdentifierKind.Accessor && + previousInfo.isStatic === isStatic && !previousInfo.setterName) { previousInfo.setterName = setterName; } else { @@ -2511,7 +2457,7 @@ namespace ts { _node: AutoAccessorPropertyDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined @@ -2519,8 +2465,8 @@ namespace ts { const getterName = createHoistedVariableForPrivateName(name, "_get"); const setterName = createHoistedVariableForPrivateName(name, "_set"); const brandCheckIdentifier = isStatic ? - Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : - Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment") : + Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); setPrivateIdentifier(privateEnv, name, { kind: PrivateIdentifierKind.Accessor, @@ -2539,7 +2485,7 @@ namespace ts { node: T, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined @@ -2554,7 +2500,7 @@ namespace ts { } function createHoistedVariableForClass(name: string | PrivateIdentifier | undefined, node: PrivateIdentifier | ClassStaticBlockDeclaration, suffix?: string): Identifier { - const { className } = getPrivateIdentifierEnvironment(); + const { className } = getPrivateIdentifierEnvironment().data; const prefix: GeneratedNamePart | string = className ? { prefix: "_", node: className, suffix: "_" } : "_"; const identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.ReservedInNestedScopes, prefix, suffix) : @@ -2582,45 +2528,8 @@ namespace ts { * @seealso {@link addPrivateIdentifierToEnvironment} */ function accessPrivateIdentifier(name: PrivateIdentifier) { - if (isGeneratedPrivateIdentifier(name)) { - return accessGeneratedPrivateIdentifier(name); - } - else { - return accessPrivateIdentifierByText(name.escapedText); - } - } - - function accessPrivateIdentifierByText(text: __String) { - return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); - } - - function accessGeneratedPrivateIdentifier(name: GeneratedPrivateIdentifier) { - return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, getNodeForGeneratedName(name)); - } - - function accessPrivateIdentifierWorker( - getPrivateIdentifierInfo: (privateEnv: PrivateIdentifierEnvironment, key: K) => PrivateIdentifierInfo | undefined, - privateIdentifierKey: K - ) { - if (currentClassLexicalEnvironment?.privateIdentifierEnvironment) { - const info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); - if (info) { - return info; - } - } - for (let i = classLexicalEnvironmentStack.length - 1; i >= 0; --i) { - const env = classLexicalEnvironmentStack[i]; - if (!env) { - continue; - } - if (env.privateIdentifierEnvironment) { - const info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); - if (info) { - return info; - } - } - } - return undefined; + const info = ts.accessPrivateIdentifier(lexicalEnvironment, name); + return info?.kind === "untransformed" ? undefined : info; } function wrapPrivateIdentifierForDestructuringTarget(node: PrivateIdentifierPropertyAccessExpression) { @@ -2658,8 +2567,8 @@ namespace ts { else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - const { classConstructor, superClassReference, facts } = currentClassLexicalEnvironment; + lexicalEnvironment?.data) { + const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & ClassFacts.ClassWasDecorated) { return visitInvalidSuperProperty(node); } @@ -2699,7 +2608,10 @@ namespace ts { let initializer: Expression; if (isIdentifier(node.left) && isAnonymousClassDeclarationNeedingAssignedName(node.right)) { - const referencedName = factory.createStringLiteralFromNode(node.left); + const original = getOriginalNode(node.right, isClassLike); + const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? + factory.createStringLiteral("default") : + factory.createStringLiteralFromNode(node.left); initializer = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); } else { @@ -2767,10 +2679,12 @@ namespace ts { if (node.objectAssignmentInitializer && isAnonymousClassDeclarationNeedingAssignedName(node.objectAssignmentInitializer)) { - const name = visitNode(node.name, visitor, isIdentifier); - const referencedName = factory.createStringLiteralFromNode(node.name); + const original = getOriginalNode(node.objectAssignmentInitializer, isClassLike); + const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? + factory.createStringLiteral("default") : + factory.createStringLiteralFromNode(node.name); const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, node => namedEvaluationVisitor(node, referencedName), isExpression); - return factory.updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer); + return factory.updateShorthandPropertyAssignment(node, node.name, objectAssignmentInitializer); } return visitEachChild(node, visitor, context); @@ -2822,6 +2736,140 @@ namespace ts { ); } } + + function onEmitNode(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) { + const original = getOriginalNode(node); + const lex = lexicalEnvironmentMap.get(original); + if (lex) { + // If we've associated a lexical environment with the original node for this node, use it explicitly. + const savedLexicalEnvironment = lexicalEnvironment; + const savedPreviousShouldSubstituteThisWithClassThis = previousShouldSubstituteThisWithClassThis; + lexicalEnvironment = lex; + previousShouldSubstituteThisWithClassThis = shouldSubstituteThisWithClassThis; + shouldSubstituteThisWithClassThis = !isClassStaticBlockDeclaration(original) || !(getInternalEmitFlags(original) & InternalEmitFlags.TransformPrivateStaticElements); + previousOnEmitNode(hint, node, emitCallback); + shouldSubstituteThisWithClassThis = previousShouldSubstituteThisWithClassThis; + previousShouldSubstituteThisWithClassThis = savedPreviousShouldSubstituteThisWithClassThis; + lexicalEnvironment = savedLexicalEnvironment; + return; + } + + switch (node.kind) { + case SyntaxKind.FunctionExpression: + if (isArrowFunction(original) || getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { + // Arrow functions and functions that serve as the transformed body of an async function should + // preserve the outer lexical environment. + break; + } + // falls through + + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.PropertyDeclaration: { + // Other function bodies and property declarations should clear the lexical environment. + // Note that this won't happen if a lexical environment was bound to the original node as that + // was handled above. + const savedLexicalEnvironment = lexicalEnvironment; + const savedPreviousShouldSubstituteThisWithClassThis = previousShouldSubstituteThisWithClassThis; + lexicalEnvironment = undefined; + previousShouldSubstituteThisWithClassThis = shouldSubstituteThisWithClassThis; + shouldSubstituteThisWithClassThis = false; + previousOnEmitNode(hint, node, emitCallback); + shouldSubstituteThisWithClassThis = previousShouldSubstituteThisWithClassThis; + previousShouldSubstituteThisWithClassThis = savedPreviousShouldSubstituteThisWithClassThis; + lexicalEnvironment = savedLexicalEnvironment; + return; + } + + case SyntaxKind.ComputedPropertyName: { + // Computed property names should use the outer lexical environment. + const savedLexicalEnvironment = lexicalEnvironment; + const savedShouldSubstituteThisWithClassThis = shouldSubstituteThisWithClassThis; + lexicalEnvironment = lexicalEnvironment?.previous; + shouldSubstituteThisWithClassThis = previousShouldSubstituteThisWithClassThis; + previousOnEmitNode(hint, node, emitCallback); + shouldSubstituteThisWithClassThis = savedShouldSubstituteThisWithClassThis; + lexicalEnvironment = savedLexicalEnvironment; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + + /** + * Hooks node substitutions. + * + * @param hint The context for the emitter. + * @param node The node to substitute. + */ + function onSubstituteNode(hint: EmitHint, node: Node) { + node = previousOnSubstituteNode(hint, node); + if (hint === EmitHint.Expression) { + return substituteExpression(node as Expression); + } + return node; + } + + function substituteExpression(node: Expression) { + switch (node.kind) { + case SyntaxKind.Identifier: + return substituteExpressionIdentifier(node as Identifier); + case SyntaxKind.ThisKeyword: + return substituteThisExpression(node as ThisExpression); + } + return node; + } + + function substituteThisExpression(node: ThisExpression) { + if (enabledSubstitutions & ClassPropertySubstitutionFlags.ClassStaticThisOrSuperReference && lexicalEnvironment?.data) { + const { facts, classConstructor, classThis } = lexicalEnvironment.data; + if (facts & ClassFacts.ClassWasDecorated && legacyDecorators) { + return factory.createParenthesizedExpression(factory.createVoidZero()); + } + const substituteThis = shouldSubstituteThisWithClassThis ? classThis ?? classConstructor : classConstructor; + if (substituteThis) { + return setTextRange( + setOriginalNode( + factory.cloneNode(substituteThis), + node, + ), + node + ); + } + } + return node; + } + + function substituteExpressionIdentifier(node: Identifier): Expression { + return trySubstituteClassAlias(node) || node; + } + + function trySubstituteClassAlias(node: Identifier): Expression | undefined { + if (enabledSubstitutions & ClassPropertySubstitutionFlags.ClassAliases) { + if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.ConstructorReferenceInClass) { + // Due to the emit for class decorators, any reference to the class from inside of the class body + // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind + // behavior of class names in ES6. + // Also, when emitting statics for class expressions, we must substitute a class alias for + // constructor references in static property initializers. + const declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + const classAlias = classAliases[declaration.id!]; // TODO: GH#18217 + if (classAlias) { + const clone = factory.cloneNode(classAlias); + setSourceMapRange(clone, node); + setCommentRange(clone, node); + return clone; + } + } + } + } + + return undefined; + } } function createPrivateStaticFieldInitializer(variableName: Identifier, initializer: Expression | undefined) { @@ -2853,28 +2901,10 @@ namespace ts { return !isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; } - function getPrivateIdentifier(privateEnv: PrivateIdentifierEnvironment, name: PrivateIdentifier) { - return isGeneratedPrivateIdentifier(name) ? - getGeneratedPrivateIdentifierInfo(privateEnv, getNodeForGeneratedName(name)) : - getPrivateIdentifierInfo(privateEnv, name.escapedText); - } - - function setPrivateIdentifier(privateEnv: PrivateIdentifierEnvironment, name: PrivateIdentifier, info: PrivateIdentifierInfo) { - if (isGeneratedPrivateIdentifier(name)) { - privateEnv.generatedIdentifiers ??= new Map(); - privateEnv.generatedIdentifiers.set(getNodeForGeneratedName(name), info); - } - else { - privateEnv.identifiers ??= new Map(); - privateEnv.identifiers.set(name.escapedText, info); - } - } - - function getPrivateIdentifierInfo(privateEnv: PrivateIdentifierEnvironment, key: __String) { - return privateEnv.identifiers?.get(key); - } + type PrivateIdentifierInExpression = BinaryExpression & { readonly left: PrivateIdentifier, readonly token: InKeyword }; - function getGeneratedPrivateIdentifierInfo(privateEnv: PrivateIdentifierEnvironment, key: Node) { - return privateEnv.generatedIdentifiers?.get(key); + function isPrivateIdentifierInExpression(node: BinaryExpression): node is PrivateIdentifierInExpression { + return isPrivateIdentifier(node.left) + && node.operatorToken.kind === SyntaxKind.InKeyword; } } diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 58b495a596e8d..6ff1563afac02 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -371,7 +371,7 @@ namespace ts { || convertedLoopState !== undefined || (hierarchyFacts & HierarchyFacts.ConstructorWithCapturedSuper && isOrMayContainReturnCompletion(node)) || (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatement(node)) - || (getEmitFlags(node) & EmitFlags.TypeScriptClassWrapper) !== 0; + || (getInternalEmitFlags(node) & InternalEmitFlags.TypeScriptClassWrapper) !== 0; } function visitor(node: Node): VisitResult { @@ -2135,7 +2135,7 @@ namespace ts { function isVariableStatementOfTypeScriptClassWrapper(node: VariableStatement) { return node.declarationList.declarations.length === 1 && !!node.declarationList.declarations[0].initializer - && !!(getEmitFlags(node.declarationList.declarations[0].initializer) & EmitFlags.TypeScriptClassWrapper); + && !!(getInternalEmitFlags(node.declarationList.declarations[0].initializer) & InternalEmitFlags.TypeScriptClassWrapper); } function visitVariableStatement(node: VariableStatement): Statement | undefined { @@ -3703,7 +3703,7 @@ namespace ts { * @param node a CallExpression. */ function visitCallExpression(node: CallExpression) { - if (getEmitFlags(node) & EmitFlags.TypeScriptClassWrapper) { + if (getInternalEmitFlags(node) & InternalEmitFlags.TypeScriptClassWrapper) { return visitTypeScriptClassWrapper(node); } diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index 80d4800831e54..a6575b21f952f 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -104,13 +104,19 @@ namespace ts { let classThis: Identifier | undefined; let classSuper: Identifier | undefined; let pendingExpressions: Expression[] | undefined; + let shouldTransformPrivateStaticElementsInFile: boolean; return chainBundle(context, transformSourceFile); function transformSourceFile(node: SourceFile) { top = undefined; + shouldTransformPrivateStaticElementsInFile = false; const visited = visitEachChild(node, visitor, context); addEmitHelpers(visited, context.readEmitHelpers()); + if (shouldTransformPrivateStaticElementsInFile) { + addInternalEmitFlags(visited, InternalEmitFlags.TransformPrivateStaticElements); + shouldTransformPrivateStaticElementsInFile = false; + } return visited; } @@ -145,14 +151,14 @@ namespace ts { } function exitClass() { - Debug.assert(top?.kind === "class"); + Debug.assert(top?.kind === "class", "Incorrect value for top.kind.", () => `Expected top.kind to be 'class' but got '${top?.kind}' instead.`); pendingExpressions = top.savedPendingExpressions; top = top.next; updateState(); } function enterClassElement(node: ClassElement) { - Debug.assert(top?.kind === "class"); + Debug.assert(top?.kind === "class", "Incorrect value for top.kind.", () => `Expected top.kind to be 'class' but got '${top?.kind}' instead.`); top = { kind: "class-element", next: top }; if (isClassStaticBlockDeclaration(node) || isPropertyDeclaration(node) && hasStaticModifier(node)) { top.classThis = top.next.classInfo?.classThis; @@ -162,20 +168,20 @@ namespace ts { } function exitClassElement() { - Debug.assert(top?.kind === "class-element"); - Debug.assert(top.next?.kind === "class"); + Debug.assert(top?.kind === "class-element", "Incorrect value for top.kind.", () => `Expected top.kind to be 'class-element' but got '${top?.kind}' instead.`); + Debug.assert(top.next?.kind === "class", "Incorrect value for top.next.kind.", () => `Expected top.next.kind to be 'class' but got '${top!.next?.kind}' instead.`); top = top.next; updateState(); } function enterName() { - Debug.assert(top?.kind === "class-element"); + Debug.assert(top?.kind === "class-element", "Incorrect value for top.kind.", () => `Expected top.kind to be 'class-element' but got '${top?.kind}' instead.`); top = { kind: "name", next: top }; updateState(); } function exitName() { - Debug.assert(top?.kind === "name"); + Debug.assert(top?.kind === "name", "Incorrect value for top.kind.", () => `Expected top.kind to be 'name' but got '${top?.kind}' instead.`); top = top.next; updateState(); } @@ -193,7 +199,7 @@ namespace ts { } function exitOther() { - Debug.assert(top?.kind === "other"); + Debug.assert(top?.kind === "other", "Incorrect value for top.kind.", () => `Expected top.kind to be 'other' but got '${top?.kind}' instead.`); if (top.depth > 0) { Debug.assert(!pendingExpressions); top.depth--; @@ -435,6 +441,7 @@ namespace ts { let trailingBlockStatements: Statement[] | undefined; let syntheticConstructor: ConstructorDeclaration | undefined; let heritageClauses: NodeArray | undefined; + let shouldTransformPrivateStaticElementsInClass = false; // 1. Class decorators are evaluated outside of the private name scope of the class. const classDecorators = transformAllDecoratorsOfDeclaration(getAllDecoratorsOfClass(node)); @@ -455,6 +462,14 @@ namespace ts { createLet(classInfo.classExtraInitializersName, factory.createArrayLiteralExpression()), createLet(classInfo.classThis), ); + + for (const member of node.members) { + if ((isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member)) { + shouldTransformPrivateStaticElementsInClass = true; + shouldTransformPrivateStaticElementsInFile = true; + break; + } + } } // Rewrite `super` in static initializers so that we can use the correct `this`. @@ -485,8 +500,7 @@ namespace ts { heritageClauses = visitNodes(node.heritageClauses, visitor, isHeritageClause); } - const lexicalClassThis = factory.createThis(); - const renamedClassThis = classInfo.classThis ?? lexicalClassThis; + const renamedClassThis = classInfo.classThis ?? factory.createThis(); // 3. The name of the class is assigned. // @@ -496,7 +510,7 @@ namespace ts { // class decorators) const needsSetNameHelper = !getOriginalNode(node, isClassLike)?.name && (classDecorators || !isStringLiteral(className) || !isEmptyStringLiteral(className)); if (needsSetNameHelper) { - const setNameExpr = emitHelpers().createSetFunctionNameHelper(lexicalClassThis, className); + const setNameExpr = emitHelpers().createSetFunctionNameHelper(factory.createThis(), className); leadingBlockStatements = append(leadingBlockStatements, factory.createExpressionStatement(setNameExpr)); } @@ -602,10 +616,10 @@ namespace ts { leadingBlockStatements ??= []; // __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: "C" }, _classExtraInitializers); - const valueProperty = factory.createPropertyAssignment("value", lexicalClassThis); + const valueProperty = factory.createPropertyAssignment("value", factory.createThis()); const classDescriptor = factory.createObjectLiteralExpression([valueProperty]); const classDescriptorAssignment = factory.createAssignment(classInfo.classDescriptorName, classDescriptor); - const classNameReference = factory.createPropertyAccessExpression(lexicalClassThis, "name"); + const classNameReference = factory.createPropertyAccessExpression(factory.createThis(), "name"); const esDecorateHelper = emitHelpers().createESDecorateHelper( factory.createNull(), classDescriptorAssignment, @@ -653,6 +667,12 @@ namespace ts { // } const leadingStaticBlockBody = factory.createBlock(leadingBlockStatements, /*multiline*/ true); const leadingStaticBlock = factory.createClassStaticBlockDeclaration(leadingStaticBlockBody); + if (shouldTransformPrivateStaticElementsInClass) { + // We use `InternalEmitFlags.TransformPrivateStaticElements` as a marker on a class static block + // to inform the classFields transform that it shouldn't rename `this` to `_classThis` in the + // transformed class static block. + setInternalEmitFlags(leadingStaticBlock, InternalEmitFlags.TransformPrivateStaticElements); + } newMembers = [leadingStaticBlock, ...newMembers]; } @@ -678,6 +698,7 @@ namespace ts { } const lexicalEnvironment = endLexicalEnvironment(); + let classExpression: ClassExpression; if (classDecorators) { // We use `var` instead of `let` so we can leverage NamedEvaluation to define the class name // and still be able to ensure it is initialized prior to any use in `static {}`. @@ -701,7 +722,7 @@ namespace ts { // return C; // })(); - const classExpression = factory.createClassExpression(/*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, heritageClauses, members); + classExpression = factory.createClassExpression(/*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, heritageClauses, members); const classReferenceDeclaration = factory.createVariableDeclaration(classReference, /*exclamationToken*/ undefined, /*type*/ undefined, classExpression); const classReferenceVarDeclList = factory.createVariableDeclarationList([classReferenceDeclaration]); const returnExpr = classInfo.classThis ? factory.createAssignment(classReference, classInfo.classThis) : classReference; @@ -712,10 +733,21 @@ namespace ts { } else { // return ; - const classExpression = factory.createClassExpression(/*modifiers*/ undefined, node.name, /*typeParameters*/ undefined, heritageClauses, members); + classExpression = factory.createClassExpression(/*modifiers*/ undefined, node.name, /*typeParameters*/ undefined, heritageClauses, members); classDefinitionStatements.push(factory.createReturnStatement(classExpression)); } + if (shouldTransformPrivateStaticElementsInClass) { + addInternalEmitFlags(classExpression, InternalEmitFlags.TransformPrivateStaticElements); + for (const member of classExpression.members) { + if ((isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member)) { + addInternalEmitFlags(member, InternalEmitFlags.TransformPrivateStaticElements); + } + } + } + + setOriginalNode(classExpression, node); + getOrCreateEmitNode(classExpression).classThis = classInfo.classThis; return factory.createImmediatelyInvokedArrowFunction(factory.mergeLexicalEnvironment(classDefinitionStatements, lexicalEnvironment)); } @@ -883,9 +915,6 @@ namespace ts { return { modifiers, referencedName, name, initializersName, descriptorName, thisArg }; } - // TODO(rbuckton): Handle computed property names outside of currentClassInfo, currentClassThis, currentClassSuper - // Debug.assertNotNode(member.name, isComputedPropertyName, "Not yet implemented."); - // Member decorators require privileged access to private names. However, computed property // evaluation occurs interspersed with decorator evaluation. This means that if we encounter // a computed property name we must inline decorator evaluation. @@ -997,10 +1026,6 @@ namespace ts { else if (isPropertyDeclaration(member)) { initializersName = memberInfo.memberInitializersName ??= createHelperVariable(member, "initializers"); - // TODO(rbuckton): remove - // classInfo.pendingVariablesOutsideOfBody ??= []; - // classInfo.pendingVariablesOutsideOfBody.push({ name: initializersName, initializer: factory.createArrayLiteralExpression() }); - if (isStatic(member)) { thisArg = classInfo.classThis; } @@ -1039,27 +1064,6 @@ namespace ts { exitName(); } - // if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression) && classInfo.pendingVariablesInsideOfBody) { - // let newPendingVariablesInsideOfBody: { name: Identifier, initializer?: Expression }[] | undefined; - // const expressions: Expression[] = []; - // for (const { name, initializer } of classInfo.pendingVariablesInsideOfBody) { - // if (!initializer) { - // newPendingVariablesInsideOfBody ??= []; - // newPendingVariablesInsideOfBody.push({ name }); - // } - // else { - // classInfo.pendingVariablesOutsideOfBody ??= []; - // classInfo.pendingVariablesOutsideOfBody.push({ name }); - // expressions.push(factory.createAssignment(name, initializer)); - // } - // } - // if (expressions.length) { - // expressions.push(name.expression); - // name = factory.updateComputedPropertyName(name, factory.inlineExpressions(expressions)); - // classInfo.pendingVariablesInsideOfBody = newPendingVariablesInsideOfBody; - // } - // } - return { modifiers, referencedName, name, initializersName, descriptorName, thisArg }; } @@ -1121,7 +1125,9 @@ namespace ts { function visitPropertyDeclaration(node: PropertyDeclaration) { enterClassElement(node); - // TODO(rbuckton) + // TODO(rbuckton): We support decorating `declare x` fields with legacyDecorators, but we currently don't + // support them with esDecorators. We need to consider whether we will support them in the + // future, and how. For now, these should be elided by the `ts` transform. Debug.assertNotNode(node, isAmbientPropertyDeclaration, "Not yet implemented."); // 10.2.1.3 RS: EvaluateBody @@ -1132,7 +1138,7 @@ namespace ts { // ... const useNamedEvaluation = !!node.initializer && isDecoratedAnonymousClassExpression(node.initializer); - const { modifiers, name, referencedName, initializersName, /*descriptorName,*/ thisArg } = partialTransformClassElement(node, useNamedEvaluation, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : undefined); + const { modifiers, name, referencedName, initializersName, descriptorName, thisArg } = partialTransformClassElement(node, useNamedEvaluation, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : undefined); startLexicalEnvironment(); @@ -1164,41 +1170,6 @@ namespace ts { classInfo.hasStaticInitializers = true; } - // if (hasAccessorModifier(node)) { - // if (descriptorName) { - // // given: - // // accessor #x = 1; - // // - // // emits: - // // static { - // // _esDecorate(null, _private_x_descriptor = { get() { return this.#x_1; }, set(value) { this.#x_1 = value; } }, ...) - // // } - // // ... - // // #x_1 = 1; - // // get #x() { return _private_x_descriptor.get.call(this); } - // // set #x(value) { _private_x_descriptor.set.call(this, value); } - // return [ - // finishClassElement(createAccessorPropertyBackingField(node, modifiers, initializer), node), - // finishClassElement(createGetAccessorDescriptorForwarder(modifiers, name, descriptorName), node), - // finishClassElement(createSetAccessorDescriptorForwarder(modifiers, name, descriptorName), node), - // ]; - // } - // else { - // // given: - // // accessor x = 1; - // // - // // emits: - // // #x = 1; - // // get x() { return this.#x; } - // // set x(value) { this.#x = value; } - // return [ - // finishClassElement(createAccessorPropertyBackingField(node, modifiers, initializer), node), - // finishClassElement(createAccessorPropertyGetRedirector(node, modifiers, name), node), - // finishClassElement(createAccessorPropertySetRedirector(node, modifiers, name), node), - // ]; - // } - // } - const declarations = endLexicalEnvironment(); if (some(declarations)) { initializer = factory.createImmediatelyInvokedArrowFunction([ @@ -1208,6 +1179,67 @@ namespace ts { } exitClassElement(); + + if (hasAccessorModifier(node)) { + if (descriptorName) { + // given: + // accessor #x = 1; + // + // emits: + // static { + // _esDecorate(null, _private_x_descriptor = { get() { return this.#x_1; }, set(value) { this.#x_1 = value; } }, ...) + // } + // ... + // #x_1 = 1; + // get #x() { return _private_x_descriptor.get.call(this); } + // set #x(value) { _private_x_descriptor.set.call(this, value); } + + const commentRange = getCommentRange(node); + const sourceMapRange = getSourceMapRange(node); + + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + const name = node.name; + let getterName = name; + let setterName = name; + if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression)) { + const cacheVariable = findComputedPropertyNameCacheVariable(name); + if (cacheVariable) { + getterName = factory.updateComputedPropertyName(name, visitNode(name.expression, visitor, isExpression)); + setterName = factory.updateComputedPropertyName(name, cacheVariable); + } + else { + const temp = factory.createTempVariable(hoistVariableDeclaration); + setSourceMapRange(temp, name.expression); + const expression = visitNode(name.expression, visitor, isExpression); + const assignment = factory.createAssignment(temp, expression); + setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, assignment); + setterName = factory.updateComputedPropertyName(name, temp); + } + } + + const modifiersWithoutAccessor = visitNodes(modifiers, node => node.kind !== SyntaxKind.AccessorKeyword ? node : undefined); + + const backingField = createAccessorPropertyBackingField(factory, node, modifiersWithoutAccessor, initializer); + setOriginalNode(backingField, node); + setEmitFlags(backingField, EmitFlags.NoComments); + setSourceMapRange(backingField, sourceMapRange); + + const getter = createGetAccessorDescriptorForwarder(modifiersWithoutAccessor, getterName, descriptorName); + setOriginalNode(getter, node); + setCommentRange(getter, commentRange); + setSourceMapRange(getter, sourceMapRange); + + const setter = createSetAccessorDescriptorForwarder(modifiersWithoutAccessor, setterName, descriptorName); + setOriginalNode(setter, node); + setEmitFlags(setter, EmitFlags.NoComments); + setSourceMapRange(setter, sourceMapRange); + + return [backingField, getter, setter]; + } + } + return finishClassElement(factory.updatePropertyDeclaration(node, modifiers, name, /*questionOrExclamationToken*/ undefined, /*type*/ undefined, initializer), node); } diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 9fa8f738bafee..f57c1c618033a 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -864,7 +864,7 @@ namespace ts { } function getHelperExpressionForExport(node: ExportDeclaration, innerExpr: Expression) { - if (!getESModuleInterop(compilerOptions) || getEmitFlags(node) & EmitFlags.NeverApplyImportHelper) { + if (!getESModuleInterop(compilerOptions) || getInternalEmitFlags(node) & InternalEmitFlags.NeverApplyImportHelper) { return innerExpr; } if (getExportNeedsImportStarHelper(node)) { @@ -874,7 +874,7 @@ namespace ts { } function getHelperExpressionForImport(node: ImportDeclaration, innerExpr: Expression) { - if (!getESModuleInterop(compilerOptions) || getEmitFlags(node) & EmitFlags.NeverApplyImportHelper) { + if (!getESModuleInterop(compilerOptions) || getInternalEmitFlags(node) & InternalEmitFlags.NeverApplyImportHelper) { return innerExpr; } if (getImportNeedsImportStarHelper(node)) { @@ -1135,7 +1135,7 @@ namespace ts { else { const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && - !(getEmitFlags(node) & EmitFlags.NeverApplyImportHelper) && + !(getInternalEmitFlags(node) & InternalEmitFlags.NeverApplyImportHelper) && idText(specifier.propertyName || specifier.name) === "default"; const exportedValue = factory.createPropertyAccessExpression( exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName, @@ -1871,13 +1871,13 @@ namespace ts { const expression = substituteExpressionIdentifier(node.expression); noSubstitution[getNodeId(expression)] = true; if (!isIdentifier(expression) && !(getEmitFlags(node.expression) & EmitFlags.HelperName)) { - return addEmitFlags( + return addInternalEmitFlags( factory.updateCallExpression(node, expression, /*typeArguments*/ undefined, node.arguments ), - EmitFlags.IndirectCall + InternalEmitFlags.IndirectCall ); } @@ -1890,13 +1890,13 @@ namespace ts { const tag = substituteExpressionIdentifier(node.tag); noSubstitution[getNodeId(tag)] = true; if (!isIdentifier(tag) && !(getEmitFlags(node.tag) & EmitFlags.HelperName)) { - return addEmitFlags( + return addInternalEmitFlags( factory.updateTaggedTemplateExpression(node, tag, /*typeArguments*/ undefined, node.template ), - EmitFlags.IndirectCall + InternalEmitFlags.IndirectCall ); } } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index cf9b4fb6717cb..b224cb7ae2910 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -724,7 +724,7 @@ namespace ts { insertStatementsAfterStandardPrologue(statements, context.endLexicalEnvironment()); const iife = factory.createImmediatelyInvokedArrowFunction(statements); - setEmitFlags(iife, EmitFlags.TypeScriptClassWrapper); + setInternalEmitFlags(iife, InternalEmitFlags.TypeScriptClassWrapper); // export let C = (() => { ... })(); const modifiers = facts & ClassFacts.IsNamedExternalExport ? @@ -868,6 +868,8 @@ namespace ts { * @param node The declaration node. */ function getTypeMetadata(node: Declaration, container: ClassLikeDeclaration) { + // Decorator metadata is not yet supported for ES decorators. + if (!legacyDecorators) return undefined; return USE_NEW_TYPE_METADATA_FORMAT ? getNewTypeMetadata(node, container) : getOldTypeMetadata(node, container); diff --git a/src/compiler/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index 391ab27dfad24..b4779de900ae6 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -527,4 +527,73 @@ namespace ts { return { decorators }; } + export interface PrivateEnvironment { + readonly data: TData; + + /** + * A mapping of private names to information needed for transformation. + */ + identifiers?: UnderscoreEscapedMap; + + /** + * A mapping of generated private names to information needed for transformation. + */ + generatedIdentifiers?: ESMap; + } + + export interface LexicalEnvironment { + data: TEnvData; + privateEnv?: PrivateEnvironment; + readonly previous: LexicalEnvironment | undefined; + } + + export function walkUpLexicalEnvironments( + env: LexicalEnvironment | undefined, + cb: (env: LexicalEnvironment) => U + ): U | undefined { + while (env) { + const result = cb(env); + if (result !== undefined) return result; + env = env.previous; + } + } + + export function newPrivateEnvironment(data: TData): PrivateEnvironment { + return { data }; + } + + export function getPrivateIdentifier( + privateEnv: PrivateEnvironment | undefined, + name: PrivateIdentifier + ) { + return isGeneratedPrivateIdentifier(name) ? + privateEnv?.generatedIdentifiers?.get(getNodeForGeneratedName(name)) : + privateEnv?.identifiers?.get(name.escapedText); + } + + export function setPrivateIdentifier( + privateEnv: PrivateEnvironment, + name: PrivateIdentifier, + entry: TEntry + ) { + if (isGeneratedPrivateIdentifier(name)) { + privateEnv.generatedIdentifiers ??= new Map(); + privateEnv.generatedIdentifiers.set(getNodeForGeneratedName(name), entry); + } + else { + privateEnv.identifiers ??= new Map(); + privateEnv.identifiers.set(name.escapedText, entry); + } + } + + export function accessPrivateIdentifier< + TEnvData, + TPrivateEnvData, + TPrivateEntry, + >( + env: LexicalEnvironment | undefined, + name: PrivateIdentifier, + ) { + return walkUpLexicalEnvironments(env, env => getPrivateIdentifier(env.privateEnv, name)); + } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e36ba1b6f361c..96c842e1704d9 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7349,6 +7349,7 @@ namespace ts { export interface EmitNode { annotatedNodes?: Node[]; // Tracks Parse-tree nodes with EmitNodes for eventual cleanup. flags: EmitFlags; // Flags that customize emit + internalFlags: InternalEmitFlags; // Internal flags that customize emit leadingComments?: SynthesizedComment[]; // Synthesized leading comments trailingComments?: SynthesizedComment[]; // Synthesized trailing comments commentRange?: TextRange; // The text range to use when emitting leading or trailing comments @@ -7360,7 +7361,8 @@ namespace ts { helpers?: EmitHelper[]; // Emit helpers for the node startsOnNewLine?: boolean; // If the node should begin on a new line snippetElement?: SnippetElement; // Snippet element of the node - typeNode?: TypeNode; // VariableDeclaration type + typeNode?: TypeNode; // VariableDeclaration type + classThis?: Identifier; // Identifier that points to the final class constructor after decorators are applied } /* @internal */ @@ -7417,11 +7419,17 @@ namespace ts { HasEndOfDeclarationMarker = 1 << 22, // Declaration has an associated NotEmittedStatement to mark the end of the declaration Iterator = 1 << 23, // The expression to a `yield*` should be treated as an Iterator when down-leveling, not an Iterable. NoAsciiEscaping = 1 << 24, // When synthesizing nodes that lack an original node or textSourceNode, we want to write the text on the node with ASCII escaping substitutions. - /*@internal*/ TypeScriptClassWrapper = 1 << 25, // The node is an IIFE class wrapper created by the ts transform. - /*@internal*/ NeverApplyImportHelper = 1 << 26, // Indicates the node should never be wrapped with an import star helper (because, for example, it imports tslib itself) - /*@internal*/ IgnoreSourceNewlines = 1 << 27, // Overrides `printerOptions.preserveSourceNewlines` to print this node (and all descendants) with default whitespace. - /*@internal*/ Immutable = 1 << 28, // Indicates a node is a singleton intended to be reused in multiple locations. Any attempt to make further changes to the node will result in an error. - /*@internal*/ IndirectCall = 1 << 29, // Emit CallExpression as an indirect call: `(0, f)()` + } + + /* @internal */ + export const enum InternalEmitFlags { + None = 0, + TypeScriptClassWrapper = 1 << 0, // The node is an IIFE class wrapper created by the ts transform. + NeverApplyImportHelper = 1 << 1, // Indicates the node should never be wrapped with an import star helper (because, for example, it imports tslib itself) + IgnoreSourceNewlines = 1 << 2, // Overrides `printerOptions.preserveSourceNewlines` to print this node (and all descendants) with default whitespace. + Immutable = 1 << 3, // Indicates a node is a singleton intended to be reused in multiple locations. Any attempt to make further changes to the node will result in an error. + IndirectCall = 1 << 4, // Emit CallExpression as an indirect call: `(0, f)()` + TransformPrivateStaticElements = 1 << 5, // Indicates static private elements in a file or class should be transformed regardless of --target (used by esDecorators transform) } export interface EmitHelperBase { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 3ecb70b2b0270..3e243d3b83ca2 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -561,6 +561,14 @@ namespace ts { return emitNode && emitNode.flags || 0; } + /** + * Gets flags that control emit behavior of a node. + */ + export function getInternalEmitFlags(node: Node): InternalEmitFlags { + const emitNode = node.emitNode; + return emitNode && emitNode.internalFlags || 0; + } + interface ScriptTargetFeatures { [key: string]: { [key: string]: string[] | undefined }; } diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts index 319df818631a1..6acd666d49c4d 100644 --- a/src/testRunner/unittests/evaluation/esDecorators.ts +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -1416,6 +1416,21 @@ describe("unittests:: evaluation:: esDecorators", () => { assert.throws(() => main(1)); assert.throws(() => main("abc")); }); + describe("redirects private static", () => { + it("when: field", () => { + const { C } = exec` + export @((t: any, c): any => class extends t {}) class C { + static #x = 1; + static g() { + this.#x = this.#x + 1; + this.#x++; + return this.#x; + } + } + `; + assert.strictEqual(C.g(), 3); + }); + }); }); describe("for: method", () => { it("may return undefined", () => { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index dbdbb89a6ae09..41b15c8d1562d 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3361,7 +3361,7 @@ declare namespace ts { NoHoisting = 2097152, HasEndOfDeclarationMarker = 4194304, Iterator = 8388608, - NoAsciiEscaping = 16777216, + NoAsciiEscaping = 16777216 } export interface EmitHelperBase { readonly name: string; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index c92ac2a6f7377..b52233dffcde7 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3361,7 +3361,7 @@ declare namespace ts { NoHoisting = 2097152, HasEndOfDeclarationMarker = 4194304, Iterator = 8388608, - NoAsciiEscaping = 16777216, + NoAsciiEscaping = 16777216 } export interface EmitHelperBase { readonly name: string; diff --git a/tests/baselines/reference/decoratorOnClass8.es6.js b/tests/baselines/reference/decoratorOnClass8.es6.js index 813c0eaa22133..b4b890f41c1f1 100644 --- a/tests/baselines/reference/decoratorOnClass8.es6.js +++ b/tests/baselines/reference/decoratorOnClass8.es6.js @@ -17,10 +17,9 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: name }); }; -var _a; -let default_1 = (_a = class { -}, __setFunctionName(_a, "default_1"), - _a); +let default_1 = class { +}; +__setFunctionName(default_1, "default"); default_1.y = 1; default_1 = __decorate([ dec diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js index d62babf06827e..eaf6c0c73eb53 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js @@ -6,7 +6,6 @@ class C { @dec(2) static set #method1(value) {} } -// TODO: We should translate these to weakmaps when < ESNext @dec class D { static get #method1() { return 0; } @@ -40,27 +39,26 @@ let C = (() => { _a; })(); let D = (() => { - var _a, _method1_get, _method1_set; + var _method1_get, _method1_set; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var D = (_a = class { - }, - _method1_get = function _method1_get() { return 0; }, - _method1_set = function _method1_set(value) { }, - __setFunctionName(_a, "D"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - D = _classThis = _classDescriptor.value; - })(), - (() => { - __classPrivateFieldGet(_classThis, _a, "a", _method1_get); - __classPrivateFieldSet(_classThis, _a, 1, "a", _method1_set); - })(), - (() => { - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var D = _classThis = class { + }; + _method1_get = function _method1_get() { return 0; }; + _method1_set = function _method1_set(value) { }; + __setFunctionName(_classThis, "D"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(); + (() => { + __classPrivateFieldGet(_classThis, _classThis, "a", _method1_get); + __classPrivateFieldSet(_classThis, _classThis, 1, "a", _method1_set); + })(); + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js index ee49275288548..1ce1cc65fdf2e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js @@ -6,7 +6,6 @@ class C { @dec(2) static set #method1(value) {} } -// TODO: We should translate these to weakmaps when < ESNext @dec class D { static get #method1() { return 0; } @@ -38,20 +37,21 @@ let C = (() => { }; })(); let D = (() => { + var _method1_get, _method1_set; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; var D = class { + static { __setFunctionName(this, "D"); } + static { _method1_get = function _method1_get() { return 0; }, _method1_set = function _method1_set(value) { }; } static { __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); D = _classThis = _classDescriptor.value; } - static get #method1() { return 0; } - static set #method1(value) { } static { - _classThis.#method1; - _classThis.#method1 = 1; + __classPrivateFieldGet(_classThis, _classThis, "a", _method1_get); + __classPrivateFieldSet(_classThis, _classThis, 1, "a", _method1_set); } static { __runInitializers(_classThis, _classExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).js index a83b666bdec00..7db3406603928 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).js @@ -6,7 +6,6 @@ class C { @dec(2) static set #method1(value) {} } -// TODO: We should translate these to weakmaps when < ESNext @dec class D { static get #method1() { return 0; } @@ -25,7 +24,6 @@ class C { @dec(2) static set #method1(value) { } } -// TODO: We should translate these to weakmaps when < ESNext @dec class D { static get #method1() { return 0; } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js index b293db33e431a..086bc280bb02e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js @@ -13,30 +13,29 @@ class C { //// [esDecorators-classDeclaration-classThisReference.js] let C = (() => { - var _a, _a_accessor_storage; + var _a_accessor_storage; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var C = (_a = class { - static get a() { return __classPrivateFieldGet(_a, _a, "f", _a_accessor_storage); } - static set a(value) { __classPrivateFieldSet(_a, _a, value, "f", _a_accessor_storage); } - static m() { this; } - static get g() { return this; } - }, - __setFunctionName(_a, "C"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - })(), - (() => { - _classThis; - })(), - _a.x = _classThis, - _a_accessor_storage = { value: _classThis }, - (() => { - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = class { + static get a() { return __classPrivateFieldGet(_classThis, _classThis, "f", _a_accessor_storage); } + static set a(value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _a_accessor_storage); } + static m() { this; } + static get g() { return this; } + }; + __setFunctionName(_classThis, "C"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + })(); + (() => { + _classThis; + })(); + _classThis.x = _classThis; + _a_accessor_storage = { value: _classThis }; + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js index ae5a4e716bebb..d618f317f5248 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js @@ -13,25 +13,33 @@ class C { //// [esDecorators-classDeclaration-classThisReference.js] let C = (() => { + var _a_accessor_storage; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; var C = class { + static { __setFunctionName(this, "C"); } static { __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; } static { _classThis; } static x = _classThis; - static #a_accessor_storage = _classThis; - static get a() { return this.#a_accessor_storage; } - static set a(value) { this.#a_accessor_storage = value; } + static get a() { return __classPrivateFieldGet(this, _classThis, "f", _a_accessor_storage); } + static set a(value) { __classPrivateFieldSet(this, _classThis, value, "f", _a_accessor_storage); } static m() { this; } static get g() { return this; } static { __runInitializers(_classThis, _classExtraInitializers); } }; + Object.defineProperty(_classThis, "x", { + enumerable: true, + configurable: true, + writable: true, + value: _classThis + }); + _a_accessor_storage = { value: _classThis }; return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js index caf175ef39d1c..218d40b4c367d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js @@ -13,34 +13,32 @@ class C { //// [esDecorators-classDeclaration-classThisReference.es5.js] var _this = this; var C = function () { - var _a; var _classDecorators = [dec]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; - var C = (_a = /** @class */ (function () { - function class_1() { - } - class_1.m = function () { this; }; - Object.defineProperty(class_1, "g", { - get: function () { return this; }, - enumerable: false, - configurable: true - }); - return class_1; - }()), - __setFunctionName(_a, "C"), - (function () { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - })(), - (function () { - _classThis; - })(), - _a.x = _classThis, - (function () { - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = /** @class */ (function () { + function C_1() { + } + C_1.m = function () { this; }; + Object.defineProperty(C_1, "g", { + get: function () { return this; }, + enumerable: false, + configurable: true + }); + return C_1; + }()); + __setFunctionName(_classThis, "C"); + (function () { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + })(); + (function () { + _classThis; + })(); + _classThis.x = _classThis; + (function () { + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js index 97c911d9de41d..49a912b9e522c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js @@ -8,7 +8,7 @@ class C { //// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.js] let C = (() => { - var _C_instances, _a, _C_field1_get, _C_field1_set, _C_field1_accessor_storage; + var _C_instances, _a, _C_field1_accessor_storage, _C_field1_get, _C_field1_set; let _instanceExtraInitializers = []; let _private_field1_decorators; let _private_field1_initializers = []; @@ -19,10 +19,10 @@ let C = (() => { _C_field1_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0))); } }, - _C_instances = new WeakSet(), _C_field1_accessor_storage = new WeakMap(), - _C_field1_get = function _C_field1_get() { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, - _C_field1_set = function _C_field1_set(value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, + _C_instances = new WeakSet(), + _C_field1_get = function _C_field1_get() { return _private_field1_descriptor.get.call(this); }, + _C_field1_set = function _C_field1_set(value) { return _private_field1_descriptor.set.call(this, value); }, (() => { _private_field1_decorators = [dec]; __esDecorate(_a, _private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, "#field1"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, "#field1") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _C_instances, value, "a", _C_field1_set); } } }, _private_field1_initializers, _instanceExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js index 91430205ea234..63a73bc6e6650 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js @@ -18,7 +18,7 @@ let C = (() => { __esDecorate(this, _private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _private_field1_initializers, _instanceExtraInitializers); } #field1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0)); - get #field1() { return this.#field1_accessor_storage; } - set #field1(value) { this.#field1_accessor_storage = value; } + get #field1() { return _private_field1_descriptor.get.call(this); } + set #field1(value) { return _private_field1_descriptor.set.call(this, value); } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js index 1814487613742..22977af509b5c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js @@ -9,7 +9,6 @@ class C { @dec(3) static accessor [field3] = 3; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor field1 = 1; @@ -51,28 +50,27 @@ let C = (() => { _a; })(); let D = (() => { - var _a, _field1_1_accessor_storage; + var _field1_1_accessor_storage; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var D = (_a = class { - static get field1() { return __classPrivateFieldGet(_a, _a, "f", _field1_1_accessor_storage); } - static set field1(value) { __classPrivateFieldSet(_a, _a, value, "f", _field1_1_accessor_storage); } - }, - __setFunctionName(_a, "D"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - D = _classThis = _classDescriptor.value; - })(), - _field1_1_accessor_storage = { value: 1 }, - (() => { - _classThis.field1; - _classThis.field1 = 1; - })(), - (() => { - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var D = _classThis = class { + static get field1() { return __classPrivateFieldGet(_classThis, _classThis, "f", _field1_1_accessor_storage); } + static set field1(value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _field1_1_accessor_storage); } + }; + __setFunctionName(_classThis, "D"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(); + _field1_1_accessor_storage = { value: 1 }; + (() => { + _classThis.field1; + _classThis.field1 = 1; + })(); + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js index d8feed7d30f58..661ba19fb8c22 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js @@ -9,7 +9,6 @@ class C { @dec(3) static accessor [field3] = 3; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor field1 = 1; @@ -49,18 +48,19 @@ let C = (() => { }; })(); let D = (() => { + var _field1_1_accessor_storage; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; var D = class { + static { __setFunctionName(this, "D"); } static { __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); D = _classThis = _classDescriptor.value; } - static #field1_1_accessor_storage = 1; - static get field1() { return this.#field1_1_accessor_storage; } - static set field1(value) { this.#field1_1_accessor_storage = value; } + static get field1() { return __classPrivateFieldGet(this, _classThis, "f", _field1_1_accessor_storage); } + static set field1(value) { __classPrivateFieldSet(this, _classThis, value, "f", _field1_1_accessor_storage); } static { _classThis.field1; _classThis.field1 = 1; @@ -69,5 +69,6 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; + _field1_1_accessor_storage = { value: 1 }; return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).js index ff13b33e216f5..d4c76162f914f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).js @@ -9,7 +9,6 @@ class C { @dec(3) static accessor [field3] = 3; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor field1 = 1; @@ -29,7 +28,6 @@ class C { @dec(3) static accessor [field3] = 3; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor field1 = 1; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js index 4fc6eb5b91e23..c12992bfd34c7 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js @@ -5,7 +5,6 @@ class C { @dec static #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #field1 = 0; @@ -33,26 +32,25 @@ let C = (() => { _a; })(); let D = (() => { - var _a, _field1; + var _field1; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var D = (_a = class { - }, - __setFunctionName(_a, "D"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - D = _classThis = _classDescriptor.value; - })(), - _field1 = { value: 0 }, - (() => { - __classPrivateFieldGet(_classThis, _a, "f", _field1); - __classPrivateFieldSet(_classThis, _a, 1, "f", _field1); - })(), - (() => { - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var D = _classThis = class { + }; + __setFunctionName(_classThis, "D"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(); + _field1 = { value: 0 }; + (() => { + __classPrivateFieldGet(_classThis, _classThis, "f", _field1); + __classPrivateFieldSet(_classThis, _classThis, 1, "f", _field1); + })(); + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js index a7e2456c8c855..c1266008d01ac 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js @@ -5,7 +5,6 @@ class C { @dec static #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #field1 = 0; @@ -31,23 +30,25 @@ let C = (() => { }; })(); let D = (() => { + var _field1; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; var D = class { + static { __setFunctionName(this, "D"); } static { __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); D = _classThis = _classDescriptor.value; } - static #field1 = 0; static { - _classThis.#field1; - _classThis.#field1 = 1; + __classPrivateFieldGet(_classThis, _classThis, "f", _field1); + __classPrivateFieldSet(_classThis, _classThis, 1, "f", _field1); } static { __runInitializers(_classThis, _classExtraInitializers); } }; + _field1 = { value: 0 }; return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).js index b66d18b13d777..4f7ea0b8285f8 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).js @@ -5,7 +5,6 @@ class C { @dec static #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #field1 = 0; @@ -21,7 +20,6 @@ class C { @dec static #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #field1 = 0; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js index 1023b707da2ea..7d963bc7b2ff3 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js @@ -5,7 +5,6 @@ class C { @dec static accessor #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor #field1 = 0; @@ -18,46 +17,45 @@ class D { //// [esDecorators-classDeclaration-fields-staticPrivateAccessor.js] let C = (() => { - var _a, _C_field1_get, _C_field1_set, _C_field1_accessor_storage; + var _a, _C_field1_accessor_storage, _C_field1_get, _C_field1_set; let _staticExtraInitializers = []; let _static_private_field1_decorators; let _static_private_field1_initializers = []; let _static_private_field1_descriptor; return _a = class C { }, - _C_field1_get = function _C_field1_get() { return __classPrivateFieldGet(this, _a, "f", _C_field1_accessor_storage); }, - _C_field1_set = function _C_field1_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C_field1_accessor_storage); }, + _C_field1_get = function _C_field1_get() { return _static_private_field1_descriptor.get.call(this); }, + _C_field1_set = function _C_field1_set(value) { return _static_private_field1_descriptor.set.call(this, value); }, (() => { _static_private_field1_decorators = [dec]; __esDecorate(_a, _static_private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); }, "#field1"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); }, "#field1") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _a, value, "a", _C_field1_set); } } }, _static_private_field1_initializers, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), - _C_field1_accessor_storage = { value: __runInitializers(_a, _static_private_field1_initializers, 0) }, + _C_field1_accessor_storage = { value: __runInitializers(this, _static_private_field1_initializers, 0) }, _a; })(); let D = (() => { - var _a, _field1_get, _field1_set, _field1_1_accessor_storage; + var _field1_get, _field1_set, _field1_1_accessor_storage; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var D = (_a = class { - }, - _field1_get = function _field1_get() { return __classPrivateFieldGet(this, _a, "f", _field1_1_accessor_storage); }, - _field1_set = function _field1_set(value) { __classPrivateFieldSet(this, _a, value, "f", _field1_1_accessor_storage); }, - __setFunctionName(_a, "D"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - D = _classThis = _classDescriptor.value; - })(), - _field1_1_accessor_storage = { value: 0 }, - (() => { - __classPrivateFieldGet(_classThis, _a, "a", _field1_get); - __classPrivateFieldSet(_classThis, _a, 1, "a", _field1_set); - })(), - (() => { - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var D = _classThis = class { + }; + _field1_get = function _field1_get() { return __classPrivateFieldGet(this, _classThis, "f", _field1_1_accessor_storage); }; + _field1_set = function _field1_set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _field1_1_accessor_storage); }; + __setFunctionName(_classThis, "D"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(); + _field1_1_accessor_storage = { value: 0 }; + (() => { + __classPrivateFieldGet(_classThis, _classThis, "a", _field1_get); + __classPrivateFieldSet(_classThis, _classThis, 1, "a", _field1_set); + })(); + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js index 6bccec306cdef..1de161594c09c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js @@ -5,7 +5,6 @@ class C { @dec static accessor #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor #field1 = 0; @@ -29,30 +28,31 @@ let C = (() => { __runInitializers(this, _staticExtraInitializers); } static #field1_accessor_storage = __runInitializers(this, _static_private_field1_initializers, 0); - static get #field1() { return this.#field1_accessor_storage; } - static set #field1(value) { this.#field1_accessor_storage = value; } + static get #field1() { return _static_private_field1_descriptor.get.call(this); } + static set #field1(value) { return _static_private_field1_descriptor.set.call(this, value); } }; })(); let D = (() => { + var _field1_get, _field1_set, _field1_1_accessor_storage; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; var D = class { + static { __setFunctionName(this, "D"); } + static { _field1_get = function _field1_get() { return __classPrivateFieldGet(this, _classThis, "f", _field1_1_accessor_storage); }, _field1_set = function _field1_set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _field1_1_accessor_storage); }; } static { __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); D = _classThis = _classDescriptor.value; } - static #field1_1_accessor_storage = 0; - static get #field1() { return this.#field1_1_accessor_storage; } - static set #field1(value) { this.#field1_1_accessor_storage = value; } static { - _classThis.#field1; - _classThis.#field1 = 1; + __classPrivateFieldGet(_classThis, _classThis, "a", _field1_get); + __classPrivateFieldSet(_classThis, _classThis, 1, "a", _field1_set); } static { __runInitializers(_classThis, _classExtraInitializers); } }; + _field1_1_accessor_storage = { value: 0 }; return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).js index 6be42f08705c0..34957f5c432fe 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).js @@ -5,7 +5,6 @@ class C { @dec static accessor #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor #field1 = 0; @@ -21,7 +20,6 @@ class C { @dec static accessor #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor #field1 = 0; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js index b2ee71f58ae22..6e848af6b11f8 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js @@ -5,7 +5,6 @@ class C { @dec static #method1() {} } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #method1() {} @@ -29,20 +28,19 @@ let C = (() => { _a; })(); let D = (() => { - var _a, _method1; + var _method1; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var D = (_a = class { - }, - _method1 = function _method1() { }, - __setFunctionName(_a, "D"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - D = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var D = _classThis = class { + }; + _method1 = function _method1() { }; + __setFunctionName(_classThis, "D"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js index 8c8cf49019236..26a8e980cf037 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js @@ -5,7 +5,6 @@ class C { @dec static #method1() {} } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #method1() {} @@ -27,17 +26,19 @@ let C = (() => { }; })(); let D = (() => { + var _method1; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; var D = class { + static { __setFunctionName(this, "D"); } + static { _method1 = function _method1() { }; } static { __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); D = _classThis = _classDescriptor.value; __runInitializers(_classThis, _classExtraInitializers); } - static #method1() { } }; return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).js index 49d9a495c3256..77bf2e0573206 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).js @@ -5,7 +5,6 @@ class C { @dec static #method1() {} } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #method1() {} @@ -17,7 +16,6 @@ class C { @dec static #method1() { } } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #method1() { } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js index 2d9739fa68855..fac9d3cbc855b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js @@ -9,19 +9,17 @@ class C { //// [esDecorators-classDeclaration-multipleDecorators.js] let C = (() => { - var _a; let _classDecorators = [dec1, dec2]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var C = (_a = class { - }, - __setFunctionName(_a, "C"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = class { + }; + __setFunctionName(_classThis, "C"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js index bf989b883d1ea..8946e029ab70e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js @@ -10,22 +10,20 @@ class C { //// [esDecorators-classDeclaration-multipleDecorators.js] var _this = this; var C = function () { - var _a; var _classDecorators = [dec1, dec2]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; - var C = (_a = /** @class */ (function () { - function class_1() { - } - return class_1; - }()), - __setFunctionName(_a, "C"), - (function () { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = /** @class */ (function () { + function C_1() { + } + return C_1; + }()); + __setFunctionName(_classThis, "C"); + (function () { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js index 7f96b632067fd..7702afec3b08f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js @@ -25,56 +25,50 @@ declare let dec: any; //// [a.js] let C = (() => { - var _a; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var C = (_a = class { - }, - __setFunctionName(_a, "C"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = class { + }; + __setFunctionName(_classThis, "C"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; })(); export {}; //// [b.js] export let C = (() => { - var _a; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var C = (_a = class { - }, - __setFunctionName(_a, "C"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = class { + }; + __setFunctionName(_classThis, "C"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; })(); //// [c.js] export default (() => { - var _a; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var default_1 = (_a = class { - }, - (() => { - __setFunctionName(_a, "default"); - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - default_1 = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var default_1 = _classThis = class { + }; + (() => { + __setFunctionName(_classThis, "default"); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + default_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return default_1 = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js index 038b6bdcefd0b..b574caffd3bbf 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js @@ -28,23 +28,21 @@ declare let dec: any; var _this = this; Object.defineProperty(exports, "__esModule", { value: true }); var C = function () { - var _a; var _classDecorators = [dec]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; - var C = (_a = /** @class */ (function () { - function class_1() { - } - return class_1; - }()), - __setFunctionName(_a, "C"), - (function () { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = /** @class */ (function () { + function C_1() { + } + return C_1; + }()); + __setFunctionName(_classThis, "C"); + (function () { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; }(); //// [b.js] @@ -53,23 +51,21 @@ var _this = this; Object.defineProperty(exports, "__esModule", { value: true }); exports.C = void 0; var C = exports.C = function () { - var _a; var _classDecorators = [dec]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; - var C = (_a = /** @class */ (function () { - function class_1() { - } - return class_1; - }()), - __setFunctionName(_a, "C"), - (function () { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = /** @class */ (function () { + function C_1() { + } + return C_1; + }()); + __setFunctionName(_classThis, "C"); + (function () { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; }(); //// [c.js] @@ -77,23 +73,21 @@ var C = exports.C = function () { var _this = this; Object.defineProperty(exports, "__esModule", { value: true }); var default_1 = function () { - var _a; var _classDecorators = [dec]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; - var default_1 = (_a = /** @class */ (function () { - function class_1() { - } - return class_1; - }()), - (function () { - __setFunctionName(_a, "default_1"); - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - default_1 = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var default_1 = _classThis = /** @class */ (function () { + function default_1() { + } + return default_1; + }()); + (function () { + __setFunctionName(_classThis, "default_1"); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + default_1 = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return default_1 = _classThis; }(); exports.default = default_1; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js index f864ee9fe6658..aaf0a0957d941 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js @@ -8,19 +8,17 @@ class C { //// [esDecorators-classDeclaration-simpleTransformation.js] let C = (() => { - var _a; let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var C = (_a = class { - }, - __setFunctionName(_a, "C"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = class { + }; + __setFunctionName(_classThis, "C"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js index 649622daccf12..82754d7ead7e2 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js @@ -9,22 +9,20 @@ class C { //// [esDecorators-classDeclaration-simpleTransformation.js] var _this = this; var C = function () { - var _a; var _classDecorators = [dec]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; - var C = (_a = /** @class */ (function () { - function class_1() { - } - return class_1; - }()), - __setFunctionName(_a, "C"), - (function () { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = /** @class */ (function () { + function C_1() { + } + return C_1; + }()); + __setFunctionName(_classThis, "C"); + (function () { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; }(); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js index 9a3f8352e3788..eaaf5bb3a9a7d 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js @@ -48,8 +48,7 @@ class C { //// [esDecorators-emitDecoratorMetadata.js] let C = (() => { - var _a; - let _classDecorators = [dec, __metadata("design:paramtypes", [Number])]; + let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; @@ -63,43 +62,41 @@ let C = (() => { let _set_x_decorators; let _y_decorators; let _y_initializers = []; - var C = (_a = class { - constructor(x) { - this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); - } - method(x) { } - set x(x) { } - static method(x) { } - static set x(x) { } - }, - __setFunctionName(_a, "C"), - (() => { - _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _y_decorators = [dec, __metadata("design:type", Number)]; - _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _static_y_decorators = [dec, __metadata("design:type", Number)]; - __esDecorate(_a, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _staticExtraInitializers); - })(), - _a.y = __runInitializers(_classThis, _static_y_initializers), - (() => { - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = class { + constructor(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + } + method(x) { } + set x(x) { } + static method(x) { } + static set x(x) { } + }; + __setFunctionName(_classThis, "C"); + (() => { + _method_decorators = [dec]; + _set_x_decorators = [dec]; + _y_decorators = [dec]; + _static_method_decorators = [dec]; + _static_set_x_decorators = [dec]; + _static_y_decorators = [dec]; + __esDecorate(_classThis, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + })(); + _classThis.y = __runInitializers(_classThis, _static_y_initializers); + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; })(); ((() => { - var _a; - let _classDecorators_1 = [dec, __metadata("design:paramtypes", [Number])]; + let _classDecorators_1 = [dec]; let _classDescriptor_1; let _classExtraInitializers_1 = []; let _classThis_1; @@ -113,7 +110,7 @@ let C = (() => { let _set_x_decorators; let _y_decorators; let _y_initializers = []; - var C = (_a = class { + var C = (_classThis_1 = class { constructor(x) { this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); } @@ -122,28 +119,28 @@ let C = (() => { static method(x) { } static set x(x) { } }, - __setFunctionName(_a, "C"), + __setFunctionName(_classThis_1, "C"), (() => { - _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _y_decorators = [dec, __metadata("design:type", Number)]; - _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _static_y_decorators = [dec, __metadata("design:type", Number)]; - __esDecorate(_a, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers_1); - __esDecorate(_a, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers_1); - __esDecorate(_a, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers_1); - __esDecorate(_a, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers_1); + _method_decorators = [dec]; + _set_x_decorators = [dec]; + _y_decorators = [dec]; + _static_method_decorators = [dec]; + _static_set_x_decorators = [dec]; + _static_y_decorators = [dec]; + __esDecorate(_classThis_1, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers_1); + __esDecorate(_classThis_1, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers_1); + __esDecorate(_classThis_1, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers_1); + __esDecorate(_classThis_1, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers_1); __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers_1); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); - __esDecorate(null, _classDescriptor_1 = { value: _a }, _classDecorators_1, { kind: "class", name: _a.name }, null, _classExtraInitializers_1); + __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); C = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _staticExtraInitializers_1); })(), - _a.y = __runInitializers(_classThis_1, _static_y_initializers), + _classThis_1.y = __runInitializers(_classThis_1, _static_y_initializers), (() => { __runInitializers(_classThis_1, _classExtraInitializers_1); })(), - _a); + _classThis_1); return C = _classThis_1; })()); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js index 27136e1394dbd..7dc01fd69adce 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js @@ -48,7 +48,7 @@ class C { //// [esDecorators-emitDecoratorMetadata.js] let C = (() => { - let _classDecorators = [dec, __metadata("design:paramtypes", [Number])]; + let _classDecorators = [dec]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; @@ -64,12 +64,12 @@ let C = (() => { let _y_initializers = []; var C = class { static { - _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _y_decorators = [dec, __metadata("design:type", Number)]; - _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _static_y_decorators = [dec, __metadata("design:type", Number)]; + _method_decorators = [dec]; + _set_x_decorators = [dec]; + _y_decorators = [dec]; + _static_method_decorators = [dec]; + _static_set_x_decorators = [dec]; + _static_y_decorators = [dec]; __esDecorate(this, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers); __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); @@ -94,7 +94,7 @@ let C = (() => { return C = _classThis; })(); ((() => { - let _classDecorators_1 = [dec, __metadata("design:paramtypes", [Number])]; + let _classDecorators_1 = [dec]; let _classDescriptor_1; let _classExtraInitializers_1 = []; let _classThis_1; @@ -110,12 +110,12 @@ let C = (() => { let _y_initializers = []; var C = class { static { - _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _y_decorators = [dec, __metadata("design:type", Number)]; - _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _static_y_decorators = [dec, __metadata("design:type", Number)]; + _method_decorators = [dec]; + _set_x_decorators = [dec]; + _y_decorators = [dec]; + _static_method_decorators = [dec]; + _static_set_x_decorators = [dec]; + _static_y_decorators = [dec]; __esDecorate(this, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers_1); __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers_1); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers_1); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js index 8e6820d7c631f..4b5a8db7b19c5 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js @@ -49,8 +49,7 @@ class C { //// [esDecorators-emitDecoratorMetadata.js] var _this = this; var C = function () { - var _a; - var _classDecorators = [dec, __metadata("design:paramtypes", [Number])]; + var _classDecorators = [dec]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; @@ -64,52 +63,50 @@ var C = function () { var _set_x_decorators; var _y_decorators; var _y_initializers = []; - var C = (_a = /** @class */ (function () { - function class_1(x) { - this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); - } - class_1.prototype.method = function (x) { }; - Object.defineProperty(class_1.prototype, "x", { - set: function (x) { }, - enumerable: false, - configurable: true - }); - class_1.method = function (x) { }; - Object.defineProperty(class_1, "x", { - set: function (x) { }, - enumerable: false, - configurable: true - }); - return class_1; - }()), - __setFunctionName(_a, "C"), - (function () { - _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _y_decorators = [dec, __metadata("design:type", Number)]; - _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _static_y_decorators = [dec, __metadata("design:type", Number)]; - __esDecorate(_a, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get: function () { return this.method; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set: function (value) { this.x = value; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get: function () { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set: function (value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - C = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _staticExtraInitializers); - })(), - _a.y = __runInitializers(_classThis, _static_y_initializers), - (function () { - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var C = _classThis = /** @class */ (function () { + function C_1(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + } + C_1.prototype.method = function (x) { }; + Object.defineProperty(C_1.prototype, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + C_1.method = function (x) { }; + Object.defineProperty(C_1, "x", { + set: function (x) { }, + enumerable: false, + configurable: true + }); + return C_1; + }()); + __setFunctionName(_classThis, "C"); + (function () { + _method_decorators = [dec]; + _set_x_decorators = [dec]; + _y_decorators = [dec]; + _static_method_decorators = [dec]; + _static_set_x_decorators = [dec]; + _static_y_decorators = [dec]; + __esDecorate(_classThis, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get: function () { return this.method; } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set: function (value) { this.x = value; } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get: function () { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set: function (value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + })(); + _classThis.y = __runInitializers(_classThis, _static_y_initializers); + (function () { + __runInitializers(_classThis, _classExtraInitializers); + })(); return C = _classThis; }(); ((function () { - var _a; - var _classDecorators_1 = [dec, __metadata("design:paramtypes", [Number])]; + var _classDecorators_1 = [dec]; var _classDescriptor_1; var _classExtraInitializers_1 = []; var _classThis_1; @@ -123,46 +120,46 @@ var C = function () { var _set_x_decorators; var _y_decorators; var _y_initializers = []; - var C = (_a = /** @class */ (function () { - function class_2(x) { + var C = (_classThis_1 = /** @class */ (function () { + function class_1(x) { this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); } - class_2.prototype.method = function (x) { }; - Object.defineProperty(class_2.prototype, "x", { + class_1.prototype.method = function (x) { }; + Object.defineProperty(class_1.prototype, "x", { set: function (x) { }, enumerable: false, configurable: true }); - class_2.method = function (x) { }; - Object.defineProperty(class_2, "x", { + class_1.method = function (x) { }; + Object.defineProperty(class_1, "x", { set: function (x) { }, enumerable: false, configurable: true }); - return class_2; + return class_1; }()), - __setFunctionName(_a, "C"), + __setFunctionName(_classThis_1, "C"), (function () { - _method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _y_decorators = [dec, __metadata("design:type", Number)]; - _static_method_decorators = [dec, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0)]; - _static_set_x_decorators = [dec, __metadata("design:type", Number), __metadata("design:paramtypes", [Number])]; - _static_y_decorators = [dec, __metadata("design:type", Number)]; - __esDecorate(_a, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get: function () { return this.method; } } }, null, _staticExtraInitializers_1); - __esDecorate(_a, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set: function (value) { this.x = value; } } }, null, _staticExtraInitializers_1); - __esDecorate(_a, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get: function () { return this.method; } } }, null, _instanceExtraInitializers_1); - __esDecorate(_a, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set: function (value) { this.x = value; } } }, null, _instanceExtraInitializers_1); + _method_decorators = [dec]; + _set_x_decorators = [dec]; + _y_decorators = [dec]; + _static_method_decorators = [dec]; + _static_set_x_decorators = [dec]; + _static_y_decorators = [dec]; + __esDecorate(_classThis_1, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get: function () { return this.method; } } }, null, _staticExtraInitializers_1); + __esDecorate(_classThis_1, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set: function (value) { this.x = value; } } }, null, _staticExtraInitializers_1); + __esDecorate(_classThis_1, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get: function () { return this.method; } } }, null, _instanceExtraInitializers_1); + __esDecorate(_classThis_1, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set: function (value) { this.x = value; } } }, null, _instanceExtraInitializers_1); __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers_1); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); - __esDecorate(null, _classDescriptor_1 = { value: _a }, _classDecorators_1, { kind: "class", name: _a.name }, null, _classExtraInitializers_1); + __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); C = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _staticExtraInitializers_1); })(), - _a.y = __runInitializers(_classThis_1, _static_y_initializers), + _classThis_1.y = __runInitializers(_classThis_1, _static_y_initializers), (function () { __runInitializers(_classThis_1, _classExtraInitializers_1); })(), - _a); + _classThis_1); return C = _classThis_1; })()); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).js index c8888fa2878a2..f8bed6444b6c0 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).js @@ -48,61 +48,35 @@ class C { //// [esDecorators-emitDecoratorMetadata.js] @dec -@__metadata("design:paramtypes", [Number]) class C { constructor(x) { } @dec - @__metadata("design:type", Function) - @__metadata("design:paramtypes", [Number]) - @__metadata("design:returntype", void 0) method(x) { } @dec - @__metadata("design:type", Number) - @__metadata("design:paramtypes", [Number]) set x(x) { } @dec - @__metadata("design:type", Number) y; @dec - @__metadata("design:type", Function) - @__metadata("design:paramtypes", [Number]) - @__metadata("design:returntype", void 0) static method(x) { } @dec - @__metadata("design:type", Number) - @__metadata("design:paramtypes", [Number]) static set x(x) { } @dec - @__metadata("design:type", Number) static y; } ( @dec -@__metadata("design:paramtypes", [Number]) class C { constructor(x) { } @dec - @__metadata("design:type", Function) - @__metadata("design:paramtypes", [Number]) - @__metadata("design:returntype", void 0) method(x) { } @dec - @__metadata("design:type", Number) - @__metadata("design:paramtypes", [Number]) set x(x) { } @dec - @__metadata("design:type", Number) y; @dec - @__metadata("design:type", Function) - @__metadata("design:paramtypes", [Number]) - @__metadata("design:returntype", void 0) static method(x) { } @dec - @__metadata("design:type", Number) - @__metadata("design:paramtypes", [Number]) static set x(x) { } @dec - @__metadata("design:type", Number) static y; }); diff --git a/tests/baselines/reference/privateNameMethodAccess.js b/tests/baselines/reference/privateNameMethodAccess.js index de9680a242698..10cf647682eb9 100644 --- a/tests/baselines/reference/privateNameMethodAccess.js +++ b/tests/baselines/reference/privateNameMethodAccess.js @@ -29,7 +29,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function ( if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; -var _A2_instances, _A2_method, _a; +var _A2_instances, _A2_method; class A2 { constructor() { _A2_instances.add(this); @@ -42,14 +42,12 @@ class A2 { } } _A2_instances = new WeakSet(), _A2_method = function _A2_method() { return ""; }; -(_a = new A2())..call(_a); // Error +new A2().(); // Error function foo() { - var _a; - (_a = new A2())..call(_a); // Error + new A2().(); // Error } class B2 { m() { - var _a; - (_a = new A2())..call(_a); + new A2().(); } } diff --git a/tests/baselines/reference/privateNameMethodsDerivedClasses.js b/tests/baselines/reference/privateNameMethodsDerivedClasses.js index b6b4027e749b1..f961d9c25cd60 100644 --- a/tests/baselines/reference/privateNameMethodsDerivedClasses.js +++ b/tests/baselines/reference/privateNameMethodsDerivedClasses.js @@ -30,6 +30,6 @@ class Base { _Base_instances = new WeakSet(), _Base_prop = function _Base_prop() { return 123; }; class Derived extends Base { static method(x) { - console.log(x..call(x)); + console.log(x.()); } } diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js b/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js index f685bf4233f63..85522f3021846 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js @@ -129,21 +129,19 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { }; import './b'; export let A = (() => { - var _a; let _classDecorators = [((_) => { })]; let _classDescriptor; let _classExtraInitializers = []; let _classThis; - var A = (_a = class { - constructor(p) { } - }, - __setFunctionName(_a, "A"), - (() => { - __esDecorate(null, _classDescriptor = { value: _a }, _classDecorators, { kind: "class", name: _a.name }, null, _classExtraInitializers); - A = _classThis = _classDescriptor.value; - __runInitializers(_classThis, _classExtraInitializers); - })(), - _a); + var A = _classThis = class { + constructor(p) { } + }; + __setFunctionName(_classThis, "A"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + A = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); return A = _classThis; })(); diff --git a/tests/baselines/reference/typeOfThisInStaticMembers12(target=es2022).js b/tests/baselines/reference/typeOfThisInStaticMembers12(target=es2022).js index 61a0be489d18b..e36f0855dbb59 100644 --- a/tests/baselines/reference/typeOfThisInStaticMembers12(target=es2022).js +++ b/tests/baselines/reference/typeOfThisInStaticMembers12(target=es2022).js @@ -14,10 +14,10 @@ class C { static { this.c = "foo"; } static { this.bar = (_c = () => { _a = this.c, _b = this.c; }, class Inner { - constructor() { - this[_b] = 123; - } - static { _c(); } - static { this[_a] = 123; } - }); } + constructor() { + this[_b] = 123; + } + static { _c(); } + static { this[_a] = 123; } + }); } } diff --git a/tests/baselines/reference/typeOfThisInStaticMembers12(target=esnext).js b/tests/baselines/reference/typeOfThisInStaticMembers12(target=esnext).js index 61a0be489d18b..e36f0855dbb59 100644 --- a/tests/baselines/reference/typeOfThisInStaticMembers12(target=esnext).js +++ b/tests/baselines/reference/typeOfThisInStaticMembers12(target=esnext).js @@ -14,10 +14,10 @@ class C { static { this.c = "foo"; } static { this.bar = (_c = () => { _a = this.c, _b = this.c; }, class Inner { - constructor() { - this[_b] = 123; - } - static { _c(); } - static { this[_a] = 123; } - }); } + constructor() { + this[_b] = 123; + } + static { _c(); } + static { this[_a] = 123; } + }); } } diff --git a/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-staticPrivate.ts b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-staticPrivate.ts index e234c85818b89..821521bd2b3be 100644 --- a/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-staticPrivate.ts +++ b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-staticPrivate.ts @@ -9,7 +9,6 @@ class C { @dec(2) static set #method1(value) {} } -// TODO: We should translate these to weakmaps when < ESNext @dec class D { static get #method1() { return 0; } diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAccessor.ts index 3445fc0c0cfd7..118ad1a5e827b 100644 --- a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAccessor.ts +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAccessor.ts @@ -12,7 +12,6 @@ class C { @dec(3) static accessor [field3] = 3; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor field1 = 1; diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivate.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivate.ts index 439e8085533b6..c42095ebfca20 100644 --- a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivate.ts +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivate.ts @@ -8,7 +8,6 @@ class C { @dec static #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #field1 = 0; diff --git a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivateAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivateAccessor.ts index 132f60d5184c9..215b0cca67c29 100644 --- a/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivateAccessor.ts +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivateAccessor.ts @@ -8,7 +8,6 @@ class C { @dec static accessor #field1 = 0; } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static accessor #field1 = 0; diff --git a/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-staticPrivate.ts b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-staticPrivate.ts index 6f04817aaa383..89954a68bcc87 100644 --- a/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-staticPrivate.ts +++ b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-staticPrivate.ts @@ -8,7 +8,6 @@ class C { @dec static #method1() {} } -// TODO: We should translate static private to weakmaps when < ESNext @dec class D { static #method1() {} From 5797ac7d3f461c3920efca6485465a2c9b9ffe8b Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 28 Sep 2022 18:02:10 -0400 Subject: [PATCH 14/51] Accept baselines after merge --- tests/baselines/reference/completionsStringMethods.baseline | 4 ++-- ...odulesExportsBlocksTypesVersions(module=node16).trace.json | 4 ++++ ...ulesExportsBlocksTypesVersions(module=nodenext).trace.json | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/completionsStringMethods.baseline b/tests/baselines/reference/completionsStringMethods.baseline index 7f560b27e947e..ef888a34de066 100644 --- a/tests/baselines/reference/completionsStringMethods.baseline +++ b/tests/baselines/reference/completionsStringMethods.baseline @@ -1078,7 +1078,7 @@ "target": { "fileName": "lib.d.ts", "textSpan": { - "start": 18880, + "start": 18961, "length": 28 } } @@ -1101,7 +1101,7 @@ "target": { "fileName": "lib.d.ts", "textSpan": { - "start": 18880, + "start": 18961, "length": 28 } } diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node16).trace.json b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node16).trace.json index 64a53eefcc0c7..d3b668129cbe3 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node16).trace.json +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node16).trace.json @@ -256,5 +256,9 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=nodenext).trace.json b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=nodenext).trace.json index 0469b9d6ee7c7..1c274670668b1 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=nodenext).trace.json +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=nodenext).trace.json @@ -260,5 +260,9 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file From 712b037a7b3f94be34d66e6d8b5909ac911fad1a Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 30 Sep 2022 16:26:34 -0400 Subject: [PATCH 15/51] Contextual types for decorators --- src/compiler/checker.ts | 266 +++++++++++------- src/compiler/types.ts | 1 + .../reference/esDecorators-contextualTypes.js | 108 +++++++ .../esDecorators-contextualTypes.symbols | 152 ++++++++++ .../esDecorators-contextualTypes.types | 206 ++++++++++++++ .../esDecorators-contextualTypes.ts | 64 +++++ 6 files changed, 702 insertions(+), 95 deletions(-) create mode 100644 tests/baselines/reference/esDecorators-contextualTypes.js create mode 100644 tests/baselines/reference/esDecorators-contextualTypes.symbols create mode 100644 tests/baselines/reference/esDecorators-contextualTypes.types create mode 100644 tests/cases/conformance/esDecorators/esDecorators-contextualTypes.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 127a44ad9a8b1..ea9369bd74a39 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -27181,6 +27181,12 @@ namespace ts { getTypeAtPosition(signature, argIndex); } + function getContextualTypeForDecorator(decorator: Decorator): Type | undefined { + if (legacyDecorators) return undefined; + const signature = getESDecoratorCallSignature(decorator); + return signature ? getOrCreateTypeFromSignature(signature) : undefined; + } + function getContextualTypeForSubstitutionExpression(template: TemplateExpression, substitutionExpression: Expression) { if (template.parent.kind === SyntaxKind.TaggedTemplateExpression) { return getContextualTypeForArgument(template.parent as TaggedTemplateExpression, substitutionExpression); @@ -27643,7 +27649,9 @@ namespace ts { return getContextualTypeForAwaitOperand(parent as AwaitExpression, contextFlags); case SyntaxKind.CallExpression: case SyntaxKind.NewExpression: - return getContextualTypeForArgument(parent as CallExpression | NewExpression, node); + return getContextualTypeForArgument(parent as CallExpression | NewExpression | Decorator, node); + case SyntaxKind.Decorator: + return getContextualTypeForDecorator(parent as Decorator); case SyntaxKind.TypeAssertionExpression: case SyntaxKind.AsExpression: return isConstTypeReference((parent as AssertionExpression).type) ? tryFindWhenConstTypeReference(parent as AssertionExpression) : getTypeFromTypeNode((parent as AssertionExpression).type); @@ -30959,48 +30967,15 @@ namespace ts { * Returns the synthetic argument list for a decorator invocation. */ function getEffectiveESDecoratorArguments(node: Decorator): readonly Expression[] { - const parent = node.parent; const expr = node.expression; - switch (parent.kind) { - case SyntaxKind.ClassDeclaration: - case SyntaxKind.ClassExpression: { - // For a class decorator, the `target` is the type of the class (e.g. the - // "static" or "constructor" side of the class). - - // TODO(rbuckton): Some mechanism of defining a type variable that - // is dependent on the result of evaluating all decorators. - const classInType = getTypeOfSymbol(getSymbolOfNode(parent)); - const classFinalType = classInType; - return [ - createSyntheticExpression(expr, classInType), - createSyntheticExpression(expr, createClassDecoratorContextType(classFinalType)) - ]; - } - case SyntaxKind.MethodDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.PropertyDeclaration: { - // TODO(rbuckton): Some mechanism of defining a type variable that - // is dependent on the result of evaluating all decorators. - const nameType = undefined; - const isStatic = hasStaticModifier(parent); - const isPrivate = !!parent.name && isPrivateIdentifier(parent.name); - const valueInType = getTypeOfNode(parent); - const valueFinalType = valueInType; - const thisFinalType = unknownType; - const contextType = - isMethodDeclaration(parent) ? createClassMethodDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : - isGetAccessorDeclaration(parent) ? createClassGetterDecoratorContextType(thisFinalType, valueFinalType) : - isSetAccessorDeclaration(parent) ? createClassSetterDecoratorContextType(thisFinalType, valueFinalType) : - hasAccessorModifier(parent) ? createClassAccessorDecoratorContextType(thisFinalType, valueFinalType) : - createClassFieldDecoratorContextType(thisFinalType, valueFinalType); - return [ - createSyntheticExpression(expr, valueInType), - createSyntheticExpression(expr, contextType) - ]; + const signature = getESDecoratorCallSignature(node); + if (signature) { + const args: Expression[] = []; + for (const param of signature.parameters) { + const type = getTypeOfSymbol(param); + args.push(createSyntheticExpression(expr, type)); } - case SyntaxKind.Parameter: - Debug.fail("Not yet implemented."); + return args; } return Debug.fail(); } @@ -33112,7 +33087,7 @@ namespace ts { } } - function createClassDecoratorContextType(classType: Type) { + function createClassESDecoratorContextType(classType: Type) { const globalClassDecoratorContextType = getGlobalClassDecoratorContextType(/*reportErrors*/ true); if (globalClassDecoratorContextType !== emptyGenericType) { return createTypeReference(globalClassDecoratorContextType, [classType]); @@ -33120,7 +33095,27 @@ namespace ts { return unknownType; } - function tryCreateDecoratorContextOverrideType(nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + function createClassMethodESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + return createESDecoratorContextTypeReference(getGlobalClassMethodDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + } + + function createClassGetterESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + return createESDecoratorContextTypeReference(getGlobalClassGetterDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + } + + function createClassSetterESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + return createESDecoratorContextTypeReference(getGlobalClassSetterDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + } + + function createClassAccessorESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + return createESDecoratorContextTypeReference(getGlobalClassAccessorDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + } + + function createClassFieldESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + return createESDecoratorContextTypeReference(getGlobalClassFieldDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + } + + function tryCreateESDecoratorContextOverrideType(nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { let members: SymbolTable | undefined; if (nameType !== undefined) { const symbol = createSymbol(SymbolFlags.Property, "name" as __String); @@ -33128,63 +33123,145 @@ namespace ts { members ??= createSymbolTable(); members.set(symbol.escapedName, symbol); } - if (isStatic !== undefined) { - const symbol = createSymbol(SymbolFlags.Property, "static" as __String); - symbol.type = isStatic ? trueType : falseType; - members ??= createSymbolTable(); - members.set(symbol.escapedName, symbol); - } if (isPrivate !== undefined) { const symbol = createSymbol(SymbolFlags.Property, "private" as __String); symbol.type = isPrivate ? trueType : falseType; members ??= createSymbolTable(); members.set(symbol.escapedName, symbol); } + if (isStatic !== undefined) { + const symbol = createSymbol(SymbolFlags.Property, "static" as __String); + symbol.type = isStatic ? trueType : falseType; + members ??= createSymbolTable(); + members.set(symbol.escapedName, symbol); + } if (members) { return createAnonymousType(/*symbol*/ undefined, members, emptyArray, emptyArray, emptyArray); } } - function createClassMethodDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { - const globalClassMethodDecoratorContextType = getGlobalClassMethodDecoratorContextType(/*reportErrors*/ true); - if (globalClassMethodDecoratorContextType !== emptyGenericType) { - const contextType = createTypeReference(globalClassMethodDecoratorContextType, [thisType, valueType]); - const overrideType = tryCreateDecoratorContextOverrideType(nameType, isStatic, isPrivate); + function createESDecoratorContextTypeReference(decoratorContextType: GenericType, thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + if (decoratorContextType !== emptyGenericType) { + const contextType = createTypeReference(decoratorContextType, [thisType, valueType]); + const overrideType = tryCreateESDecoratorContextOverrideType(nameType, isStatic, isPrivate); return overrideType ? getIntersectionType([contextType, overrideType]) : contextType; } return unknownType; } - function createClassGetterDecoratorContextType(thisType: Type, valueType: Type) { - const globalClassGetterDecoratorContextType = getGlobalClassGetterDecoratorContextType(/*reportErrors*/ true); - if (globalClassGetterDecoratorContextType !== emptyGenericType) { - return createTypeReference(globalClassGetterDecoratorContextType, [thisType, valueType]); - } - return unknownType; + function createClassDecoratorReturnType(node: ClassDeclaration | ClassExpression) { + const classSymbol = getSymbolOfNode(node); + const classConstructorType = getTypeOfSymbol(classSymbol); + return getUnionType([classConstructorType, voidType]); } - function createClassSetterDecoratorContextType(thisType: Type, valueType: Type) { - const globalClassSetterDecoratorContextType = getGlobalClassSetterDecoratorContextType(/*reportErrors*/ true); - if (globalClassSetterDecoratorContextType !== emptyGenericType) { - return createTypeReference(globalClassSetterDecoratorContextType, [thisType, valueType]); - } - return unknownType; + function createClassAccessorESDecoratorReturnType(valueType: Type) { + const param = createSymbol(SymbolFlags.FunctionScopedVariable, "value" as __String, /*checkFlags*/ undefined, valueType); + const initializerSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], valueType); + const getSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, emptyArray, valueType); + const setSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], voidType); + const members = createSymbolTable([ + createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "get" as __String, /*checkFlags*/ undefined, getSignatureType), + createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "set" as __String, /*checkFlags*/ undefined, setSignatureType), + createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "init" as __String, /*checkFlags*/ undefined, initializerSignatureType) + ]); + const descriptorType = createAnonymousType(/*symbol*/ undefined, members, emptyArray, emptyArray, emptyArray); + return getUnionType([descriptorType, voidType]); } - function createClassAccessorDecoratorContextType(thisType: Type, valueType: Type) { - const globalClassAccessorDecoratorContextType = getGlobalClassAccessorDecoratorContextType(/*reportErrors*/ true); - if (globalClassAccessorDecoratorContextType !== emptyGenericType) { - return createTypeReference(globalClassAccessorDecoratorContextType, [thisType, valueType]); - } - return unknownType; + function createClassFieldESDecoratorReturnType(valueType: Type) { + const param = createSymbol(SymbolFlags.FunctionScopedVariable, "value" as __String, /*checkFlags*/ undefined, valueType); + const initializerSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], valueType); + return getUnionType([initializerSignatureType, voidType]); } - function createClassFieldDecoratorContextType(thisType: Type, valueType: Type) { - const globalClassFieldDecoratorContextType = getGlobalClassFieldDecoratorContextType(/*reportErrors*/ true); - if (globalClassFieldDecoratorContextType !== emptyGenericType) { - return createTypeReference(globalClassFieldDecoratorContextType, [thisType, valueType]); + function getESDecoratorCallSignature(decorator: Decorator) { + const { parent } = decorator; + const links = getNodeLinks(parent); + if (!links.decoratorSignature) { + links.decoratorSignature = anySignature; + switch (parent.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: { + const node = decorator.parent as ClassDeclaration | ClassExpression; + const targetType = getTypeOfSymbol(getSymbolOfNode(node)); + + // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of + // evaluating all decorators. + const finalType = targetType; + + const contextType = createClassESDecoratorContextType(finalType); + const returnType = getUnionType([targetType, voidType]); + const targetParam = createSymbol(SymbolFlags.FunctionScopedVariable, "target" as __String, /*checkFlags*/ undefined, targetType); + const contextParam = createSymbol(SymbolFlags.FunctionScopedVariable, "context" as __String, /*checkFlags*/ undefined, contextType); + links.decoratorSignature = createCallSignature(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [targetParam, contextParam], returnType, /*typePredicate*/ undefined, 2); + break; + } + + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: { + const node = decorator.parent as MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration; + if (isClassLike(node.parent)) { + const targetType = getOrCreateTypeFromSignature(getSignatureFromDeclaration(node)); + + // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of + // evaluating all decorators. + const valueFinalType = targetType; + const thisFinalType = hasStaticModifier(node) ? + getTypeOfSymbol(getSymbolOfNode(node.parent)) : + getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); + + const isStatic = hasStaticModifier(node); + const isPrivate = isPrivateIdentifier(node.name); + const nameType = isPrivate ? getStringLiteralType(idText(node.name)) : getLiteralTypeFromPropertyName(node.name); + + const contextType = + isGetAccessorDeclaration(node) ? createClassGetterESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : + isSetAccessorDeclaration(node) ? createClassSetterESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : + createClassMethodESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate); + + const returnType = getUnionType([targetType, voidType]); + const targetParam = createSymbol(SymbolFlags.FunctionScopedVariable, "target" as __String, /*checkFlags*/ undefined, targetType); + const contextParam = createSymbol(SymbolFlags.FunctionScopedVariable, "context" as __String, /*checkFlags*/ undefined, contextType); + links.decoratorSignature = createCallSignature(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [targetParam, contextParam], returnType, /*typePredicate*/ undefined, 2); + } + break; + } + + case SyntaxKind.PropertyDeclaration: { + const node = decorator.parent as PropertyDeclaration; + if (isClassLike(node.parent)) { + const targetType = getTypeOfNode(node); + + // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of + // evaluating all decorators. + const valueFinalType = targetType; + const thisFinalType = hasStaticModifier(node) ? + getTypeOfSymbol(getSymbolOfNode(node.parent)) : + getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); + + const isStatic = hasStaticModifier(node); + const isPrivate = isPrivateIdentifier(node.name); + const nameType = isPrivate ? getStringLiteralType(idText(node.name)) : getLiteralTypeFromPropertyName(node.name); + + const contextType = + hasAccessorModifier(node) ? createClassAccessorESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : + createClassFieldESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate); + + const returnType = + hasAccessorModifier(node) ? createClassAccessorESDecoratorReturnType(targetType) : + createClassFieldESDecoratorReturnType(targetType); + + const targetParam = createSymbol(SymbolFlags.FunctionScopedVariable, "target" as __String, /*checkFlags*/ undefined, targetType); + const contextParam = createSymbol(SymbolFlags.FunctionScopedVariable, "context" as __String, /*checkFlags*/ undefined, contextType); + links.decoratorSignature = createCallSignature(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [targetParam, contextParam], returnType, /*typePredicate*/ undefined, 2); + } + break; + } + } } - return unknownType; + return links.decoratorSignature === anySignature ? undefined : links.decoratorSignature; } function createPromiseType(promisedType: Type): Type { @@ -37502,31 +37579,18 @@ namespace ts { case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; - const classSymbol = getSymbolOfNode(node.parent); - const classConstructorType = getTypeOfSymbol(classSymbol); - expectedReturnType = getUnionType([classConstructorType, voidType]); + expectedReturnType = createClassDecoratorReturnType(node.parent as ClassDeclaration | ClassExpression); break; case SyntaxKind.PropertyDeclaration: if (!legacyDecorators) { headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; const expectedType = getTypeOfNode(node.parent); - const param = createSymbol(SymbolFlags.FunctionScopedVariable, "value" as __String, /*checkFlags*/ undefined, expectedType); - const initializerSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], expectedType); if (hasAccessorModifier(node.parent)) { - const getSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, emptyArray, expectedType); - const setSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], voidType); - const members = createSymbolTable([ - createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "get" as __String, /*checkFlags*/ undefined, getSignatureType), - createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "set" as __String, /*checkFlags*/ undefined, setSignatureType), - createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "init" as __String, /*checkFlags*/ undefined, initializerSignatureType) - ]); - - const descriptorType = createAnonymousType(/*symbol*/ undefined, members, emptyArray, emptyArray, emptyArray); - expectedReturnType = getUnionType([descriptorType, voidType]); + expectedReturnType = createClassAccessorESDecoratorReturnType(expectedType); } else { - expectedReturnType = getUnionType([initializerSignatureType, voidType]); + expectedReturnType = createClassFieldESDecoratorReturnType(expectedType); } break; } @@ -37554,7 +37618,7 @@ namespace ts { checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage); } - function createFunctionType( + function createCallSignature( typeParameters: readonly TypeParameter[] | undefined, thisParameter: Symbol | undefined, parameters: readonly Symbol[], @@ -37564,7 +37628,19 @@ namespace ts { flags: SignatureFlags = SignatureFlags.None ) { const decl = factory.createFunctionTypeNode(/*typeParameters*/ undefined, emptyArray, factory.createKeywordTypeNode(SyntaxKind.AnyKeyword)); - const signature = createSignature(decl, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, flags); + return createSignature(decl, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, flags); + } + + function createFunctionType( + typeParameters: readonly TypeParameter[] | undefined, + thisParameter: Symbol | undefined, + parameters: readonly Symbol[], + returnType: Type, + typePredicate?: TypePredicate, + minArgumentCount: number = parameters.length, + flags: SignatureFlags = SignatureFlags.None + ) { + const signature = createCallSignature(typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, flags); return getOrCreateTypeFromSignature(signature); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c2c71a94cc301..dd508544ccf86 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5578,6 +5578,7 @@ namespace ts { skipDirectInference?: true; // Flag set by the API `getContextualType` call on a node when `Completions` is passed to force the checker to skip making inferences to a node's type declarationRequiresScopeChange?: boolean; // Set by `useOuterVariableScopeInParameter` in checker when downlevel emit would change the name resolution scope inside of a parameter. serializedTypes?: ESMap; // Collection of types serialized at this location + decoratorSignature?: Signature; // Signature for decorator as if invoked by the runtime. } export const enum TypeFlags { diff --git a/tests/baselines/reference/esDecorators-contextualTypes.js b/tests/baselines/reference/esDecorators-contextualTypes.js new file mode 100644 index 0000000000000..b02a5ea1f1d95 --- /dev/null +++ b/tests/baselines/reference/esDecorators-contextualTypes.js @@ -0,0 +1,108 @@ +//// [esDecorators-contextualTypes.ts] +@((t, c) => { }) +class C { + @((t, c) => { }) + static f() {} + + @((t, c) => { }) + static #f() {} + + @((t, c) => { }) + static get x() { return 1; } + + @((t, c) => { }) + static set x(value) { } + + @((t, c) => { }) + static get #x() { return 1; } + + @((t, c) => { }) + static set #x(value) { } + + @((t, c) => { }) + static accessor y = 1; + + @((t, c) => { }) + static accessor #y = 1; + + @((t, c) => { }) + static z = 1; + + @((t, c) => { }) + static #z = 1; + + @((t, c) => { }) + g() {} + + @((t, c) => { }) + #g() {} + + @((t, c) => { }) + get a() { return 1; } + + @((t, c) => { }) + set a(value) { } + + @((t, c) => { }) + get #a() { return 1; } + + @((t, c) => { }) + set #a(value) { } + + @((t, c) => { }) + accessor b = 1; + + @((t, c) => { }) + accessor #b = 1; + + @((t, c) => { }) + c = 1; + + @((t, c) => { }) + #c = 1; +} + +//// [esDecorators-contextualTypes.js] +@((t, c) => { }) +class C { + @((t, c) => { }) + static f() { } + @((t, c) => { }) + static #f() { } + @((t, c) => { }) + static get x() { return 1; } + @((t, c) => { }) + static set x(value) { } + @((t, c) => { }) + static get #x() { return 1; } + @((t, c) => { }) + static set #x(value) { } + @((t, c) => { }) + static accessor y = 1; + @((t, c) => { }) + static accessor #y = 1; + @((t, c) => { }) + static z = 1; + @((t, c) => { }) + static #z = 1; + @((t, c) => { }) + g() { } + @((t, c) => { }) + #g() { } + @((t, c) => { }) + get a() { return 1; } + @((t, c) => { }) + set a(value) { } + @((t, c) => { }) + get #a() { return 1; } + @((t, c) => { }) + set #a(value) { } + @((t, c) => { }) + accessor b = 1; + @((t, c) => { }) + accessor #b = 1; + @((t, c) => { }) + c = 1; + @((t, c) => { }) + #c = 1; +} diff --git a/tests/baselines/reference/esDecorators-contextualTypes.symbols b/tests/baselines/reference/esDecorators-contextualTypes.symbols new file mode 100644 index 0000000000000..15018c6991df2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-contextualTypes.symbols @@ -0,0 +1,152 @@ +=== tests/cases/conformance/esDecorators/esDecorators-contextualTypes.ts === +@((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 0, 3)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 0, 5)) + +class C { +>C : Symbol(C, Decl(esDecorators-contextualTypes.ts, 0, 0)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 2, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 2, 9)) + + static f() {} +>f : Symbol(C.f, Decl(esDecorators-contextualTypes.ts, 1, 9)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 5, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 5, 9)) + + static #f() {} +>#f : Symbol(C.#f, Decl(esDecorators-contextualTypes.ts, 3, 17)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 8, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 8, 9)) + + static get x() { return 1; } +>x : Symbol(C.x, Decl(esDecorators-contextualTypes.ts, 6, 18), Decl(esDecorators-contextualTypes.ts, 9, 32)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 11, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 11, 9)) + + static set x(value) { } +>x : Symbol(C.x, Decl(esDecorators-contextualTypes.ts, 6, 18), Decl(esDecorators-contextualTypes.ts, 9, 32)) +>value : Symbol(value, Decl(esDecorators-contextualTypes.ts, 12, 17)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 14, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 14, 9)) + + static get #x() { return 1; } +>#x : Symbol(C.#x, Decl(esDecorators-contextualTypes.ts, 12, 27), Decl(esDecorators-contextualTypes.ts, 15, 33)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 17, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 17, 9)) + + static set #x(value) { } +>#x : Symbol(C.#x, Decl(esDecorators-contextualTypes.ts, 12, 27), Decl(esDecorators-contextualTypes.ts, 15, 33)) +>value : Symbol(value, Decl(esDecorators-contextualTypes.ts, 18, 18)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 20, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 20, 9)) + + static accessor y = 1; +>y : Symbol(C.y, Decl(esDecorators-contextualTypes.ts, 18, 28)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 23, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 23, 9)) + + static accessor #y = 1; +>#y : Symbol(C.#y, Decl(esDecorators-contextualTypes.ts, 21, 26)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 26, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 26, 9)) + + static z = 1; +>z : Symbol(C.z, Decl(esDecorators-contextualTypes.ts, 24, 27)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 29, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 29, 9)) + + static #z = 1; +>#z : Symbol(C.#z, Decl(esDecorators-contextualTypes.ts, 27, 17)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 32, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 32, 9)) + + g() {} +>g : Symbol(C.g, Decl(esDecorators-contextualTypes.ts, 30, 18)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 35, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 35, 9)) + + #g() {} +>#g : Symbol(C.#g, Decl(esDecorators-contextualTypes.ts, 33, 10)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 38, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 38, 9)) + + get a() { return 1; } +>a : Symbol(C.a, Decl(esDecorators-contextualTypes.ts, 36, 11), Decl(esDecorators-contextualTypes.ts, 39, 25)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 41, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 41, 9)) + + set a(value) { } +>a : Symbol(C.a, Decl(esDecorators-contextualTypes.ts, 36, 11), Decl(esDecorators-contextualTypes.ts, 39, 25)) +>value : Symbol(value, Decl(esDecorators-contextualTypes.ts, 42, 10)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 44, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 44, 9)) + + get #a() { return 1; } +>#a : Symbol(C.#a, Decl(esDecorators-contextualTypes.ts, 42, 20), Decl(esDecorators-contextualTypes.ts, 45, 26)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 47, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 47, 9)) + + set #a(value) { } +>#a : Symbol(C.#a, Decl(esDecorators-contextualTypes.ts, 42, 20), Decl(esDecorators-contextualTypes.ts, 45, 26)) +>value : Symbol(value, Decl(esDecorators-contextualTypes.ts, 48, 11)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 50, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 50, 9)) + + accessor b = 1; +>b : Symbol(C.b, Decl(esDecorators-contextualTypes.ts, 48, 21)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 53, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 53, 9)) + + accessor #b = 1; +>#b : Symbol(C.#b, Decl(esDecorators-contextualTypes.ts, 51, 19)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 56, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 56, 9)) + + c = 1; +>c : Symbol(C.c, Decl(esDecorators-contextualTypes.ts, 54, 20)) + + @((t, c) => { }) +>t : Symbol(t, Decl(esDecorators-contextualTypes.ts, 59, 7)) +>c : Symbol(c, Decl(esDecorators-contextualTypes.ts, 59, 9)) + + #c = 1; +>#c : Symbol(C.#c, Decl(esDecorators-contextualTypes.ts, 57, 10)) +} diff --git a/tests/baselines/reference/esDecorators-contextualTypes.types b/tests/baselines/reference/esDecorators-contextualTypes.types new file mode 100644 index 0000000000000..e041ae4465c25 --- /dev/null +++ b/tests/baselines/reference/esDecorators-contextualTypes.types @@ -0,0 +1,206 @@ +=== tests/cases/conformance/esDecorators/esDecorators-contextualTypes.ts === +@((t, c) => { }) +>((t, c) => { }) : (t: typeof C, c: ClassDecoratorContext) => void +>(t, c) => { } : (t: typeof C, c: ClassDecoratorContext) => void +>t : typeof C +>c : ClassDecoratorContext + +class C { +>C : C + + @((t, c) => { }) +>((t, c) => { }) : (t: () => void, c: ClassMethodDecoratorContext void> & { name: "f"; private: false; static: true; }) => void +>(t, c) => { } : (t: () => void, c: ClassMethodDecoratorContext void> & { name: "f"; private: false; static: true; }) => void +>t : () => void +>c : ClassMethodDecoratorContext void> & { name: "f"; private: false; static: true; } + + static f() {} +>f : () => void + + @((t, c) => { }) +>((t, c) => { }) : (t: () => void, c: ClassMethodDecoratorContext void> & { name: "#f"; private: true; static: true; }) => void +>(t, c) => { } : (t: () => void, c: ClassMethodDecoratorContext void> & { name: "#f"; private: true; static: true; }) => void +>t : () => void +>c : ClassMethodDecoratorContext void> & { name: "#f"; private: true; static: true; } + + static #f() {} +>#f : () => void + + @((t, c) => { }) +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "x"; private: false; static: true; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "x"; private: false; static: true; }) => void +>t : () => number +>c : ClassGetterDecoratorContext number> & { name: "x"; private: false; static: true; } + + static get x() { return 1; } +>x : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "x"; private: false; static: true; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "x"; private: false; static: true; }) => void +>t : (value: number) => void +>c : ClassSetterDecoratorContext void> & { name: "x"; private: false; static: true; } + + static set x(value) { } +>x : number +>value : number + + @((t, c) => { }) +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "#x"; private: true; static: true; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "#x"; private: true; static: true; }) => void +>t : () => number +>c : ClassGetterDecoratorContext number> & { name: "#x"; private: true; static: true; } + + static get #x() { return 1; } +>#x : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "#x"; private: true; static: true; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "#x"; private: true; static: true; }) => void +>t : (value: number) => void +>c : ClassSetterDecoratorContext void> & { name: "#x"; private: true; static: true; } + + static set #x(value) { } +>#x : number +>value : number + + @((t, c) => { }) +>((t, c) => { }) : (t: number, c: ClassAccessorDecoratorContext & { name: "y"; private: false; static: true; }) => void +>(t, c) => { } : (t: number, c: ClassAccessorDecoratorContext & { name: "y"; private: false; static: true; }) => void +>t : number +>c : ClassAccessorDecoratorContext & { name: "y"; private: false; static: true; } + + static accessor y = 1; +>y : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: number, c: ClassAccessorDecoratorContext & { name: "#y"; private: true; static: true; }) => void +>(t, c) => { } : (t: number, c: ClassAccessorDecoratorContext & { name: "#y"; private: true; static: true; }) => void +>t : number +>c : ClassAccessorDecoratorContext & { name: "#y"; private: true; static: true; } + + static accessor #y = 1; +>#y : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: number, c: ClassFieldDecoratorContext & { name: "z"; private: false; static: true; }) => void +>(t, c) => { } : (t: number, c: ClassFieldDecoratorContext & { name: "z"; private: false; static: true; }) => void +>t : number +>c : ClassFieldDecoratorContext & { name: "z"; private: false; static: true; } + + static z = 1; +>z : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: number, c: ClassFieldDecoratorContext & { name: "#z"; private: true; static: true; }) => void +>(t, c) => { } : (t: number, c: ClassFieldDecoratorContext & { name: "#z"; private: true; static: true; }) => void +>t : number +>c : ClassFieldDecoratorContext & { name: "#z"; private: true; static: true; } + + static #z = 1; +>#z : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: () => void, c: ClassMethodDecoratorContext void> & { name: "g"; private: false; static: false; }) => void +>(t, c) => { } : (t: () => void, c: ClassMethodDecoratorContext void> & { name: "g"; private: false; static: false; }) => void +>t : () => void +>c : ClassMethodDecoratorContext void> & { name: "g"; private: false; static: false; } + + g() {} +>g : () => void + + @((t, c) => { }) +>((t, c) => { }) : (t: () => void, c: ClassMethodDecoratorContext void> & { name: "#g"; private: true; static: false; }) => void +>(t, c) => { } : (t: () => void, c: ClassMethodDecoratorContext void> & { name: "#g"; private: true; static: false; }) => void +>t : () => void +>c : ClassMethodDecoratorContext void> & { name: "#g"; private: true; static: false; } + + #g() {} +>#g : () => void + + @((t, c) => { }) +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "a"; private: false; static: false; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "a"; private: false; static: false; }) => void +>t : () => number +>c : ClassGetterDecoratorContext number> & { name: "a"; private: false; static: false; } + + get a() { return 1; } +>a : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "a"; private: false; static: false; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "a"; private: false; static: false; }) => void +>t : (value: number) => void +>c : ClassSetterDecoratorContext void> & { name: "a"; private: false; static: false; } + + set a(value) { } +>a : number +>value : number + + @((t, c) => { }) +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "#a"; private: true; static: false; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "#a"; private: true; static: false; }) => void +>t : () => number +>c : ClassGetterDecoratorContext number> & { name: "#a"; private: true; static: false; } + + get #a() { return 1; } +>#a : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "#a"; private: true; static: false; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "#a"; private: true; static: false; }) => void +>t : (value: number) => void +>c : ClassSetterDecoratorContext void> & { name: "#a"; private: true; static: false; } + + set #a(value) { } +>#a : number +>value : number + + @((t, c) => { }) +>((t, c) => { }) : (t: number, c: ClassAccessorDecoratorContext & { name: "b"; private: false; static: false; }) => void +>(t, c) => { } : (t: number, c: ClassAccessorDecoratorContext & { name: "b"; private: false; static: false; }) => void +>t : number +>c : ClassAccessorDecoratorContext & { name: "b"; private: false; static: false; } + + accessor b = 1; +>b : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: number, c: ClassAccessorDecoratorContext & { name: "#b"; private: true; static: false; }) => void +>(t, c) => { } : (t: number, c: ClassAccessorDecoratorContext & { name: "#b"; private: true; static: false; }) => void +>t : number +>c : ClassAccessorDecoratorContext & { name: "#b"; private: true; static: false; } + + accessor #b = 1; +>#b : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: number, c: ClassFieldDecoratorContext & { name: "c"; private: false; static: false; }) => void +>(t, c) => { } : (t: number, c: ClassFieldDecoratorContext & { name: "c"; private: false; static: false; }) => void +>t : number +>c : ClassFieldDecoratorContext & { name: "c"; private: false; static: false; } + + c = 1; +>c : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: number, c: ClassFieldDecoratorContext & { name: "#c"; private: true; static: false; }) => void +>(t, c) => { } : (t: number, c: ClassFieldDecoratorContext & { name: "#c"; private: true; static: false; }) => void +>t : number +>c : ClassFieldDecoratorContext & { name: "#c"; private: true; static: false; } + + #c = 1; +>#c : number +>1 : 1 +} diff --git a/tests/cases/conformance/esDecorators/esDecorators-contextualTypes.ts b/tests/cases/conformance/esDecorators/esDecorators-contextualTypes.ts new file mode 100644 index 0000000000000..1f629459d97fa --- /dev/null +++ b/tests/cases/conformance/esDecorators/esDecorators-contextualTypes.ts @@ -0,0 +1,64 @@ +// @target: esnext + +@((t, c) => { }) +class C { + @((t, c) => { }) + static f() {} + + @((t, c) => { }) + static #f() {} + + @((t, c) => { }) + static get x() { return 1; } + + @((t, c) => { }) + static set x(value) { } + + @((t, c) => { }) + static get #x() { return 1; } + + @((t, c) => { }) + static set #x(value) { } + + @((t, c) => { }) + static accessor y = 1; + + @((t, c) => { }) + static accessor #y = 1; + + @((t, c) => { }) + static z = 1; + + @((t, c) => { }) + static #z = 1; + + @((t, c) => { }) + g() {} + + @((t, c) => { }) + #g() {} + + @((t, c) => { }) + get a() { return 1; } + + @((t, c) => { }) + set a(value) { } + + @((t, c) => { }) + get #a() { return 1; } + + @((t, c) => { }) + set #a(value) { } + + @((t, c) => { }) + accessor b = 1; + + @((t, c) => { }) + accessor #b = 1; + + @((t, c) => { }) + c = 1; + + @((t, c) => { }) + #c = 1; +} \ No newline at end of file From 8f3ee6aa34bd2c327711b1169b64e8e9484c854f Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 10 Oct 2022 11:53:17 -0400 Subject: [PATCH 16/51] Improve comment preservation --- src/compiler/emitter.ts | 36 ++- src/compiler/factory/utilities.ts | 2 +- src/compiler/transformers/classFields.ts | 7 + src/compiler/transformers/esDecorators.ts | 36 +-- ...ecorators-classDeclaration-classSuper.2.js | 3 + ...ecorators-classDeclaration-classSuper.6.js | 1 + ...ervation(module=commonjs,target=es2015).js | 275 ++++++++++++++++++ ...ervation(module=commonjs,target=es2022).js | 264 +++++++++++++++++ ...ervation(module=commonjs,target=esnext).js | 231 +++++++++++++++ ...eservation(module=esnext,target=es2015).js | 272 +++++++++++++++++ ...eservation(module=esnext,target=es2022).js | 261 +++++++++++++++++ ...eservation(module=esnext,target=esnext).js | 223 ++++++++++++++ ...sion-commentPreservation(target=es2015).js | 169 +++++++++++ ...sion-commentPreservation(target=es2022).js | 162 +++++++++++ ...sion-commentPreservation(target=esnext).js | 154 ++++++++++ ...rs-classDeclaration-commentPreservation.ts | 125 ++++++++ ...ors-classExpression-commentPreservation.ts | 86 ++++++ 17 files changed, 2271 insertions(+), 36 deletions(-) create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=esnext).js create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-commentPreservation.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 3b2856e1e6fc3..e4f76a65c79ad 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2160,8 +2160,9 @@ namespace ts { } function emitAccessorDeclaration(node: AccessorDeclaration) { - emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === SyntaxKind.GetAccessor ? "get" : "set"); + const pos = emitDecoratorsAndModifiers(node, node.modifiers); + const token = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.GetKeyword : SyntaxKind.SetKeyword; + emitTokenWithComment(token, pos, writeKeyword, node); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -3325,7 +3326,7 @@ namespace ts { forEach(node.members, generateMemberNames); emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword("class"); + emitTokenWithComment(SyntaxKind.ClassKeyword, moveRangePastModifiers(node).pos, writeKeyword, node); if (node.name) { writeSpace(); emitIdentifierName(node.name); @@ -4252,10 +4253,11 @@ namespace ts { let mode: "modifiers" | "decorators" | undefined; let start = 0; let pos = 0; + let lastModifier: ModifierLike | undefined; while (start < modifiers.length) { while (pos < modifiers.length) { - const modifier = modifiers[pos]; - mode = isDecorator(modifier) ? "decorators" : "modifiers"; + lastModifier = modifiers[pos]; + mode = isDecorator(lastModifier) ? "decorators" : "modifiers"; if (lastMode === undefined) { lastMode = mode; } @@ -4285,11 +4287,19 @@ namespace ts { } onAfterEmitNodeArray?.(modifiers); + + if (lastModifier && !positionIsSynthesized(lastModifier.end)) { + return lastModifier.end; + } } + + return node.pos; } - function emitModifiers(node: Node, modifiers: NodeArray | undefined): void { + function emitModifiers(node: Node, modifiers: NodeArray | undefined): number { emitList(node, modifiers, ListFormat.Modifiers); + const lastModifier = lastOrUndefined(modifiers); + return lastModifier && !positionIsSynthesized(lastModifier.end) ? lastModifier.end : node.pos; } function emitTypeAnnotation(node: TypeNode | undefined) { @@ -4355,8 +4365,10 @@ namespace ts { } } - function emitDecorators(parentNode: Node, decorators: NodeArray | undefined): void { + function emitDecorators(parentNode: Node, decorators: NodeArray | undefined): number { emitList(parentNode, decorators, ListFormat.Decorators); + const lastDecorator = lastOrUndefined(decorators); + return lastDecorator && !positionIsSynthesized(lastDecorator.end) ? lastDecorator.end : parentNode.pos; } function emitTypeArguments(parentNode: Node, typeArguments: NodeArray | undefined) { @@ -4507,6 +4519,7 @@ namespace ts { // Emit each child. let previousSibling: Node | undefined; + let previousSiblingEmitFlags: EmitFlags | undefined; let previousSourceFileTextKind: ReturnType; let shouldDecreaseIndentAfterEmit = false; for (let i = 0; i < count; i++) { @@ -4526,8 +4539,12 @@ namespace ts { // /* End of parameter a */ -> this comment isn't considered to be trailing comment of parameter "a" due to newline // , if (format & ListFormat.DelimitersMask && previousSibling.end !== (parentNode ? parentNode.end : -1)) { - emitLeadingCommentsOfPosition(previousSibling.end); + previousSiblingEmitFlags = getEmitFlags(previousSibling); + if (!(previousSiblingEmitFlags & EmitFlags.NoTrailingComments)) { + emitLeadingCommentsOfPosition(previousSibling.end); + } } + writeDelimiter(format); recordBundleFileInternalSectionEnd(previousSourceFileTextKind); @@ -4568,10 +4585,11 @@ namespace ts { } previousSibling = child; + previousSiblingEmitFlags = undefined; } // Write a trailing comma, if requested. - const emitFlags = previousSibling ? getEmitFlags(previousSibling) : 0; + const emitFlags = previousSibling ? previousSiblingEmitFlags ?? getEmitFlags(previousSibling) : 0; const skipTrailingComments = commentsDisabled || !!(emitFlags & EmitFlags.NoTrailingComments); const emitTrailingComma = hasTrailingComma && (format & ListFormat.AllowTrailingComma) && (format & ListFormat.CommaDelimited); if (emitTrailingComma) { diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 02a806cc05ee1..6800cef1ad4db 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -18,7 +18,7 @@ namespace ts { : factory.createElementAccessExpression(target, memberName), memberName ); - getOrCreateEmitNode(expression).flags |= EmitFlags.NoNestedSourceMaps; + addEmitFlags(expression, EmitFlags.NoNestedSourceMaps); return expression; } } diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index af4425a93f3e3..99d0f6e7af53c 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -2050,6 +2050,12 @@ namespace ts { setSyntheticLeadingComments(expression, undefined); setSyntheticTrailingComments(expression, undefined); + // If the property was originally an auto-accessor, don't emit comments here since they will be attached to + // the synthezized getter. + if (hasAccessorModifier(getOriginalNode(property))) { + addEmitFlags(statement, EmitFlags.NoComments); + } + return statement; } @@ -2169,6 +2175,7 @@ namespace ts { if (emitAssignment || isPrivateIdentifier(propertyName)) { const memberAccess = createMemberAccessForPropertyName(factory, receiver, propertyName, /*location*/ propertyName); + addEmitFlags(memberAccess, EmitFlags.NoLeadingComments); return factory.createAssignment(memberAccess, initializer); } else { diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index a6575b21f952f..fb40b876fcc23 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -761,12 +761,13 @@ namespace ts { if (hasSyntacticModifier(node, ModifierFlags.Export) && hasSyntacticModifier(node, ModifierFlags.Default)) { // export default (() => { ... })(); - // TODO(rbuckton): Why do we end up with a `default_1` class name for an `export default class {}` after the TS transform? const originalClass = getOriginalNode(node, isClassLike) ?? node; const className = originalClass.name ? factory.createStringLiteralFromNode(originalClass.name) : factory.createStringLiteral("default"); const iife = transformClassLike(node, className); const statement = factory.createExportDefault(iife); setOriginalNode(statement, node); + setCommentRange(statement, getCommentRange(node)); + setSourceMapRange(statement, moveRangePastDecorators(node)); return statement; } else { @@ -778,6 +779,7 @@ namespace ts { const varDecls = factory.createVariableDeclarationList([varDecl], NodeFlags.Let); const statement = factory.createVariableStatement(modifiers, varDecls); setOriginalNode(statement, node); + setCommentRange(statement, getCommentRange(node)); return statement; } } @@ -1064,6 +1066,10 @@ namespace ts { exitName(); } + if (!some(modifiers) && (isMethodDeclaration(member) || isPropertyDeclaration(member))) { + setEmitFlags(name, EmitFlags.NoLeadingComments); + } + return { modifiers, referencedName, name, initializersName, descriptorName, thisArg }; } @@ -1825,7 +1831,6 @@ namespace ts { const decoratorExpressions: Expression[] = []; addRange(decoratorExpressions, map(allDecorators.decorators, transformDecorator)); - addRange(decoratorExpressions, flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); return decoratorExpressions; } @@ -1835,30 +1840,9 @@ namespace ts { * @param decorator The decorator node. */ function transformDecorator(decorator: Decorator) { - return visitNode(decorator.expression, visitor, isExpression); - } - - /** - * Transforms the decorators of a parameter. - * - * @param decorators The decorators for the parameter at the provided offset. - * @param parameterOffset The offset of the parameter. - */ - function transformDecoratorsOfParameter(decorators: Decorator[], parameterOffset: number) { - let expressions: Expression[] | undefined; - if (decorators) { - expressions = []; - for (const decorator of decorators) { - const helper = emitHelpers().createParamHelper( - transformDecorator(decorator), - parameterOffset); - setTextRange(helper, decorator.expression); - setEmitFlags(helper, EmitFlags.NoComments); - expressions.push(helper); - } - } - - return expressions; + const expression = visitNode(decorator.expression, visitor, isExpression); + setEmitFlags(expression, EmitFlags.NoComments); + return expression; } /** diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js index 9ee976f86a971..a8ac1577f4231 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js @@ -27,6 +27,7 @@ class C3 extends ((() => {}) as any) { //// [esDecorators-classDeclaration-classSuper.2.js] +// class expression in extends should not get an assigned name let C1 = (() => { let _classDecorators = [dec]; let _classDescriptor; @@ -48,6 +49,7 @@ let C1 = (() => { }; return C1 = _classThis; })(); +// function expression in extends should not get an assigned name let C2 = (() => { let _classDecorators_1 = [dec]; let _classDescriptor_1; @@ -68,6 +70,7 @@ let C2 = (() => { }; return C2 = _classThis_1; })(); +// arrow function in extends should not get an assigned name let C3 = (() => { let _classDecorators_2 = [dec]; let _classDescriptor_2; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js index 5e1dde0ab4600..61caf27db40e2 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js @@ -26,6 +26,7 @@ class C extends Base { //// [esDecorators-classDeclaration-classSuper.6.js] +// none of the following should result in caching `super` let C = (() => { let _classDecorators = [dec]; let _classDescriptor; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js new file mode 100644 index 0000000000000..b19fdc0eba633 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js @@ -0,0 +1,275 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts] //// + +//// [file1.ts] +declare var dec: any; + +/*1*/ +@dec +/*2*/ +@dec +/*3*/ +class C { + /*4*/ + @dec + /*5*/ + @dec + /*6*/ + method() {} + + /*7*/ + @dec + /*8*/ + @dec + /*9*/ + get x() { return 1; } + + /*10*/ + @dec + /*11*/ + @dec + /*12*/ + set x(value: number) { } + + /*13*/ + @dec + /*14*/ + @dec + /*15*/ + y = 1; + + /*16*/ + @dec + /*17*/ + @dec + /*18*/ + accessor z = 1; + + /*19*/ + @dec + /*20*/ + @dec + /*21*/ + static #method() {} + + /*22*/ + @dec + /*23*/ + @dec + /*24*/ + static get #x() { return 1; } + + /*25*/ + @dec + /*26*/ + @dec + /*27*/ + static set #x(value: number) { } + + /*28*/ + @dec + /*29*/ + @dec + /*30*/ + static #y = 1; + + /*31*/ + @dec + /*32*/ + @dec + /*33*/ + static accessor #z = 1; +} + +//// [file2.ts] +/*34*/ +@dec +/*35*/ +@dec +/*36*/ +export class D { +} + +/*37*/ +@dec +/*38*/ +@dec +/*39*/ +export default class E { +} + +//// [file3.ts] +/*40*/ +export +/*41*/ +@dec +/*42*/ +@dec +/*43*/ +class F { +} + +/*44*/ +export default +/*45*/ +@dec +/*46*/ +@dec +/*47*/ +class G { +} + + +//// [file1.js] +/*1*/ +let C = (() => { + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_private_method_decorators; + let _static_private_method_descriptor; + let _static_private_get_x_decorators; + let _static_private_get_x_descriptor; + let _static_private_set_x_decorators; + let _static_private_set_x_descriptor; + let _static_private_y_decorators; + let _static_private_y_initializers = []; + let _static_private_z_decorators; + let _static_private_z_initializers = []; + let _static_private_z_descriptor; + let _method_decorators; + let _get_x_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + let _z_decorators; + let _z_initializers = []; + var C = _classThis = class { + constructor() { + /*13*/ + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + _z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); + } + /*4*/ + method() { } + /*7*/ + get x() { return 1; } + /*10*/ + set x(value) { } + /*16*/ + get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } + set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + }; + _z_1_accessor_storage = new WeakMap(); + _method_get = function _method_get() { return _static_private_method_descriptor.value; }; + _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }; + _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }; + _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }; + _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; + __setFunctionName(_classThis, "C"); + (() => { + _method_decorators = [dec, dec]; + _get_x_decorators = [dec, dec]; + _set_x_decorators = [dec, dec]; + _y_decorators = [dec, dec]; + _z_decorators = [dec, dec]; + _static_private_method_decorators = [dec, dec]; + _static_private_get_x_decorators = [dec, dec]; + _static_private_set_x_decorators = [dec, dec]; + _static_private_y_decorators = [dec, dec]; + _static_private_z_decorators = [dec, dec]; + __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + })(); + /*28*/ + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); + return C = _classThis; +})(); +//// [file2.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.D = void 0; +/*34*/ +exports.D = (() => { + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = _classThis = class { + }; + __setFunctionName(_classThis, "D"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); + return D = _classThis; +})(); +exports.default = (() => { + let _classDecorators_1 = [dec, dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var E = _classThis_1 = class { + }; + __setFunctionName(_classThis_1, "E"); + (() => { + __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); + E = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(); + return E = _classThis_1; +})(); +//// [file3.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.F = void 0; +/*40*/ +exports.F = (() => { + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var F = _classThis = class { + }; + __setFunctionName(_classThis, "F"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + F = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); + return F = _classThis; +})(); +exports.default = (() => { + let _classDecorators_1 = [dec, dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var G = _classThis_1 = class { + }; + __setFunctionName(_classThis_1, "G"); + (() => { + __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); + G = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(); + return G = _classThis_1; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js new file mode 100644 index 0000000000000..d053c26a69a78 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js @@ -0,0 +1,264 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts] //// + +//// [file1.ts] +declare var dec: any; + +/*1*/ +@dec +/*2*/ +@dec +/*3*/ +class C { + /*4*/ + @dec + /*5*/ + @dec + /*6*/ + method() {} + + /*7*/ + @dec + /*8*/ + @dec + /*9*/ + get x() { return 1; } + + /*10*/ + @dec + /*11*/ + @dec + /*12*/ + set x(value: number) { } + + /*13*/ + @dec + /*14*/ + @dec + /*15*/ + y = 1; + + /*16*/ + @dec + /*17*/ + @dec + /*18*/ + accessor z = 1; + + /*19*/ + @dec + /*20*/ + @dec + /*21*/ + static #method() {} + + /*22*/ + @dec + /*23*/ + @dec + /*24*/ + static get #x() { return 1; } + + /*25*/ + @dec + /*26*/ + @dec + /*27*/ + static set #x(value: number) { } + + /*28*/ + @dec + /*29*/ + @dec + /*30*/ + static #y = 1; + + /*31*/ + @dec + /*32*/ + @dec + /*33*/ + static accessor #z = 1; +} + +//// [file2.ts] +/*34*/ +@dec +/*35*/ +@dec +/*36*/ +export class D { +} + +/*37*/ +@dec +/*38*/ +@dec +/*39*/ +export default class E { +} + +//// [file3.ts] +/*40*/ +export +/*41*/ +@dec +/*42*/ +@dec +/*43*/ +class F { +} + +/*44*/ +export default +/*45*/ +@dec +/*46*/ +@dec +/*47*/ +class G { +} + + +//// [file1.js] +/*1*/ +let C = (() => { + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_private_method_decorators; + let _static_private_method_descriptor; + let _static_private_get_x_decorators; + let _static_private_get_x_descriptor; + let _static_private_set_x_decorators; + let _static_private_set_x_descriptor; + let _static_private_y_decorators; + let _static_private_y_initializers = []; + let _static_private_z_decorators; + let _static_private_z_initializers = []; + let _static_private_z_descriptor; + let _method_decorators; + let _get_x_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + let _z_decorators; + let _z_initializers = []; + var C = class { + static { __setFunctionName(this, "C"); } + static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } + static { + _method_decorators = [dec, dec]; + _get_x_decorators = [dec, dec]; + _set_x_decorators = [dec, dec]; + _y_decorators = [dec, dec]; + _z_decorators = [dec, dec]; + _static_private_method_decorators = [dec, dec]; + _static_private_get_x_decorators = [dec, dec]; + _static_private_set_x_decorators = [dec, dec]; + _static_private_y_decorators = [dec, dec]; + _static_private_z_decorators = [dec, dec]; + __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + } + /*4*/ + method() { } + /*7*/ + get x() { return 1; } + /*10*/ + set x(value) { } + /*13*/ + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); + /*16*/ + get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } + set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + /*28*/ + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + return C = _classThis; +})(); +//// [file2.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.D = void 0; +/*34*/ +exports.D = (() => { + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return D = _classThis; +})(); +exports.default = (() => { + let _classDecorators_1 = [dec, dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var E = class { + static { + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + E = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return E = _classThis_1; +})(); +//// [file3.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.F = void 0; +/*40*/ +exports.F = (() => { + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var F = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + F = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return F = _classThis; +})(); +exports.default = (() => { + let _classDecorators_1 = [dec, dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var G = class { + static { + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + G = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return G = _classThis_1; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).js new file mode 100644 index 0000000000000..4008d7e6d3fbb --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).js @@ -0,0 +1,231 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts] //// + +//// [file1.ts] +declare var dec: any; + +/*1*/ +@dec +/*2*/ +@dec +/*3*/ +class C { + /*4*/ + @dec + /*5*/ + @dec + /*6*/ + method() {} + + /*7*/ + @dec + /*8*/ + @dec + /*9*/ + get x() { return 1; } + + /*10*/ + @dec + /*11*/ + @dec + /*12*/ + set x(value: number) { } + + /*13*/ + @dec + /*14*/ + @dec + /*15*/ + y = 1; + + /*16*/ + @dec + /*17*/ + @dec + /*18*/ + accessor z = 1; + + /*19*/ + @dec + /*20*/ + @dec + /*21*/ + static #method() {} + + /*22*/ + @dec + /*23*/ + @dec + /*24*/ + static get #x() { return 1; } + + /*25*/ + @dec + /*26*/ + @dec + /*27*/ + static set #x(value: number) { } + + /*28*/ + @dec + /*29*/ + @dec + /*30*/ + static #y = 1; + + /*31*/ + @dec + /*32*/ + @dec + /*33*/ + static accessor #z = 1; +} + +//// [file2.ts] +/*34*/ +@dec +/*35*/ +@dec +/*36*/ +export class D { +} + +/*37*/ +@dec +/*38*/ +@dec +/*39*/ +export default class E { +} + +//// [file3.ts] +/*40*/ +export +/*41*/ +@dec +/*42*/ +@dec +/*43*/ +class F { +} + +/*44*/ +export default +/*45*/ +@dec +/*46*/ +@dec +/*47*/ +class G { +} + + +//// [file1.js] +/*1*/ +@dec +/*2*/ +@dec +/*3*/ +class C { + /*4*/ + @dec + /*5*/ + @dec + /*6*/ + method() { } + /*7*/ + @dec + /*8*/ + @dec + /*9*/ + get x() { return 1; } + /*10*/ + @dec + /*11*/ + @dec + /*12*/ + set x(value) { } + /*13*/ + @dec + /*14*/ + @dec + /*15*/ + y = 1; + /*16*/ + @dec + /*17*/ + @dec + /*18*/ + accessor z = 1; + /*19*/ + @dec + /*20*/ + @dec + /*21*/ + static #method() { } + /*22*/ + @dec + /*23*/ + @dec + /*24*/ + static get #x() { return 1; } + /*25*/ + @dec + /*26*/ + @dec + /*27*/ + static set #x(value) { } + /*28*/ + @dec + /*29*/ + @dec + /*30*/ + static #y = 1; + /*31*/ + @dec + /*32*/ + @dec + /*33*/ + static accessor #z = 1; +} +//// [file2.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.D = void 0; +/*34*/ +@dec +/*35*/ +@dec +/*36*/ +class D { +} +exports.D = D; +/*37*/ +@dec +/*38*/ +@dec +/*39*/ +class E { +} +exports.default = E; +//// [file3.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.F = void 0; +/*40*/ +/*41*/ +@dec +/*42*/ +@dec +/*43*/ +class F { +} +exports.F = F; +/*44*/ +/*45*/ +@dec +/*46*/ +@dec +/*47*/ +class G { +} +exports.default = G; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js new file mode 100644 index 0000000000000..daafd28f72db7 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js @@ -0,0 +1,272 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts] //// + +//// [file1.ts] +declare var dec: any; + +/*1*/ +@dec +/*2*/ +@dec +/*3*/ +class C { + /*4*/ + @dec + /*5*/ + @dec + /*6*/ + method() {} + + /*7*/ + @dec + /*8*/ + @dec + /*9*/ + get x() { return 1; } + + /*10*/ + @dec + /*11*/ + @dec + /*12*/ + set x(value: number) { } + + /*13*/ + @dec + /*14*/ + @dec + /*15*/ + y = 1; + + /*16*/ + @dec + /*17*/ + @dec + /*18*/ + accessor z = 1; + + /*19*/ + @dec + /*20*/ + @dec + /*21*/ + static #method() {} + + /*22*/ + @dec + /*23*/ + @dec + /*24*/ + static get #x() { return 1; } + + /*25*/ + @dec + /*26*/ + @dec + /*27*/ + static set #x(value: number) { } + + /*28*/ + @dec + /*29*/ + @dec + /*30*/ + static #y = 1; + + /*31*/ + @dec + /*32*/ + @dec + /*33*/ + static accessor #z = 1; +} + +//// [file2.ts] +/*34*/ +@dec +/*35*/ +@dec +/*36*/ +export class D { +} + +/*37*/ +@dec +/*38*/ +@dec +/*39*/ +export default class E { +} + +//// [file3.ts] +/*40*/ +export +/*41*/ +@dec +/*42*/ +@dec +/*43*/ +class F { +} + +/*44*/ +export default +/*45*/ +@dec +/*46*/ +@dec +/*47*/ +class G { +} + + +//// [file1.js] +/*1*/ +let C = (() => { + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_private_method_decorators; + let _static_private_method_descriptor; + let _static_private_get_x_decorators; + let _static_private_get_x_descriptor; + let _static_private_set_x_decorators; + let _static_private_set_x_descriptor; + let _static_private_y_decorators; + let _static_private_y_initializers = []; + let _static_private_z_decorators; + let _static_private_z_initializers = []; + let _static_private_z_descriptor; + let _method_decorators; + let _get_x_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + let _z_decorators; + let _z_initializers = []; + var C = _classThis = class { + constructor() { + /*13*/ + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + _z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); + } + /*4*/ + method() { } + /*7*/ + get x() { return 1; } + /*10*/ + set x(value) { } + /*16*/ + get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } + set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + }; + _z_1_accessor_storage = new WeakMap(); + _method_get = function _method_get() { return _static_private_method_descriptor.value; }; + _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }; + _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }; + _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }; + _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; + __setFunctionName(_classThis, "C"); + (() => { + _method_decorators = [dec, dec]; + _get_x_decorators = [dec, dec]; + _set_x_decorators = [dec, dec]; + _y_decorators = [dec, dec]; + _z_decorators = [dec, dec]; + _static_private_method_decorators = [dec, dec]; + _static_private_get_x_decorators = [dec, dec]; + _static_private_set_x_decorators = [dec, dec]; + _static_private_y_decorators = [dec, dec]; + _static_private_z_decorators = [dec, dec]; + __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + })(); + /*28*/ + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); + return C = _classThis; +})(); +//// [file2.js] +/*34*/ +/*36*/ +export let D = (() => { + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = _classThis = class { + }; + __setFunctionName(_classThis, "D"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); + return D = _classThis; +})(); +/*37*/ +export default (() => { + let _classDecorators_1 = [dec, dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var E = _classThis_1 = class { + }; + __setFunctionName(_classThis_1, "E"); + (() => { + __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); + E = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(); + return E = _classThis_1; +})(); +//// [file3.js] +/*40*/ +export let F = (() => { + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var F = _classThis = class { + }; + __setFunctionName(_classThis, "F"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + F = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); + return F = _classThis; +})(); +/*44*/ +export default (() => { + let _classDecorators_1 = [dec, dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var G = _classThis_1 = class { + }; + __setFunctionName(_classThis_1, "G"); + (() => { + __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); + G = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(); + return G = _classThis_1; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js new file mode 100644 index 0000000000000..ef3e6f39ee1d2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js @@ -0,0 +1,261 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts] //// + +//// [file1.ts] +declare var dec: any; + +/*1*/ +@dec +/*2*/ +@dec +/*3*/ +class C { + /*4*/ + @dec + /*5*/ + @dec + /*6*/ + method() {} + + /*7*/ + @dec + /*8*/ + @dec + /*9*/ + get x() { return 1; } + + /*10*/ + @dec + /*11*/ + @dec + /*12*/ + set x(value: number) { } + + /*13*/ + @dec + /*14*/ + @dec + /*15*/ + y = 1; + + /*16*/ + @dec + /*17*/ + @dec + /*18*/ + accessor z = 1; + + /*19*/ + @dec + /*20*/ + @dec + /*21*/ + static #method() {} + + /*22*/ + @dec + /*23*/ + @dec + /*24*/ + static get #x() { return 1; } + + /*25*/ + @dec + /*26*/ + @dec + /*27*/ + static set #x(value: number) { } + + /*28*/ + @dec + /*29*/ + @dec + /*30*/ + static #y = 1; + + /*31*/ + @dec + /*32*/ + @dec + /*33*/ + static accessor #z = 1; +} + +//// [file2.ts] +/*34*/ +@dec +/*35*/ +@dec +/*36*/ +export class D { +} + +/*37*/ +@dec +/*38*/ +@dec +/*39*/ +export default class E { +} + +//// [file3.ts] +/*40*/ +export +/*41*/ +@dec +/*42*/ +@dec +/*43*/ +class F { +} + +/*44*/ +export default +/*45*/ +@dec +/*46*/ +@dec +/*47*/ +class G { +} + + +//// [file1.js] +/*1*/ +let C = (() => { + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_private_method_decorators; + let _static_private_method_descriptor; + let _static_private_get_x_decorators; + let _static_private_get_x_descriptor; + let _static_private_set_x_decorators; + let _static_private_set_x_descriptor; + let _static_private_y_decorators; + let _static_private_y_initializers = []; + let _static_private_z_decorators; + let _static_private_z_initializers = []; + let _static_private_z_descriptor; + let _method_decorators; + let _get_x_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + let _z_decorators; + let _z_initializers = []; + var C = class { + static { __setFunctionName(this, "C"); } + static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } + static { + _method_decorators = [dec, dec]; + _get_x_decorators = [dec, dec]; + _set_x_decorators = [dec, dec]; + _y_decorators = [dec, dec]; + _z_decorators = [dec, dec]; + _static_private_method_decorators = [dec, dec]; + _static_private_get_x_decorators = [dec, dec]; + _static_private_set_x_decorators = [dec, dec]; + _static_private_y_decorators = [dec, dec]; + _static_private_z_decorators = [dec, dec]; + __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + } + /*4*/ + method() { } + /*7*/ + get x() { return 1; } + /*10*/ + set x(value) { } + /*13*/ + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); + /*16*/ + get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } + set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + /*28*/ + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + return C = _classThis; +})(); +//// [file2.js] +/*34*/ +/*36*/ +export let D = (() => { + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return D = _classThis; +})(); +/*37*/ +export default (() => { + let _classDecorators_1 = [dec, dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var E = class { + static { + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + E = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return E = _classThis_1; +})(); +//// [file3.js] +/*40*/ +export let F = (() => { + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var F = class { + static { + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + F = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return F = _classThis; +})(); +/*44*/ +export default (() => { + let _classDecorators_1 = [dec, dec]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + var G = class { + static { + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + G = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return G = _classThis_1; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=esnext).js new file mode 100644 index 0000000000000..d56f696134740 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=esnext).js @@ -0,0 +1,223 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts] //// + +//// [file1.ts] +declare var dec: any; + +/*1*/ +@dec +/*2*/ +@dec +/*3*/ +class C { + /*4*/ + @dec + /*5*/ + @dec + /*6*/ + method() {} + + /*7*/ + @dec + /*8*/ + @dec + /*9*/ + get x() { return 1; } + + /*10*/ + @dec + /*11*/ + @dec + /*12*/ + set x(value: number) { } + + /*13*/ + @dec + /*14*/ + @dec + /*15*/ + y = 1; + + /*16*/ + @dec + /*17*/ + @dec + /*18*/ + accessor z = 1; + + /*19*/ + @dec + /*20*/ + @dec + /*21*/ + static #method() {} + + /*22*/ + @dec + /*23*/ + @dec + /*24*/ + static get #x() { return 1; } + + /*25*/ + @dec + /*26*/ + @dec + /*27*/ + static set #x(value: number) { } + + /*28*/ + @dec + /*29*/ + @dec + /*30*/ + static #y = 1; + + /*31*/ + @dec + /*32*/ + @dec + /*33*/ + static accessor #z = 1; +} + +//// [file2.ts] +/*34*/ +@dec +/*35*/ +@dec +/*36*/ +export class D { +} + +/*37*/ +@dec +/*38*/ +@dec +/*39*/ +export default class E { +} + +//// [file3.ts] +/*40*/ +export +/*41*/ +@dec +/*42*/ +@dec +/*43*/ +class F { +} + +/*44*/ +export default +/*45*/ +@dec +/*46*/ +@dec +/*47*/ +class G { +} + + +//// [file1.js] +/*1*/ +@dec +/*2*/ +@dec +/*3*/ +class C { + /*4*/ + @dec + /*5*/ + @dec + /*6*/ + method() { } + /*7*/ + @dec + /*8*/ + @dec + /*9*/ + get x() { return 1; } + /*10*/ + @dec + /*11*/ + @dec + /*12*/ + set x(value) { } + /*13*/ + @dec + /*14*/ + @dec + /*15*/ + y = 1; + /*16*/ + @dec + /*17*/ + @dec + /*18*/ + accessor z = 1; + /*19*/ + @dec + /*20*/ + @dec + /*21*/ + static #method() { } + /*22*/ + @dec + /*23*/ + @dec + /*24*/ + static get #x() { return 1; } + /*25*/ + @dec + /*26*/ + @dec + /*27*/ + static set #x(value) { } + /*28*/ + @dec + /*29*/ + @dec + /*30*/ + static #y = 1; + /*31*/ + @dec + /*32*/ + @dec + /*33*/ + static accessor #z = 1; +} +//// [file2.js] +/*34*/ +@dec +/*35*/ +@dec +/*36*/ +export class D { +} +/*37*/ +@dec +/*38*/ +@dec +/*39*/ +export default class E { +} +//// [file3.js] +/*40*/ +export +/*41*/ +@dec +/*42*/ +@dec +/*43*/ +class F { +} +/*44*/ +export default +/*45*/ +@dec +/*46*/ +@dec +/*47*/ +class G { +} diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js new file mode 100644 index 0000000000000..b8a52016fb320 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js @@ -0,0 +1,169 @@ +//// [esDecorators-classExpression-commentPreservation.ts] +declare var dec: any; + +/*1*/ +( +/*2*/ +@dec +/*3*/ +@dec +/*4*/ +class C { + /*5*/ + @dec + /*6*/ + @dec + /*7*/ + method() {} + + /*8*/ + @dec + /*9*/ + @dec + /*10*/ + get x() { return 1; } + + /*11*/ + @dec + /*12*/ + @dec + /*13*/ + set x(value: number) { } + + /*14*/ + @dec + /*15*/ + @dec + /*16*/ + y = 1; + + /*17*/ + @dec + /*18*/ + @dec + /*19*/ + accessor z = 1; + + /*20*/ + @dec + /*21*/ + @dec + /*22*/ + static #method() {} + + /*23*/ + @dec + /*24*/ + @dec + /*25*/ + static get #x() { return 1; } + + /*26*/ + @dec + /*27*/ + @dec + /*28*/ + static set #x(value: number) { } + + /*29*/ + @dec + /*30*/ + @dec + /*31*/ + static #y = 1; + + /*32*/ + @dec + /*33*/ + @dec + /*34*/ + static accessor #z = 1; +} +); + + +//// [esDecorators-classExpression-commentPreservation.js] +/*1*/ +((() => { + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_private_method_decorators; + let _static_private_method_descriptor; + let _static_private_get_x_decorators; + let _static_private_get_x_descriptor; + let _static_private_set_x_decorators; + let _static_private_set_x_descriptor; + let _static_private_y_decorators; + let _static_private_y_initializers = []; + let _static_private_z_decorators; + let _static_private_z_initializers = []; + let _static_private_z_descriptor; + let _method_decorators; + let _get_x_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + let _z_decorators; + let _z_initializers = []; + var C = (_classThis = class { + constructor() { + /*14*/ + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + _z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); + } + /*5*/ + method() { } + /*8*/ + get x() { return 1; } + /*11*/ + set x(value) { } + /*17*/ + get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } + set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + }, + _z_1_accessor_storage = new WeakMap(), + _method_get = function _method_get() { return _static_private_method_descriptor.value; }, + _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, + _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, + _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, + _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }, + __setFunctionName(_classThis, "C"), + (() => { + _method_decorators = [dec, dec]; + _get_x_decorators = [dec, dec]; + _set_x_decorators = [dec, dec]; + _y_decorators = [dec, dec]; + _z_decorators = [dec, dec]; + _static_private_method_decorators = [dec, dec]; + _static_private_get_x_decorators = [dec, dec]; + _static_private_set_x_decorators = [dec, dec]; + _static_private_y_decorators = [dec, dec]; + _static_private_z_decorators = [dec, dec]; + __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + })(), + /*29*/ + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }, + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }, + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(), + _classThis); + return C = _classThis; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js new file mode 100644 index 0000000000000..4b4596ed3882a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js @@ -0,0 +1,162 @@ +//// [esDecorators-classExpression-commentPreservation.ts] +declare var dec: any; + +/*1*/ +( +/*2*/ +@dec +/*3*/ +@dec +/*4*/ +class C { + /*5*/ + @dec + /*6*/ + @dec + /*7*/ + method() {} + + /*8*/ + @dec + /*9*/ + @dec + /*10*/ + get x() { return 1; } + + /*11*/ + @dec + /*12*/ + @dec + /*13*/ + set x(value: number) { } + + /*14*/ + @dec + /*15*/ + @dec + /*16*/ + y = 1; + + /*17*/ + @dec + /*18*/ + @dec + /*19*/ + accessor z = 1; + + /*20*/ + @dec + /*21*/ + @dec + /*22*/ + static #method() {} + + /*23*/ + @dec + /*24*/ + @dec + /*25*/ + static get #x() { return 1; } + + /*26*/ + @dec + /*27*/ + @dec + /*28*/ + static set #x(value: number) { } + + /*29*/ + @dec + /*30*/ + @dec + /*31*/ + static #y = 1; + + /*32*/ + @dec + /*33*/ + @dec + /*34*/ + static accessor #z = 1; +} +); + + +//// [esDecorators-classExpression-commentPreservation.js] +/*1*/ +((() => { + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage, _a; + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_private_method_decorators; + let _static_private_method_descriptor; + let _static_private_get_x_decorators; + let _static_private_get_x_descriptor; + let _static_private_set_x_decorators; + let _static_private_set_x_descriptor; + let _static_private_y_decorators; + let _static_private_y_initializers = []; + let _static_private_z_decorators; + let _static_private_z_initializers = []; + let _static_private_z_descriptor; + let _method_decorators; + let _get_x_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + let _z_decorators; + let _z_initializers = []; + var C = (_a = class { + static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } + static { + _method_decorators = [dec, dec]; + _get_x_decorators = [dec, dec]; + _set_x_decorators = [dec, dec]; + _y_decorators = [dec, dec]; + _z_decorators = [dec, dec]; + _static_private_method_decorators = [dec, dec]; + _static_private_get_x_decorators = [dec, dec]; + _static_private_set_x_decorators = [dec, dec]; + _static_private_y_decorators = [dec, dec]; + _static_private_z_decorators = [dec, dec]; + __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + } + /*5*/ + method() { } + /*8*/ + get x() { return 1; } + /*11*/ + set x(value) { } + /*14*/ + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); + /*17*/ + get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } + set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }, + __setFunctionName(_a, "C"), + /*29*/ + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }, + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }, + _a); + return C = _classThis; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=esnext).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=esnext).js new file mode 100644 index 0000000000000..af7af7170b91c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=esnext).js @@ -0,0 +1,154 @@ +//// [esDecorators-classExpression-commentPreservation.ts] +declare var dec: any; + +/*1*/ +( +/*2*/ +@dec +/*3*/ +@dec +/*4*/ +class C { + /*5*/ + @dec + /*6*/ + @dec + /*7*/ + method() {} + + /*8*/ + @dec + /*9*/ + @dec + /*10*/ + get x() { return 1; } + + /*11*/ + @dec + /*12*/ + @dec + /*13*/ + set x(value: number) { } + + /*14*/ + @dec + /*15*/ + @dec + /*16*/ + y = 1; + + /*17*/ + @dec + /*18*/ + @dec + /*19*/ + accessor z = 1; + + /*20*/ + @dec + /*21*/ + @dec + /*22*/ + static #method() {} + + /*23*/ + @dec + /*24*/ + @dec + /*25*/ + static get #x() { return 1; } + + /*26*/ + @dec + /*27*/ + @dec + /*28*/ + static set #x(value: number) { } + + /*29*/ + @dec + /*30*/ + @dec + /*31*/ + static #y = 1; + + /*32*/ + @dec + /*33*/ + @dec + /*34*/ + static accessor #z = 1; +} +); + + +//// [esDecorators-classExpression-commentPreservation.js] +/*1*/ +( +/*2*/ +@dec +/*3*/ +@dec +/*4*/ +class C { + /*5*/ + @dec + /*6*/ + @dec + /*7*/ + method() { } + /*8*/ + @dec + /*9*/ + @dec + /*10*/ + get x() { return 1; } + /*11*/ + @dec + /*12*/ + @dec + /*13*/ + set x(value) { } + /*14*/ + @dec + /*15*/ + @dec + /*16*/ + y = 1; + /*17*/ + @dec + /*18*/ + @dec + /*19*/ + accessor z = 1; + /*20*/ + @dec + /*21*/ + @dec + /*22*/ + static #method() { } + /*23*/ + @dec + /*24*/ + @dec + /*25*/ + static get #x() { return 1; } + /*26*/ + @dec + /*27*/ + @dec + /*28*/ + static set #x(value) { } + /*29*/ + @dec + /*30*/ + @dec + /*31*/ + static #y = 1; + /*32*/ + @dec + /*33*/ + @dec + /*34*/ + static accessor #z = 1; +}); diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts new file mode 100644 index 0000000000000..07785e960e5f5 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-commentPreservation.ts @@ -0,0 +1,125 @@ +// @target: esnext, es2022, es2015 +// @module: esnext, commonjs +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +// @filename: file1.ts + +declare var dec: any; + +/*1*/ +@dec +/*2*/ +@dec +/*3*/ +class C { + /*4*/ + @dec + /*5*/ + @dec + /*6*/ + method() {} + + /*7*/ + @dec + /*8*/ + @dec + /*9*/ + get x() { return 1; } + + /*10*/ + @dec + /*11*/ + @dec + /*12*/ + set x(value: number) { } + + /*13*/ + @dec + /*14*/ + @dec + /*15*/ + y = 1; + + /*16*/ + @dec + /*17*/ + @dec + /*18*/ + accessor z = 1; + + /*19*/ + @dec + /*20*/ + @dec + /*21*/ + static #method() {} + + /*22*/ + @dec + /*23*/ + @dec + /*24*/ + static get #x() { return 1; } + + /*25*/ + @dec + /*26*/ + @dec + /*27*/ + static set #x(value: number) { } + + /*28*/ + @dec + /*29*/ + @dec + /*30*/ + static #y = 1; + + /*31*/ + @dec + /*32*/ + @dec + /*33*/ + static accessor #z = 1; +} + +// @filename: file2.ts + +/*34*/ +@dec +/*35*/ +@dec +/*36*/ +export class D { +} + +/*37*/ +@dec +/*38*/ +@dec +/*39*/ +export default class E { +} + +// @filename: file3.ts + +/*40*/ +export +/*41*/ +@dec +/*42*/ +@dec +/*43*/ +class F { +} + +/*44*/ +export default +/*45*/ +@dec +/*46*/ +@dec +/*47*/ +class G { +} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-commentPreservation.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-commentPreservation.ts new file mode 100644 index 0000000000000..521cc507f852c --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-commentPreservation.ts @@ -0,0 +1,86 @@ +// @target: esnext, es2022, es2015 +// @module: esnext +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var dec: any; + +/*1*/ +( +/*2*/ +@dec +/*3*/ +@dec +/*4*/ +class C { + /*5*/ + @dec + /*6*/ + @dec + /*7*/ + method() {} + + /*8*/ + @dec + /*9*/ + @dec + /*10*/ + get x() { return 1; } + + /*11*/ + @dec + /*12*/ + @dec + /*13*/ + set x(value: number) { } + + /*14*/ + @dec + /*15*/ + @dec + /*16*/ + y = 1; + + /*17*/ + @dec + /*18*/ + @dec + /*19*/ + accessor z = 1; + + /*20*/ + @dec + /*21*/ + @dec + /*22*/ + static #method() {} + + /*23*/ + @dec + /*24*/ + @dec + /*25*/ + static get #x() { return 1; } + + /*26*/ + @dec + /*27*/ + @dec + /*28*/ + static set #x(value: number) { } + + /*29*/ + @dec + /*30*/ + @dec + /*31*/ + static #y = 1; + + /*32*/ + @dec + /*33*/ + @dec + /*34*/ + static accessor #z = 1; +} +); From 24b18d7cc7d1ba26ac9b9685aa90d748db833a4e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 14 Oct 2022 14:21:14 -0400 Subject: [PATCH 17/51] SourceMap validation --- src/compiler/checker.ts | 16 +- src/compiler/transformers/classFields.ts | 1 + src/compiler/transformers/esDecorators.ts | 52 +- src/compiler/utilities.ts | 4 + ...assDeclaration-sourceMap(target=es2015).js | 187 +++ ...eclaration-sourceMap(target=es2015).js.map | 7 + ...ion-sourceMap(target=es2015).sourcemap.txt | 1118 +++++++++++++++++ ...claration-sourceMap(target=es2015).symbols | 106 ++ ...Declaration-sourceMap(target=es2015).types | 112 ++ ...assDeclaration-sourceMap(target=es2022).js | 180 +++ ...eclaration-sourceMap(target=es2022).js.map | 7 + ...ion-sourceMap(target=es2022).sourcemap.txt | 1068 ++++++++++++++++ ...claration-sourceMap(target=es2022).symbols | 106 ++ ...Declaration-sourceMap(target=es2022).types | 112 ++ ...assDeclaration-sourceMap(target=esnext).js | 96 ++ ...eclaration-sourceMap(target=esnext).js.map | 7 + ...ion-sourceMap(target=esnext).sourcemap.txt | 745 +++++++++++ ...claration-sourceMap(target=esnext).symbols | 106 ++ ...Declaration-sourceMap(target=esnext).types | 112 ++ .../sourceMapValidationDecorators.js.map | 4 +- ...ourceMapValidationDecorators.sourcemap.txt | 25 +- ...esDecorators-classDeclaration-sourceMap.ts | 51 + 22 files changed, 4177 insertions(+), 45 deletions(-) create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).symbols create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).types create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).symbols create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).types create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).js.map create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).sourcemap.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).symbols create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).types create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ea9369bd74a39..5860eced5c7da 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -33204,23 +33204,23 @@ namespace ts { const node = decorator.parent as MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration; if (isClassLike(node.parent)) { const targetType = getOrCreateTypeFromSignature(getSignatureFromDeclaration(node)); - + // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of // evaluating all decorators. const valueFinalType = targetType; const thisFinalType = hasStaticModifier(node) ? getTypeOfSymbol(getSymbolOfNode(node.parent)) : getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); - + const isStatic = hasStaticModifier(node); const isPrivate = isPrivateIdentifier(node.name); const nameType = isPrivate ? getStringLiteralType(idText(node.name)) : getLiteralTypeFromPropertyName(node.name); - + const contextType = isGetAccessorDeclaration(node) ? createClassGetterESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : isSetAccessorDeclaration(node) ? createClassSetterESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : createClassMethodESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate); - + const returnType = getUnionType([targetType, voidType]); const targetParam = createSymbol(SymbolFlags.FunctionScopedVariable, "target" as __String, /*checkFlags*/ undefined, targetType); const contextParam = createSymbol(SymbolFlags.FunctionScopedVariable, "context" as __String, /*checkFlags*/ undefined, contextType); @@ -33233,22 +33233,22 @@ namespace ts { const node = decorator.parent as PropertyDeclaration; if (isClassLike(node.parent)) { const targetType = getTypeOfNode(node); - + // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of // evaluating all decorators. const valueFinalType = targetType; const thisFinalType = hasStaticModifier(node) ? getTypeOfSymbol(getSymbolOfNode(node.parent)) : getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); - + const isStatic = hasStaticModifier(node); const isPrivate = isPrivateIdentifier(node.name); const nameType = isPrivate ? getStringLiteralType(idText(node.name)) : getLiteralTypeFromPropertyName(node.name); - + const contextType = hasAccessorModifier(node) ? createClassAccessorESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : createClassFieldESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate); - + const returnType = hasAccessorModifier(node) ? createClassAccessorESDecoratorReturnType(targetType) : createClassFieldESDecoratorReturnType(targetType); diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 99d0f6e7af53c..2bfd0b31d57f6 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -2096,6 +2096,7 @@ namespace ts { // capture the lexical environment for the member setOriginalNode(transformed, property); addEmitFlags(transformed, EmitFlags.AdviseOnEmitNode); + setSourceMapRange(transformed, getSourceMapRange(property.name)); lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment); } currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index fb40b876fcc23..aa06b0f7a454b 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -628,7 +628,9 @@ namespace ts { factory.createNull(), classInfo.classExtraInitializersName ); - leadingBlockStatements.push(factory.createExpressionStatement(esDecorateHelper)); + const esDecorateStatement = factory.createExpressionStatement(esDecorateHelper); + setSourceMapRange(esDecorateStatement, moveRangePastDecorators(node)); + leadingBlockStatements.push(esDecorateStatement); // C = _classThis = _classDescriptor.value; const classDescriptorValueReference = factory.createPropertyAccessExpression(classInfo.classDescriptorName, "value"); @@ -640,7 +642,9 @@ namespace ts { // 11. Static extra initializers are evaluated if (classInfo.staticExtraInitializersName) { const runStaticInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo.staticExtraInitializersName); - leadingBlockStatements = append(leadingBlockStatements, factory.createExpressionStatement(runStaticInitializersHelper)); + const runStaticInitializersStatement = factory.createExpressionStatement(runStaticInitializersHelper); + setSourceMapRange(runStaticInitializersStatement, node.name ?? moveRangePastDecorators(node)); + leadingBlockStatements = append(leadingBlockStatements, runStaticInitializersStatement); } // 12. Static fields are initialized and static blocks are evaluated @@ -648,7 +652,9 @@ namespace ts { // 13. Class extra initializers are evaluated if (classInfo.classExtraInitializersName) { const runClassInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo.classExtraInitializersName); - trailingBlockStatements = append(trailingBlockStatements, factory.createExpressionStatement(runClassInitializersHelper)); + const runClassInitializersStatement = factory.createExpressionStatement(runClassInitializersHelper); + setSourceMapRange(runClassInitializersStatement, node.name ?? moveRangePastDecorators(node)); + trailingBlockStatements = append(trailingBlockStatements, runClassInitializersStatement); } // If there are no other static initializers to run, combine the leading and trailing block statements @@ -926,11 +932,12 @@ namespace ts { if (memberDecorators) { const memberDecoratorsName = createHelperVariable(member, "decorators"); const memberDecoratorsArray = factory.createArrayLiteralExpression(memberDecorators); + const memberDecoratorsAssignment = factory.createAssignment(memberDecoratorsName, memberDecoratorsArray); const memberInfo: MemberInfo = { memberDecoratorsName }; classInfo.memberInfos ??= new Map(); classInfo.memberInfos.set(member, memberInfo); pendingExpressions ??= []; - pendingExpressions.push(factory.createAssignment(memberDecoratorsName, memberDecoratorsArray)); + pendingExpressions.push(memberDecoratorsAssignment); // 5. Static non-field element decorators are applied // 6. Non-static non-field element decorators are applied @@ -1015,15 +1022,10 @@ namespace ts { descriptor = factory.createAssignment(descriptorName, descriptor); } - statements.push( - factory.createExpressionStatement( - emitHelpers().createESDecorateHelper( - factory.createThis(), - descriptor ?? factory.createNull(), - memberDecoratorsName, - context, - factory.createNull(), - extraInitializers))); + const esDecorateExpression = emitHelpers().createESDecorateHelper(factory.createThis(), descriptor ?? factory.createNull(), memberDecoratorsName, context, factory.createNull(), extraInitializers); + const esDecorateStatement = factory.createExpressionStatement(esDecorateExpression); + setSourceMapRange(esDecorateStatement, moveRangePastDecorators(member)); + statements.push(esDecorateStatement); } else if (isPropertyDeclaration(member)) { initializersName = memberInfo.memberInitializersName ??= createHelperVariable(member, "initializers"); @@ -1041,17 +1043,18 @@ namespace ts { // _static_field_initializers = __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "...", static: true, private: ..., access: { ... } }, _staticExtraInitializers); // _field_initializers = __esDecorate(null, null, _member_decorators, { kind: "field", name: "...", static: false, private: ..., access: { ... } }, _instanceExtraInitializers); - statements.push( - factory.createExpressionStatement( - emitHelpers().createESDecorateHelper( - isAutoAccessorPropertyDeclaration(member) ? - factory.createThis() : - factory.createNull(), - descriptor ?? factory.createNull(), - memberDecoratorsName, - context, - initializersName, - extraInitializers))); + const esDecorateExpression = emitHelpers().createESDecorateHelper( + isAutoAccessorPropertyDeclaration(member) ? + factory.createThis() : + factory.createNull(), + descriptor ?? factory.createNull(), + memberDecoratorsName, + context, + initializersName, + extraInitializers); + const esDecorateStatement = factory.createExpressionStatement(esDecorateExpression); + setSourceMapRange(esDecorateStatement, moveRangePastDecorators(member)); + statements.push(esDecorateStatement); } } @@ -1231,6 +1234,7 @@ namespace ts { setOriginalNode(backingField, node); setEmitFlags(backingField, EmitFlags.NoComments); setSourceMapRange(backingField, sourceMapRange); + setSourceMapRange(backingField.name, node.name); const getter = createGetAccessorDescriptorForwarder(modifiersWithoutAccessor, getterName, descriptorName); setOriginalNode(getter, node); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 3e243d3b83ca2..87beda5ef3060 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -5519,6 +5519,10 @@ namespace ts { * Moves the start position of a range past any decorators or modifiers. */ export function moveRangePastModifiers(node: Node): TextRange { + if (isPropertyDeclaration(node) || isMethodDeclaration(node)) { + return moveRangePos(node, node.name.pos); + } + const lastModifier = canHaveModifiers(node) ? lastOrUndefined(node.modifiers) : undefined; return lastModifier && !positionIsSynthesized(lastModifier.end) ? moveRangePos(node, lastModifier.end) diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js new file mode 100644 index 0000000000000..afbd3e129661c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js @@ -0,0 +1,187 @@ +//// [esDecorators-classDeclaration-sourceMap.ts] +declare var dec: any; + +@dec +@dec +class C { + @dec + @dec + method() {} + + @dec + @dec + get x() { return 1; } + + @dec + @dec + set x(value: number) { } + + @dec + @dec + y = 1; + + @dec + @dec + accessor z = 1; + + @dec + @dec + static #method() {} + + @dec + @dec + static get #x() { return 1; } + + @dec + @dec + static set #x(value: number) { } + + @dec + @dec + static #y = 1; + + @dec + @dec + static accessor #z = 1; +} + + +//// [esDecorators-classDeclaration-sourceMap.js] +var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.push(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.push(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +let C = (() => { + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_private_method_decorators; + let _static_private_method_descriptor; + let _static_private_get_x_decorators; + let _static_private_get_x_descriptor; + let _static_private_set_x_decorators; + let _static_private_set_x_descriptor; + let _static_private_y_decorators; + let _static_private_y_initializers = []; + let _static_private_z_decorators; + let _static_private_z_initializers = []; + let _static_private_z_descriptor; + let _method_decorators; + let _get_x_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + let _z_decorators; + let _z_initializers = []; + var C = _classThis = class { + constructor() { + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + _z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); + } + method() { } + get x() { return 1; } + set x(value) { } + get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } + set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + }; + _z_1_accessor_storage = new WeakMap(); + _method_get = function _method_get() { return _static_private_method_descriptor.value; }; + _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }; + _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }; + _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }; + _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; + __setFunctionName(_classThis, "C"); + (() => { + _method_decorators = [dec, dec]; + _get_x_decorators = [dec, dec]; + _set_x_decorators = [dec, dec]; + _y_decorators = [dec, dec]; + _z_decorators = [dec, dec]; + _static_private_method_decorators = [dec, dec]; + _static_private_get_x_decorators = [dec, dec]; + _static_private_set_x_decorators = [dec, dec]; + _static_private_y_decorators = [dec, dec]; + _static_private_z_decorators = [dec, dec]; + __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + })(); + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); + return C = _classThis; +})(); +//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.js.map + +//// [esDecorators-classDeclaration-sourceMap.d.ts] +declare var dec: any; +declare class C { + #private; + method(): void; + get x(): number; + set x(value: number); + y: number; + accessor z: number; +} +//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map new file mode 100644 index 0000000000000..7b267800acd43 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map @@ -0,0 +1,7 @@ +//// [esDecorators-classDeclaration-sourceMap.js.map] +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;YAeH,MAAC,kGAAG,CAAC,GAAC;YAIG,yEAAI,CAAC,GAAC;QAqBnB,CAAC;QArCG,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAQxB,IAAS,CAAC,uEAAK;QAAf,IAAS,CAAC,4EAAK;;;;;;;;;;8BAlBd,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;6CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;QAfJ,+DAAA,yBAAA,cAAkB,CAAC,YAAA,mOAAA;QAInB,8DAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,OAAA,wNAAA;QAI7B,8DAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,OAAA,6NAAA;QA5BhC,kJAAA,MAAM,2CAAK;QAIX,4IAAI,CAAC,2CAAgB;QAIrB,0IAAI,CAAC,mDAAmB;QAwBxB,wUAAc;QAId,0DAAA,uBAAA,gGAAuB,OAAA,EAAvB,uBAAA,qGAAuB,OAAA,8TAAA;QAxBvB,iIAAA,CAAC,uBAAD,CAAC,8DAAK;QAIN,0IAAS,CAAC,uBAAD,CA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kZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== + +//// [esDecorators-classDeclaration-sourceMap.d.ts.map] +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} +//// https://sokra.github.io/source-map-visualization#base64,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7DQpkZWNsYXJlIGNsYXNzIEMgew0KICAgICNwcml2YXRlOw0KICAgIG1ldGhvZCgpOiB2b2lkOw0KICAgIGdldCB4KCk6IG51bWJlcjsNCiAgICBzZXQgeCh2YWx1ZTogbnVtYmVyKTsNCiAgICB5OiBudW1iZXI7DQogICAgYWNjZXNzb3IgejogbnVtYmVyOw0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmQudHMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZ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/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..04349ba143ffa --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt @@ -0,0 +1,1118 @@ +=================================================================== +JsFile: esDecorators-classDeclaration-sourceMap.js +mapUrl: esDecorators-classDeclaration-sourceMap.js.map +sourceRoot: +sources: esDecorators-classDeclaration-sourceMap.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.js +sourceFile:esDecorators-classDeclaration-sourceMap.ts +------------------------------------------------------------------- +>>>var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { +>>> function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } +>>> var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; +>>> var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; +>>> var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); +>>> var _, done = false; +>>> for (var i = decorators.length - 1; i >= 0; i--) { +>>> var context = {}; +>>> for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; +>>> for (var p in contextIn.access) context.access[p] = contextIn.access[p]; +>>> context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; +>>> var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); +>>> if (kind === "accessor") { +>>> if (result === void 0) continue; +>>> if (result === null || typeof result !== "object") throw new TypeError("Object expected"); +>>> if (_ = accept(result.get)) descriptor.get = _; +>>> if (_ = accept(result.set)) descriptor.set = _; +>>> if (_ = accept(result.init)) initializers.push(_); +>>> } +>>> else if (_ = accept(result)) { +>>> if (kind === "field") initializers.push(_); +>>> else descriptor[key] = _; +>>> } +>>> } +>>> if (target) Object.defineProperty(target, contextIn.name, descriptor); +>>> done = true; +>>>}; +>>>var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { +>>> var useValue = arguments.length > 2; +>>> for (var i = 0; i < initializers.length; i++) { +>>> value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); +>>> } +>>> return useValue ? value : void 0; +>>>}; +>>>var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +>>> if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; +>>> return Object.defineProperty(f, "name", { configurable: true, value: name }); +>>>}; +>>>var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { +>>> if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); +>>> if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); +>>> return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +>>>}; +>>>var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { +>>> if (kind === "m") throw new TypeError("Private method is not writable"); +>>> if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); +>>> if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); +>>> return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +>>>}; +>>>let C = (() => { +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >declare var dec: any; + > + >@dec + >@dec + >class +2 > C +1 >Emitted(50, 5) Source(5, 7) + SourceIndex(0) +2 >Emitted(50, 6) Source(5, 8) + SourceIndex(0) +--- +>>> var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; +>>> let _classDecorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +1-> +2 > dec +3 > + > @ +4 > dec +1->Emitted(52, 29) Source(3, 2) + SourceIndex(0) +2 >Emitted(52, 32) Source(3, 5) + SourceIndex(0) +3 >Emitted(52, 34) Source(4, 2) + SourceIndex(0) +4 >Emitted(52, 37) Source(4, 5) + SourceIndex(0) +--- +>>> let _classDescriptor; +>>> let _classExtraInitializers = []; +>>> let _classThis; +>>> let _staticExtraInitializers = []; +>>> let _instanceExtraInitializers = []; +>>> let _static_private_method_decorators; +>>> let _static_private_method_descriptor; +>>> let _static_private_get_x_decorators; +>>> let _static_private_get_x_descriptor; +>>> let _static_private_set_x_decorators; +>>> let _static_private_set_x_descriptor; +>>> let _static_private_y_decorators; +>>> let _static_private_y_initializers = []; +>>> let _static_private_z_decorators; +>>> let _static_private_z_initializers = []; +>>> let _static_private_z_descriptor; +>>> let _method_decorators; +>>> let _get_x_decorators; +>>> let _set_x_decorators; +>>> let _y_decorators; +>>> let _y_initializers = []; +>>> let _z_decorators; +>>> let _z_initializers = []; +>>> var C = _classThis = class { +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^-> +1 > + >class +2 > C +1 >Emitted(76, 9) Source(5, 7) + SourceIndex(0) +2 >Emitted(76, 10) Source(5, 8) + SourceIndex(0) +--- +>>> constructor() { +>>> this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); +1->^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^ +1-> { + > @dec + > @dec + > method() {} + > + > @dec + > @dec + > get x() { return 1; } + > + > @dec + > @dec + > set x(value: number) { } + > + > @dec + > @dec + > +2 > y +3 > = +4 > 1 +5 > ; +1->Emitted(78, 13) Source(20, 5) + SourceIndex(0) +2 >Emitted(78, 19) Source(20, 6) + SourceIndex(0) +3 >Emitted(78, 117) Source(20, 9) + SourceIndex(0) +4 >Emitted(78, 118) Source(20, 10) + SourceIndex(0) +5 >Emitted(78, 121) Source(20, 11) + SourceIndex(0) +--- +>>> _z_1_accessor_storage.set(this, __runInitializers(this, _z_initializers, 1)); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^ +1 > + > + > @dec + > @dec + > accessor +2 > z = +3 > 1 +4 > ; +1 >Emitted(79, 13) Source(24, 14) + SourceIndex(0) +2 >Emitted(79, 86) Source(24, 18) + SourceIndex(0) +3 >Emitted(79, 87) Source(24, 19) + SourceIndex(0) +4 >Emitted(79, 90) Source(24, 20) + SourceIndex(0) +--- +>>> } +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^-> +1 > + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static #y = 1; + > + > @dec + > @dec + > static accessor #z = 1; + > +2 > } +1 >Emitted(80, 9) Source(45, 1) + SourceIndex(0) +2 >Emitted(80, 10) Source(45, 2) + SourceIndex(0) +--- +>>> method() { } +1->^^^^^^^^ +2 > ^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^-> +1-> +2 > method +3 > () { +4 > } +1->Emitted(81, 9) Source(8, 5) + SourceIndex(0) +2 >Emitted(81, 15) Source(8, 11) + SourceIndex(0) +3 >Emitted(81, 20) Source(8, 15) + SourceIndex(0) +4 >Emitted(81, 21) Source(8, 16) + SourceIndex(0) +--- +>>> get x() { return 1; } +1->^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +1-> + > + > @dec + > @dec + > +2 > get +3 > x +4 > () { +5 > return +6 > 1 +7 > ; +8 > +9 > } +1->Emitted(82, 9) Source(12, 5) + SourceIndex(0) +2 >Emitted(82, 13) Source(12, 9) + SourceIndex(0) +3 >Emitted(82, 14) Source(12, 10) + SourceIndex(0) +4 >Emitted(82, 19) Source(12, 15) + SourceIndex(0) +5 >Emitted(82, 26) Source(12, 22) + SourceIndex(0) +6 >Emitted(82, 27) Source(12, 23) + SourceIndex(0) +7 >Emitted(82, 28) Source(12, 24) + SourceIndex(0) +8 >Emitted(82, 29) Source(12, 25) + SourceIndex(0) +9 >Emitted(82, 30) Source(12, 26) + SourceIndex(0) +--- +>>> set x(value) { } +1 >^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > @dec + > @dec + > +2 > set +3 > x +4 > ( +5 > value: number +6 > ) { +7 > } +1 >Emitted(83, 9) Source(16, 5) + SourceIndex(0) +2 >Emitted(83, 13) Source(16, 9) + SourceIndex(0) +3 >Emitted(83, 14) Source(16, 10) + SourceIndex(0) +4 >Emitted(83, 15) Source(16, 11) + SourceIndex(0) +5 >Emitted(83, 20) Source(16, 24) + SourceIndex(0) +6 >Emitted(83, 24) Source(16, 28) + SourceIndex(0) +7 >Emitted(83, 25) Source(16, 29) + SourceIndex(0) +--- +>>> get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } +1->^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^-> +1-> + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > +2 > accessor +3 > z +4 > = 1; +1->Emitted(84, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(84, 13) Source(24, 14) + SourceIndex(0) +3 >Emitted(84, 14) Source(24, 15) + SourceIndex(0) +4 >Emitted(84, 85) Source(24, 20) + SourceIndex(0) +--- +>>> set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } +1->^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > accessor +3 > z +4 > = 1; +1->Emitted(85, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(85, 13) Source(24, 14) + SourceIndex(0) +3 >Emitted(85, 14) Source(24, 15) + SourceIndex(0) +4 >Emitted(85, 90) Source(24, 20) + SourceIndex(0) +--- +>>> }; +>>> _z_1_accessor_storage = new WeakMap(); +>>> _method_get = function _method_get() { return _static_private_method_descriptor.value; }; +>>> _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }; +>>> _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }; +>>> _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }; +>>> _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; +>>> __setFunctionName(_classThis, "C"); +>>> (() => { +>>> _method_decorators = [dec, dec]; +1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^-> +1 > +2 > dec +3 > + > @ +4 > dec +1 >Emitted(95, 31) Source(6, 6) + SourceIndex(0) +2 >Emitted(95, 34) Source(6, 9) + SourceIndex(0) +3 >Emitted(95, 36) Source(7, 6) + SourceIndex(0) +4 >Emitted(95, 39) Source(7, 9) + SourceIndex(0) +--- +>>> _get_x_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^-> +1-> + > method() {} + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(96, 30) Source(10, 6) + SourceIndex(0) +2 >Emitted(96, 33) Source(10, 9) + SourceIndex(0) +3 >Emitted(96, 35) Source(11, 6) + SourceIndex(0) +4 >Emitted(96, 38) Source(11, 9) + SourceIndex(0) +--- +>>> _set_x_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +1-> + > get x() { return 1; } + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(97, 30) Source(14, 6) + SourceIndex(0) +2 >Emitted(97, 33) Source(14, 9) + SourceIndex(0) +3 >Emitted(97, 35) Source(15, 6) + SourceIndex(0) +4 >Emitted(97, 38) Source(15, 9) + SourceIndex(0) +--- +>>> _y_decorators = [dec, dec]; +1 >^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^-> +1 > + > set x(value: number) { } + > + > @ +2 > dec +3 > + > @ +4 > dec +1 >Emitted(98, 26) Source(18, 6) + SourceIndex(0) +2 >Emitted(98, 29) Source(18, 9) + SourceIndex(0) +3 >Emitted(98, 31) Source(19, 6) + SourceIndex(0) +4 >Emitted(98, 34) Source(19, 9) + SourceIndex(0) +--- +>>> _z_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > y = 1; + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(99, 26) Source(22, 6) + SourceIndex(0) +2 >Emitted(99, 29) Source(22, 9) + SourceIndex(0) +3 >Emitted(99, 31) Source(23, 6) + SourceIndex(0) +4 >Emitted(99, 34) Source(23, 9) + SourceIndex(0) +--- +>>> _static_private_method_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^-> +1-> + > accessor z = 1; + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(100, 46) Source(26, 6) + SourceIndex(0) +2 >Emitted(100, 49) Source(26, 9) + SourceIndex(0) +3 >Emitted(100, 51) Source(27, 6) + SourceIndex(0) +4 >Emitted(100, 54) Source(27, 9) + SourceIndex(0) +--- +>>> _static_private_get_x_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^-> +1-> + > static #method() {} + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(101, 45) Source(30, 6) + SourceIndex(0) +2 >Emitted(101, 48) Source(30, 9) + SourceIndex(0) +3 >Emitted(101, 50) Source(31, 6) + SourceIndex(0) +4 >Emitted(101, 53) Source(31, 9) + SourceIndex(0) +--- +>>> _static_private_set_x_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +1-> + > static get #x() { return 1; } + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(102, 45) Source(34, 6) + SourceIndex(0) +2 >Emitted(102, 48) Source(34, 9) + SourceIndex(0) +3 >Emitted(102, 50) Source(35, 6) + SourceIndex(0) +4 >Emitted(102, 53) Source(35, 9) + SourceIndex(0) +--- +>>> _static_private_y_decorators = [dec, dec]; +1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^-> +1 > + > static set #x(value: number) { } + > + > @ +2 > dec +3 > + > @ +4 > dec +1 >Emitted(103, 41) Source(38, 6) + SourceIndex(0) +2 >Emitted(103, 44) Source(38, 9) + SourceIndex(0) +3 >Emitted(103, 46) Source(39, 6) + SourceIndex(0) +4 >Emitted(103, 49) Source(39, 9) + SourceIndex(0) +--- +>>> _static_private_z_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > static #y = 1; + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(104, 41) Source(42, 6) + SourceIndex(0) +2 >Emitted(104, 44) Source(42, 9) + SourceIndex(0) +3 >Emitted(104, 46) Source(43, 6) + SourceIndex(0) +4 >Emitted(104, 49) Source(43, 9) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > +3 > +4 > static #method() { +5 > } +6 > +7 > +1->Emitted(105, 9) Source(28, 5) + SourceIndex(0) +2 >Emitted(105, 72) Source(28, 5) + SourceIndex(0) +3 >Emitted(105, 97) Source(28, 5) + SourceIndex(0) +4 >Emitted(105, 111) Source(28, 23) + SourceIndex(0) +5 >Emitted(105, 112) Source(28, 24) + SourceIndex(0) +6 >Emitted(105, 124) Source(28, 24) + SourceIndex(0) +7 >Emitted(105, 351) Source(28, 24) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^^^^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^-> +1 > + > + > @dec + > @dec + > +2 > +3 > +4 > static get #x() { +5 > return +6 > 1 +7 > ; +8 > +9 > } +10> +11> +1 >Emitted(106, 9) Source(32, 5) + SourceIndex(0) +2 >Emitted(106, 71) Source(32, 5) + SourceIndex(0) +3 >Emitted(106, 94) Source(32, 5) + SourceIndex(0) +4 >Emitted(106, 108) Source(32, 23) + SourceIndex(0) +5 >Emitted(106, 115) Source(32, 30) + SourceIndex(0) +6 >Emitted(106, 116) Source(32, 31) + SourceIndex(0) +7 >Emitted(106, 117) Source(32, 32) + SourceIndex(0) +8 >Emitted(106, 118) Source(32, 33) + SourceIndex(0) +9 >Emitted(106, 119) Source(32, 34) + SourceIndex(0) +10>Emitted(106, 126) Source(32, 34) + SourceIndex(0) +11>Emitted(106, 342) Source(32, 34) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^ +5 > ^^^^^ +6 > ^^^^ +7 > ^ +8 > ^^^^^^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> + > + > @dec + > @dec + > +2 > +3 > +4 > static set #x( +5 > value: number +6 > ) { +7 > } +8 > +9 > +1->Emitted(107, 9) Source(36, 5) + SourceIndex(0) +2 >Emitted(107, 71) Source(36, 5) + SourceIndex(0) +3 >Emitted(107, 94) Source(36, 5) + SourceIndex(0) +4 >Emitted(107, 104) Source(36, 19) + SourceIndex(0) +5 >Emitted(107, 109) Source(36, 32) + SourceIndex(0) +6 >Emitted(107, 113) Source(36, 36) + SourceIndex(0) +7 >Emitted(107, 114) Source(36, 37) + SourceIndex(0) +8 >Emitted(107, 121) Source(36, 37) + SourceIndex(0) +9 >Emitted(107, 342) Source(36, 37) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > +3 > method +4 > () {} +1 >Emitted(108, 9) Source(8, 5) + SourceIndex(0) +2 >Emitted(108, 155) Source(8, 5) + SourceIndex(0) +3 >Emitted(108, 161) Source(8, 11) + SourceIndex(0) +4 >Emitted(108, 204) Source(8, 16) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^-> +1 > + > + > @dec + > @dec + > +2 > get +3 > x +4 > () { return 1; } +1 >Emitted(109, 9) Source(12, 5) + SourceIndex(0) +2 >Emitted(109, 149) Source(12, 9) + SourceIndex(0) +3 >Emitted(109, 150) Source(12, 10) + SourceIndex(0) +4 >Emitted(109, 193) Source(12, 26) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > @dec + > @dec + > +2 > set +3 > x +4 > (value: number) { } +1->Emitted(110, 9) Source(16, 5) + SourceIndex(0) +2 >Emitted(110, 147) Source(16, 9) + SourceIndex(0) +3 >Emitted(110, 148) Source(16, 10) + SourceIndex(0) +4 >Emitted(110, 199) Source(16, 29) + SourceIndex(0) +--- +>>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > accessor z = 1; + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > +2 > static #y = 1; +1->Emitted(111, 9) Source(40, 5) + SourceIndex(0) +2 >Emitted(111, 337) Source(40, 19) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> + > + > @dec + > @dec + > +2 > +3 > +4 > static accessor #z = 1; +5 > +6 > +7 > +8 > static accessor #z = 1; +9 > +10> +1->Emitted(112, 9) Source(44, 5) + SourceIndex(0) +2 >Emitted(112, 67) Source(44, 5) + SourceIndex(0) +3 >Emitted(112, 90) Source(44, 5) + SourceIndex(0) +4 >Emitted(112, 186) Source(44, 28) + SourceIndex(0) +5 >Emitted(112, 193) Source(44, 28) + SourceIndex(0) +6 >Emitted(112, 195) Source(44, 5) + SourceIndex(0) +7 >Emitted(112, 218) Source(44, 5) + SourceIndex(0) +8 >Emitted(112, 319) Source(44, 28) + SourceIndex(0) +9 >Emitted(112, 326) Source(44, 28) + SourceIndex(0) +10>Emitted(112, 644) Source(44, 28) + SourceIndex(0) +--- +>>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^^^^^^^^^-> +1 > +2 > +3 > y +4 > +5 > y +6 > = 1; +1 >Emitted(113, 9) Source(20, 5) + SourceIndex(0) +2 >Emitted(113, 138) Source(20, 5) + SourceIndex(0) +3 >Emitted(113, 139) Source(20, 6) + SourceIndex(0) +4 >Emitted(113, 162) Source(20, 5) + SourceIndex(0) +5 >Emitted(113, 163) Source(20, 6) + SourceIndex(0) +6 >Emitted(113, 225) Source(20, 11) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> + > + > @dec + > @dec + > +2 > accessor +3 > z +4 > +5 > z +6 > = 1; +1->Emitted(114, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(114, 147) Source(24, 14) + SourceIndex(0) +3 >Emitted(114, 148) Source(24, 15) + SourceIndex(0) +4 >Emitted(114, 171) Source(24, 14) + SourceIndex(0) +5 >Emitted(114, 172) Source(24, 15) + SourceIndex(0) +6 >Emitted(114, 234) Source(24, 20) + SourceIndex(0) +--- +>>> __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > class C { + > @dec + > @dec + > method() {} + > + > @dec + > @dec + > get x() { return 1; } + > + > @dec + > @dec + > set x(value: number) { } + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > accessor z = 1; + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static #y = 1; + > + > @dec + > @dec + > static accessor #z = 1; + > } +1 >Emitted(115, 9) Source(5, 1) + SourceIndex(0) +2 >Emitted(115, 161) Source(45, 2) + SourceIndex(0) +--- +>>> C = _classThis = _classDescriptor.value; +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 > C +1 >Emitted(116, 9) Source(5, 7) + SourceIndex(0) +2 >Emitted(116, 10) Source(5, 8) + SourceIndex(0) +--- +>>> __runInitializers(_classThis, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > C +1->Emitted(117, 9) Source(5, 7) + SourceIndex(0) +2 >Emitted(117, 65) Source(5, 8) + SourceIndex(0) +--- +>>> })(); +>>> _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^-> +1 > { + > @dec + > @dec + > method() {} + > + > @dec + > @dec + > get x() { return 1; } + > + > @dec + > @dec + > set x(value: number) { } + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > accessor z = 1; + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static +2 > #y = +3 > 1 +4 > +5 > = 1; +1 >Emitted(119, 5) Source(40, 12) + SourceIndex(0) +2 >Emitted(119, 81) Source(40, 17) + SourceIndex(0) +3 >Emitted(119, 82) Source(40, 18) + SourceIndex(0) +4 >Emitted(119, 85) Source(40, 14) + SourceIndex(0) +5 >Emitted(119, 86) Source(40, 19) + SourceIndex(0) +--- +>>> _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +1-> + > + > @dec + > @dec + > static accessor +2 > #z = +3 > 1 +4 > +5 > = 1; +1->Emitted(120, 5) Source(44, 21) + SourceIndex(0) +2 >Emitted(120, 98) Source(44, 26) + SourceIndex(0) +3 >Emitted(120, 99) Source(44, 27) + SourceIndex(0) +4 >Emitted(120, 102) Source(44, 23) + SourceIndex(0) +5 >Emitted(120, 103) Source(44, 28) + SourceIndex(0) +--- +>>> (() => { +>>> __runInitializers(_classThis, _classExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > C +1 >Emitted(122, 9) Source(5, 7) + SourceIndex(0) +2 >Emitted(122, 64) Source(5, 8) + SourceIndex(0) +--- +>>> })(); +>>> return C = _classThis; +1 >^^^^^^^^^^^ +2 > ^ +1 > +2 > C +1 >Emitted(124, 12) Source(5, 7) + SourceIndex(0) +2 >Emitted(124, 13) Source(5, 8) + SourceIndex(0) +--- +>>>})(); +>>>//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.js.map=================================================================== +JsFile: esDecorators-classDeclaration-sourceMap.d.ts +mapUrl: esDecorators-classDeclaration-sourceMap.d.ts.map +sourceRoot: +sources: esDecorators-classDeclaration-sourceMap.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.d.ts +sourceFile:esDecorators-classDeclaration-sourceMap.ts +------------------------------------------------------------------- +>>>declare var dec: any; +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^^ +5 > ^^^ +6 > ^^ +7 > ^^^ +8 > ^ +1 > +2 >declare +3 > +4 > var +5 > dec +6 > : +7 > any +8 > ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +4 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +6 >Emitted(1, 18) Source(1, 18) + SourceIndex(0) +7 >Emitted(1, 21) Source(1, 21) + SourceIndex(0) +8 >Emitted(1, 22) Source(1, 22) + SourceIndex(0) +--- +>>>declare class C { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^ +1 > + > + > +2 >@dec + >@dec + >class +3 > C +1 >Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 15) Source(5, 7) + SourceIndex(0) +3 >Emitted(2, 16) Source(5, 8) + SourceIndex(0) +--- +>>> #private; +>>> method(): void; +1 >^^^^ +2 > ^^^^^^ +3 > ^^^^^^^^^^^-> +1 > { + > @dec + > @dec + > +2 > method +1 >Emitted(4, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(4, 11) Source(8, 11) + SourceIndex(0) +--- +>>> get x(): number; +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^^^-> +1->() {} + > + > +2 > @dec + > @dec + > get +3 > x +4 > () { return 1; } + > + > @dec + > @dec + > set x(value: +5 > number +6 > +1->Emitted(5, 5) Source(10, 5) + SourceIndex(0) +2 >Emitted(5, 9) Source(12, 9) + SourceIndex(0) +3 >Emitted(5, 10) Source(12, 10) + SourceIndex(0) +4 >Emitted(5, 14) Source(16, 18) + SourceIndex(0) +5 >Emitted(5, 20) Source(16, 24) + SourceIndex(0) +6 >Emitted(5, 21) Source(12, 26) + SourceIndex(0) +--- +>>> set x(value: number); +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +1-> + > + > +2 > @dec + > @dec + > set +3 > x +4 > ( +5 > value +6 > : +7 > number +8 > ) { } +1->Emitted(6, 5) Source(14, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(16, 9) + SourceIndex(0) +3 >Emitted(6, 10) Source(16, 10) + SourceIndex(0) +4 >Emitted(6, 11) Source(16, 11) + SourceIndex(0) +5 >Emitted(6, 16) Source(16, 16) + SourceIndex(0) +6 >Emitted(6, 18) Source(16, 18) + SourceIndex(0) +7 >Emitted(6, 24) Source(16, 24) + SourceIndex(0) +8 >Emitted(6, 26) Source(16, 29) + SourceIndex(0) +--- +>>> y: number; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^ +4 > ^^^^^^^^^^-> +1 > + > + > @dec + > @dec + > +2 > y +3 > = 1; +1 >Emitted(7, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(7, 6) Source(20, 6) + SourceIndex(0) +3 >Emitted(7, 15) Source(20, 11) + SourceIndex(0) +--- +>>> accessor z: number; +1->^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^ +1-> + > + > @dec + > @dec + > +2 > accessor +3 > +4 > z +5 > = 1; +1->Emitted(8, 5) Source(24, 5) + SourceIndex(0) +2 >Emitted(8, 13) Source(24, 13) + SourceIndex(0) +3 >Emitted(8, 14) Source(24, 14) + SourceIndex(0) +4 >Emitted(8, 15) Source(24, 15) + SourceIndex(0) +5 >Emitted(8, 24) Source(24, 20) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static #y = 1; + > + > @dec + > @dec + > static accessor #z = 1; + >} +1 >Emitted(9, 2) Source(45, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).symbols b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).symbols new file mode 100644 index 0000000000000..fdb35b4809deb --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).symbols @@ -0,0 +1,106 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts === +declare var dec: any; +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + +@dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + +@dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + +class C { +>C : Symbol(C, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 21)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + method() {} +>method : Symbol(C.method, Decl(esDecorators-classDeclaration-sourceMap.ts, 4, 9)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + get x() { return 1; } +>x : Symbol(C.x, Decl(esDecorators-classDeclaration-sourceMap.ts, 7, 15), Decl(esDecorators-classDeclaration-sourceMap.ts, 11, 25)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + set x(value: number) { } +>x : Symbol(C.x, Decl(esDecorators-classDeclaration-sourceMap.ts, 7, 15), Decl(esDecorators-classDeclaration-sourceMap.ts, 11, 25)) +>value : Symbol(value, Decl(esDecorators-classDeclaration-sourceMap.ts, 15, 10)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + y = 1; +>y : Symbol(C.y, Decl(esDecorators-classDeclaration-sourceMap.ts, 15, 28)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + accessor z = 1; +>z : Symbol(C.z, Decl(esDecorators-classDeclaration-sourceMap.ts, 19, 10)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static #method() {} +>#method : Symbol(C.#method, Decl(esDecorators-classDeclaration-sourceMap.ts, 23, 19)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static get #x() { return 1; } +>#x : Symbol(C.#x, Decl(esDecorators-classDeclaration-sourceMap.ts, 27, 23), Decl(esDecorators-classDeclaration-sourceMap.ts, 31, 33)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static set #x(value: number) { } +>#x : Symbol(C.#x, Decl(esDecorators-classDeclaration-sourceMap.ts, 27, 23), Decl(esDecorators-classDeclaration-sourceMap.ts, 31, 33)) +>value : Symbol(value, Decl(esDecorators-classDeclaration-sourceMap.ts, 35, 18)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static #y = 1; +>#y : Symbol(C.#y, Decl(esDecorators-classDeclaration-sourceMap.ts, 35, 36)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static accessor #z = 1; +>#z : Symbol(C.#z, Decl(esDecorators-classDeclaration-sourceMap.ts, 39, 18)) +} + diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).types b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).types new file mode 100644 index 0000000000000..0953c47c87f0d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts === +declare var dec: any; +>dec : any + +@dec +>dec : any + +@dec +>dec : any + +class C { +>C : C + + @dec +>dec : any + + @dec +>dec : any + + method() {} +>method : () => void + + @dec +>dec : any + + @dec +>dec : any + + get x() { return 1; } +>x : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + set x(value: number) { } +>x : number +>value : number + + @dec +>dec : any + + @dec +>dec : any + + y = 1; +>y : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + accessor z = 1; +>z : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + static #method() {} +>#method : () => void + + @dec +>dec : any + + @dec +>dec : any + + static get #x() { return 1; } +>#x : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + static set #x(value: number) { } +>#x : number +>value : number + + @dec +>dec : any + + @dec +>dec : any + + static #y = 1; +>#y : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + static accessor #z = 1; +>#z : number +>1 : 1 +} + diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js new file mode 100644 index 0000000000000..fb560f644d27c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js @@ -0,0 +1,180 @@ +//// [esDecorators-classDeclaration-sourceMap.ts] +declare var dec: any; + +@dec +@dec +class C { + @dec + @dec + method() {} + + @dec + @dec + get x() { return 1; } + + @dec + @dec + set x(value: number) { } + + @dec + @dec + y = 1; + + @dec + @dec + accessor z = 1; + + @dec + @dec + static #method() {} + + @dec + @dec + static get #x() { return 1; } + + @dec + @dec + static set #x(value: number) { } + + @dec + @dec + static #y = 1; + + @dec + @dec + static accessor #z = 1; +} + + +//// [esDecorators-classDeclaration-sourceMap.js] +var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.push(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.push(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; +var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: name }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +let C = (() => { + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + let _classDecorators = [dec, dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _staticExtraInitializers = []; + let _instanceExtraInitializers = []; + let _static_private_method_decorators; + let _static_private_method_descriptor; + let _static_private_get_x_decorators; + let _static_private_get_x_descriptor; + let _static_private_set_x_decorators; + let _static_private_set_x_descriptor; + let _static_private_y_decorators; + let _static_private_y_initializers = []; + let _static_private_z_decorators; + let _static_private_z_initializers = []; + let _static_private_z_descriptor; + let _method_decorators; + let _get_x_decorators; + let _set_x_decorators; + let _y_decorators; + let _y_initializers = []; + let _z_decorators; + let _z_initializers = []; + var C = class { + static { __setFunctionName(this, "C"); } + static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } + static { + _method_decorators = [dec, dec]; + _get_x_decorators = [dec, dec]; + _set_x_decorators = [dec, dec]; + _y_decorators = [dec, dec]; + _z_decorators = [dec, dec]; + _static_private_method_decorators = [dec, dec]; + _static_private_get_x_decorators = [dec, dec]; + _static_private_set_x_decorators = [dec, dec]; + _static_private_y_decorators = [dec, dec]; + _static_private_z_decorators = [dec, dec]; + __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _staticExtraInitializers); + } + method() { } + get x() { return 1; } + set x(value) { } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); + get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } + set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + return C = _classThis; +})(); +//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.js.map + +//// [esDecorators-classDeclaration-sourceMap.d.ts] +declare var dec: any; +declare class C { + #private; + method(): void; + get x(): number; + set x(value: number); + y: number; + accessor z: number; +} +//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map new file mode 100644 index 0000000000000..430b235683c1c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map @@ -0,0 +1,7 @@ +//// [esDecorators-classDeclaration-sourceMap.js.map] +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BA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lYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== + +//// [esDecorators-classDeclaration-sourceMap.d.ts.map] +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} +//// https://sokra.github.io/source-map-visualization#base64,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7DQpkZWNsYXJlIGNsYXNzIEMgew0KICAgICNwcml2YXRlOw0KICAgIG1ldGhvZCgpOiB2b2lkOw0KICAgIGdldCB4KCk6IG51bWJlcjsNCiAgICBzZXQgeCh2YWx1ZTogbnVtYmVyKTsNCiAgICB5OiBudW1iZXI7DQogICAgYWNjZXNzb3IgejogbnVtYmVyOw0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmQudHMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJlc0RlY29yYXRvcnMtY2xhc3NEZWNsYXJhdGlvbi1zb3VyY2VNYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxDQUFDLElBQUksR0FBRyxFQUFFLEdBQUcsQ0FBQztBQUVyQixjQUVNLENBQUM7O0lBR0gsTUFBTTtJQUVOLElBRUksQ0FBQyxJQUlRLE1BQU0sQ0FKRTtJQUVyQixJQUVJLENBQUMsQ0FBQyxLQUFLLEVBQUUsTUFBTSxFQUFLO0lBSXhCLENBQUMsU0FBSztJQUlOLFFBQVEsQ0FBQyxDQUFDLFNBQUs7Q0FxQmxCIn0=,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt new file mode 100644 index 0000000000000..8838715235f28 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt @@ -0,0 +1,1068 @@ +=================================================================== +JsFile: esDecorators-classDeclaration-sourceMap.js +mapUrl: esDecorators-classDeclaration-sourceMap.js.map +sourceRoot: +sources: esDecorators-classDeclaration-sourceMap.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.js +sourceFile:esDecorators-classDeclaration-sourceMap.ts +------------------------------------------------------------------- +>>>var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { +>>> function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } +>>> var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; +>>> var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; +>>> var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); +>>> var _, done = false; +>>> for (var i = decorators.length - 1; i >= 0; i--) { +>>> var context = {}; +>>> for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; +>>> for (var p in contextIn.access) context.access[p] = contextIn.access[p]; +>>> context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; +>>> var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); +>>> if (kind === "accessor") { +>>> if (result === void 0) continue; +>>> if (result === null || typeof result !== "object") throw new TypeError("Object expected"); +>>> if (_ = accept(result.get)) descriptor.get = _; +>>> if (_ = accept(result.set)) descriptor.set = _; +>>> if (_ = accept(result.init)) initializers.push(_); +>>> } +>>> else if (_ = accept(result)) { +>>> if (kind === "field") initializers.push(_); +>>> else descriptor[key] = _; +>>> } +>>> } +>>> if (target) Object.defineProperty(target, contextIn.name, descriptor); +>>> done = true; +>>>}; +>>>var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { +>>> var useValue = arguments.length > 2; +>>> for (var i = 0; i < initializers.length; i++) { +>>> value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); +>>> } +>>> return useValue ? value : void 0; +>>>}; +>>>var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +>>> if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; +>>> return Object.defineProperty(f, "name", { configurable: true, value: name }); +>>>}; +>>>var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { +>>> if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); +>>> if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); +>>> return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +>>>}; +>>>var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { +>>> if (kind === "m") throw new TypeError("Private method is not writable"); +>>> if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); +>>> if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); +>>> return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +>>>}; +>>>let C = (() => { +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >declare var dec: any; + > + >@dec + >@dec + >class +2 > C +1 >Emitted(50, 5) Source(5, 7) + SourceIndex(0) +2 >Emitted(50, 6) Source(5, 8) + SourceIndex(0) +--- +>>> var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; +>>> let _classDecorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +1-> +2 > dec +3 > + > @ +4 > dec +1->Emitted(52, 29) Source(3, 2) + SourceIndex(0) +2 >Emitted(52, 32) Source(3, 5) + SourceIndex(0) +3 >Emitted(52, 34) Source(4, 2) + SourceIndex(0) +4 >Emitted(52, 37) Source(4, 5) + SourceIndex(0) +--- +>>> let _classDescriptor; +>>> let _classExtraInitializers = []; +>>> let _classThis; +>>> let _staticExtraInitializers = []; +>>> let _instanceExtraInitializers = []; +>>> let _static_private_method_decorators; +>>> let _static_private_method_descriptor; +>>> let _static_private_get_x_decorators; +>>> let _static_private_get_x_descriptor; +>>> let _static_private_set_x_decorators; +>>> let _static_private_set_x_descriptor; +>>> let _static_private_y_decorators; +>>> let _static_private_y_initializers = []; +>>> let _static_private_z_decorators; +>>> let _static_private_z_initializers = []; +>>> let _static_private_z_descriptor; +>>> let _method_decorators; +>>> let _get_x_decorators; +>>> let _set_x_decorators; +>>> let _y_decorators; +>>> let _y_initializers = []; +>>> let _z_decorators; +>>> let _z_initializers = []; +>>> var C = class { +1 >^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >class +2 > C +1 >Emitted(76, 9) Source(5, 7) + SourceIndex(0) +2 >Emitted(76, 10) Source(5, 8) + SourceIndex(0) +--- +>>> static { __setFunctionName(this, "C"); } +>>> static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } +>>> static { +>>> _method_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^-> +1-> { + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(80, 35) Source(6, 6) + SourceIndex(0) +2 >Emitted(80, 38) Source(6, 9) + SourceIndex(0) +3 >Emitted(80, 40) Source(7, 6) + SourceIndex(0) +4 >Emitted(80, 43) Source(7, 9) + SourceIndex(0) +--- +>>> _get_x_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^-> +1-> + > method() {} + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(81, 34) Source(10, 6) + SourceIndex(0) +2 >Emitted(81, 37) Source(10, 9) + SourceIndex(0) +3 >Emitted(81, 39) Source(11, 6) + SourceIndex(0) +4 >Emitted(81, 42) Source(11, 9) + SourceIndex(0) +--- +>>> _set_x_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +1-> + > get x() { return 1; } + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(82, 34) Source(14, 6) + SourceIndex(0) +2 >Emitted(82, 37) Source(14, 9) + SourceIndex(0) +3 >Emitted(82, 39) Source(15, 6) + SourceIndex(0) +4 >Emitted(82, 42) Source(15, 9) + SourceIndex(0) +--- +>>> _y_decorators = [dec, dec]; +1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^-> +1 > + > set x(value: number) { } + > + > @ +2 > dec +3 > + > @ +4 > dec +1 >Emitted(83, 30) Source(18, 6) + SourceIndex(0) +2 >Emitted(83, 33) Source(18, 9) + SourceIndex(0) +3 >Emitted(83, 35) Source(19, 6) + SourceIndex(0) +4 >Emitted(83, 38) Source(19, 9) + SourceIndex(0) +--- +>>> _z_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > y = 1; + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(84, 30) Source(22, 6) + SourceIndex(0) +2 >Emitted(84, 33) Source(22, 9) + SourceIndex(0) +3 >Emitted(84, 35) Source(23, 6) + SourceIndex(0) +4 >Emitted(84, 38) Source(23, 9) + SourceIndex(0) +--- +>>> _static_private_method_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^-> +1-> + > accessor z = 1; + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(85, 50) Source(26, 6) + SourceIndex(0) +2 >Emitted(85, 53) Source(26, 9) + SourceIndex(0) +3 >Emitted(85, 55) Source(27, 6) + SourceIndex(0) +4 >Emitted(85, 58) Source(27, 9) + SourceIndex(0) +--- +>>> _static_private_get_x_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^-> +1-> + > static #method() {} + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(86, 49) Source(30, 6) + SourceIndex(0) +2 >Emitted(86, 52) Source(30, 9) + SourceIndex(0) +3 >Emitted(86, 54) Source(31, 6) + SourceIndex(0) +4 >Emitted(86, 57) Source(31, 9) + SourceIndex(0) +--- +>>> _static_private_set_x_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +1-> + > static get #x() { return 1; } + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(87, 49) Source(34, 6) + SourceIndex(0) +2 >Emitted(87, 52) Source(34, 9) + SourceIndex(0) +3 >Emitted(87, 54) Source(35, 6) + SourceIndex(0) +4 >Emitted(87, 57) Source(35, 9) + SourceIndex(0) +--- +>>> _static_private_y_decorators = [dec, dec]; +1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^-> +1 > + > static set #x(value: number) { } + > + > @ +2 > dec +3 > + > @ +4 > dec +1 >Emitted(88, 45) Source(38, 6) + SourceIndex(0) +2 >Emitted(88, 48) Source(38, 9) + SourceIndex(0) +3 >Emitted(88, 50) Source(39, 6) + SourceIndex(0) +4 >Emitted(88, 53) Source(39, 9) + SourceIndex(0) +--- +>>> _static_private_z_decorators = [dec, dec]; +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > static #y = 1; + > + > @ +2 > dec +3 > + > @ +4 > dec +1->Emitted(89, 45) Source(42, 6) + SourceIndex(0) +2 >Emitted(89, 48) Source(42, 9) + SourceIndex(0) +3 >Emitted(89, 50) Source(43, 6) + SourceIndex(0) +4 >Emitted(89, 53) Source(43, 9) + SourceIndex(0) +--- +>>> __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > +3 > +4 > static #method() { +5 > } +6 > +7 > +1->Emitted(90, 13) Source(28, 5) + SourceIndex(0) +2 >Emitted(90, 70) Source(28, 5) + SourceIndex(0) +3 >Emitted(90, 95) Source(28, 5) + SourceIndex(0) +4 >Emitted(90, 109) Source(28, 23) + SourceIndex(0) +5 >Emitted(90, 110) Source(28, 24) + SourceIndex(0) +6 >Emitted(90, 122) Source(28, 24) + SourceIndex(0) +7 >Emitted(90, 349) Source(28, 24) + SourceIndex(0) +--- +>>> __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^^^^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^-> +1 > + > + > @dec + > @dec + > +2 > +3 > +4 > static get #x() { +5 > return +6 > 1 +7 > ; +8 > +9 > } +10> +11> +1 >Emitted(91, 13) Source(32, 5) + SourceIndex(0) +2 >Emitted(91, 69) Source(32, 5) + SourceIndex(0) +3 >Emitted(91, 92) Source(32, 5) + SourceIndex(0) +4 >Emitted(91, 106) Source(32, 23) + SourceIndex(0) +5 >Emitted(91, 113) Source(32, 30) + SourceIndex(0) +6 >Emitted(91, 114) Source(32, 31) + SourceIndex(0) +7 >Emitted(91, 115) Source(32, 32) + SourceIndex(0) +8 >Emitted(91, 116) Source(32, 33) + SourceIndex(0) +9 >Emitted(91, 117) Source(32, 34) + SourceIndex(0) +10>Emitted(91, 124) Source(32, 34) + SourceIndex(0) +11>Emitted(91, 340) Source(32, 34) + SourceIndex(0) +--- +>>> __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^ +5 > ^^^^^ +6 > ^^^^ +7 > ^ +8 > ^^^^^^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> + > + > @dec + > @dec + > +2 > +3 > +4 > static set #x( +5 > value: number +6 > ) { +7 > } +8 > +9 > +1->Emitted(92, 13) Source(36, 5) + SourceIndex(0) +2 >Emitted(92, 69) Source(36, 5) + SourceIndex(0) +3 >Emitted(92, 92) Source(36, 5) + SourceIndex(0) +4 >Emitted(92, 102) Source(36, 19) + SourceIndex(0) +5 >Emitted(92, 107) Source(36, 32) + SourceIndex(0) +6 >Emitted(92, 111) Source(36, 36) + SourceIndex(0) +7 >Emitted(92, 112) Source(36, 37) + SourceIndex(0) +8 >Emitted(92, 119) Source(36, 37) + SourceIndex(0) +9 >Emitted(92, 340) Source(36, 37) + SourceIndex(0) +--- +>>> __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > +3 > method +4 > () {} +1 >Emitted(93, 13) Source(8, 5) + SourceIndex(0) +2 >Emitted(93, 153) Source(8, 5) + SourceIndex(0) +3 >Emitted(93, 159) Source(8, 11) + SourceIndex(0) +4 >Emitted(93, 202) Source(8, 16) + SourceIndex(0) +--- +>>> __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^-> +1 > + > + > @dec + > @dec + > +2 > get +3 > x +4 > () { return 1; } +1 >Emitted(94, 13) Source(12, 5) + SourceIndex(0) +2 >Emitted(94, 147) Source(12, 9) + SourceIndex(0) +3 >Emitted(94, 148) Source(12, 10) + SourceIndex(0) +4 >Emitted(94, 191) Source(12, 26) + SourceIndex(0) +--- +>>> __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > @dec + > @dec + > +2 > set +3 > x +4 > (value: number) { } +1->Emitted(95, 13) Source(16, 5) + SourceIndex(0) +2 >Emitted(95, 145) Source(16, 9) + SourceIndex(0) +3 >Emitted(95, 146) Source(16, 10) + SourceIndex(0) +4 >Emitted(95, 197) Source(16, 29) + SourceIndex(0) +--- +>>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > accessor z = 1; + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > +2 > static #y = 1; +1->Emitted(96, 13) Source(40, 5) + SourceIndex(0) +2 >Emitted(96, 341) Source(40, 19) + SourceIndex(0) +--- +>>> __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> + > + > @dec + > @dec + > +2 > +3 > +4 > static accessor #z = 1; +5 > +6 > +7 > +8 > static accessor #z = 1; +9 > +10> +1->Emitted(97, 13) Source(44, 5) + SourceIndex(0) +2 >Emitted(97, 65) Source(44, 5) + SourceIndex(0) +3 >Emitted(97, 88) Source(44, 5) + SourceIndex(0) +4 >Emitted(97, 178) Source(44, 28) + SourceIndex(0) +5 >Emitted(97, 185) Source(44, 28) + SourceIndex(0) +6 >Emitted(97, 187) Source(44, 5) + SourceIndex(0) +7 >Emitted(97, 210) Source(44, 5) + SourceIndex(0) +8 >Emitted(97, 305) Source(44, 28) + SourceIndex(0) +9 >Emitted(97, 312) Source(44, 28) + SourceIndex(0) +10>Emitted(97, 630) Source(44, 28) + SourceIndex(0) +--- +>>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^^^-> +1 > +2 > +3 > y +4 > +5 > y +6 > = 1; +1 >Emitted(98, 13) Source(20, 5) + SourceIndex(0) +2 >Emitted(98, 142) Source(20, 5) + SourceIndex(0) +3 >Emitted(98, 143) Source(20, 6) + SourceIndex(0) +4 >Emitted(98, 166) Source(20, 5) + SourceIndex(0) +5 >Emitted(98, 167) Source(20, 6) + SourceIndex(0) +6 >Emitted(98, 229) Source(20, 11) + SourceIndex(0) +--- +>>> __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> + > + > @dec + > @dec + > +2 > accessor +3 > z +4 > +5 > z +6 > = 1; +1->Emitted(99, 13) Source(24, 5) + SourceIndex(0) +2 >Emitted(99, 145) Source(24, 14) + SourceIndex(0) +3 >Emitted(99, 146) Source(24, 15) + SourceIndex(0) +4 >Emitted(99, 169) Source(24, 14) + SourceIndex(0) +5 >Emitted(99, 170) Source(24, 15) + SourceIndex(0) +6 >Emitted(99, 232) Source(24, 20) + SourceIndex(0) +--- +>>> __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > class C { + > @dec + > @dec + > method() {} + > + > @dec + > @dec + > get x() { return 1; } + > + > @dec + > @dec + > set x(value: number) { } + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > accessor z = 1; + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static #y = 1; + > + > @dec + > @dec + > static accessor #z = 1; + > } +1 >Emitted(100, 13) Source(5, 1) + SourceIndex(0) +2 >Emitted(100, 153) Source(45, 2) + SourceIndex(0) +--- +>>> C = _classThis = _classDescriptor.value; +1 >^^^^^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 > C +1 >Emitted(101, 13) Source(5, 7) + SourceIndex(0) +2 >Emitted(101, 14) Source(5, 8) + SourceIndex(0) +--- +>>> __runInitializers(_classThis, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > C +1->Emitted(102, 13) Source(5, 7) + SourceIndex(0) +2 >Emitted(102, 69) Source(5, 8) + SourceIndex(0) +--- +>>> } +>>> method() { } +1 >^^^^^^^^ +2 > ^^^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^-> +1 > { + > @dec + > @dec + > +2 > method +3 > () { +4 > } +1 >Emitted(104, 9) Source(8, 5) + SourceIndex(0) +2 >Emitted(104, 15) Source(8, 11) + SourceIndex(0) +3 >Emitted(104, 20) Source(8, 15) + SourceIndex(0) +4 >Emitted(104, 21) Source(8, 16) + SourceIndex(0) +--- +>>> get x() { return 1; } +1->^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +1-> + > + > @dec + > @dec + > +2 > get +3 > x +4 > () { +5 > return +6 > 1 +7 > ; +8 > +9 > } +1->Emitted(105, 9) Source(12, 5) + SourceIndex(0) +2 >Emitted(105, 13) Source(12, 9) + SourceIndex(0) +3 >Emitted(105, 14) Source(12, 10) + SourceIndex(0) +4 >Emitted(105, 19) Source(12, 15) + SourceIndex(0) +5 >Emitted(105, 26) Source(12, 22) + SourceIndex(0) +6 >Emitted(105, 27) Source(12, 23) + SourceIndex(0) +7 >Emitted(105, 28) Source(12, 24) + SourceIndex(0) +8 >Emitted(105, 29) Source(12, 25) + SourceIndex(0) +9 >Emitted(105, 30) Source(12, 26) + SourceIndex(0) +--- +>>> set x(value) { } +1 >^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > @dec + > @dec + > +2 > set +3 > x +4 > ( +5 > value: number +6 > ) { +7 > } +1 >Emitted(106, 9) Source(16, 5) + SourceIndex(0) +2 >Emitted(106, 13) Source(16, 9) + SourceIndex(0) +3 >Emitted(106, 14) Source(16, 10) + SourceIndex(0) +4 >Emitted(106, 15) Source(16, 11) + SourceIndex(0) +5 >Emitted(106, 20) Source(16, 24) + SourceIndex(0) +6 >Emitted(106, 24) Source(16, 28) + SourceIndex(0) +7 >Emitted(106, 25) Source(16, 29) + SourceIndex(0) +--- +>>> y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); +1->^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^ +1-> + > + > @dec + > @dec + > +2 > y +3 > = +4 > 1 +5 > ; +1->Emitted(107, 9) Source(20, 5) + SourceIndex(0) +2 >Emitted(107, 10) Source(20, 6) + SourceIndex(0) +3 >Emitted(107, 108) Source(20, 9) + SourceIndex(0) +4 >Emitted(107, 109) Source(20, 10) + SourceIndex(0) +5 >Emitted(107, 112) Source(20, 11) + SourceIndex(0) +--- +>>> #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^^^^^^^^^-> +1 > + > + > @dec + > @dec + > +2 > accessor z = +3 > 1 +4 > ; +1 >Emitted(108, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(108, 74) Source(24, 18) + SourceIndex(0) +3 >Emitted(108, 75) Source(24, 19) + SourceIndex(0) +4 >Emitted(108, 77) Source(24, 20) + SourceIndex(0) +--- +>>> get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } +1->^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^-> +1-> +2 > accessor +3 > z +4 > = 1; +1->Emitted(109, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(109, 13) Source(24, 14) + SourceIndex(0) +3 >Emitted(109, 14) Source(24, 15) + SourceIndex(0) +4 >Emitted(109, 85) Source(24, 20) + SourceIndex(0) +--- +>>> set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } +1->^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > accessor +3 > z +4 > = 1; +1->Emitted(110, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(110, 13) Source(24, 14) + SourceIndex(0) +3 >Emitted(110, 14) Source(24, 15) + SourceIndex(0) +4 >Emitted(110, 90) Source(24, 20) + SourceIndex(0) +--- +>>> static { +>>> __runInitializers(_classThis, _classExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > C +1 >Emitted(112, 13) Source(5, 7) + SourceIndex(0) +2 >Emitted(112, 68) Source(5, 8) + SourceIndex(0) +--- +>>> } +>>> }; +>>> _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^-> +1 > { + > @dec + > @dec + > method() {} + > + > @dec + > @dec + > get x() { return 1; } + > + > @dec + > @dec + > set x(value: number) { } + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > accessor z = 1; + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static +2 > #y = +3 > 1 +4 > +5 > = 1; +1 >Emitted(115, 5) Source(40, 12) + SourceIndex(0) +2 >Emitted(115, 81) Source(40, 17) + SourceIndex(0) +3 >Emitted(115, 82) Source(40, 18) + SourceIndex(0) +4 >Emitted(115, 85) Source(40, 14) + SourceIndex(0) +5 >Emitted(115, 86) Source(40, 19) + SourceIndex(0) +--- +>>> _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +1-> + > + > @dec + > @dec + > static accessor +2 > #z = +3 > 1 +4 > +5 > = 1; +1->Emitted(116, 5) Source(44, 21) + SourceIndex(0) +2 >Emitted(116, 98) Source(44, 26) + SourceIndex(0) +3 >Emitted(116, 99) Source(44, 27) + SourceIndex(0) +4 >Emitted(116, 102) Source(44, 23) + SourceIndex(0) +5 >Emitted(116, 103) Source(44, 28) + SourceIndex(0) +--- +>>> return C = _classThis; +1 >^^^^^^^^^^^ +2 > ^ +1 > +2 > C +1 >Emitted(117, 12) Source(5, 7) + SourceIndex(0) +2 >Emitted(117, 13) Source(5, 8) + SourceIndex(0) +--- +>>>})(); +>>>//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.js.map=================================================================== +JsFile: esDecorators-classDeclaration-sourceMap.d.ts +mapUrl: esDecorators-classDeclaration-sourceMap.d.ts.map +sourceRoot: +sources: esDecorators-classDeclaration-sourceMap.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.d.ts +sourceFile:esDecorators-classDeclaration-sourceMap.ts +------------------------------------------------------------------- +>>>declare var dec: any; +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^^ +5 > ^^^ +6 > ^^ +7 > ^^^ +8 > ^ +1 > +2 >declare +3 > +4 > var +5 > dec +6 > : +7 > any +8 > ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +4 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +6 >Emitted(1, 18) Source(1, 18) + SourceIndex(0) +7 >Emitted(1, 21) Source(1, 21) + SourceIndex(0) +8 >Emitted(1, 22) Source(1, 22) + SourceIndex(0) +--- +>>>declare class C { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^ +1 > + > + > +2 >@dec + >@dec + >class +3 > C +1 >Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 15) Source(5, 7) + SourceIndex(0) +3 >Emitted(2, 16) Source(5, 8) + SourceIndex(0) +--- +>>> #private; +>>> method(): void; +1 >^^^^ +2 > ^^^^^^ +3 > ^^^^^^^^^^^-> +1 > { + > @dec + > @dec + > +2 > method +1 >Emitted(4, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(4, 11) Source(8, 11) + SourceIndex(0) +--- +>>> get x(): number; +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^^^-> +1->() {} + > + > +2 > @dec + > @dec + > get +3 > x +4 > () { return 1; } + > + > @dec + > @dec + > set x(value: +5 > number +6 > +1->Emitted(5, 5) Source(10, 5) + SourceIndex(0) +2 >Emitted(5, 9) Source(12, 9) + SourceIndex(0) +3 >Emitted(5, 10) Source(12, 10) + SourceIndex(0) +4 >Emitted(5, 14) Source(16, 18) + SourceIndex(0) +5 >Emitted(5, 20) Source(16, 24) + SourceIndex(0) +6 >Emitted(5, 21) Source(12, 26) + SourceIndex(0) +--- +>>> set x(value: number); +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +1-> + > + > +2 > @dec + > @dec + > set +3 > x +4 > ( +5 > value +6 > : +7 > number +8 > ) { } +1->Emitted(6, 5) Source(14, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(16, 9) + SourceIndex(0) +3 >Emitted(6, 10) Source(16, 10) + SourceIndex(0) +4 >Emitted(6, 11) Source(16, 11) + SourceIndex(0) +5 >Emitted(6, 16) Source(16, 16) + SourceIndex(0) +6 >Emitted(6, 18) Source(16, 18) + SourceIndex(0) +7 >Emitted(6, 24) Source(16, 24) + SourceIndex(0) +8 >Emitted(6, 26) Source(16, 29) + SourceIndex(0) +--- +>>> y: number; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^ +4 > ^^^^^^^^^^-> +1 > + > + > @dec + > @dec + > +2 > y +3 > = 1; +1 >Emitted(7, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(7, 6) Source(20, 6) + SourceIndex(0) +3 >Emitted(7, 15) Source(20, 11) + SourceIndex(0) +--- +>>> accessor z: number; +1->^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^ +1-> + > + > @dec + > @dec + > +2 > accessor +3 > +4 > z +5 > = 1; +1->Emitted(8, 5) Source(24, 5) + SourceIndex(0) +2 >Emitted(8, 13) Source(24, 13) + SourceIndex(0) +3 >Emitted(8, 14) Source(24, 14) + SourceIndex(0) +4 >Emitted(8, 15) Source(24, 15) + SourceIndex(0) +5 >Emitted(8, 24) Source(24, 20) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static #y = 1; + > + > @dec + > @dec + > static accessor #z = 1; + >} +1 >Emitted(9, 2) Source(45, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).symbols b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).symbols new file mode 100644 index 0000000000000..fdb35b4809deb --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).symbols @@ -0,0 +1,106 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts === +declare var dec: any; +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + +@dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + +@dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + +class C { +>C : Symbol(C, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 21)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + method() {} +>method : Symbol(C.method, Decl(esDecorators-classDeclaration-sourceMap.ts, 4, 9)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + get x() { return 1; } +>x : Symbol(C.x, Decl(esDecorators-classDeclaration-sourceMap.ts, 7, 15), Decl(esDecorators-classDeclaration-sourceMap.ts, 11, 25)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + set x(value: number) { } +>x : Symbol(C.x, Decl(esDecorators-classDeclaration-sourceMap.ts, 7, 15), Decl(esDecorators-classDeclaration-sourceMap.ts, 11, 25)) +>value : Symbol(value, Decl(esDecorators-classDeclaration-sourceMap.ts, 15, 10)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + y = 1; +>y : Symbol(C.y, Decl(esDecorators-classDeclaration-sourceMap.ts, 15, 28)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + accessor z = 1; +>z : Symbol(C.z, Decl(esDecorators-classDeclaration-sourceMap.ts, 19, 10)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static #method() {} +>#method : Symbol(C.#method, Decl(esDecorators-classDeclaration-sourceMap.ts, 23, 19)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static get #x() { return 1; } +>#x : Symbol(C.#x, Decl(esDecorators-classDeclaration-sourceMap.ts, 27, 23), Decl(esDecorators-classDeclaration-sourceMap.ts, 31, 33)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static set #x(value: number) { } +>#x : Symbol(C.#x, Decl(esDecorators-classDeclaration-sourceMap.ts, 27, 23), Decl(esDecorators-classDeclaration-sourceMap.ts, 31, 33)) +>value : Symbol(value, Decl(esDecorators-classDeclaration-sourceMap.ts, 35, 18)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static #y = 1; +>#y : Symbol(C.#y, Decl(esDecorators-classDeclaration-sourceMap.ts, 35, 36)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static accessor #z = 1; +>#z : Symbol(C.#z, Decl(esDecorators-classDeclaration-sourceMap.ts, 39, 18)) +} + diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).types b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).types new file mode 100644 index 0000000000000..0953c47c87f0d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts === +declare var dec: any; +>dec : any + +@dec +>dec : any + +@dec +>dec : any + +class C { +>C : C + + @dec +>dec : any + + @dec +>dec : any + + method() {} +>method : () => void + + @dec +>dec : any + + @dec +>dec : any + + get x() { return 1; } +>x : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + set x(value: number) { } +>x : number +>value : number + + @dec +>dec : any + + @dec +>dec : any + + y = 1; +>y : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + accessor z = 1; +>z : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + static #method() {} +>#method : () => void + + @dec +>dec : any + + @dec +>dec : any + + static get #x() { return 1; } +>#x : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + static set #x(value: number) { } +>#x : number +>value : number + + @dec +>dec : any + + @dec +>dec : any + + static #y = 1; +>#y : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + static accessor #z = 1; +>#z : number +>1 : 1 +} + diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).js new file mode 100644 index 0000000000000..ebd8088626496 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).js @@ -0,0 +1,96 @@ +//// [esDecorators-classDeclaration-sourceMap.ts] +declare var dec: any; + +@dec +@dec +class C { + @dec + @dec + method() {} + + @dec + @dec + get x() { return 1; } + + @dec + @dec + set x(value: number) { } + + @dec + @dec + y = 1; + + @dec + @dec + accessor z = 1; + + @dec + @dec + static #method() {} + + @dec + @dec + static get #x() { return 1; } + + @dec + @dec + static set #x(value: number) { } + + @dec + @dec + static #y = 1; + + @dec + @dec + static accessor #z = 1; +} + + +//// [esDecorators-classDeclaration-sourceMap.js] +@dec +@dec +class C { + @dec + @dec + method() { } + @dec + @dec + get x() { return 1; } + @dec + @dec + set x(value) { } + @dec + @dec + y = 1; + @dec + @dec + accessor z = 1; + @dec + @dec + static #method() { } + @dec + @dec + static get #x() { return 1; } + @dec + @dec + static set #x(value) { } + @dec + @dec + static #y = 1; + @dec + @dec + static accessor #z = 1; +} +//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.js.map + +//// [esDecorators-classDeclaration-sourceMap.d.ts] +declare var dec: any; +declare class C { + #private; + method(): void; + get x(): number; + set x(value: number); + y: number; + accessor z: number; +} +//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).js.map new file mode 100644 index 0000000000000..da283b863de83 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).js.map @@ -0,0 +1,7 @@ +//// [esDecorators-classDeclaration-sourceMap.js.map] +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAEA,CAAC,GAAG;AACJ,CAAC,GAAG;MACE,CAAC;IACH,CAAC,GAAG;IACJ,CAAC,GAAG;I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QUc7SUFDSixDQUFDLEdBQUc7SUFDSixNQUFNLEtBQUssRUFBRSxLQUFLLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUU3QixDQUFDLEdBQUc7SUFDSixDQUFDLEdBQUc7SUFDSixNQUFNLEtBQUssRUFBRSxDQUFDLEtBQWEsSUFBSSxDQUFDO0lBRWhDLENBQUMsR0FBRztJQUNKLENBQUMsR0FBRztJQUNKLE1BQU0sQ0FBQyxFQUFFLEdBQUcsQ0FBQyxDQUFDO0lBRWQsQ0FBQyxHQUFHO0lBQ0osQ0FBQyxHQUFHO0lBQ0osTUFBTSxDQUFDLFFBQVEsQ0FBQyxFQUFFLEdBQUcsQ0FBQyxDQUFDIn0=,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== + +//// [esDecorators-classDeclaration-sourceMap.d.ts.map] +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} +//// https://sokra.github.io/source-map-visualization#base64,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7DQpkZWNsYXJlIGNsYXNzIEMgew0KICAgICNwcml2YXRlOw0KICAgIG1ldGhvZCgpOiB2b2lkOw0KICAgIGdldCB4KCk6IG51bWJlcjsNCiAgICBzZXQgeCh2YWx1ZTogbnVtYmVyKTsNCiAgICB5OiBudW1iZXI7DQogICAgYWNjZXNzb3IgejogbnVtYmVyOw0KfQ0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmQudHMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJlc0RlY29yYXRvcnMtY2xhc3NEZWNsYXJhdGlvbi1zb3VyY2VNYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxDQUFDLElBQUksR0FBRyxFQUFFLEdBQUcsQ0FBQztBQUVyQixjQUVNLENBQUM7O0lBR0gsTUFBTTtJQUVOLElBRUksQ0FBQyxJQUlRLE1BQU0sQ0FKRTtJQUVyQixJQUVJLENBQUMsQ0FBQyxLQUFLLEVBQUUsTUFBTSxFQUFLO0lBSXhCLENBQUMsU0FBSztJQUlOLFFBQVEsQ0FBQyxDQUFDLFNBQUs7Q0FxQmxCIn0=,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).sourcemap.txt new file mode 100644 index 0000000000000..bf9cda83847fa --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).sourcemap.txt @@ -0,0 +1,745 @@ +=================================================================== +JsFile: esDecorators-classDeclaration-sourceMap.js +mapUrl: esDecorators-classDeclaration-sourceMap.js.map +sourceRoot: +sources: esDecorators-classDeclaration-sourceMap.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.js +sourceFile:esDecorators-classDeclaration-sourceMap.ts +------------------------------------------------------------------- +>>>@dec +1 > +2 >^ +3 > ^^^ +4 > ^-> +1 >declare var dec: any; + > + > +2 >@ +3 > dec +1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(1, 2) Source(3, 2) + SourceIndex(0) +3 >Emitted(1, 5) Source(3, 5) + SourceIndex(0) +--- +>>>@dec +1-> +2 >^ +3 > ^^^ +4 > ^^^^^^-> +1-> + > +2 >@ +3 > dec +1->Emitted(2, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(2, 2) Source(4, 2) + SourceIndex(0) +3 >Emitted(2, 5) Source(4, 5) + SourceIndex(0) +--- +>>>class C { +1->^^^^^^ +2 > ^ +3 > ^^-> +1-> + >class +2 > C +1->Emitted(3, 7) Source(5, 7) + SourceIndex(0) +2 >Emitted(3, 8) Source(5, 8) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1-> { + > +2 > @ +3 > dec +1->Emitted(4, 5) Source(6, 5) + SourceIndex(0) +2 >Emitted(4, 6) Source(6, 6) + SourceIndex(0) +3 >Emitted(4, 9) Source(6, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^^^^^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(5, 5) Source(7, 5) + SourceIndex(0) +2 >Emitted(5, 6) Source(7, 6) + SourceIndex(0) +3 >Emitted(5, 9) Source(7, 9) + SourceIndex(0) +--- +>>> method() { } +1->^^^^ +2 > ^^^^^^ +3 > ^^^^^ +4 > ^ +1-> + > +2 > method +3 > () { +4 > } +1->Emitted(6, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(6, 11) Source(8, 11) + SourceIndex(0) +3 >Emitted(6, 16) Source(8, 15) + SourceIndex(0) +4 >Emitted(6, 17) Source(8, 16) + SourceIndex(0) +--- +>>> @dec +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1 > + > + > +2 > @ +3 > dec +1 >Emitted(7, 5) Source(10, 5) + SourceIndex(0) +2 >Emitted(7, 6) Source(10, 6) + SourceIndex(0) +3 >Emitted(7, 9) Source(10, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(8, 5) Source(11, 5) + SourceIndex(0) +2 >Emitted(8, 6) Source(11, 6) + SourceIndex(0) +3 >Emitted(8, 9) Source(11, 9) + SourceIndex(0) +--- +>>> get x() { return 1; } +1->^^^^^^^^ +2 > ^ +3 > ^^^^^ +4 > ^^^^^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +1-> + > get +2 > x +3 > () { +4 > return +5 > 1 +6 > ; +7 > +8 > } +1->Emitted(9, 9) Source(12, 9) + SourceIndex(0) +2 >Emitted(9, 10) Source(12, 10) + SourceIndex(0) +3 >Emitted(9, 15) Source(12, 15) + SourceIndex(0) +4 >Emitted(9, 22) Source(12, 22) + SourceIndex(0) +5 >Emitted(9, 23) Source(12, 23) + SourceIndex(0) +6 >Emitted(9, 24) Source(12, 24) + SourceIndex(0) +7 >Emitted(9, 25) Source(12, 25) + SourceIndex(0) +8 >Emitted(9, 26) Source(12, 26) + SourceIndex(0) +--- +>>> @dec +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1 > + > + > +2 > @ +3 > dec +1 >Emitted(10, 5) Source(14, 5) + SourceIndex(0) +2 >Emitted(10, 6) Source(14, 6) + SourceIndex(0) +3 >Emitted(10, 9) Source(14, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^^^^^^^^^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(11, 5) Source(15, 5) + SourceIndex(0) +2 >Emitted(11, 6) Source(15, 6) + SourceIndex(0) +3 >Emitted(11, 9) Source(15, 9) + SourceIndex(0) +--- +>>> set x(value) { } +1->^^^^^^^^ +2 > ^ +3 > ^ +4 > ^^^^^ +5 > ^^^^ +6 > ^ +1-> + > set +2 > x +3 > ( +4 > value: number +5 > ) { +6 > } +1->Emitted(12, 9) Source(16, 9) + SourceIndex(0) +2 >Emitted(12, 10) Source(16, 10) + SourceIndex(0) +3 >Emitted(12, 11) Source(16, 11) + SourceIndex(0) +4 >Emitted(12, 16) Source(16, 24) + SourceIndex(0) +5 >Emitted(12, 20) Source(16, 28) + SourceIndex(0) +6 >Emitted(12, 21) Source(16, 29) + SourceIndex(0) +--- +>>> @dec +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1 > + > + > +2 > @ +3 > dec +1 >Emitted(13, 5) Source(18, 5) + SourceIndex(0) +2 >Emitted(13, 6) Source(18, 6) + SourceIndex(0) +3 >Emitted(13, 9) Source(18, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(14, 5) Source(19, 5) + SourceIndex(0) +2 >Emitted(14, 6) Source(19, 6) + SourceIndex(0) +3 >Emitted(14, 9) Source(19, 9) + SourceIndex(0) +--- +>>> y = 1; +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^ +5 > ^ +1-> + > +2 > y +3 > = +4 > 1 +5 > ; +1->Emitted(15, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(15, 6) Source(20, 6) + SourceIndex(0) +3 >Emitted(15, 9) Source(20, 9) + SourceIndex(0) +4 >Emitted(15, 10) Source(20, 10) + SourceIndex(0) +5 >Emitted(15, 11) Source(20, 11) + SourceIndex(0) +--- +>>> @dec +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1 > + > + > +2 > @ +3 > dec +1 >Emitted(16, 5) Source(22, 5) + SourceIndex(0) +2 >Emitted(16, 6) Source(22, 6) + SourceIndex(0) +3 >Emitted(16, 9) Source(22, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^^^^^^^^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(17, 5) Source(23, 5) + SourceIndex(0) +2 >Emitted(17, 6) Source(23, 6) + SourceIndex(0) +3 >Emitted(17, 9) Source(23, 9) + SourceIndex(0) +--- +>>> accessor z = 1; +1->^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^ +5 > ^^^ +6 > ^ +7 > ^ +1-> + > +2 > accessor +3 > +4 > z +5 > = +6 > 1 +7 > ; +1->Emitted(18, 5) Source(24, 5) + SourceIndex(0) +2 >Emitted(18, 13) Source(24, 13) + SourceIndex(0) +3 >Emitted(18, 14) Source(24, 14) + SourceIndex(0) +4 >Emitted(18, 15) Source(24, 15) + SourceIndex(0) +5 >Emitted(18, 18) Source(24, 18) + SourceIndex(0) +6 >Emitted(18, 19) Source(24, 19) + SourceIndex(0) +7 >Emitted(18, 20) Source(24, 20) + SourceIndex(0) +--- +>>> @dec +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1 > + > + > +2 > @ +3 > dec +1 >Emitted(19, 5) Source(26, 5) + SourceIndex(0) +2 >Emitted(19, 6) Source(26, 6) + SourceIndex(0) +3 >Emitted(19, 9) Source(26, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^^^^^^^^^^^^^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(20, 5) Source(27, 5) + SourceIndex(0) +2 >Emitted(20, 6) Source(27, 6) + SourceIndex(0) +3 >Emitted(20, 9) Source(27, 9) + SourceIndex(0) +--- +>>> static #method() { } +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^ +5 > ^^^^^ +6 > ^ +1-> + > +2 > static +3 > +4 > #method +5 > () { +6 > } +1->Emitted(21, 5) Source(28, 5) + SourceIndex(0) +2 >Emitted(21, 11) Source(28, 11) + SourceIndex(0) +3 >Emitted(21, 12) Source(28, 12) + SourceIndex(0) +4 >Emitted(21, 19) Source(28, 19) + SourceIndex(0) +5 >Emitted(21, 24) Source(28, 23) + SourceIndex(0) +6 >Emitted(21, 25) Source(28, 24) + SourceIndex(0) +--- +>>> @dec +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1 > + > + > +2 > @ +3 > dec +1 >Emitted(22, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(22, 6) Source(30, 6) + SourceIndex(0) +3 >Emitted(22, 9) Source(30, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(23, 5) Source(31, 5) + SourceIndex(0) +2 >Emitted(23, 6) Source(31, 6) + SourceIndex(0) +3 >Emitted(23, 9) Source(31, 9) + SourceIndex(0) +--- +>>> static get #x() { return 1; } +1->^^^^ +2 > ^^^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^^^^^ +6 > ^^^^^^^ +7 > ^ +8 > ^ +9 > ^ +10> ^ +1-> + > +2 > static +3 > get +4 > #x +5 > () { +6 > return +7 > 1 +8 > ; +9 > +10> } +1->Emitted(24, 5) Source(32, 5) + SourceIndex(0) +2 >Emitted(24, 11) Source(32, 11) + SourceIndex(0) +3 >Emitted(24, 16) Source(32, 16) + SourceIndex(0) +4 >Emitted(24, 18) Source(32, 18) + SourceIndex(0) +5 >Emitted(24, 23) Source(32, 23) + SourceIndex(0) +6 >Emitted(24, 30) Source(32, 30) + SourceIndex(0) +7 >Emitted(24, 31) Source(32, 31) + SourceIndex(0) +8 >Emitted(24, 32) Source(32, 32) + SourceIndex(0) +9 >Emitted(24, 33) Source(32, 33) + SourceIndex(0) +10>Emitted(24, 34) Source(32, 34) + SourceIndex(0) +--- +>>> @dec +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1 > + > + > +2 > @ +3 > dec +1 >Emitted(25, 5) Source(34, 5) + SourceIndex(0) +2 >Emitted(25, 6) Source(34, 6) + SourceIndex(0) +3 >Emitted(25, 9) Source(34, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(26, 5) Source(35, 5) + SourceIndex(0) +2 >Emitted(26, 6) Source(35, 6) + SourceIndex(0) +3 >Emitted(26, 9) Source(35, 9) + SourceIndex(0) +--- +>>> static set #x(value) { } +1->^^^^ +2 > ^^^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^ +6 > ^^^^^ +7 > ^^^^ +8 > ^ +1-> + > +2 > static +3 > set +4 > #x +5 > ( +6 > value: number +7 > ) { +8 > } +1->Emitted(27, 5) Source(36, 5) + SourceIndex(0) +2 >Emitted(27, 11) Source(36, 11) + SourceIndex(0) +3 >Emitted(27, 16) Source(36, 16) + SourceIndex(0) +4 >Emitted(27, 18) Source(36, 18) + SourceIndex(0) +5 >Emitted(27, 19) Source(36, 19) + SourceIndex(0) +6 >Emitted(27, 24) Source(36, 32) + SourceIndex(0) +7 >Emitted(27, 28) Source(36, 36) + SourceIndex(0) +8 >Emitted(27, 29) Source(36, 37) + SourceIndex(0) +--- +>>> @dec +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1 > + > + > +2 > @ +3 > dec +1 >Emitted(28, 5) Source(38, 5) + SourceIndex(0) +2 >Emitted(28, 6) Source(38, 6) + SourceIndex(0) +3 >Emitted(28, 9) Source(38, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^^^^^^^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(29, 5) Source(39, 5) + SourceIndex(0) +2 >Emitted(29, 6) Source(39, 6) + SourceIndex(0) +3 >Emitted(29, 9) Source(39, 9) + SourceIndex(0) +--- +>>> static #y = 1; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^^^ +6 > ^ +7 > ^ +1-> + > +2 > static +3 > +4 > #y +5 > = +6 > 1 +7 > ; +1->Emitted(30, 5) Source(40, 5) + SourceIndex(0) +2 >Emitted(30, 11) Source(40, 11) + SourceIndex(0) +3 >Emitted(30, 12) Source(40, 12) + SourceIndex(0) +4 >Emitted(30, 14) Source(40, 14) + SourceIndex(0) +5 >Emitted(30, 17) Source(40, 17) + SourceIndex(0) +6 >Emitted(30, 18) Source(40, 18) + SourceIndex(0) +7 >Emitted(30, 19) Source(40, 19) + SourceIndex(0) +--- +>>> @dec +1 >^^^^ +2 > ^ +3 > ^^^ +4 > ^-> +1 > + > + > +2 > @ +3 > dec +1 >Emitted(31, 5) Source(42, 5) + SourceIndex(0) +2 >Emitted(31, 6) Source(42, 6) + SourceIndex(0) +3 >Emitted(31, 9) Source(42, 9) + SourceIndex(0) +--- +>>> @dec +1->^^^^ +2 > ^ +3 > ^^^ +4 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > @ +3 > dec +1->Emitted(32, 5) Source(43, 5) + SourceIndex(0) +2 >Emitted(32, 6) Source(43, 6) + SourceIndex(0) +3 >Emitted(32, 9) Source(43, 9) + SourceIndex(0) +--- +>>> static accessor #z = 1; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^ +5 > ^ +6 > ^^ +7 > ^^^ +8 > ^ +9 > ^ +1-> + > +2 > static +3 > +4 > accessor +5 > +6 > #z +7 > = +8 > 1 +9 > ; +1->Emitted(33, 5) Source(44, 5) + SourceIndex(0) +2 >Emitted(33, 11) Source(44, 11) + SourceIndex(0) +3 >Emitted(33, 12) Source(44, 12) + SourceIndex(0) +4 >Emitted(33, 20) Source(44, 20) + SourceIndex(0) +5 >Emitted(33, 21) Source(44, 21) + SourceIndex(0) +6 >Emitted(33, 23) Source(44, 23) + SourceIndex(0) +7 >Emitted(33, 26) Source(44, 26) + SourceIndex(0) +8 >Emitted(33, 27) Source(44, 27) + SourceIndex(0) +9 >Emitted(33, 28) Source(44, 28) + SourceIndex(0) +--- +>>>} +>>>//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.js.map=================================================================== +JsFile: esDecorators-classDeclaration-sourceMap.d.ts +mapUrl: esDecorators-classDeclaration-sourceMap.d.ts.map +sourceRoot: +sources: esDecorators-classDeclaration-sourceMap.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.d.ts +sourceFile:esDecorators-classDeclaration-sourceMap.ts +------------------------------------------------------------------- +>>>declare var dec: any; +1 > +2 >^^^^^^^ +3 > ^ +4 > ^^^^ +5 > ^^^ +6 > ^^ +7 > ^^^ +8 > ^ +1 > +2 >declare +3 > +4 > var +5 > dec +6 > : +7 > any +8 > ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +4 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +6 >Emitted(1, 18) Source(1, 18) + SourceIndex(0) +7 >Emitted(1, 21) Source(1, 21) + SourceIndex(0) +8 >Emitted(1, 22) Source(1, 22) + SourceIndex(0) +--- +>>>declare class C { +1 > +2 >^^^^^^^^^^^^^^ +3 > ^ +1 > + > + > +2 >@dec + >@dec + >class +3 > C +1 >Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 15) Source(5, 7) + SourceIndex(0) +3 >Emitted(2, 16) Source(5, 8) + SourceIndex(0) +--- +>>> #private; +>>> method(): void; +1 >^^^^ +2 > ^^^^^^ +3 > ^^^^^^^^^^^-> +1 > { + > @dec + > @dec + > +2 > method +1 >Emitted(4, 5) Source(8, 5) + SourceIndex(0) +2 >Emitted(4, 11) Source(8, 11) + SourceIndex(0) +--- +>>> get x(): number; +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^^^-> +1->() {} + > + > +2 > @dec + > @dec + > get +3 > x +4 > () { return 1; } + > + > @dec + > @dec + > set x(value: +5 > number +6 > +1->Emitted(5, 5) Source(10, 5) + SourceIndex(0) +2 >Emitted(5, 9) Source(12, 9) + SourceIndex(0) +3 >Emitted(5, 10) Source(12, 10) + SourceIndex(0) +4 >Emitted(5, 14) Source(16, 18) + SourceIndex(0) +5 >Emitted(5, 20) Source(16, 24) + SourceIndex(0) +6 >Emitted(5, 21) Source(12, 26) + SourceIndex(0) +--- +>>> set x(value: number); +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^ +1-> + > + > +2 > @dec + > @dec + > set +3 > x +4 > ( +5 > value +6 > : +7 > number +8 > ) { } +1->Emitted(6, 5) Source(14, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(16, 9) + SourceIndex(0) +3 >Emitted(6, 10) Source(16, 10) + SourceIndex(0) +4 >Emitted(6, 11) Source(16, 11) + SourceIndex(0) +5 >Emitted(6, 16) Source(16, 16) + SourceIndex(0) +6 >Emitted(6, 18) Source(16, 18) + SourceIndex(0) +7 >Emitted(6, 24) Source(16, 24) + SourceIndex(0) +8 >Emitted(6, 26) Source(16, 29) + SourceIndex(0) +--- +>>> y: number; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^ +4 > ^^^^^^^^^^-> +1 > + > + > @dec + > @dec + > +2 > y +3 > = 1; +1 >Emitted(7, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(7, 6) Source(20, 6) + SourceIndex(0) +3 >Emitted(7, 15) Source(20, 11) + SourceIndex(0) +--- +>>> accessor z: number; +1->^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^ +1-> + > + > @dec + > @dec + > +2 > accessor +3 > +4 > z +5 > = 1; +1->Emitted(8, 5) Source(24, 5) + SourceIndex(0) +2 >Emitted(8, 13) Source(24, 13) + SourceIndex(0) +3 >Emitted(8, 14) Source(24, 14) + SourceIndex(0) +4 >Emitted(8, 15) Source(24, 15) + SourceIndex(0) +5 >Emitted(8, 24) Source(24, 20) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > @dec + > @dec + > static #method() {} + > + > @dec + > @dec + > static get #x() { return 1; } + > + > @dec + > @dec + > static set #x(value: number) { } + > + > @dec + > @dec + > static #y = 1; + > + > @dec + > @dec + > static accessor #z = 1; + >} +1 >Emitted(9, 2) Source(45, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.d.ts.map \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).symbols b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).symbols new file mode 100644 index 0000000000000..fdb35b4809deb --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).symbols @@ -0,0 +1,106 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts === +declare var dec: any; +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + +@dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + +@dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + +class C { +>C : Symbol(C, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 21)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + method() {} +>method : Symbol(C.method, Decl(esDecorators-classDeclaration-sourceMap.ts, 4, 9)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + get x() { return 1; } +>x : Symbol(C.x, Decl(esDecorators-classDeclaration-sourceMap.ts, 7, 15), Decl(esDecorators-classDeclaration-sourceMap.ts, 11, 25)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + set x(value: number) { } +>x : Symbol(C.x, Decl(esDecorators-classDeclaration-sourceMap.ts, 7, 15), Decl(esDecorators-classDeclaration-sourceMap.ts, 11, 25)) +>value : Symbol(value, Decl(esDecorators-classDeclaration-sourceMap.ts, 15, 10)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + y = 1; +>y : Symbol(C.y, Decl(esDecorators-classDeclaration-sourceMap.ts, 15, 28)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + accessor z = 1; +>z : Symbol(C.z, Decl(esDecorators-classDeclaration-sourceMap.ts, 19, 10)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static #method() {} +>#method : Symbol(C.#method, Decl(esDecorators-classDeclaration-sourceMap.ts, 23, 19)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static get #x() { return 1; } +>#x : Symbol(C.#x, Decl(esDecorators-classDeclaration-sourceMap.ts, 27, 23), Decl(esDecorators-classDeclaration-sourceMap.ts, 31, 33)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static set #x(value: number) { } +>#x : Symbol(C.#x, Decl(esDecorators-classDeclaration-sourceMap.ts, 27, 23), Decl(esDecorators-classDeclaration-sourceMap.ts, 31, 33)) +>value : Symbol(value, Decl(esDecorators-classDeclaration-sourceMap.ts, 35, 18)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static #y = 1; +>#y : Symbol(C.#y, Decl(esDecorators-classDeclaration-sourceMap.ts, 35, 36)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + @dec +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-sourceMap.ts, 0, 11)) + + static accessor #z = 1; +>#z : Symbol(C.#z, Decl(esDecorators-classDeclaration-sourceMap.ts, 39, 18)) +} + diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).types b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).types new file mode 100644 index 0000000000000..0953c47c87f0d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=esnext).types @@ -0,0 +1,112 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts === +declare var dec: any; +>dec : any + +@dec +>dec : any + +@dec +>dec : any + +class C { +>C : C + + @dec +>dec : any + + @dec +>dec : any + + method() {} +>method : () => void + + @dec +>dec : any + + @dec +>dec : any + + get x() { return 1; } +>x : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + set x(value: number) { } +>x : number +>value : number + + @dec +>dec : any + + @dec +>dec : any + + y = 1; +>y : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + accessor z = 1; +>z : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + static #method() {} +>#method : () => void + + @dec +>dec : any + + @dec +>dec : any + + static get #x() { return 1; } +>#x : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + static set #x(value: number) { } +>#x : number +>value : number + + @dec +>dec : any + + @dec +>dec : any + + static #y = 1; +>#y : number +>1 : 1 + + @dec +>dec : any + + @dec +>dec : any + + static accessor #z = 1; +>#z : number +>1 : 1 +} + diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js.map b/tests/baselines/reference/sourceMapValidationDecorators.js.map index 97eeb8282bf58..21c6fae6e74fc 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.js.map +++ b/tests/baselines/reference/sourceMapValidationDecorators.js.map @@ -1,3 +1,3 @@ //// [sourceMapValidationDecorators.js.map] -{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":[],"mappings":";;;;;;;;;AASA;IACI,iBAGS,QAAgB;QAIvB,WAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,0BAAc;;QAJP,aAAQ,GAAR,QAAQ,CAAQ;IAKzB,CAAC;IAID,uBAAK,GAAL;QACI,OAAO,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5C,CAAC;IAUO,oBAAE,GAAV,UAGE,CAAS;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAID,sBAAI,8BAAS;aAAb;YACI,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;aAED,UAGE,SAAiB;YACf,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC9B,CAAC;;;OAPA;IAbc,UAAE,GAAW,EAAG,CAAA;IAV/B;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;wCAGtB;IAID;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;sCACL;IAMlB;QACG,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;qCAGzB;IAID;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;QAMpB,WA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W5nID0gZ3JlZXRpbmdzOw0KICAgICAgICB9LA0KICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwNCiAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlDQogICAgfSk7DQogICAgR3JlZXRlci54MSA9IDEwOw0KICAgIF9fZGVjb3JhdGUoWw0KICAgICAgICBQcm9wZXJ0eURlY29yYXRvcjEsDQogICAgICAgIFByb3BlcnR5RGVjb3JhdG9yMig0MCkNCiAgICBdLCBHcmVldGVyLnByb3RvdHlwZSwgImdyZWV0IiwgbnVsbCk7DQogICAgX19kZWNvcmF0ZShbDQogICAgICAgIFByb3BlcnR5RGVjb3JhdG9yMSwNCiAgICAgICAgUHJvcGVydHlEZWNvcmF0b3IyKDUwKQ0KICAgIF0sIEdyZWV0ZXIucHJvdG90eXBlLCAieCIsIHZvaWQgMCk7DQogICAgX19kZWNvcmF0ZShbDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMSksDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMig3MCkpDQogICAgXSwgR3JlZXRlci5wcm90b3R5cGUsICJmbiIsIG51bGwpOw0KICAgIF9fZGVjb3JhdGUoWw0KICAgICAgICBQcm9wZXJ0eURlY29yYXRvcjEsDQogICAgICAgIFByb3BlcnR5RGVjb3JhdG9yMig4MCksDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMSksDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMig5MCkpDQogICAgXSwgR3JlZXRlci5wcm90b3R5cGUsICJncmVldGluZ3MiLCBudWxsKTsNCiAgICBfX2RlY29yYXRlKFsNCiAgICAgICAgUHJvcGVydHlEZWNvcmF0b3IxLA0KICAgICAgICBQcm9wZXJ0eURlY29yYXRvcjIoNjApDQogICAgXSwgR3JlZXRlciwgIngxIiwgdm9pZCAwKTsNCiAgICBHcmVldGVyID0gX19kZ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CiAgICAgICAgcmV0dXJuICI8aDE+IiArIHRoaXMuZ3JlZXRpbmcgKyAiPC9oMT4iOwogICAgfQoKICAgIEBQcm9wZXJ0eURlY29yYXRvcjEKICAgIEBQcm9wZXJ0eURlY29yYXRvcjIoNTApCiAgICBwcml2YXRlIHg6IHN0cmluZzsKCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDYwKQogICAgcHJpdmF0ZSBzdGF0aWMgeDE6IG51bWJlciA9IDEwOwogICAgCiAgICBwcml2YXRlIGZuKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoNzApIAogICAgICB4OiBudW1iZXIpIHsKICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsKICAgIH0KCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDgwKQogICAgZ2V0IGdyZWV0aW5ncygpIHsKICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsKICAgIH0KCiAgICBzZXQgZ3JlZXRpbmdzKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoOTApIAogICAgICBncmVldGluZ3M6IHN0cmluZykgewogICAgICAgIHRoaXMuZ3JlZXRpbmcgPSBncmVldGluZ3M7CiAgICB9ICAgIAp9 +{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":[],"mappings":";;;;;;;;;AASA;IACI,iBAGS,QAAgB;QAIvB,WAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,0BAAc;;QAJP,aAAQ,GAAR,QAAQ,CAAQ;IAKzB,CAAC;IAID,uBAAK,GAAL;QACI,OAAO,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5C,CAAC;IAUO,oBA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3JlZXRpbmdzKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoOTApIAogICAgICBncmVldGluZ3M6IHN0cmluZykgewogICAgICAgIHRoaXMuZ3JlZXRpbmcgPSBncmVldGluZ3M7CiAgICB9ICAgIAp9 diff --git a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt index 06296a367daaf..bac66cde505a7 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt @@ -198,14 +198,14 @@ sourceFile:sourceMapValidationDecorators.ts > private 2 > fn 3 > -4 > private fn( +4 > fn( > @ParameterDecorator1 > @ParameterDecorator2(70) > 5 > x: number 1->Emitted(21, 5) Source(35, 13) + SourceIndex(0) 2 >Emitted(21, 25) Source(35, 15) + SourceIndex(0) -3 >Emitted(21, 28) Source(35, 5) + SourceIndex(0) +3 >Emitted(21, 28) Source(35, 13) + SourceIndex(0) 4 >Emitted(21, 38) Source(38, 7) + SourceIndex(0) 5 >Emitted(21, 39) Source(38, 16) + SourceIndex(0) --- @@ -356,17 +356,20 @@ sourceFile:sourceMapValidationDecorators.ts 2 > ^^^^^^^^^^ 3 > ^^^ 4 > ^^ -5 > ^ +5 > +6 > ^ 1-> 2 > x1 3 > : number = -4 > 10; +4 > 10 5 > +6 > : number = 10; 1->Emitted(34, 5) Source(33, 20) + SourceIndex(0) 2 >Emitted(34, 15) Source(33, 22) + SourceIndex(0) 3 >Emitted(34, 18) Source(33, 33) + SourceIndex(0) -4 >Emitted(34, 20) Source(33, 36) + SourceIndex(0) -5 >Emitted(34, 21) Source(33, 36) + SourceIndex(0) +4 >Emitted(34, 20) Source(33, 35) + SourceIndex(0) +5 >Emitted(34, 20) Source(33, 22) + SourceIndex(0) +6 >Emitted(34, 21) Source(33, 36) + SourceIndex(0) --- >>> __decorate([ 1 >^^^^ @@ -417,8 +420,8 @@ sourceFile:sourceMapValidationDecorators.ts > > @PropertyDecorator1 > @PropertyDecorator2(50) - > -1 >Emitted(39, 5) Source(29, 5) + SourceIndex(0) + > private +1 >Emitted(39, 5) Source(29, 13) + SourceIndex(0) --- >>> PropertyDecorator1, 1->^^^^^^^^ @@ -463,8 +466,8 @@ sourceFile:sourceMapValidationDecorators.ts > @PropertyDecorator2(60) > private static x1: number = 10; > - > -1 >Emitted(43, 5) Source(35, 5) + SourceIndex(0) + > private +1 >Emitted(43, 5) Source(35, 13) + SourceIndex(0) --- >>> __param(0, ParameterDecorator1), 1->^^^^^^^^ @@ -472,7 +475,7 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ^^^^^^^^^^^^^^^^^^^ 4 > ^ 5 > ^^^^^-> -1->private fn( +1->fn( > @ 2 > 3 > ParameterDecorator1 diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts new file mode 100644 index 0000000000000..f9ddcd0a28941 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-sourceMap.ts @@ -0,0 +1,51 @@ +// @target: esnext, es2022, es2015 +// @module: esnext +// @sourceMap: true +// @declaration: true +// @declarationMap: true + +declare var dec: any; + +@dec +@dec +class C { + @dec + @dec + method() {} + + @dec + @dec + get x() { return 1; } + + @dec + @dec + set x(value: number) { } + + @dec + @dec + y = 1; + + @dec + @dec + accessor z = 1; + + @dec + @dec + static #method() {} + + @dec + @dec + static get #x() { return 1; } + + @dec + @dec + static set #x(value: number) { } + + @dec + @dec + static #y = 1; + + @dec + @dec + static accessor #z = 1; +} From b28964202545639a0de918f8c2c95b6109967e0f Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 14 Oct 2022 20:39:30 -0400 Subject: [PATCH 18/51] Remove excess temp in computed name, fix collision in generated names --- src/compiler/emitter.ts | 5 ++- src/compiler/factory/utilities.ts | 38 ++++++++++++++++++- src/compiler/transformers/classFields.ts | 11 +++--- src/compiler/transformers/esDecorators.ts | 10 +++-- ...t=es2015,usedefineforclassfields=false).js | 17 +++++---- ...et=es2015,usedefineforclassfields=true).js | 17 +++++---- ...t=es2022,usedefineforclassfields=false).js | 5 +-- ...rget=es5,usedefineforclassfields=false).js | 17 +++++---- ...arget=es5,usedefineforclassfields=true).js | 17 +++++---- ...t=esnext,usedefineforclassfields=false).js | 5 +-- ...t=es2015,usedefineforclassfields=false).js | 11 ++++-- ...et=es2015,usedefineforclassfields=true).js | 11 ++++-- ...t=es2022,usedefineforclassfields=false).js | 5 +-- ...rget=es5,usedefineforclassfields=false).js | 11 ++++-- ...arget=es5,usedefineforclassfields=true).js | 11 ++++-- ...t=esnext,usedefineforclassfields=false).js | 5 +-- 16 files changed, 128 insertions(+), 68 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e4f76a65c79ad..152bb09908e10 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -904,6 +904,7 @@ namespace ts { let currentSourceFile: SourceFile | undefined; let nodeIdToGeneratedName: string[]; // Map of generated names for specific nodes. + let nodeIdToGeneratedPrivateName: string[]; // Map of generated names for specific nodes. let autoGeneratedIdToGeneratedName: string[]; // Map of generated names for temp and loop variables. let generatedNames: Set; // Set of names generated by the NameGenerator. let formattedNameTempFlagsStack: (ESMap | undefined)[]; @@ -1196,6 +1197,7 @@ namespace ts { function reset() { nodeIdToGeneratedName = []; + nodeIdToGeneratedPrivateName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new Set(); formattedNameTempFlagsStack = []; @@ -5208,7 +5210,8 @@ namespace ts { function generateNameCached(node: Node, privateName: boolean, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string) { const nodeId = getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags ?? GeneratedIdentifierFlags.None, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix))); + const cache = privateName ? nodeIdToGeneratedPrivateName : nodeIdToGeneratedName; + return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags ?? GeneratedIdentifierFlags.None, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix))); } /** diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 6800cef1ad4db..6d4ac8044547b 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -1399,7 +1399,7 @@ namespace ts { ); } - export function findComputedPropertyNameCacheVariable(name: ComputedPropertyName) { + export function findComputedPropertyNameCacheAssignment(name: ComputedPropertyName) { let node = name.expression; while (true) { node = skipOuterExpressions(node); @@ -1414,10 +1414,44 @@ namespace ts { } if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && isGeneratedIdentifier(node.left)) { - return node.left; + return node as AssignmentExpression & { readonly left: GeneratedIdentifier }; } break; } } + + function isSyntheticParenthesizedExpression(node: Expression): node is ParenthesizedExpression { + return isParenthesizedExpression(node) + && nodeIsSynthesized(node) + && !node.emitNode; + } + + function flattenCommaListWorker(node: Expression, expressions: Expression[]) { + if (isSyntheticParenthesizedExpression(node)) { + flattenCommaListWorker(node.expression, expressions); + } + else if (isCommaExpression(node)) { + flattenCommaListWorker(node.left, expressions); + flattenCommaListWorker(node.right, expressions); + } + else if (isCommaListExpression(node)) { + for (const child of node.elements) { + flattenCommaListWorker(child, expressions); + } + } + else { + expressions.push(node); + } + } + + /** + * Flatten a CommaExpression or CommaListExpression into an array of one or more expressions, unwrapping any nested + * comma expressions and synthetic parens. + */ + export function flattenCommaList(node: Expression) { + const expressions: Expression[] = []; + flattenCommaListWorker(node, expressions); + return expressions; + } } diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 2bfd0b31d57f6..49bdd12854430 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -648,10 +648,10 @@ namespace ts { let getterName = name; let setterName = name; if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression)) { - const cacheVariable = findComputedPropertyNameCacheVariable(name); - if (cacheVariable) { + const cacheAssignment = findComputedPropertyNameCacheAssignment(name); + if (cacheAssignment) { getterName = factory.updateComputedPropertyName(name, visitNode(name.expression, visitor, isExpression)); - setterName = factory.updateComputedPropertyName(name, cacheVariable); + setterName = factory.updateComputedPropertyName(name, cacheAssignment.left); } else { const temp = factory.createTempVariable(hoistVariableDeclaration); @@ -734,7 +734,7 @@ namespace ts { /*shouldHoist*/ !!node.initializer || useDefineForClassFields, /*captureReferencedName*/ !!node.initializer && isAnonymousClassDeclarationNeedingAssignedName(node.initializer)); if (expr) { - getPendingExpressions().push(expr); + getPendingExpressions().push(...flattenCommaList(expr)); } if (isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { @@ -2258,10 +2258,11 @@ namespace ts { */ function getPropertyNameExpressionIfNeeded(name: PropertyName, shouldHoist: boolean, captureReferencedName: boolean): Expression | undefined { if (isComputedPropertyName(name)) { + const cacheAssignment = findComputedPropertyNameCacheAssignment(name); let expression = visitNode(name.expression, visitor, isExpression); const innerExpression = skipPartiallyEmittedExpressions(expression); const inlinable = isSimpleInlineableExpression(innerExpression); - const alreadyTransformed = isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left); + const alreadyTransformed = !!cacheAssignment || isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left); if (!alreadyTransformed && !inlinable && shouldHoist) { const generatedName = factory.getGeneratedNameForNode(name); if (resolver.getNodeCheckFlags(name) & NodeCheckFlags.BlockScopedBindingInLoop) { diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index aa06b0f7a454b..143f6fd19b21f 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -1212,10 +1212,10 @@ namespace ts { let getterName = name; let setterName = name; if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression)) { - const cacheVariable = findComputedPropertyNameCacheVariable(name); - if (cacheVariable) { + const cacheAssignment = findComputedPropertyNameCacheAssignment(name); + if (cacheAssignment) { getterName = factory.updateComputedPropertyName(name, visitNode(name.expression, visitor, isExpression)); - setterName = factory.updateComputedPropertyName(name, cacheVariable); + setterName = factory.updateComputedPropertyName(name, cacheAssignment.left); } else { const temp = factory.createTempVariable(hoistVariableDeclaration); @@ -1522,7 +1522,9 @@ namespace ts { return { referencedName, name }; } - const referencedName = factory.createTempVariable(hoistVariableDeclaration); + const referencedName = factory.getGeneratedNameForNode(node); + hoistVariableDeclaration(referencedName); + const key = emitHelpers().createPropKeyHelper(visitNode(node.expression, visitor, isExpression)); const assignment = factory.createAssignment(referencedName, key); const name = factory.updateComputedPropertyName(node, injectPendingExpressions(assignment)); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js index 250aec399b15e..016a8bd69f29b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js @@ -13,8 +13,8 @@ class C { //// [esDecorators-classDeclaration-fields-nonStatic.js] const field3 = "field3"; let C = (() => { - var _a, _b; - var _c; + var _a; + var _b; let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; @@ -22,18 +22,21 @@ let C = (() => { let _member_initializers = []; let _member_decorators_1; let _member_initializers_1 = []; - return _b = class C { + return _a = class C { constructor() { this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); this["field2"] = __runInitializers(this, _member_initializers, 2); - this[_a] = __runInitializers(this, _member_initializers_1, 3); + this[_b] = __runInitializers(this, _member_initializers_1, 3); } }, - _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _c = __propKey(field3)), + _field1_decorators = [dec(1)], + _member_decorators = [dec(2)], + _member_decorators_1 = [dec(3)], + _b = __propKey(field3), (() => { __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _c, static: false, private: false, access: { get() { return this[_c]; }, set(value) { this[_c] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); })(), - _b; + _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js index e2c30d41af173..0f0236495bd39 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js @@ -13,8 +13,8 @@ class C { //// [esDecorators-classDeclaration-fields-nonStatic.js] const field3 = "field3"; let C = (() => { - var _a, _b; - var _c; + var _a; + var _b; let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; @@ -22,7 +22,7 @@ let C = (() => { let _member_initializers = []; let _member_decorators_1; let _member_initializers_1 = []; - return _b = class C { + return _a = class C { constructor() { Object.defineProperty(this, "field1", { enumerable: true, @@ -36,7 +36,7 @@ let C = (() => { writable: true, value: __runInitializers(this, _member_initializers, 2) }); - Object.defineProperty(this, _a, { + Object.defineProperty(this, _b, { enumerable: true, configurable: true, writable: true, @@ -44,11 +44,14 @@ let C = (() => { }); } }, - _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _c = __propKey(field3)), + _field1_decorators = [dec(1)], + _member_decorators = [dec(2)], + _member_decorators_1 = [dec(3)], + _b = __propKey(field3), (() => { __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _c, static: false, private: false, access: { get() { return this[_c]; }, set(value) { this[_c] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); })(), - _b; + _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js index 8c3b19e83a625..355ce3c6396c9 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js @@ -14,7 +14,6 @@ class C { const field3 = "field3"; let C = (() => { var _a; - var _b; let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; @@ -28,11 +27,11 @@ let C = (() => { this["field2"] = __runInitializers(this, _member_initializers, 2); this[_a] = __runInitializers(this, _member_initializers_1, 3); } - static { _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _b = __propKey(field3)); } + static { _field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _member_initializers_1, _instanceExtraInitializers); } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js index c397533589005..89561163bce08 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js @@ -13,8 +13,8 @@ class C { //// [esDecorators-classDeclaration-fields-nonStatic.js] var field3 = "field3"; var C = function () { - var _a, _b; - var _c; + var _a; + var _b; var _instanceExtraInitializers = []; var _field1_decorators; var _field1_initializers = []; @@ -22,19 +22,22 @@ var C = function () { var _member_initializers = []; var _member_decorators_1; var _member_initializers_1 = []; - return _b = /** @class */ (function () { + return _a = /** @class */ (function () { function C() { this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); this["field2"] = __runInitializers(this, _member_initializers, 2); - this[_a] = __runInitializers(this, _member_initializers_1, 3); + this[_b] = __runInitializers(this, _member_initializers_1, 3); } return C; }()), - _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _c = __propKey(field3)), + _field1_decorators = [dec(1)], + _member_decorators = [dec(2)], + _member_decorators_1 = [dec(3)], + _b = __propKey(field3), (function () { __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _c, static: false, private: false, access: { get: function () { return this[_c]; }, set: function (value) { this[_c] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get: function () { return this[_b]; }, set: function (value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); })(), - _b; + _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js index 774a8015c6d28..e175818c2e36b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js @@ -13,8 +13,8 @@ class C { //// [esDecorators-classDeclaration-fields-nonStatic.js] var field3 = "field3"; var C = function () { - var _a, _b; - var _c; + var _a; + var _b; var _instanceExtraInitializers = []; var _field1_decorators; var _field1_initializers = []; @@ -22,7 +22,7 @@ var C = function () { var _member_initializers = []; var _member_decorators_1; var _member_initializers_1 = []; - return _b = /** @class */ (function () { + return _a = /** @class */ (function () { function C() { Object.defineProperty(this, "field1", { enumerable: true, @@ -36,7 +36,7 @@ var C = function () { writable: true, value: __runInitializers(this, _member_initializers, 2) }); - Object.defineProperty(this, _a, { + Object.defineProperty(this, _b, { enumerable: true, configurable: true, writable: true, @@ -45,11 +45,14 @@ var C = function () { } return C; }()), - _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _c = __propKey(field3)), + _field1_decorators = [dec(1)], + _member_decorators = [dec(2)], + _member_decorators_1 = [dec(3)], + _b = __propKey(field3), (function () { __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _c, static: false, private: false, access: { get: function () { return this[_c]; }, set: function (value) { this[_c] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get: function () { return this[_b]; }, set: function (value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); })(), - _b; + _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js index 8c3b19e83a625..355ce3c6396c9 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js @@ -14,7 +14,6 @@ class C { const field3 = "field3"; let C = (() => { var _a; - var _b; let _instanceExtraInitializers = []; let _field1_decorators; let _field1_initializers = []; @@ -28,11 +27,11 @@ let C = (() => { this["field2"] = __runInitializers(this, _member_initializers, 2); this[_a] = __runInitializers(this, _member_initializers_1, 3); } - static { _a = (_field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _b = __propKey(field3)); } + static { _field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _member_initializers_1, _instanceExtraInitializers); } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js index 807b64ece17d2..8f04ac4628bb3 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js @@ -13,8 +13,8 @@ class C { //// [esDecorators-classDeclaration-fields-static.js] const field3 = "field3"; let C = (() => { - var _a, _b; - var _c; + var _a; + var _b; let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; @@ -24,11 +24,14 @@ let C = (() => { let _static_member_initializers_1 = []; return _a = class C { }, - _b = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _c = __propKey(field3)), + _static_field1_decorators = [dec(1)], + _static_member_decorators = [dec(2)], + _static_member_decorators_1 = [dec(3)], + _b = __propKey(field3), (() => { __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _c, static: true, private: false, access: { get() { return this[_c]; }, set(value) { this[_c] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a.field1 = __runInitializers(_a, _static_field1_initializers, 1), diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js index 87877a0493194..b010985c38374 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js @@ -13,8 +13,8 @@ class C { //// [esDecorators-classDeclaration-fields-static.js] const field3 = "field3"; let C = (() => { - var _a, _b; - var _c; + var _a; + var _b; let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; @@ -24,11 +24,14 @@ let C = (() => { let _static_member_initializers_1 = []; return _a = class C { }, - _b = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _c = __propKey(field3)), + _static_field1_decorators = [dec(1)], + _static_member_decorators = [dec(2)], + _static_member_decorators_1 = [dec(3)], + _b = __propKey(field3), (() => { __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _c, static: true, private: false, access: { get() { return this[_c]; }, set(value) { this[_c] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), Object.defineProperty(_a, "field1", { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js index f006eb3f426ff..dcfe43d3dfc0a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js @@ -14,7 +14,6 @@ class C { const field3 = "field3"; let C = (() => { var _a; - var _b; let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; @@ -23,11 +22,11 @@ let C = (() => { let _static_member_decorators_1; let _static_member_initializers_1 = []; return class C { - static { _a = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _b = __propKey(field3)); } + static { _static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static { this.field1 = __runInitializers(this, _static_field1_initializers, 1); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js index 39eb794d1dc74..cb1c7ef0afcc5 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js @@ -14,8 +14,8 @@ class C { var _this = this; var field3 = "field3"; var C = function () { - var _a, _b; - var _c; + var _a; + var _b; var _staticExtraInitializers = []; var _static_field1_decorators; var _static_field1_initializers = []; @@ -28,11 +28,14 @@ var C = function () { } return C; }()), - _b = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _c = __propKey(field3)), + _static_field1_decorators = [dec(1)], + _static_member_decorators = [dec(2)], + _static_member_decorators_1 = [dec(3)], + _b = __propKey(field3), (function () { __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _c, static: true, private: false, access: { get: function () { return this[_c]; }, set: function (value) { this[_c] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get: function () { return this[_b]; }, set: function (value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a.field1 = __runInitializers(_a, _static_field1_initializers, 1), diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js index 91b96fe98affc..840beab156bae 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js @@ -14,8 +14,8 @@ class C { var _this = this; var field3 = "field3"; var C = function () { - var _a, _b; - var _c; + var _a; + var _b; var _staticExtraInitializers = []; var _static_field1_decorators; var _static_field1_initializers = []; @@ -28,11 +28,14 @@ var C = function () { } return C; }()), - _b = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _c = __propKey(field3)), + _static_field1_decorators = [dec(1)], + _static_member_decorators = [dec(2)], + _static_member_decorators_1 = [dec(3)], + _b = __propKey(field3), (function () { __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _c, static: true, private: false, access: { get: function () { return this[_c]; }, set: function (value) { this[_c] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get: function () { return this[_b]; }, set: function (value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), Object.defineProperty(_a, "field1", { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js index f006eb3f426ff..dcfe43d3dfc0a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js @@ -14,7 +14,6 @@ class C { const field3 = "field3"; let C = (() => { var _a; - var _b; let _staticExtraInitializers = []; let _static_field1_decorators; let _static_field1_initializers = []; @@ -23,11 +22,11 @@ let C = (() => { let _static_member_decorators_1; let _static_member_initializers_1 = []; return class C { - static { _a = (_static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _b = __propKey(field3)); } + static { _static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static { this.field1 = __runInitializers(this, _static_field1_initializers, 1); } From caea4b0e475e1d15944329aa15b16053a59d5c6e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 20 Oct 2022 17:20:15 -0400 Subject: [PATCH 19/51] Fix for ClassGetter/SetterDecoratorFunction target types --- src/lib/decorators.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/decorators.d.ts b/src/lib/decorators.d.ts index 8086704986eba..7eb2d9a482f04 100644 --- a/src/lib/decorators.d.ts +++ b/src/lib/decorators.d.ts @@ -123,7 +123,7 @@ type ClassGetterDecoratorFunction = < In, Out = In, Value = Out, ->(target: { get(this: This): In }, context: ClassGetterDecoratorContext) => { get(this: This): Out; } | void; +>(target: (this: This) => In, context: ClassGetterDecoratorContext) => ((this: This) => Out) | void; /** * Context provided to a class `set` method decorator. @@ -159,7 +159,7 @@ type ClassSetterDecoratorFunction = < In, Out = In, Value = Out ->(target: { set(this: This, value: In): void; }, context: ClassSetterDecoratorContext) => { set(this: This, value: Out): void; } | void; +>(target: (this: This, value: In) => void, context: ClassSetterDecoratorContext) => ((this: This, value: Out) => void) | void; /** * Context provided to a class `accessor` field decorator. From 8abe8525e56d34150ce1bc06461275fcc2f0bd34 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 25 Oct 2022 19:37:56 -0400 Subject: [PATCH 20/51] decorator typing updates, minor fixes, remove --annotateTransforms --- src/compiler/checker.ts | 63 +++++++----- src/compiler/commandLineParser.ts | 7 -- src/compiler/emitter.ts | 60 +----------- src/compiler/transformer.ts | 42 +------- src/compiler/types.ts | 3 - src/harness/fourslashInterfaceImpl.ts | 4 + src/lib/decorators.d.ts | 54 +++++++++-- .../reference/api/tsserverlibrary.d.ts | 1 - tests/baselines/reference/api/typescript.d.ts | 1 - .../annotateTransforms/tsconfig.json | 5 - .../esDecorators-contextualTypes.types | 96 +++++++++---------- .../annotateTransforms/tsconfig.json | 5 - 12 files changed, 144 insertions(+), 197 deletions(-) delete mode 100644 tests/baselines/reference/config/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json delete mode 100644 tests/baselines/reference/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b5db4f1af2036..71dd98596bad6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1010,6 +1010,8 @@ namespace ts { let deferredGlobalClassGetterDecoratorContextType: GenericType | undefined; let deferredGlobalClassSetterDecoratorContextType: GenericType | undefined; let deferredGlobalClassAccessorDecoratorContextType: GenericType | undefined; + let deferredGlobalClassAccessorDecoratorTargetType: GenericType | undefined; + let deferredGlobalClassAccessorDecoratorResultType: GenericType | undefined; let deferredGlobalClassFieldDecoratorContextType: GenericType | undefined; const allPotentiallyUnusedIdentifiers = new Map(); // key is file name @@ -14438,6 +14440,14 @@ namespace ts { return (deferredGlobalClassAccessorDecoratorContextType ??= getGlobalType("ClassAccessorDecoratorContext" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; } + function getGlobalClassAccessorDecoratorTargetType(reportErrors: boolean) { + return (deferredGlobalClassAccessorDecoratorTargetType ??= getGlobalType("ClassAccessorDecoratorTarget" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; + } + + function getGlobalClassAccessorDecoratorResultType(reportErrors: boolean) { + return (deferredGlobalClassAccessorDecoratorResultType ??= getGlobalType("ClassAccessorDecoratorResult" as __String, /*arity*/ 3, reportErrors)) ?? emptyGenericType; + } + function getGlobalClassFieldDecoratorContextType(reportErrors: boolean) { return (deferredGlobalClassFieldDecoratorContextType ??= getGlobalType("ClassFieldDecoratorContext" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; } @@ -33224,23 +33234,25 @@ namespace ts { return getUnionType([classConstructorType, voidType]); } - function createClassAccessorESDecoratorReturnType(valueType: Type) { - const param = createSymbol(SymbolFlags.FunctionScopedVariable, "value" as __String, /*checkFlags*/ undefined, valueType); - const initializerSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], valueType); - const getSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, emptyArray, valueType); - const setSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], voidType); - const members = createSymbolTable([ - createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "get" as __String, /*checkFlags*/ undefined, getSignatureType), - createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "set" as __String, /*checkFlags*/ undefined, setSignatureType), - createSymbol(SymbolFlags.Property | SymbolFlags.Optional, "init" as __String, /*checkFlags*/ undefined, initializerSignatureType) - ]); - const descriptorType = createAnonymousType(/*symbol*/ undefined, members, emptyArray, emptyArray, emptyArray); - return getUnionType([descriptorType, voidType]); + function createClassAccessorESDecoratorTargetType(thisType: Type, valueType: Type) { + const globalClassAccessorDecoratorTargetType = getGlobalClassAccessorDecoratorTargetType(/*reportError*/ true); + if (globalClassAccessorDecoratorTargetType !== emptyGenericType) { + return createTypeReference(globalClassAccessorDecoratorTargetType, [thisType, valueType]); + } + return unknownType; } - function createClassFieldESDecoratorReturnType(valueType: Type) { - const param = createSymbol(SymbolFlags.FunctionScopedVariable, "value" as __String, /*checkFlags*/ undefined, valueType); - const initializerSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], valueType); + function createClassAccessorESDecoratorResultType(thisType: Type, valueInType: Type, valueOutType: Type) { + const globalClassAccessorDecoratorResultType = getGlobalClassAccessorDecoratorResultType(/*reportError*/ true); + const resultType = globalClassAccessorDecoratorResultType !== emptyGenericType ? + createTypeReference(globalClassAccessorDecoratorResultType, [thisType, valueInType, valueOutType]) : + unknownType; + return getUnionType([resultType, voidType]); + } + + function createClassFieldESDecoratorReturnType(valueInType: Type, valueOutType: Type) { + const param = createSymbol(SymbolFlags.FunctionScopedVariable, "value" as __String, /*checkFlags*/ undefined, valueOutType); + const initializerSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], valueInType); return getUnionType([initializerSignatureType, voidType]); } @@ -33276,7 +33288,7 @@ namespace ts { // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of // evaluating all decorators. - const valueFinalType = targetType; + const valueFinalType = isMethodDeclaration(node) ? targetType : getTypeOfNode(node); const thisFinalType = hasStaticModifier(node) ? getTypeOfSymbol(getSymbolOfNode(node.parent)) : getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); @@ -33301,15 +33313,19 @@ namespace ts { case SyntaxKind.PropertyDeclaration: { const node = decorator.parent as PropertyDeclaration; if (isClassLike(node.parent)) { - const targetType = getTypeOfNode(node); + const initializerType = getTypeOfNode(node); // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of // evaluating all decorators. - const valueFinalType = targetType; + const valueFinalType = initializerType; const thisFinalType = hasStaticModifier(node) ? getTypeOfSymbol(getSymbolOfNode(node.parent)) : getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); + const targetType = + hasAccessorModifier(node) ? createClassAccessorESDecoratorTargetType(thisFinalType, initializerType) : + undefinedType; + const isStatic = hasStaticModifier(node); const isPrivate = isPrivateIdentifier(node.name); const nameType = isPrivate ? getStringLiteralType(idText(node.name)) : getLiteralTypeFromPropertyName(node.name); @@ -33319,8 +33335,8 @@ namespace ts { createClassFieldESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate); const returnType = - hasAccessorModifier(node) ? createClassAccessorESDecoratorReturnType(targetType) : - createClassFieldESDecoratorReturnType(targetType); + hasAccessorModifier(node) ? createClassAccessorESDecoratorResultType(thisFinalType, initializerType, valueFinalType) : + createClassFieldESDecoratorReturnType(initializerType, valueFinalType); const targetParam = createSymbol(SymbolFlags.FunctionScopedVariable, "target" as __String, /*checkFlags*/ undefined, targetType); const contextParam = createSymbol(SymbolFlags.FunctionScopedVariable, "context" as __String, /*checkFlags*/ undefined, contextType); @@ -37668,12 +37684,15 @@ namespace ts { case SyntaxKind.PropertyDeclaration: if (!legacyDecorators) { headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; + const thisType = hasStaticModifier(node.parent) ? + getTypeOfSymbol(getSymbolOfNode((node.parent as PropertyDeclaration).parent)) : + getDeclaredTypeOfClassOrInterface(getSymbolOfNode((node.parent as PropertyDeclaration).parent)); const expectedType = getTypeOfNode(node.parent); if (hasAccessorModifier(node.parent)) { - expectedReturnType = createClassAccessorESDecoratorReturnType(expectedType); + expectedReturnType = createClassAccessorESDecoratorResultType(thisType, expectedType, expectedType); } else { - expectedReturnType = createClassFieldESDecoratorReturnType(expectedType); + expectedReturnType = createClassFieldESDecoratorReturnType(expectedType, expectedType); } break; } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 96a88264d26c4..fcc40709bc9d8 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -320,13 +320,6 @@ namespace ts { isCommandLineOnly: true, description: Diagnostics.Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit, defaultValueDescription: Diagnostics.Platform_specific - }, - { - name: "annotateTransforms", - type: "boolean", - affectsEmit: true, - category: Diagnostics.Compiler_Diagnostics, - defaultValueDescription: false } ]; diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 152bb09908e10..870582f6aabbe 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -384,7 +384,7 @@ namespace ts { return; } // Transform the source files - const transform = transformNodes(resolver, host, /*factory*/ undefined, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false); + const transform = transformNodes(resolver, host, factory, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false); const printerOptions: PrinterOptions = { removeComments: compilerOptions.removeComments, @@ -398,7 +398,6 @@ namespace ts { extendedDiagnostics: compilerOptions.extendedDiagnostics, writeBundleFileInfo: !!bundleBuildInfo, relativeToBuildInfo, - annotateTransforms: compilerOptions.annotateTransforms }; // Create a printer to print the nodes @@ -439,7 +438,7 @@ namespace ts { // Do that here when emitting only dts files filesForEmit.forEach(collectLinkedAliases); } - const declarationTransform = transformNodes(resolver, host, /*factory*/ undefined, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false); + const declarationTransform = transformNodes(resolver, host, factory, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false); if (length(declarationTransform.diagnostics)) { for (const diagnostic of declarationTransform.diagnostics!) { emitterDiagnostics.add(diagnostic); @@ -459,7 +458,6 @@ namespace ts { writeBundleFileInfo: !!bundleBuildInfo, recordInternalSection: !!bundleBuildInfo, relativeToBuildInfo, - annotateTransforms: compilerOptions.annotateTransforms }; const declarationPrinter = createPrinter(printerOptions, { @@ -900,7 +898,6 @@ namespace ts { const newLine = getNewLineCharacter(printerOptions); const moduleKind = getEmitModuleKind(printerOptions); const bundledHelpers = new Map(); - const annotateTransforms = printerOptions.annotateTransforms; let currentSourceFile: SourceFile | undefined; let nodeIdToGeneratedName: string[]; // Map of generated names for specific nodes. @@ -1316,15 +1313,6 @@ namespace ts { function pipelineEmitWithHint(hint: EmitHint, node: Node): void { onBeforeEmitNode?.(node); - let wroteAnnotation = false; - if (annotateTransforms) { - const transformerNames = getTransformerNames(node); - if (transformerNames) { - transformerNames.reverse(); - writeComment(`/*tx: ${transformerNames.join("->")}(*/`); - wroteAnnotation = true; - } - } if (preserveSourceNewlines) { const savedPreserveSourceNewlines = preserveSourceNewlines; beforeEmitNode(node); @@ -1334,9 +1322,6 @@ namespace ts { else { pipelineEmitWithHintWorker(hint, node); } - if (wroteAnnotation) { - writeComment(`/*)*/`); - } onAfterEmitNode?.(node); // clear the parenthesizer rule as we ascend currentParenthesizerRule = undefined; @@ -6092,45 +6077,4 @@ namespace ts { typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule; } - - function getTransformerNames(node: Node | undefined) { - let transformerNames: string[] | undefined; - let lastTransformerName: string | undefined; - while (node) { - const transformerName = getTransformerName(node.transformer); - if (transformerName && transformerName !== lastTransformerName) { - transformerNames = append(transformerNames, transformerName); - lastTransformerName = transformerName; - } - node = node.original; - } - return transformerNames; - } - - function getTransformerName(transformer: TransformerFactory | undefined) { - switch (transformer) { - case transformTypeScript: return "ts"; - case transformESNext: return "esnext"; - case transformES2021: return "es2021"; - case transformES2020: return "es2020"; - case transformES2019: return "es2019"; - case transformES2018: return "es2018"; - case transformES2017: return "es2017"; - case transformES2016: return "es2016"; - case transformES2015: return "es2015"; - case transformES5: return "es5"; - case transformClassFields: return "classFields"; - case transformESDecorators: return "esDecorators"; - case transformLegacyDecorators: return "legacyDecorators"; - case transformGenerators: return "generators"; - case transformJsx: return "jsx"; - case transformECMAScriptModule: return "esmodule"; - case transformModule: return "module"; - case transformSystemModule: return "system"; - case transformNodeModule: return "node"; - case transformDeclarations: return "declarations"; - case undefined: return; - default: return transformer.name; - } - } } diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 0ea1c8e473890..48c9b64776dd8 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -160,7 +160,7 @@ namespace ts { * @param transforms An array of `TransformerFactory` callbacks. * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ - export function transformNodes(resolver: EmitResolver | undefined, host: EmitHost | undefined, factoryIn: NodeFactory | undefined, options: CompilerOptions, nodes: readonly T[], transformers: readonly TransformerFactory[], allowDtsFiles: boolean): TransformationResult { + export function transformNodes(resolver: EmitResolver | undefined, host: EmitHost | undefined, factory: NodeFactory, options: CompilerOptions, nodes: readonly T[], transformers: readonly TransformerFactory[], allowDtsFiles: boolean): TransformationResult { const enabledSyntaxKindFeatures = new Array(SyntaxKind.Count); let lexicalEnvironmentVariableDeclarations: VariableDeclaration[]; let lexicalEnvironmentFunctionDeclarations: FunctionDeclaration[]; @@ -179,13 +179,12 @@ namespace ts { let onSubstituteNode: TransformationContext["onSubstituteNode"] = noEmitSubstitution; let onEmitNode: TransformationContext["onEmitNode"] = noEmitNotification; let state = TransformationState.Uninitialized; - const shouldAttachTransformer = options.annotateTransforms || Debug.isDebugging; const diagnostics: DiagnosticWithLocation[] = []; // The transformation context is provided to each transformer as part of transformer // initialization. const context: TransformationContext = { - factory: factoryIn ?? factory, + factory, getCompilerOptions: () => options, getEmitResolver: () => resolver!, // TODO: GH#18217 getEmitHost: () => host!, // TODO: GH#18217 @@ -233,7 +232,7 @@ namespace ts { performance.mark("beforeTransform"); // Chain together and initialize each transformer. - const transformersWithContext = transformers.map(createTransformerWithContext); + const transformersWithContext = transformers.map(t => t(context)); const transformation = (node: T): T => { for (const transform of transformersWithContext) { node = transform(node); @@ -267,41 +266,6 @@ namespace ts { diagnostics }; - function createTransformerWithContext(t: TransformerFactory) { - if (factoryIn || !shouldAttachTransformer) { - return t(context); - } - - const baseFactory = factory.baseFactory; - const perTransformerBaseFactory: BaseNodeFactory = { - createBaseSourceFileNode: kind => attachTransformer(baseFactory.createBaseSourceFileNode(kind), t), - createBaseIdentifierNode: kind => attachTransformer(baseFactory.createBaseIdentifierNode(kind), t), - createBasePrivateIdentifierNode: kind => attachTransformer(baseFactory.createBasePrivateIdentifierNode(kind), t), - createBaseTokenNode: kind => attachTransformer(baseFactory.createBaseTokenNode(kind), t), - createBaseNode: kind => attachTransformer(baseFactory.createBaseNode(kind), t), - }; - - const perTransformerFactory = createNodeFactory(NodeFactoryFlags.NoIndentationOnFreshPropertyAccess, perTransformerBaseFactory); - const perTransformerContext: TransformationContext = Object.create(context, { - factory: { - configurable: true, - writable: true, - value: perTransformerFactory - }, - getEmitHelperFactory: { - configurable: true, - writable: true, - value: memoize(() => createEmitHelperFactory(perTransformerContext)) - } - }); - return t(perTransformerContext); - } - - function attachTransformer(node: TNode, transformer: TransformerFactory) { - node.transformer = transformer; - return node; - } - function transformRoot(node: T) { return node && (!isSourceFile(node) || !node.isDeclarationFile) ? transformation(node) : node; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a39df0ae13bc3..205c4ef6a3bda 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -885,7 +885,6 @@ namespace ts { /* @internal */ emitNode?: EmitNode; // Associated EmitNode (initialized by transforms) /* @internal */ contextualType?: Type; // Used to temporarily assign a contextual type during overload resolution /* @internal */ inferenceContext?: InferenceContext; // Inference context for contextual type - /* @internal */ transformer?: TransformerFactory; // Source transformer that created the node } export interface JSDocContainer { @@ -6675,7 +6674,6 @@ namespace ts { esModuleInterop?: boolean; /* @internal */ showConfig?: boolean; useDefineForClassFields?: boolean; - annotateTransforms?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } @@ -8804,7 +8802,6 @@ namespace ts { /*@internal*/ stripInternal?: boolean; /*@internal*/ preserveSourceNewlines?: boolean; /*@internal*/ terminateUnterminatedLiterals?: boolean; - /*@internal*/ annotateTransforms?: boolean; /*@internal*/ relativeToBuildInfo?: (path: string) => string; } diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index ca5ae0c1784b2..beac04068e35c 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1164,6 +1164,8 @@ namespace FourSlashInterface { typeEntry("PropertyDecorator"), typeEntry("MethodDecorator"), typeEntry("ParameterDecorator"), + typeEntry("ClassMemberDecoratorContext"), + typeEntry("DecoratorContext"), interfaceEntry("ClassDecoratorContext"), typeEntry("ClassDecoratorFunction"), interfaceEntry("ClassMethodDecoratorContext"), @@ -1173,6 +1175,8 @@ namespace FourSlashInterface { interfaceEntry("ClassSetterDecoratorContext"), typeEntry("ClassSetterDecoratorFunction"), interfaceEntry("ClassAccessorDecoratorContext"), + interfaceEntry("ClassAccessorDecoratorTarget"), + interfaceEntry("ClassAccessorDecoratorResult"), typeEntry("ClassAccessorDecoratorFunction"), interfaceEntry("ClassFieldDecoratorContext"), typeEntry("ClassFieldDecoratorFunction"), diff --git a/src/lib/decorators.d.ts b/src/lib/decorators.d.ts index 7eb2d9a482f04..0ace4e41687ed 100644 --- a/src/lib/decorators.d.ts +++ b/src/lib/decorators.d.ts @@ -1,7 +1,20 @@ +type ClassMemberDecoratorContext = + | ClassMethodDecoratorContext + | ClassGetterDecoratorContext + | ClassSetterDecoratorContext + | ClassFieldDecoratorContext + | ClassAccessorDecoratorContext + ; + +type DecoratorContext = + | ClassDecoratorContext + | ClassMemberDecoratorContext + ; + /** * Context provided to a class decorator. */ -interface ClassDecoratorContext any> { +interface ClassDecoratorContext any = abstract new (...args: any) => any> { readonly kind: "class"; readonly name: string | undefined; @@ -25,6 +38,8 @@ interface ClassDecoratorContext a addInitializer(initializer: (this: Class) => void): void; } +// #region type ClassDecoratorFunction + /** * Describes a function that can be used to decorate a class. */ @@ -34,10 +49,12 @@ type ClassDecoratorFunction = < Class extends abstract new (...args: any[]) => any = Out >(target: In, context: ClassDecoratorContext) => Out | void; +// #endregion + /** * Context provided to a class method decorator. */ -interface ClassMethodDecoratorContext any> { +interface ClassMethodDecoratorContext any = (this: This, ...args: any) => any> { readonly kind: "method"; readonly name: string | symbol; readonly static: boolean; @@ -79,6 +96,7 @@ interface ClassMethodDecoratorContext void): void; } +// #region type ClassMethodDecoratorFunction /** * Describes a function that can be used to decorate a class method. */ @@ -88,11 +106,12 @@ type ClassMethodDecoratorFunction any = In, Value extends (this: This, ...args: any[]) => any = Out >(target: In, context: ClassMethodDecoratorContext & Readonly>) => Out | void; +// #endregion /** * Context provided to a class `get` method decorator. */ -interface ClassGetterDecoratorContext { +interface ClassGetterDecoratorContext { readonly kind: "getter"; readonly name: string | symbol; readonly static: boolean; @@ -115,6 +134,7 @@ interface ClassGetterDecoratorContext { addInitializer(initializer: (this: This) => void): void; } +// #region type ClassGetterDecoratorFunction /** * Describes a function that can be used to decorate a class `get` method. */ @@ -124,11 +144,12 @@ type ClassGetterDecoratorFunction = < Out = In, Value = Out, >(target: (this: This) => In, context: ClassGetterDecoratorContext) => ((this: This) => Out) | void; +// #endregion /** * Context provided to a class `set` method decorator. */ -interface ClassSetterDecoratorContext { +interface ClassSetterDecoratorContext { readonly kind: "setter"; readonly name: string | symbol; readonly static: boolean; @@ -151,6 +172,7 @@ interface ClassSetterDecoratorContext { addInitializer(initializer: (this: This) => void): void; } +// #region type ClassSetterDecoratorFunction /** * Describes a function that can be used to decorate a class `set` method. */ @@ -160,11 +182,12 @@ type ClassSetterDecoratorFunction = < Out = In, Value = Out >(target: (this: This, value: In) => void, context: ClassSetterDecoratorContext) => ((this: This, value: Out) => void) | void; +// #endregion /** * Context provided to a class `accessor` field decorator. */ -interface ClassAccessorDecoratorContext { +interface ClassAccessorDecoratorContext { readonly kind: "accessor"; readonly name: string | symbol; readonly static: boolean; @@ -195,6 +218,18 @@ interface ClassAccessorDecoratorContext { addInitializer(initializer: (this: This) => void): void; } +interface ClassAccessorDecoratorTarget { + get(this: This): In; + set(this: This, value: In): void; +} + +interface ClassAccessorDecoratorResult { + get?(this: This): Out; + set?(this: This, value: Out): void; + init?(this: This, value: In): Out +} + +// #region type ClassAccessorDecoratorFunction /** * Describes a function that can be used to decorate a class `accessor` field. */ @@ -204,14 +239,15 @@ type ClassAccessorDecoratorFunction = < Out = In, Value = Out >( - target: { get(this: This): In; set(this: This, value: In): void; }, + target: ClassAccessorDecoratorTarget, context: ClassAccessorDecoratorContext -) => { get?(this: This): Out; set?(this: This, value: Out): void; init?(this: This, value: In): Out; } | void; +) => ClassAccessorDecoratorResult | void; +// #endregion /** * Context provided to a class field decorator. */ -interface ClassFieldDecoratorContext { +interface ClassFieldDecoratorContext { readonly kind: "field"; readonly name: string | symbol; readonly static: boolean; @@ -236,6 +272,7 @@ interface ClassFieldDecoratorContext { addInitializer(initializer: (this: This) => void): void; } +// #region type ClassFieldDecoratorFunction /** * Describes a function that can be used to decorate a class field. */ @@ -245,3 +282,4 @@ type ClassFieldDecoratorFunction = < Out = In, Value = Out >(target: undefined, context: ClassAccessorDecoratorContext) => ((this: This, initialValue: In) => Out) | void; +// #endregion diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2d9201b620a4a..bd16a56193700 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3088,7 +3088,6 @@ declare namespace ts { typeRoots?: string[]; esModuleInterop?: boolean; useDefineForClassFields?: boolean; - annotateTransforms?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } export interface WatchOptions { diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 2d4e7c2bba525..abd72d49ce61c 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3088,7 +3088,6 @@ declare namespace ts { typeRoots?: string[]; esModuleInterop?: boolean; useDefineForClassFields?: boolean; - annotateTransforms?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } export interface WatchOptions { diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json deleted file mode 100644 index e1bc61fff7489..0000000000000 --- a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "annotateTransforms": true - } -} diff --git a/tests/baselines/reference/esDecorators-contextualTypes.types b/tests/baselines/reference/esDecorators-contextualTypes.types index e041ae4465c25..0e2539de5e446 100644 --- a/tests/baselines/reference/esDecorators-contextualTypes.types +++ b/tests/baselines/reference/esDecorators-contextualTypes.types @@ -27,49 +27,49 @@ class C { >#f : () => void @((t, c) => { }) ->((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "x"; private: false; static: true; }) => void ->(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "x"; private: false; static: true; }) => void +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext & { name: "x"; private: false; static: true; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext & { name: "x"; private: false; static: true; }) => void >t : () => number ->c : ClassGetterDecoratorContext number> & { name: "x"; private: false; static: true; } +>c : ClassGetterDecoratorContext & { name: "x"; private: false; static: true; } static get x() { return 1; } >x : number >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "x"; private: false; static: true; }) => void ->(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "x"; private: false; static: true; }) => void +>((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext & { name: "x"; private: false; static: true; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext & { name: "x"; private: false; static: true; }) => void >t : (value: number) => void ->c : ClassSetterDecoratorContext void> & { name: "x"; private: false; static: true; } +>c : ClassSetterDecoratorContext & { name: "x"; private: false; static: true; } static set x(value) { } >x : number >value : number @((t, c) => { }) ->((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "#x"; private: true; static: true; }) => void ->(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "#x"; private: true; static: true; }) => void +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext & { name: "#x"; private: true; static: true; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext & { name: "#x"; private: true; static: true; }) => void >t : () => number ->c : ClassGetterDecoratorContext number> & { name: "#x"; private: true; static: true; } +>c : ClassGetterDecoratorContext & { name: "#x"; private: true; static: true; } static get #x() { return 1; } >#x : number >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "#x"; private: true; static: true; }) => void ->(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "#x"; private: true; static: true; }) => void +>((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext & { name: "#x"; private: true; static: true; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext & { name: "#x"; private: true; static: true; }) => void >t : (value: number) => void ->c : ClassSetterDecoratorContext void> & { name: "#x"; private: true; static: true; } +>c : ClassSetterDecoratorContext & { name: "#x"; private: true; static: true; } static set #x(value) { } >#x : number >value : number @((t, c) => { }) ->((t, c) => { }) : (t: number, c: ClassAccessorDecoratorContext & { name: "y"; private: false; static: true; }) => void ->(t, c) => { } : (t: number, c: ClassAccessorDecoratorContext & { name: "y"; private: false; static: true; }) => void ->t : number +>((t, c) => { }) : (t: ClassAccessorDecoratorTarget, c: ClassAccessorDecoratorContext & { name: "y"; private: false; static: true; }) => void +>(t, c) => { } : (t: ClassAccessorDecoratorTarget, c: ClassAccessorDecoratorContext & { name: "y"; private: false; static: true; }) => void +>t : ClassAccessorDecoratorTarget >c : ClassAccessorDecoratorContext & { name: "y"; private: false; static: true; } static accessor y = 1; @@ -77,9 +77,9 @@ class C { >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: number, c: ClassAccessorDecoratorContext & { name: "#y"; private: true; static: true; }) => void ->(t, c) => { } : (t: number, c: ClassAccessorDecoratorContext & { name: "#y"; private: true; static: true; }) => void ->t : number +>((t, c) => { }) : (t: ClassAccessorDecoratorTarget, c: ClassAccessorDecoratorContext & { name: "#y"; private: true; static: true; }) => void +>(t, c) => { } : (t: ClassAccessorDecoratorTarget, c: ClassAccessorDecoratorContext & { name: "#y"; private: true; static: true; }) => void +>t : ClassAccessorDecoratorTarget >c : ClassAccessorDecoratorContext & { name: "#y"; private: true; static: true; } static accessor #y = 1; @@ -87,9 +87,9 @@ class C { >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: number, c: ClassFieldDecoratorContext & { name: "z"; private: false; static: true; }) => void ->(t, c) => { } : (t: number, c: ClassFieldDecoratorContext & { name: "z"; private: false; static: true; }) => void ->t : number +>((t, c) => { }) : (t: undefined, c: ClassFieldDecoratorContext & { name: "z"; private: false; static: true; }) => void +>(t, c) => { } : (t: undefined, c: ClassFieldDecoratorContext & { name: "z"; private: false; static: true; }) => void +>t : undefined >c : ClassFieldDecoratorContext & { name: "z"; private: false; static: true; } static z = 1; @@ -97,9 +97,9 @@ class C { >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: number, c: ClassFieldDecoratorContext & { name: "#z"; private: true; static: true; }) => void ->(t, c) => { } : (t: number, c: ClassFieldDecoratorContext & { name: "#z"; private: true; static: true; }) => void ->t : number +>((t, c) => { }) : (t: undefined, c: ClassFieldDecoratorContext & { name: "#z"; private: true; static: true; }) => void +>(t, c) => { } : (t: undefined, c: ClassFieldDecoratorContext & { name: "#z"; private: true; static: true; }) => void +>t : undefined >c : ClassFieldDecoratorContext & { name: "#z"; private: true; static: true; } static #z = 1; @@ -125,49 +125,49 @@ class C { >#g : () => void @((t, c) => { }) ->((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "a"; private: false; static: false; }) => void ->(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "a"; private: false; static: false; }) => void +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext & { name: "a"; private: false; static: false; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext & { name: "a"; private: false; static: false; }) => void >t : () => number ->c : ClassGetterDecoratorContext number> & { name: "a"; private: false; static: false; } +>c : ClassGetterDecoratorContext & { name: "a"; private: false; static: false; } get a() { return 1; } >a : number >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "a"; private: false; static: false; }) => void ->(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "a"; private: false; static: false; }) => void +>((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext & { name: "a"; private: false; static: false; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext & { name: "a"; private: false; static: false; }) => void >t : (value: number) => void ->c : ClassSetterDecoratorContext void> & { name: "a"; private: false; static: false; } +>c : ClassSetterDecoratorContext & { name: "a"; private: false; static: false; } set a(value) { } >a : number >value : number @((t, c) => { }) ->((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "#a"; private: true; static: false; }) => void ->(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext number> & { name: "#a"; private: true; static: false; }) => void +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext & { name: "#a"; private: true; static: false; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext & { name: "#a"; private: true; static: false; }) => void >t : () => number ->c : ClassGetterDecoratorContext number> & { name: "#a"; private: true; static: false; } +>c : ClassGetterDecoratorContext & { name: "#a"; private: true; static: false; } get #a() { return 1; } >#a : number >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "#a"; private: true; static: false; }) => void ->(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext void> & { name: "#a"; private: true; static: false; }) => void +>((t, c) => { }) : (t: (value: number) => void, c: ClassSetterDecoratorContext & { name: "#a"; private: true; static: false; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext & { name: "#a"; private: true; static: false; }) => void >t : (value: number) => void ->c : ClassSetterDecoratorContext void> & { name: "#a"; private: true; static: false; } +>c : ClassSetterDecoratorContext & { name: "#a"; private: true; static: false; } set #a(value) { } >#a : number >value : number @((t, c) => { }) ->((t, c) => { }) : (t: number, c: ClassAccessorDecoratorContext & { name: "b"; private: false; static: false; }) => void ->(t, c) => { } : (t: number, c: ClassAccessorDecoratorContext & { name: "b"; private: false; static: false; }) => void ->t : number +>((t, c) => { }) : (t: ClassAccessorDecoratorTarget, c: ClassAccessorDecoratorContext & { name: "b"; private: false; static: false; }) => void +>(t, c) => { } : (t: ClassAccessorDecoratorTarget, c: ClassAccessorDecoratorContext & { name: "b"; private: false; static: false; }) => void +>t : ClassAccessorDecoratorTarget >c : ClassAccessorDecoratorContext & { name: "b"; private: false; static: false; } accessor b = 1; @@ -175,9 +175,9 @@ class C { >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: number, c: ClassAccessorDecoratorContext & { name: "#b"; private: true; static: false; }) => void ->(t, c) => { } : (t: number, c: ClassAccessorDecoratorContext & { name: "#b"; private: true; static: false; }) => void ->t : number +>((t, c) => { }) : (t: ClassAccessorDecoratorTarget, c: ClassAccessorDecoratorContext & { name: "#b"; private: true; static: false; }) => void +>(t, c) => { } : (t: ClassAccessorDecoratorTarget, c: ClassAccessorDecoratorContext & { name: "#b"; private: true; static: false; }) => void +>t : ClassAccessorDecoratorTarget >c : ClassAccessorDecoratorContext & { name: "#b"; private: true; static: false; } accessor #b = 1; @@ -185,9 +185,9 @@ class C { >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: number, c: ClassFieldDecoratorContext & { name: "c"; private: false; static: false; }) => void ->(t, c) => { } : (t: number, c: ClassFieldDecoratorContext & { name: "c"; private: false; static: false; }) => void ->t : number +>((t, c) => { }) : (t: undefined, c: ClassFieldDecoratorContext & { name: "c"; private: false; static: false; }) => void +>(t, c) => { } : (t: undefined, c: ClassFieldDecoratorContext & { name: "c"; private: false; static: false; }) => void +>t : undefined >c : ClassFieldDecoratorContext & { name: "c"; private: false; static: false; } c = 1; @@ -195,9 +195,9 @@ class C { >1 : 1 @((t, c) => { }) ->((t, c) => { }) : (t: number, c: ClassFieldDecoratorContext & { name: "#c"; private: true; static: false; }) => void ->(t, c) => { } : (t: number, c: ClassFieldDecoratorContext & { name: "#c"; private: true; static: false; }) => void ->t : number +>((t, c) => { }) : (t: undefined, c: ClassFieldDecoratorContext & { name: "#c"; private: true; static: false; }) => void +>(t, c) => { } : (t: undefined, c: ClassFieldDecoratorContext & { name: "#c"; private: true; static: false; }) => void +>t : undefined >c : ClassFieldDecoratorContext & { name: "#c"; private: true; static: false; } #c = 1; diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json deleted file mode 100644 index e1bc61fff7489..0000000000000 --- a/tests/baselines/reference/showConfig/Shows tsconfig for single option/annotateTransforms/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "annotateTransforms": true - } -} From d3301992ed9873946fe510d734d1f87493e25785 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 26 Oct 2022 18:17:05 -0400 Subject: [PATCH 21/51] getDecoratorCallSignature clean up, make ES and legacy decorators handling consistent --- src/compiler/checker.ts | 587 ++++++++++++------ src/compiler/diagnosticMessages.json | 2 +- src/compiler/parser.ts | 6 +- src/compiler/utilities.ts | 5 +- .../decoratorChecksFunctionBodies.errors.txt | 4 +- .../decoratorChecksFunctionBodies.js | 8 +- .../decoratorChecksFunctionBodies.symbols | 7 +- .../decoratorChecksFunctionBodies.types | 15 +- ...ratorOnClassMethodThisParameter.errors.txt | 8 +- .../decoratorOnFunctionParameter.errors.txt | 8 +- .../reference/generatorTypeCheck61.types | 2 +- .../legacyDecorators-contextualTypes.js | 94 +++ .../legacyDecorators-contextualTypes.symbols | 97 +++ .../legacyDecorators-contextualTypes.types | 127 ++++ .../thisTypeInFunctionsNegative.errors.txt | 8 +- .../class/decoratorChecksFunctionBodies.ts | 4 +- .../legacyDecorators-contextualTypes.ts | 36 ++ 17 files changed, 798 insertions(+), 220 deletions(-) create mode 100644 tests/baselines/reference/legacyDecorators-contextualTypes.js create mode 100644 tests/baselines/reference/legacyDecorators-contextualTypes.symbols create mode 100644 tests/baselines/reference/legacyDecorators-contextualTypes.types create mode 100644 tests/cases/conformance/decorators/legacyDecorators-contextualTypes.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 71dd98596bad6..bff9f9ca60984 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1273,11 +1273,22 @@ namespace ts { return addDeprecatedSuggestionWorker(declaration, diagnostic); } - function createSymbol(flags: SymbolFlags, name: __String, checkFlags?: CheckFlags, type?: Type) { + function createSymbol(flags: SymbolFlags, name: __String, checkFlags?: CheckFlags) { symbolCount++; const symbol = (new Symbol(flags | SymbolFlags.Transient, name) as TransientSymbol); symbol.checkFlags = checkFlags || 0; - if (type) symbol.type = type; + return symbol; + } + + function createParameter(name: __String, type: Type) { + const symbol = createSymbol(SymbolFlags.FunctionScopedVariable, name); + symbol.type = type; + return symbol; + } + + function createProperty(name: __String, type: Type) { + const symbol = createSymbol(SymbolFlags.Property, name); + symbol.type = type; return symbol; } @@ -13760,6 +13771,14 @@ namespace ts { return result & ObjectFlags.PropagatingFlags; } + function tryCreateTypeReference(target: GenericType, typeArguments: readonly Type[] | undefined): Type { + if (some(typeArguments) && target === emptyGenericType) { + return unknownType; + } + + return createTypeReference(target, typeArguments); + } + function createTypeReference(target: GenericType, typeArguments: readonly Type[] | undefined): TypeReference { const id = getTypeListId(typeArguments); let type = target.instantiations.get(id); @@ -27260,8 +27279,7 @@ namespace ts { } function getContextualTypeForDecorator(decorator: Decorator): Type | undefined { - if (legacyDecorators) return undefined; - const signature = getESDecoratorCallSignature(decorator); + const signature = getDecoratorCallSignature(decorator); return signature ? getOrCreateTypeFromSignature(signature) : undefined; } @@ -30997,57 +31015,8 @@ namespace ts { * Returns the synthetic argument list for a decorator invocation. */ function getEffectiveDecoratorArguments(node: Decorator): readonly Expression[] { - return compilerOptions.experimentalDecorators ? - getEffectiveLegacyDecoratorArguments(node) : - getEffectiveESDecoratorArguments(node); - } - - /** - * Returns the synthetic argument list for a decorator invocation. - */ - function getEffectiveLegacyDecoratorArguments(node: Decorator): readonly Expression[] { - const parent = node.parent; - const expr = node.expression; - switch (parent.kind) { - case SyntaxKind.ClassDeclaration: - case SyntaxKind.ClassExpression: - // For a class decorator, the `target` is the type of the class (e.g. the - // "static" or "constructor" side of the class). - return [ - createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) - ]; - case SyntaxKind.Parameter: - // A parameter declaration decorator will have three arguments (see - // `ParameterDecorator` in core.d.ts). - const func = parent.parent as FunctionLikeDeclaration; - return [ - createSyntheticExpression(expr, parent.parent.kind === SyntaxKind.Constructor ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), - createSyntheticExpression(expr, anyType), - createSyntheticExpression(expr, numberType) - ]; - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - // A method or accessor declaration decorator will have two or three arguments (see - // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators - // for ES3, we will only pass two arguments. - const hasPropDesc = languageVersion !== ScriptTarget.ES3 && (!isPropertyDeclaration(parent) || hasAccessorModifier(parent)); - return [ - createSyntheticExpression(expr, getParentTypeOfClassElement(parent as ClassElement)), - createSyntheticExpression(expr, getClassElementPropertyKeyType(parent as ClassElement)), - createSyntheticExpression(expr, hasPropDesc ? createTypedPropertyDescriptorType(getTypeOfNode(parent)) : anyType) - ]; - } - return Debug.fail(); - } - - /** - * Returns the synthetic argument list for a decorator invocation. - */ - function getEffectiveESDecoratorArguments(node: Decorator): readonly Expression[] { const expr = node.expression; - const signature = getESDecoratorCallSignature(node); + const signature = getDecoratorCallSignature(node); if (signature) { const args: Expression[] = []; for (const param of signature.parameters) { @@ -33166,51 +33135,44 @@ namespace ts { } } - function createClassESDecoratorContextType(classType: Type) { - const globalClassDecoratorContextType = getGlobalClassDecoratorContextType(/*reportErrors*/ true); - if (globalClassDecoratorContextType !== emptyGenericType) { - return createTypeReference(globalClassDecoratorContextType, [classType]); - } - return unknownType; + function createClassDecoratorContextType(classType: Type) { + return tryCreateTypeReference(getGlobalClassDecoratorContextType(/*reportErrors*/ true), [classType]); } - function createClassMethodESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { - return createESDecoratorContextTypeReference(getGlobalClassMethodDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + function createClassMethodDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassMethodDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); } - function createClassGetterESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { - return createESDecoratorContextTypeReference(getGlobalClassGetterDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + function createClassGetterDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassGetterDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); } - function createClassSetterESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { - return createESDecoratorContextTypeReference(getGlobalClassSetterDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + function createClassSetterDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassSetterDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); } - function createClassAccessorESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { - return createESDecoratorContextTypeReference(getGlobalClassAccessorDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + function createClassAccessorDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassAccessorDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); } - function createClassFieldESDecoratorContextType(thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { - return createESDecoratorContextTypeReference(getGlobalClassFieldDecoratorContextType(/*reportErrors*/ true), thisType, valueType, nameType, isStatic, isPrivate); + function createClassFieldDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassFieldDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); } - function tryCreateESDecoratorContextOverrideType(nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { + function tryCreateClassMemberDecoratorContextOverrideType(nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { let members: SymbolTable | undefined; if (nameType !== undefined) { - const symbol = createSymbol(SymbolFlags.Property, "name" as __String); - symbol.type = nameType; + const symbol = createProperty("name" as __String, nameType); members ??= createSymbolTable(); members.set(symbol.escapedName, symbol); } if (isPrivate !== undefined) { - const symbol = createSymbol(SymbolFlags.Property, "private" as __String); - symbol.type = isPrivate ? trueType : falseType; + const symbol = createProperty("private" as __String, isPrivate ? trueType : falseType); members ??= createSymbolTable(); members.set(symbol.escapedName, symbol); } if (isStatic !== undefined) { - const symbol = createSymbol(SymbolFlags.Property, "static" as __String); - symbol.type = isStatic ? trueType : falseType; + const symbol = createProperty("static" as __String, isStatic ? trueType : falseType); members ??= createSymbolTable(); members.set(symbol.escapedName, symbol); } @@ -33219,44 +33181,136 @@ namespace ts { } } - function createESDecoratorContextTypeReference(decoratorContextType: GenericType, thisType: Type, valueType: Type, nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { - if (decoratorContextType !== emptyGenericType) { - const contextType = createTypeReference(decoratorContextType, [thisType, valueType]); - const overrideType = tryCreateESDecoratorContextOverrideType(nameType, isStatic, isPrivate); - return overrideType ? getIntersectionType([contextType, overrideType]) : contextType; - } - return unknownType; + function createClassMemberDecoratorContextTypeForNode(node: MethodDeclaration | AccessorDeclaration | PropertyDeclaration, thisType: Type, valueType: Type) { + const isStatic = hasStaticModifier(node); + const isPrivate = isPrivateIdentifier(node.name); + const nameType = isPrivate ? getStringLiteralType(idText(node.name)) : getLiteralTypeFromPropertyName(node.name); + const contextType = + isMethodDeclaration(node) ? createClassMethodDecoratorContextType(thisType, valueType) : + isGetAccessorDeclaration(node) ? createClassGetterDecoratorContextType(thisType, valueType) : + isSetAccessorDeclaration(node) ? createClassSetterDecoratorContextType(thisType, valueType) : + isAutoAccessorPropertyDeclaration(node) ? createClassAccessorDecoratorContextType(thisType, valueType) : + isPropertyDeclaration(node) ? createClassFieldDecoratorContextType(thisType, valueType) : + Debug.failBadSyntaxKind(node); + const overrideType = tryCreateClassMemberDecoratorContextOverrideType(nameType, isStatic, isPrivate); + return overrideType ? getIntersectionType([contextType, overrideType]) : contextType; + } - function createClassDecoratorReturnType(node: ClassDeclaration | ClassExpression) { - const classSymbol = getSymbolOfNode(node); - const classConstructorType = getTypeOfSymbol(classSymbol); - return getUnionType([classConstructorType, voidType]); + function createClassAccessorDecoratorTargetType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassAccessorDecoratorTargetType(/*reportError*/ true), [thisType, valueType]); } - function createClassAccessorESDecoratorTargetType(thisType: Type, valueType: Type) { - const globalClassAccessorDecoratorTargetType = getGlobalClassAccessorDecoratorTargetType(/*reportError*/ true); - if (globalClassAccessorDecoratorTargetType !== emptyGenericType) { - return createTypeReference(globalClassAccessorDecoratorTargetType, [thisType, valueType]); - } - return unknownType; + function createClassAccessorDecoratorResultType(thisType: Type, inputType: Type, outputType: Type) { + return tryCreateTypeReference(getGlobalClassAccessorDecoratorResultType(/*reportError*/ true), [thisType, inputType, outputType]); } - function createClassAccessorESDecoratorResultType(thisType: Type, valueInType: Type, valueOutType: Type) { - const globalClassAccessorDecoratorResultType = getGlobalClassAccessorDecoratorResultType(/*reportError*/ true); - const resultType = globalClassAccessorDecoratorResultType !== emptyGenericType ? - createTypeReference(globalClassAccessorDecoratorResultType, [thisType, valueInType, valueOutType]) : - unknownType; - return getUnionType([resultType, voidType]); + function createClassFieldDecoratorInitializerMutatorType(thisType: Type, inputType: Type, outputType: Type) { + const thisParam = createParameter("this" as __String, thisType); + const valueParam = createParameter("value" as __String, outputType); + return createFunctionType(/*typeParameters*/ undefined, thisParam, [valueParam], inputType, /*typePredicate*/ undefined, 1); } - function createClassFieldESDecoratorReturnType(valueInType: Type, valueOutType: Type) { - const param = createSymbol(SymbolFlags.FunctionScopedVariable, "value" as __String, /*checkFlags*/ undefined, valueOutType); - const initializerSignatureType = createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [param], valueInType); - return getUnionType([initializerSignatureType, voidType]); + /** + * Creates a call signature for an ES Decorator. This method is used by the semantics of + * `getESDecoratorCallSignature`, which you should probably be using instead. + */ + function createESDecoratorCallSignature(targetType: Type, contextType: Type, nonOptionalReturnType: Type) { + const targetParam = createParameter("target" as __String, targetType); + const contextParam = createParameter("context" as __String, contextType); + const returnType = getUnionType([nonOptionalReturnType, voidType]); + return createCallSignature(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [targetParam, contextParam], returnType); } + /** + * Gets a call signature that should be used when resolving `decorator` as a call. This does not use the value + * of the decorator itself, but instead uses the declaration on which it is placed along with its relative + * position amongst other decorators on the same declaration to determine the applicable signature. The + * resulting signature can be used for call resolution, inference, and contextual typing. + */ function getESDecoratorCallSignature(decorator: Decorator) { + // In the future we are considering allowing the types of decorators to affect the type of the class and its + // members, such as a `@Stringify` decorator changing the type of a `number` field to `string`, or a + // `@Callable` decorator adding a call signature to a `class`. For now, the type arguments for the various + // context types that will eventually change to reflect such mutations will be stubbed out with fixed + // types so that we have a convenient place to apply these mutations. + // + // In some cases we describe such potential mutations as coming from a "prior decorator application". It is + // important to note that, while decorators are *evaluated* left to right, they are *applied* right to left + // to preserve f ৹ g -> f(g(x)) application order. In these cases, a "prior" decorator usually means the + // next decorator following this one in document order. + // + // The "original type" of a class or member is the type it was declared as, or the type we infer from + // initializers, before _any_ decorators are applied. + // + // The type of a class or member that is a result of a prior decorator application represents the + // "current type", i.e., the type for the declaration at the time the decorator is _applied_. + // + // The type of a class or member that is the result of the application of *all* relevant decorators is the + // "final type". + // + // Any decorator that allows mutation or replacement will also refer to an "input type" and an + // "output type". The "input type" corresponds to the "current type" of the declaration, while the + // "output type" will become either the "input type/current type" for a subsequent decorator application, + // or the "final type" for the decorated declaration. + // + // It is important to understand decorator application order as it relates to how the "current", "input", + // "output", and "final" types will be determined: + // + // @E2 @E1 class SomeClass { + // @A2 @A1 static f() {} + // @B2 @B1 g() {} + // @C2 @C1 static x; + // @D2 @D1 y; + // } + // + // Per [the specification][1], decorators are applied in the following order: + // + // 1. For each static method (incl. get/set methods), in document order: + // a. Apply each decorator for that method, in reverse order (`A1`, `A2`). + // 2. For each instance method (incl. get/set methods), in document order: + // a. Apply each decorator for that method, in reverse order (`B1`, `B2`). + // 3. For each static field (incl. auto-accessors), in document order: + // a. Apply each decorator for that field, in reverse order (`C1`, `C2`). + // 4. For each instance field (incl. auto-accessors), in document order: + // a. Apply each decorator for that field, in reverse order (`D1`, `D2`). + // 5. Apply each decorator for the class, in reverse order (`E1`, `E2`). + // + // As a result, "current" types at each decorator application are as follows: + // - For `A1`, the "current" types of the class and method their "original" types. + // - For `A2`, the "current type" of the method is the "output type" of `A1`, and the "current type" of the + // class is the type of `SomeClass` where `f` is the "output type" of `A1`. This becomes the "final type" + // of `f`. + // - For `B1`, the "current type" of the method is its "original type", and the "current type" of the + // class is the type of `SomeClass` where `f` now has its "final type". + // - etc. + // + // [1]: https://arai-a.github.io/ecma262-compare/?pr=2417&id=sec-runtime-semantics-classdefinitionevaluation + // + // This seems complicated at first glance, but is not unlike our existing inference for functions: + // + // declare function pipe( + // original: Original, + // a1: (input: Original, context: Context) => A1, + // a2: (input: A1, context: Context) => A2, + // b1: (input: A2, context: Context) => B1, + // b2: (input: B1, context: Context) => B2, + // c1: (input: B2, context: Context) => C1, + // c2: (input: C1, context: Context) => C2, + // d1: (input: C2, context: Context) => D1, + // d2: (input: D1, context: Context) => D2, + // e1: (input: D2, context: Context) => E1, + // e2: (input: E1, context: Context) => E2, + // ): E2; + + // When a decorator is applied, it is passed two arguments: The "target", which is a value representing + // the thing being decorated (constructors for classes, functions for methods/accessors, `undefined` for + // fields, and a `{ get, set }` object for auto-accessors), and a "context", which is an object that + // provides reflection information about the decorated element, as well as the ability to add additional + // "extra" initializers. In most cases, the "target" argument corresponds to the "input type" in some way, + // and the return value similarly corresponds to the "output type" (though if the "output type" is `void` + // or `undefined` then the "output type" is the "input type"). + const { parent } = decorator; const links = getNodeLinks(parent); if (!links.decoratorSignature) { @@ -33264,83 +33318,242 @@ namespace ts { switch (parent.kind) { case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: { - const node = decorator.parent as ClassDeclaration | ClassExpression; - const targetType = getTypeOfSymbol(getSymbolOfNode(node)); + // Class decorators have a `context` of `ClassDecoratorContext`, where the `Class` type + // argument will be the "final type" of the class after all decorators are applied. - // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of - // evaluating all decorators. - const finalType = targetType; + const node = parent as ClassDeclaration | ClassExpression; - const contextType = createClassESDecoratorContextType(finalType); - const returnType = getUnionType([targetType, voidType]); - const targetParam = createSymbol(SymbolFlags.FunctionScopedVariable, "target" as __String, /*checkFlags*/ undefined, targetType); - const contextParam = createSymbol(SymbolFlags.FunctionScopedVariable, "context" as __String, /*checkFlags*/ undefined, contextType); - links.decoratorSignature = createCallSignature(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [targetParam, contextParam], returnType, /*typePredicate*/ undefined, 2); + // TODO: This should eventually correspond with the "output type" of any prior decorator, or + // the type of the class after all member decorator type mutations have been applied. + const inputType = getTypeOfSymbol(getSymbolOfNode(node)); + + // TODO: This should eventually be a type variable that is allowed to be any valid `function` + // type, and whose type will be inferred from decorator application and used as either + // the "input type" of the next decorator, or the "final type" of the class. + const outputType = inputType; + + // TODO: This should eventually be a type variable that is the result of the type mutations from + // all decorators. + const finalType = outputType; + + const contextType = createClassDecoratorContextType(finalType); + links.decoratorSignature = createESDecoratorCallSignature(inputType, contextType, outputType); break; } case SyntaxKind.MethodDeclaration: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: { - const node = decorator.parent as MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration; - if (isClassLike(node.parent)) { - const targetType = getOrCreateTypeFromSignature(getSignatureFromDeclaration(node)); - - // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of - // evaluating all decorators. - const valueFinalType = isMethodDeclaration(node) ? targetType : getTypeOfNode(node); - const thisFinalType = hasStaticModifier(node) ? - getTypeOfSymbol(getSymbolOfNode(node.parent)) : - getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); - - const isStatic = hasStaticModifier(node); - const isPrivate = isPrivateIdentifier(node.name); - const nameType = isPrivate ? getStringLiteralType(idText(node.name)) : getLiteralTypeFromPropertyName(node.name); - - const contextType = - isGetAccessorDeclaration(node) ? createClassGetterESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : - isSetAccessorDeclaration(node) ? createClassSetterESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : - createClassMethodESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate); - - const returnType = getUnionType([targetType, voidType]); - const targetParam = createSymbol(SymbolFlags.FunctionScopedVariable, "target" as __String, /*checkFlags*/ undefined, targetType); - const contextParam = createSymbol(SymbolFlags.FunctionScopedVariable, "context" as __String, /*checkFlags*/ undefined, contextType); - links.decoratorSignature = createCallSignature(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [targetParam, contextParam], returnType, /*typePredicate*/ undefined, 2); - } + const node = parent as MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration; + if (!isClassLike(node.parent)) break; + + // Method decorators have a `context` of `ClassMethodDecoratorContext`, where the + // `Value` type argument corresponds to the "final type" of the method. + // + // Getter decorators have a `context` of `ClassGetterDecoratorContext`, where the + // `Value` type argument corresponds to the "final type" of the value returned by the getter. + // + // Setter decorators have a `context` of `ClassSetterDecoratorContext`, where the + // `Value` type argument corresponds to the "final type" of the parameter of the setter. + // + // In all three cases, the `This` type argument is the "final type" of either the class or + // instance, depending on whether the member was `static`. + + // TODO: This should eventually correspond with either the "output type" of any prior decorator + // or the "original type" of the member. + const inputType = + isMethodDeclaration(node) ? getOrCreateTypeFromSignature(getSignatureFromDeclaration(node)) : + getTypeOfNode(node); + + // TODO: This should eventually be a type variable whose type will be inferred from decorator + // application and used as either the "input type" of the next decorator, or the + // "final type" of the member. + const outputType = inputType; + + // TODO: This should eventually be a type variable that is the result of the type mutations from + // all decorators of the member. + const finalType = outputType; + + // TODO: This should eventually be a type variable that is the result of the type mutations from + // all decorators applied to the class and its members. + const finalThisType = hasStaticModifier(node) ? + getTypeOfSymbol(getSymbolOfNode(node.parent)) : + getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); + + // We wrap the "input type", if necessary, to match the decoration target. For getters this is + // something like `() => inputType`, for setters it's `(value: inputType) => void` and for + // methods it is just the input type. + const targetType = + isGetAccessorDeclaration(node) ? createGetterFunctionType(inputType) : + isSetAccessorDeclaration(node) ? createSetterFunctionType(inputType) : + inputType; + + const contextType = createClassMemberDecoratorContextTypeForNode(node, finalThisType, finalType); + + // We also wrap the "output type", as needed. + const returnType = + isGetAccessorDeclaration(node) ? createGetterFunctionType(outputType) : + isSetAccessorDeclaration(node) ? createSetterFunctionType(outputType) : + outputType; + + links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, returnType); break; } case SyntaxKind.PropertyDeclaration: { - const node = decorator.parent as PropertyDeclaration; - if (isClassLike(node.parent)) { - const initializerType = getTypeOfNode(node); + const node = parent as PropertyDeclaration; + if (!isClassLike(node.parent)) break; + + // Field decorators have a `context` of `ClassFieldDecoratorContext` and + // auto-accessor decorators have a `context` of `ClassAccessorDecoratorContext. In + // both cases, the `This` type argument is the "final type" of either the class or instance, + // depending on whether the member was `static`, and the `Value` type argument corresponds to + // the "final type" of the value stored in the field. + + // TODO: This should eventually correspond with either the "output type" of any prior decorator + // or the "original type" of the member. + const inputType = getTypeOfNode(node); + + // TODO: This should eventually be a type variable whose type will be inferred from decorator + // application and used as either the "input type" of the next decorator, or the + // "final type" of the member. + const outputType = inputType; + + // TODO: This should eventually be a type variable that is the result of the type mutations from + // all decorators of the member. + const finalType = outputType; + + // TODO: This should eventually be a type variable that is the result of the type mutations from + // all decorators applied to the class and its members. + const finalThisType = hasStaticModifier(node) ? + getTypeOfSymbol(getSymbolOfNode(node.parent)) : + getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); + + // The `target` of an auto-accessor decorator is a `{ get, set }` object, representing the + // runtime-generated getter and setter that are added to the class/prototype. The `target` of a + // regular field decorator is always `undefined` as it isn't installed until it is initialized. + const targetType = + hasAccessorModifier(node) ? createClassAccessorDecoratorTargetType(finalThisType, inputType) : + undefinedType; + + const contextType = createClassMemberDecoratorContextTypeForNode(node, finalThisType, finalType); + + // We wrap the "output type" depending on the declaration. For auto-accessors, we wrap the + // "output type" in a `ClassAccessorDecoratorResult` type, which allows for + // mutation of the runtime-generated getter and setter, as well as the injection of an + // initializer mutator. For regular fields, we wrap the "output type" in an initializer mutator. + const returnType = + hasAccessorModifier(node) ? createClassAccessorDecoratorResultType(finalThisType, inputType, finalType) : + createClassFieldDecoratorInitializerMutatorType(finalThisType, inputType, finalType); + + links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, returnType); + break; + } + } + } + return links.decoratorSignature === anySignature ? undefined : links.decoratorSignature; + } + + function getLegacyDecoratorCallSignature(decorator: Decorator) { + const { parent } = decorator; + const links = getNodeLinks(parent); + if (!links.decoratorSignature) { + links.decoratorSignature = anySignature; + switch (parent.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: { + const node = parent as ClassDeclaration | ClassExpression; + // For a class decorator, the `target` is the type of the class (e.g. the + // "static" or "constructor" side of the class). + const targetType = getTypeOfSymbol(getSymbolOfNode(node)); + const targetParam = createParameter("target" as __String, targetType); + links.decoratorSignature = createCallSignature( + /*typeParameters*/ undefined, + /*thisParameter*/ undefined, + [targetParam], + getUnionType([targetType, voidType]) + ); + break; + } + case SyntaxKind.Parameter: { + const node = parent as ParameterDeclaration; + if (!isConstructorDeclaration(node.parent) && + !((isMethodDeclaration(node.parent) || isSetAccessorDeclaration(node.parent) && isClassLike(node.parent.parent)))) { + break; + } + + if (getThisParameter(node.parent) === node) { + break; + } - // TODO(rbuckton): Some mechanism of defining a type variable that is dependent on the result of - // evaluating all decorators. - const valueFinalType = initializerType; - const thisFinalType = hasStaticModifier(node) ? - getTypeOfSymbol(getSymbolOfNode(node.parent)) : - getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node.parent)); + const index = getThisParameter(node.parent) ? + node.parent.parameters.indexOf(node) - 1 : + node.parent.parameters.indexOf(node); + Debug.assert(index >= 0); - const targetType = - hasAccessorModifier(node) ? createClassAccessorESDecoratorTargetType(thisFinalType, initializerType) : - undefinedType; + // A parameter declaration decorator will have three arguments (see `ParameterDecorator` in + // core.d.ts). - const isStatic = hasStaticModifier(node); - const isPrivate = isPrivateIdentifier(node.name); - const nameType = isPrivate ? getStringLiteralType(idText(node.name)) : getLiteralTypeFromPropertyName(node.name); + const targetType = + isConstructorDeclaration(node.parent) ? getTypeOfSymbol(getSymbolOfNode(node.parent.parent)) : + getParentTypeOfClassElement(node.parent); - const contextType = - hasAccessorModifier(node) ? createClassAccessorESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate) : - createClassFieldESDecoratorContextType(thisFinalType, valueFinalType, nameType, isStatic, isPrivate); + const keyType = + isConstructorDeclaration(node.parent) ? undefinedType : + getClassElementPropertyKeyType(node.parent); - const returnType = - hasAccessorModifier(node) ? createClassAccessorESDecoratorResultType(thisFinalType, initializerType, valueFinalType) : - createClassFieldESDecoratorReturnType(initializerType, valueFinalType); + const indexType = getNumberLiteralType(index); - const targetParam = createSymbol(SymbolFlags.FunctionScopedVariable, "target" as __String, /*checkFlags*/ undefined, targetType); - const contextParam = createSymbol(SymbolFlags.FunctionScopedVariable, "context" as __String, /*checkFlags*/ undefined, contextType); - links.decoratorSignature = createCallSignature(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [targetParam, contextParam], returnType, /*typePredicate*/ undefined, 2); + const targetParam = createParameter("target" as __String, targetType); + const keyParam = createParameter("propertyKey" as __String, keyType); + const indexParam = createParameter("parameterIndex" as __String, indexType); + links.decoratorSignature = createCallSignature( + /*typeParameters*/ undefined, + /*thisParameter*/ undefined, + [targetParam, keyParam, indexParam], + voidType + ); + break; + } + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.PropertyDeclaration: { + const node = parent as MethodDeclaration | AccessorDeclaration | PropertyDeclaration; + if (!isClassLike(node.parent)) break; + + // A method or accessor declaration decorator will have either two or three arguments (see + // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators for + // ES3, we will only pass two arguments. + + const targetType = getParentTypeOfClassElement(node); + const targetParam = createParameter("target" as __String, targetType); + + const keyType = getClassElementPropertyKeyType(node); + const keyParam = createParameter("propertyKey" as __String, keyType); + + const returnType = + isPropertyDeclaration(node) ? voidType : + createTypedPropertyDescriptorType(getTypeOfNode(node)); + + const hasPropDesc = languageVersion !== ScriptTarget.ES3 && (!isPropertyDeclaration(parent) || hasAccessorModifier(parent)); + if (hasPropDesc) { + const descriptorType = createTypedPropertyDescriptorType(getTypeOfNode(node)); + const descriptorParam = createParameter("descriptor" as __String, descriptorType); + links.decoratorSignature = createCallSignature( + /*typeParameters*/ undefined, + /*thisParameter*/ undefined, + [targetParam, keyParam, descriptorParam], + getUnionType([returnType, voidType]) + ); + } + else { + links.decoratorSignature = createCallSignature( + /*typeParameters*/ undefined, + /*thisParameter*/ undefined, + [targetParam, keyParam], + getUnionType([returnType, voidType]) + ); } break; } @@ -33349,6 +33562,11 @@ namespace ts { return links.decoratorSignature === anySignature ? undefined : links.decoratorSignature; } + function getDecoratorCallSignature(decorator: Decorator) { + return legacyDecorators ? getLegacyDecoratorCallSignature(decorator) : + getESDecoratorCallSignature(decorator); + } + function createPromiseType(promisedType: Type): Type { // creates a `Promise` type where `T` is the promisedType argument const globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); @@ -37672,45 +37890,33 @@ namespace ts { return; } + // if we fail to get a signature and return type here, we will have already reported a grammar error in `checkDecorators`. + const decoratorSignature = getDecoratorCallSignature(node); + if (!decoratorSignature?.resolvedReturnType) return; + let headMessage: DiagnosticMessage; - let expectedReturnType: Type; + const expectedReturnType = decoratorSignature.resolvedReturnType; switch (node.parent.kind) { case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; - expectedReturnType = createClassDecoratorReturnType(node.parent as ClassDeclaration | ClassExpression); break; case SyntaxKind.PropertyDeclaration: if (!legacyDecorators) { headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; - const thisType = hasStaticModifier(node.parent) ? - getTypeOfSymbol(getSymbolOfNode((node.parent as PropertyDeclaration).parent)) : - getDeclaredTypeOfClassOrInterface(getSymbolOfNode((node.parent as PropertyDeclaration).parent)); - const expectedType = getTypeOfNode(node.parent); - if (hasAccessorModifier(node.parent)) { - expectedReturnType = createClassAccessorESDecoratorResultType(thisType, expectedType, expectedType); - } - else { - expectedReturnType = createClassFieldESDecoratorReturnType(expectedType, expectedType); - } break; } // falls through case SyntaxKind.Parameter: headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; - expectedReturnType = voidType; break; case SyntaxKind.MethodDeclaration: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; - const expectedType = legacyDecorators ? - createTypedPropertyDescriptorType(getTypeOfNode(node.parent)) : - getOrCreateTypeFromSignature(getSignatureFromDeclaration(node.parent as MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration)); - expectedReturnType = getUnionType([expectedType, voidType]); break; default: @@ -37720,6 +37926,9 @@ namespace ts { checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage); } + /** + * Creates a synthetic `Signature` corresponding to a call signature. + */ function createCallSignature( typeParameters: readonly TypeParameter[] | undefined, thisParameter: Symbol | undefined, @@ -37733,19 +37942,31 @@ namespace ts { return createSignature(decl, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, flags); } + /** + * Creates a synthetic `FunctionType` + */ function createFunctionType( typeParameters: readonly TypeParameter[] | undefined, thisParameter: Symbol | undefined, parameters: readonly Symbol[], returnType: Type, typePredicate?: TypePredicate, - minArgumentCount: number = parameters.length, - flags: SignatureFlags = SignatureFlags.None + minArgumentCount?: number, + flags?: SignatureFlags ) { const signature = createCallSignature(typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, flags); return getOrCreateTypeFromSignature(signature); } + function createGetterFunctionType(type: Type) { + return createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, emptyArray, type); + } + + function createSetterFunctionType(type: Type) { + const valueParam = createParameter("value" as __String, type); + return createFunctionType(/*typeParameters*/ undefined, /*thisParameter*/ undefined, [valueParam], voidType); + } + /** * If a TypeNode can be resolved to a value symbol imported from an external module, it is * marked as referenced to prevent import elision. @@ -44692,7 +44913,7 @@ namespace ts { } if (isParameter(node) && parameterIsThisKeyword(node)) { - return grammarErrorOnFirstToken(node, Diagnostics.Decorators_and_modifiers_may_not_be_applied_to_this_parameters); + return grammarErrorOnFirstToken(node, Diagnostics.Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters); } let lastStatic: Node | undefined, lastDeclare: Node | undefined, lastAsync: Node | undefined, lastOverride: Node | undefined, firstDecorator: Decorator | undefined; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 986f99eac4ebd..09fbf4728145f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1384,7 +1384,7 @@ "category": "Error", "code": 1432 }, - "Decorators and modifiers may not be applied to 'this' parameters.": { + "Neither decorators nor modifiers may be applied to 'this' parameters.": { "category": "Error", "code": 1433 }, diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 33be5a0a04b8c..c46c1da47221e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3525,7 +3525,7 @@ namespace ts { const modifier = firstOrUndefined(modifiers); if (modifier) { - parseErrorAtRange(modifier, Diagnostics.Decorators_and_modifiers_may_not_be_applied_to_this_parameters); + parseErrorAtRange(modifier, Diagnostics.Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters); } return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -6043,7 +6043,7 @@ namespace ts { return parseFunctionExpression(); case SyntaxKind.AtToken: - return parseDecoratoratedExpression(); + return parseDecoratedExpression(); case SyntaxKind.ClassKeyword: return parseClassExpression(); case SyntaxKind.FunctionKeyword: @@ -7429,7 +7429,7 @@ namespace ts { return Debug.fail("Should not have attempted to parse class member declaration."); } - function parseDecoratoratedExpression(): PrimaryExpression { + function parseDecoratedExpression(): PrimaryExpression { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); const modifiers = parseModifiers(/*allowDecorators*/ true); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 660edc0004877..d716bd4822481 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1945,11 +1945,12 @@ namespace ts { // TODO(rbuckton): Is there a way to support parameter decorators or should we wait until it is standardized? if (!useLegacyDecorators) return false; // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target. - return (parent as FunctionLikeDeclaration).body !== undefined - && parent !== undefined + return parent !== undefined + && (parent as FunctionLikeDeclaration).body !== undefined && (parent.kind === SyntaxKind.Constructor || parent.kind === SyntaxKind.MethodDeclaration || parent.kind === SyntaxKind.SetAccessor) + && getThisParameter(parent as FunctionLikeDeclaration) !== node && grandparent !== undefined && grandparent.kind === SyntaxKind.ClassDeclaration; } diff --git a/tests/baselines/reference/decoratorChecksFunctionBodies.errors.txt b/tests/baselines/reference/decoratorChecksFunctionBodies.errors.txt index f9dd5b63b57e5..f6c467324aef6 100644 --- a/tests/baselines/reference/decoratorChecksFunctionBodies.errors.txt +++ b/tests/baselines/reference/decoratorChecksFunctionBodies.errors.txt @@ -7,12 +7,12 @@ tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts(8,14): } class A { - @((x, p) => { + @((x, p, d) => { var a = 3; func(a); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. - return x; + return d; }) m() { diff --git a/tests/baselines/reference/decoratorChecksFunctionBodies.js b/tests/baselines/reference/decoratorChecksFunctionBodies.js index 38f0784939f1e..30c8264e45ba8 100644 --- a/tests/baselines/reference/decoratorChecksFunctionBodies.js +++ b/tests/baselines/reference/decoratorChecksFunctionBodies.js @@ -4,10 +4,10 @@ function func(s: string): void { } class A { - @((x, p) => { + @((x, p, d) => { var a = 3; func(a); - return x; + return d; }) m() { @@ -30,10 +30,10 @@ var A = /** @class */ (function () { A.prototype.m = function () { }; __decorate([ - (function (x, p) { + (function (x, p, d) { var a = 3; func(a); - return x; + return d; }) ], A.prototype, "m", null); return A; diff --git a/tests/baselines/reference/decoratorChecksFunctionBodies.symbols b/tests/baselines/reference/decoratorChecksFunctionBodies.symbols index d199350138578..c71462e75f7e5 100644 --- a/tests/baselines/reference/decoratorChecksFunctionBodies.symbols +++ b/tests/baselines/reference/decoratorChecksFunctionBodies.symbols @@ -8,9 +8,10 @@ function func(s: string): void { class A { >A : Symbol(A, Decl(decoratorChecksFunctionBodies.ts, 2, 1)) - @((x, p) => { + @((x, p, d) => { >x : Symbol(x, Decl(decoratorChecksFunctionBodies.ts, 5, 7)) >p : Symbol(p, Decl(decoratorChecksFunctionBodies.ts, 5, 9)) +>d : Symbol(d, Decl(decoratorChecksFunctionBodies.ts, 5, 12)) var a = 3; >a : Symbol(a, Decl(decoratorChecksFunctionBodies.ts, 6, 11)) @@ -19,8 +20,8 @@ class A { >func : Symbol(func, Decl(decoratorChecksFunctionBodies.ts, 0, 0)) >a : Symbol(a, Decl(decoratorChecksFunctionBodies.ts, 6, 11)) - return x; ->x : Symbol(x, Decl(decoratorChecksFunctionBodies.ts, 5, 7)) + return d; +>d : Symbol(d, Decl(decoratorChecksFunctionBodies.ts, 5, 12)) }) m() { diff --git a/tests/baselines/reference/decoratorChecksFunctionBodies.types b/tests/baselines/reference/decoratorChecksFunctionBodies.types index c1f5c581b2194..8663e1d84043e 100644 --- a/tests/baselines/reference/decoratorChecksFunctionBodies.types +++ b/tests/baselines/reference/decoratorChecksFunctionBodies.types @@ -8,11 +8,12 @@ function func(s: string): void { class A { >A : A - @((x, p) => { ->((x, p) => { var a = 3; func(a); return x; }) : (x: any, p: any) => any ->(x, p) => { var a = 3; func(a); return x; } : (x: any, p: any) => any ->x : any ->p : any + @((x, p, d) => { +>((x, p, d) => { var a = 3; func(a); return d; }) : (x: A, p: "m", d: TypedPropertyDescriptor<() => void>) => TypedPropertyDescriptor<() => void> +>(x, p, d) => { var a = 3; func(a); return d; } : (x: A, p: "m", d: TypedPropertyDescriptor<() => void>) => TypedPropertyDescriptor<() => void> +>x : A +>p : "m" +>d : TypedPropertyDescriptor<() => void> var a = 3; >a : number @@ -23,8 +24,8 @@ class A { >func : (s: string) => void >a : number - return x; ->x : any + return d; +>d : TypedPropertyDescriptor<() => void> }) m() { diff --git a/tests/baselines/reference/decoratorOnClassMethodThisParameter.errors.txt b/tests/baselines/reference/decoratorOnClassMethodThisParameter.errors.txt index 0cd71e1cbcac2..e2f014e1096a4 100644 --- a/tests/baselines/reference/decoratorOnClassMethodThisParameter.errors.txt +++ b/tests/baselines/reference/decoratorOnClassMethodThisParameter.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(4,12): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. -tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(8,29): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(4,12): error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. +tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(8,29): error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(8,30): error TS2680: A 'this' parameter must be the first parameter. @@ -9,13 +9,13 @@ tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethod class C { method(@dec this: C) {} ~~~~ -!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +!!! error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. } class C2 { method(@dec allowed: C2, @dec this: C2) {} ~~~~~ -!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +!!! error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. ~~~~~~~~~~~~~ !!! error TS2680: A 'this' parameter must be the first parameter. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt b/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt index c276adae75594..fd842a094dc44 100644 --- a/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt +++ b/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(5,17): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. -tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(6,17): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(5,17): error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. +tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(6,17): error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. ==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts (2 errors) ==== @@ -9,7 +9,7 @@ tests/cases/conformance/decorators/invalid/decoratorOnFunctionParameter.ts(6,17) function direct(@dec this: C) { return this.n; } ~~~~ -!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +!!! error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. function called(@dec() this: C) { return this.n; } ~~~~~~ -!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. \ No newline at end of file +!!! error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. \ No newline at end of file diff --git a/tests/baselines/reference/generatorTypeCheck61.types b/tests/baselines/reference/generatorTypeCheck61.types index d78d7439d47e5..0c8c4ee850367 100644 --- a/tests/baselines/reference/generatorTypeCheck61.types +++ b/tests/baselines/reference/generatorTypeCheck61.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts === function * g() { ->g : () => Generator +>g : () => Generator void | typeof C> @(yield 0) >(yield 0) : any diff --git a/tests/baselines/reference/legacyDecorators-contextualTypes.js b/tests/baselines/reference/legacyDecorators-contextualTypes.js new file mode 100644 index 0000000000000..c93d9bf15469e --- /dev/null +++ b/tests/baselines/reference/legacyDecorators-contextualTypes.js @@ -0,0 +1,94 @@ +//// [legacyDecorators-contextualTypes.ts] +@((t) => { }) +class C { + constructor(@((t, k, i) => {}) p: any) {} + + @((t, k, d) => { }) + static f() {} + + @((t, k, d) => { }) + static get x() { return 1; } + static set x(value) { } + + @((t, k, d) => { }) + static accessor y = 1; + + @((t, k) => { }) + static z = 1; + + @((t, k, d) => { }) + g() {} + + @((t, k, d) => { }) + get a() { return 1; } + set a(value) { } + + @((t, k, d) => { }) + accessor b = 1; + + @((t, k) => { }) + c = 1; + + static h(@((t, k, i) => {}) p: any) {} + h(@((t, k, i) => {}) p: any) {} +} + +//// [legacyDecorators-contextualTypes.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; +let C = class C { + constructor(p) { } + static f() { } + static get x() { return 1; } + static set x(value) { } + static accessor y = 1; + static z = 1; + g() { } + get a() { return 1; } + set a(value) { } + accessor b = 1; + c = 1; + static h(p) { } + h(p) { } +}; +__decorate([ + ((t, k, d) => { }) +], C.prototype, "g", null); +__decorate([ + ((t, k, d) => { }) +], C.prototype, "a", null); +__decorate([ + ((t, k, d) => { }) +], C.prototype, "b", null); +__decorate([ + ((t, k) => { }) +], C.prototype, "c", void 0); +__decorate([ + __param(0, ((t, k, i) => { })) +], C.prototype, "h", null); +__decorate([ + ((t, k, d) => { }) +], C, "f", null); +__decorate([ + ((t, k, d) => { }) +], C, "x", null); +__decorate([ + ((t, k, d) => { }) +], C, "y", null); +__decorate([ + ((t, k) => { }) +], C, "z", void 0); +__decorate([ + __param(0, ((t, k, i) => { })) +], C, "h", null); +C = __decorate([ + ((t) => { }), + __param(0, ((t, k, i) => { })) +], C); diff --git a/tests/baselines/reference/legacyDecorators-contextualTypes.symbols b/tests/baselines/reference/legacyDecorators-contextualTypes.symbols new file mode 100644 index 0000000000000..eb916b335e097 --- /dev/null +++ b/tests/baselines/reference/legacyDecorators-contextualTypes.symbols @@ -0,0 +1,97 @@ +=== tests/cases/conformance/decorators/legacyDecorators-contextualTypes.ts === +@((t) => { }) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 0, 3)) + +class C { +>C : Symbol(C, Decl(legacyDecorators-contextualTypes.ts, 0, 0)) + + constructor(@((t, k, i) => {}) p: any) {} +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 2, 19)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 2, 21)) +>i : Symbol(i, Decl(legacyDecorators-contextualTypes.ts, 2, 24)) +>p : Symbol(p, Decl(legacyDecorators-contextualTypes.ts, 2, 16)) + + @((t, k, d) => { }) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 4, 7)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 4, 9)) +>d : Symbol(d, Decl(legacyDecorators-contextualTypes.ts, 4, 12)) + + static f() {} +>f : Symbol(C.f, Decl(legacyDecorators-contextualTypes.ts, 2, 45)) + + @((t, k, d) => { }) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 7, 7)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 7, 9)) +>d : Symbol(d, Decl(legacyDecorators-contextualTypes.ts, 7, 12)) + + static get x() { return 1; } +>x : Symbol(C.x, Decl(legacyDecorators-contextualTypes.ts, 5, 17), Decl(legacyDecorators-contextualTypes.ts, 8, 32)) + + static set x(value) { } +>x : Symbol(C.x, Decl(legacyDecorators-contextualTypes.ts, 5, 17), Decl(legacyDecorators-contextualTypes.ts, 8, 32)) +>value : Symbol(value, Decl(legacyDecorators-contextualTypes.ts, 9, 17)) + + @((t, k, d) => { }) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 11, 7)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 11, 9)) +>d : Symbol(d, Decl(legacyDecorators-contextualTypes.ts, 11, 12)) + + static accessor y = 1; +>y : Symbol(C.y, Decl(legacyDecorators-contextualTypes.ts, 9, 27)) + + @((t, k) => { }) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 14, 7)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 14, 9)) + + static z = 1; +>z : Symbol(C.z, Decl(legacyDecorators-contextualTypes.ts, 12, 26)) + + @((t, k, d) => { }) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 17, 7)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 17, 9)) +>d : Symbol(d, Decl(legacyDecorators-contextualTypes.ts, 17, 12)) + + g() {} +>g : Symbol(C.g, Decl(legacyDecorators-contextualTypes.ts, 15, 17)) + + @((t, k, d) => { }) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 20, 7)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 20, 9)) +>d : Symbol(d, Decl(legacyDecorators-contextualTypes.ts, 20, 12)) + + get a() { return 1; } +>a : Symbol(C.a, Decl(legacyDecorators-contextualTypes.ts, 18, 10), Decl(legacyDecorators-contextualTypes.ts, 21, 25)) + + set a(value) { } +>a : Symbol(C.a, Decl(legacyDecorators-contextualTypes.ts, 18, 10), Decl(legacyDecorators-contextualTypes.ts, 21, 25)) +>value : Symbol(value, Decl(legacyDecorators-contextualTypes.ts, 22, 10)) + + @((t, k, d) => { }) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 24, 7)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 24, 9)) +>d : Symbol(d, Decl(legacyDecorators-contextualTypes.ts, 24, 12)) + + accessor b = 1; +>b : Symbol(C.b, Decl(legacyDecorators-contextualTypes.ts, 22, 20)) + + @((t, k) => { }) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 27, 7)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 27, 9)) + + c = 1; +>c : Symbol(C.c, Decl(legacyDecorators-contextualTypes.ts, 25, 19)) + + static h(@((t, k, i) => {}) p: any) {} +>h : Symbol(C.h, Decl(legacyDecorators-contextualTypes.ts, 28, 10)) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 30, 16)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 30, 18)) +>i : Symbol(i, Decl(legacyDecorators-contextualTypes.ts, 30, 21)) +>p : Symbol(p, Decl(legacyDecorators-contextualTypes.ts, 30, 13)) + + h(@((t, k, i) => {}) p: any) {} +>h : Symbol(C.h, Decl(legacyDecorators-contextualTypes.ts, 30, 42)) +>t : Symbol(t, Decl(legacyDecorators-contextualTypes.ts, 31, 9)) +>k : Symbol(k, Decl(legacyDecorators-contextualTypes.ts, 31, 11)) +>i : Symbol(i, Decl(legacyDecorators-contextualTypes.ts, 31, 14)) +>p : Symbol(p, Decl(legacyDecorators-contextualTypes.ts, 31, 6)) +} diff --git a/tests/baselines/reference/legacyDecorators-contextualTypes.types b/tests/baselines/reference/legacyDecorators-contextualTypes.types new file mode 100644 index 0000000000000..a881cd2337469 --- /dev/null +++ b/tests/baselines/reference/legacyDecorators-contextualTypes.types @@ -0,0 +1,127 @@ +=== tests/cases/conformance/decorators/legacyDecorators-contextualTypes.ts === +@((t) => { }) +>((t) => { }) : (t: typeof C) => void +>(t) => { } : (t: typeof C) => void +>t : typeof C + +class C { +>C : C + + constructor(@((t, k, i) => {}) p: any) {} +>((t, k, i) => {}) : (t: typeof C, k: undefined, i: 0) => void +>(t, k, i) => {} : (t: typeof C, k: undefined, i: 0) => void +>t : typeof C +>k : undefined +>i : 0 +>p : any + + @((t, k, d) => { }) +>((t, k, d) => { }) : (t: typeof C, k: "f", d: TypedPropertyDescriptor<() => void>) => void +>(t, k, d) => { } : (t: typeof C, k: "f", d: TypedPropertyDescriptor<() => void>) => void +>t : typeof C +>k : "f" +>d : TypedPropertyDescriptor<() => void> + + static f() {} +>f : () => void + + @((t, k, d) => { }) +>((t, k, d) => { }) : (t: typeof C, k: "x", d: TypedPropertyDescriptor) => void +>(t, k, d) => { } : (t: typeof C, k: "x", d: TypedPropertyDescriptor) => void +>t : typeof C +>k : "x" +>d : TypedPropertyDescriptor + + static get x() { return 1; } +>x : number +>1 : 1 + + static set x(value) { } +>x : number +>value : number + + @((t, k, d) => { }) +>((t, k, d) => { }) : (t: typeof C, k: "y", d: TypedPropertyDescriptor) => void +>(t, k, d) => { } : (t: typeof C, k: "y", d: TypedPropertyDescriptor) => void +>t : typeof C +>k : "y" +>d : TypedPropertyDescriptor + + static accessor y = 1; +>y : number +>1 : 1 + + @((t, k) => { }) +>((t, k) => { }) : (t: typeof C, k: "z") => void +>(t, k) => { } : (t: typeof C, k: "z") => void +>t : typeof C +>k : "z" + + static z = 1; +>z : number +>1 : 1 + + @((t, k, d) => { }) +>((t, k, d) => { }) : (t: C, k: "g", d: TypedPropertyDescriptor<() => void>) => void +>(t, k, d) => { } : (t: C, k: "g", d: TypedPropertyDescriptor<() => void>) => void +>t : C +>k : "g" +>d : TypedPropertyDescriptor<() => void> + + g() {} +>g : () => void + + @((t, k, d) => { }) +>((t, k, d) => { }) : (t: C, k: "a", d: TypedPropertyDescriptor) => void +>(t, k, d) => { } : (t: C, k: "a", d: TypedPropertyDescriptor) => void +>t : C +>k : "a" +>d : TypedPropertyDescriptor + + get a() { return 1; } +>a : number +>1 : 1 + + set a(value) { } +>a : number +>value : number + + @((t, k, d) => { }) +>((t, k, d) => { }) : (t: C, k: "b", d: TypedPropertyDescriptor) => void +>(t, k, d) => { } : (t: C, k: "b", d: TypedPropertyDescriptor) => void +>t : C +>k : "b" +>d : TypedPropertyDescriptor + + accessor b = 1; +>b : number +>1 : 1 + + @((t, k) => { }) +>((t, k) => { }) : (t: C, k: "c") => void +>(t, k) => { } : (t: C, k: "c") => void +>t : C +>k : "c" + + c = 1; +>c : number +>1 : 1 + + static h(@((t, k, i) => {}) p: any) {} +>h : (p: any) => void +>((t, k, i) => {}) : (t: typeof C, k: "h", i: 0) => void +>(t, k, i) => {} : (t: typeof C, k: "h", i: 0) => void +>t : typeof C +>k : "h" +>i : 0 +>p : any + + h(@((t, k, i) => {}) p: any) {} +>h : (p: any) => void +>((t, k, i) => {}) : (t: C, k: "h", i: 0) => void +>(t, k, i) => {} : (t: C, k: "h", i: 0) => void +>t : C +>k : "h" +>i : 0 +>p : any +} diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt index 4f44ad576af5c..1c4858865f2a3 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt @@ -74,11 +74,11 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(158,17): e tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(162,9): error TS2681: A constructor cannot have a 'this' parameter. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(164,31): error TS2681: A constructor cannot have a 'this' parameter. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(165,30): error TS2680: A 'this' parameter must be the first parameter. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,20): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,20): error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,23): error TS1359: Identifier expected. 'this' is a reserved word that cannot be used here. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,23): error TS2680: A 'this' parameter must be the first parameter. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,23): error TS1005: ',' expected. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,20): error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,20): error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,30): error TS1005: ',' expected. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,32): error TS1359: Identifier expected. 'new' is a reserved word that cannot be used here. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,37): error TS1005: ',' expected. @@ -393,7 +393,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e ///// parse errors ///// function modifiers(async this: C): number { return this.n; } ~~~~~ -!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +!!! error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. function restParam(...this: C): number { return this.n; } ~~~~ !!! error TS1359: Identifier expected. 'this' is a reserved word that cannot be used here. @@ -404,7 +404,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e !!! error TS1005: ',' expected. function decorated(@deco() this: C): number { return this.n; } ~~~~~~~ -!!! error TS1433: Decorators and modifiers may not be applied to 'this' parameters. +!!! error TS1433: Neither decorators nor modifiers may be applied to 'this' parameters. function initializer(this: C = new C()): number { return this.n; } ~ !!! error TS1005: ',' expected. diff --git a/tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts b/tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts index 36237f3cb58ed..0db73f7b1e216 100644 --- a/tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts +++ b/tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts @@ -6,10 +6,10 @@ function func(s: string): void { } class A { - @((x, p) => { + @((x, p, d) => { var a = 3; func(a); - return x; + return d; }) m() { diff --git a/tests/cases/conformance/decorators/legacyDecorators-contextualTypes.ts b/tests/cases/conformance/decorators/legacyDecorators-contextualTypes.ts new file mode 100644 index 0000000000000..b669e306e1efc --- /dev/null +++ b/tests/cases/conformance/decorators/legacyDecorators-contextualTypes.ts @@ -0,0 +1,36 @@ +// @target: esnext +// @experimentalDecorators: true + +@((t) => { }) +class C { + constructor(@((t, k, i) => {}) p: any) {} + + @((t, k, d) => { }) + static f() {} + + @((t, k, d) => { }) + static get x() { return 1; } + static set x(value) { } + + @((t, k, d) => { }) + static accessor y = 1; + + @((t, k) => { }) + static z = 1; + + @((t, k, d) => { }) + g() {} + + @((t, k, d) => { }) + get a() { return 1; } + set a(value) { } + + @((t, k, d) => { }) + accessor b = 1; + + @((t, k) => { }) + c = 1; + + static h(@((t, k, i) => {}) p: any) {} + h(@((t, k, i) => {}) p: any) {} +} \ No newline at end of file From 49dbc72074572c7f3e907f8bb02a11dff413325b Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 27 Oct 2022 13:57:38 -0400 Subject: [PATCH 22/51] Address additional PR feedback --- src/compiler/checker.ts | 50 +++++++++++---------- src/compiler/transformers/classFields.ts | 55 ++++++++++------------- src/compiler/transformers/esDecorators.ts | 33 +++++++++----- 3 files changed, 71 insertions(+), 67 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bff9f9ca60984..fde69cb280116 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -33229,11 +33229,11 @@ namespace ts { * resulting signature can be used for call resolution, inference, and contextual typing. */ function getESDecoratorCallSignature(decorator: Decorator) { - // In the future we are considering allowing the types of decorators to affect the type of the class and its - // members, such as a `@Stringify` decorator changing the type of a `number` field to `string`, or a - // `@Callable` decorator adding a call signature to a `class`. For now, the type arguments for the various - // context types that will eventually change to reflect such mutations will be stubbed out with fixed - // types so that we have a convenient place to apply these mutations. + // We are considering a future change that would allow the type of a decorator to affect the type of the + // class and its members, such as a `@Stringify` decorator changing the type of a `number` field to + // `string`, or a `@Callable` decorator adding a call signature to a `class`. For now, the type arguments + // for the various context types that will eventually change to reflect such mutations will be stubbed out + // with fixed types so that we have a convenient place to apply these mutations. // // In some cases we describe such potential mutations as coming from a "prior decorator application". It is // important to note that, while decorators are *evaluated* left to right, they are *applied* right to left @@ -33281,8 +33281,8 @@ namespace ts { // - For `A2`, the "current type" of the method is the "output type" of `A1`, and the "current type" of the // class is the type of `SomeClass` where `f` is the "output type" of `A1`. This becomes the "final type" // of `f`. - // - For `B1`, the "current type" of the method is its "original type", and the "current type" of the - // class is the type of `SomeClass` where `f` now has its "final type". + // - For `B1`, the "current type" of the method is its "original type", and the "current type" of the class + // is the type of `SomeClass` where `f` now has its "final type". // - etc. // // [1]: https://arai-a.github.io/ecma262-compare/?pr=2417&id=sec-runtime-semantics-classdefinitionevaluation @@ -33303,13 +33303,13 @@ namespace ts { // e2: (input: E1, context: Context) => E2, // ): E2; - // When a decorator is applied, it is passed two arguments: The "target", which is a value representing - // the thing being decorated (constructors for classes, functions for methods/accessors, `undefined` for - // fields, and a `{ get, set }` object for auto-accessors), and a "context", which is an object that - // provides reflection information about the decorated element, as well as the ability to add additional - // "extra" initializers. In most cases, the "target" argument corresponds to the "input type" in some way, - // and the return value similarly corresponds to the "output type" (though if the "output type" is `void` - // or `undefined` then the "output type" is the "input type"). + // When a decorator is applied, it is passed two arguments: "target", which is a value representing the + // thing being decorated (constructors for classes, functions for methods/accessors, `undefined` for fields, + // and a `{ get, set }` object for auto-accessors), and "context", which is an object that provides + // reflection information about the decorated element, as well as the ability to add additional "extra" + // initializers. In most cases, the "target" argument corresponds to the "input type" in some way, and the + // return value similarly corresponds to the "output type" (though if the "output type" is `void` or + // `undefined` then the "output type" is the "input type"). const { parent } = decorator; const links = getNodeLinks(parent); @@ -45249,12 +45249,19 @@ namespace ts { * undefined: Need to do full checking on the modifiers. */ function reportObviousModifierErrors(node: HasModifiers | HasIllegalModifiers): boolean | undefined { - if (canHaveModifiers(node) ? node.modifiers === undefined : node.decoratorsAndModifiers === undefined) return false; - const modifier = shouldReportBadModifier(node); + const unmodified = canHaveModifiers(node) ? !node.modifiers : !node.decoratorsAndModifiers; + if (unmodified) return false; + + const modifier = findFirstIllegalModifier(node); return modifier && grammarErrorOnFirstToken(modifier, Diagnostics.Modifiers_cannot_appear_here); } - function shouldReportBadModifier(node: HasModifiers | HasIllegalModifiers): Modifier | undefined { + function findFirstModifierExcept(node: HasModifiers, allowedModifier: SyntaxKind): Modifier | undefined { + const modifier = find(node.modifiers, isModifier); + return modifier && modifier.kind !== allowedModifier ? modifier : undefined; + } + + function findFirstIllegalModifier(node: HasModifiers | HasIllegalModifiers): Modifier | undefined { switch (node.kind) { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: @@ -45304,17 +45311,12 @@ namespace ts { } } - function findFirstModifierExcept(node: HasModifiers, allowedModifier: SyntaxKind): Modifier | undefined { - const modifier = find(node.modifiers, isModifier); - return modifier && modifier.kind !== allowedModifier ? modifier : undefined; - } - function reportObviousDecoratorErrors(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators) { - const decorator = shouldReportBadDecorator(node); + const decorator = findFirstIllegalDecorator(node); return decorator && grammarErrorOnFirstToken(decorator, Diagnostics.Decorators_are_not_valid_here); } - function shouldReportBadDecorator(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators): Decorator | undefined { + function findFirstIllegalDecorator(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators): Decorator | undefined { if (canHaveIllegalDecorators(node)) return find(node.decoratorsAndModifiers, isDecorator); } diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 49bdd12854430..81d956dbc6f0e 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -449,6 +449,13 @@ namespace ts { return statement; } + function getAssignedNameOfIdentifier(name: Identifier, initializer: Expression) { + const originalClass = getOriginalNode(initializer, isClassLike); + return originalClass && !originalClass.name && hasSyntacticModifier(originalClass, ModifierFlags.Default) ? + factory.createStringLiteral("default") : + factory.createStringLiteralFromNode(name); + } + function visitVariableDeclaration(node: VariableDeclaration) { // 14.3.1.2 RS: Evaluation // LexicalBinding : BindingIdentifier Initializer @@ -466,12 +473,9 @@ namespace ts { if (isIdentifier(node.name) && node.initializer && isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { - const original = getOriginalNode(node.initializer, isClassLike); - const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? - factory.createStringLiteral("default") : - factory.createStringLiteralFromNode(node.name); + const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateVariableDeclaration(node, name, /*exclamationToken*/ undefined, /*type*/ undefined, initializer); } @@ -495,16 +499,12 @@ namespace ts { // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. // ... - if (!node.dotDotDotToken && - isIdentifier(node.name) && node.initializer && + if (!node.dotDotDotToken && isIdentifier(node.name) && node.initializer && isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { - const original = getOriginalNode(node.initializer, isClassLike); - const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? - factory.createStringLiteral("default") : - factory.createStringLiteralFromNode(node.name); + const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); const propertyName = visitNode(node.propertyName, visitor, isPropertyName); const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateBindingElement(node, /*dotDotDotToken*/ undefined, propertyName, name, initializer); } @@ -522,9 +522,9 @@ namespace ts { // is `""`. if (isAnonymousClassDeclarationNeedingAssignedName(node.expression)) { - const referencedName = factory.createStringLiteral(node.isExportEquals ? "" : "default"); + const assignedName = factory.createStringLiteral(node.isExportEquals ? "" : "default"); const modifiers = visitNodes(node.modifiers, visitor, isModifier); - const expression = visitNode(node.expression, node => namedEvaluationVisitor(node, referencedName), isExpression); + const expression = visitNode(node.expression, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateExportAssignment(node, modifiers, expression); } @@ -534,10 +534,12 @@ namespace ts { function injectPendingExpressions(expression: Expression) { if (some(pendingExpressions)) { if (isParenthesizedExpression(expression)) { - expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions([...pendingExpressions, expression.expression])); + pendingExpressions.push(expression.expression); + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(pendingExpressions)); } else { - expression = factory.inlineExpressions([...pendingExpressions, expression]); + pendingExpressions.push(expression); + expression = factory.inlineExpressions(pendingExpressions); } pendingExpressions = undefined; } @@ -1177,12 +1179,9 @@ namespace ts { case SyntaxKind.QuestionQuestionEqualsToken: if (isIdentifier(node.left) && isAnonymousClassDeclarationNeedingAssignedName(node.right)) { - const original = getOriginalNode(node.right, isClassLike); - const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? - factory.createStringLiteral("default") : - factory.createStringLiteralFromNode(node.left); + const assignedName = getAssignedNameOfIdentifier(node.left, node.right); const left = visitNode(node.left, visitor, isExpression); - const right = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); + const right = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateBinaryExpression(node, left, node.operatorToken, right); } break; @@ -2617,11 +2616,8 @@ namespace ts { let initializer: Expression; if (isIdentifier(node.left) && isAnonymousClassDeclarationNeedingAssignedName(node.right)) { - const original = getOriginalNode(node.right, isClassLike); - const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? - factory.createStringLiteral("default") : - factory.createStringLiteralFromNode(node.left); - initializer = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); + const assignedName = getAssignedNameOfIdentifier(node.left, node.right); + initializer = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); } else { initializer = visitNode(node.right, visitor, isExpression); @@ -2688,11 +2684,8 @@ namespace ts { if (node.objectAssignmentInitializer && isAnonymousClassDeclarationNeedingAssignedName(node.objectAssignmentInitializer)) { - const original = getOriginalNode(node.objectAssignmentInitializer, isClassLike); - const referencedName = original && !original.name && hasSyntacticModifier(original, ModifierFlags.Default) ? - factory.createStringLiteral("default") : - factory.createStringLiteralFromNode(node.name); - const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + const assignedName = getAssignedNameOfIdentifier(node.name, node.objectAssignmentInitializer); + const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateShorthandPropertyAssignment(node, node.name, objectAssignmentInitializer); } diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index 143f6fd19b21f..570cdcc838ebc 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -1388,9 +1388,9 @@ namespace ts { case SyntaxKind.QuestionQuestionEqualsToken: if (isIdentifier(node.left) && isDecoratedAnonymousClassExpression(node.right)) { - const referencedName = factory.createStringLiteralFromNode(node.left); + const assignedName = getAssignedNameOfIdentifier(node.left, node.right); const left = visitNode(node.left, visitor, isExpression); - const right = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); + const right = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateBinaryExpression(node, left, node.operatorToken, right); } break; @@ -1581,9 +1581,9 @@ namespace ts { if (isIdentifier(node.name) && node.initializer && isDecoratedAnonymousClassExpression(node.initializer)) { - const referencedName = factory.createStringLiteralFromNode(node.name); + const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateVariableDeclaration(node, name, /*exclamationToken*/ undefined, /*type*/ undefined, initializer); } @@ -1610,10 +1610,10 @@ namespace ts { if (!node.dotDotDotToken && isIdentifier(node.name) && node.initializer && isDecoratedAnonymousClassExpression(node.initializer)) { - const referencedName = factory.createStringLiteralFromNode(node.name); + const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); const propertyName = visitNode(node.propertyName, visitor, isPropertyName); const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateBindingElement(node, /*dotDotDotToken*/ undefined, propertyName, name, initializer); } @@ -1664,8 +1664,8 @@ namespace ts { let initializer: Expression; if (isIdentifier(node.left) && isDecoratedAnonymousClassExpression(node.right)) { - const referencedName = factory.createStringLiteralFromNode(node.left); - initializer = visitNode(node.right, node => namedEvaluationVisitor(node, referencedName), isExpression); + const assignedName = getAssignedNameOfIdentifier(node.left, node.right); + initializer = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); } else { initializer = visitNode(node.right, visitor, isExpression); @@ -1731,9 +1731,9 @@ namespace ts { if (node.objectAssignmentInitializer && isDecoratedAnonymousClassExpression(node.objectAssignmentInitializer)) { + const assignedName = getAssignedNameOfIdentifier(node.name, node.objectAssignmentInitializer); const name = visitNode(node.name, visitor, isIdentifier); - const referencedName = factory.createStringLiteralFromNode(node.name); - const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, node => namedEvaluationVisitor(node, referencedName), isExpression); + const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer); } @@ -1815,10 +1815,12 @@ namespace ts { function injectPendingExpressions(expression: Expression) { if (some(pendingExpressions)) { if (isParenthesizedExpression(expression)) { - expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions([...pendingExpressions, expression.expression])); + pendingExpressions.push(expression.expression); + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(pendingExpressions)); } else { - expression = factory.inlineExpressions([...pendingExpressions, expression]); + pendingExpressions.push(expression); + expression = factory.inlineExpressions(pendingExpressions); } pendingExpressions = undefined; } @@ -2069,5 +2071,12 @@ namespace ts { ]) ); } + + function getAssignedNameOfIdentifier(name: Identifier, initializer: Expression) { + const originalClass = getOriginalNode(initializer, isClassLike); + return originalClass && !originalClass.name && hasSyntacticModifier(originalClass, ModifierFlags.Default) ? + factory.createStringLiteral("default") : + factory.createStringLiteralFromNode(name); + } } } From 2142a10a4079f150fa1814df9d919229085bf734 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Sun, 30 Oct 2022 11:02:58 -0400 Subject: [PATCH 23/51] Remove extranous loop in transformClassLike --- src/compiler/transformers/esDecorators.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index 570cdcc838ebc..5bf72390957f4 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -55,6 +55,7 @@ namespace ts { hasStaticInitializers: boolean; hasNonAmbientInstanceFields: boolean; hasInjectedInstanceInitializers?: boolean; + hasStaticPrivateClassElements: boolean; } interface ClassLexicalEnvironmentStackEntry { @@ -376,6 +377,7 @@ namespace ts { let staticExtraInitializersName: Identifier | undefined; let hasStaticInitializers = false; let hasNonAmbientInstanceFields = false; + let hasStaticPrivateClassElements = false; // Before visiting we perform a first pass to collect information we'll need // as we descend. @@ -401,11 +403,16 @@ namespace ts { } } + if ((isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member)) { + hasStaticPrivateClassElements = true; + } + // exit early if possible if (staticExtraInitializersName && instanceExtraInitializersName && hasStaticInitializers && - hasNonAmbientInstanceFields) { + hasNonAmbientInstanceFields && + hasStaticPrivateClassElements) { break; } } @@ -416,6 +423,7 @@ namespace ts { staticExtraInitializersName, hasStaticInitializers, hasNonAmbientInstanceFields, + hasStaticPrivateClassElements, }; } @@ -463,12 +471,9 @@ namespace ts { createLet(classInfo.classThis), ); - for (const member of node.members) { - if ((isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member)) { - shouldTransformPrivateStaticElementsInClass = true; - shouldTransformPrivateStaticElementsInFile = true; - break; - } + if (classInfo.hasStaticPrivateClassElements) { + shouldTransformPrivateStaticElementsInClass = true; + shouldTransformPrivateStaticElementsInFile = true; } } From b5a2ad6cc99c99be04df9d30e6a87902523cadab Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 31 Oct 2022 17:18:56 -0400 Subject: [PATCH 24/51] Additional PR feedback, cleanup and fixes --- src/compiler/checker.ts | 92 ++++++-- src/compiler/diagnosticMessages.json | 8 + src/compiler/factory/emitHelpers.ts | 10 +- src/compiler/transformers/esDecorators.ts | 207 +++++++++--------- src/compiler/utilities.ts | 5 + .../blockScopedVariablesUseBeforeDef.js | 4 +- .../classStaticBlock18(target=es2015).js | 4 +- .../classStaticBlock18(target=es5).js | 4 +- .../reference/decoratorCallGeneric.errors.txt | 14 +- .../reference/decoratorOnClass8.errors.txt | 3 + .../reference/decoratorOnClass8.es6.js | 4 +- .../decoratorOnClassMethod10.errors.txt | 10 +- .../decoratorOnClassMethod8.errors.txt | 10 +- .../decoratorOnClassProperty6.errors.txt | 6 +- .../decoratorOnClassProperty7.errors.txt | 3 + .../emitClassExpressionInDeclarationFile2.js | 4 +- .../esDecorators-arguments.errors.txt | 32 +++ .../reference/esDecorators-arguments.js | 17 ++ .../reference/esDecorators-arguments.symbols | 23 ++ .../reference/esDecorators-arguments.types | 34 +++ ...cessors-nonStaticPrivate(target=es2015).js | 4 +- ...cessors-nonStaticPrivate(target=es2022).js | 4 +- ...-accessors-staticPrivate(target=es2015).js | 4 +- ...-accessors-staticPrivate(target=es2022).js | 4 +- ...ervation(module=commonjs,target=es2015).js | 6 +- ...ervation(module=commonjs,target=es2022).js | 6 +- ...eservation(module=esnext,target=es2015).js | 6 +- ...eservation(module=esnext,target=es2022).js | 6 +- ...nonStaticPrivateAccessor(target=es2015).js | 2 +- ...nonStaticPrivateAccessor(target=es2022).js | 2 +- ...ds-staticPrivateAccessor(target=es2015).js | 2 +- ...ds-staticPrivateAccessor(target=es2022).js | 2 +- ...assDeclaration-sourceMap(target=es2015).js | 10 +- ...eclaration-sourceMap(target=es2015).js.map | 4 +- ...ion-sourceMap(target=es2015).sourcemap.txt | 68 +++--- ...assDeclaration-sourceMap(target=es2022).js | 10 +- ...eclaration-sourceMap(target=es2022).js.map | 4 +- ...ion-sourceMap(target=es2022).sourcemap.txt | 68 +++--- ...sion-commentPreservation(target=es2015).js | 6 +- ...sion-commentPreservation(target=es2022).js | 6 +- .../potentiallyUncalledDecorators.errors.txt | 52 ++--- .../privateNameFieldClassExpression.js | 4 +- .../privateNameStaticFieldClassExpression.js | 4 +- ...StaticFieldNoInitializer(target=es2015).js | 4 +- .../staticFieldWithInterfaceContext.js | 4 +- ...icCommentOnStaticFieldInClassExpression.js | 4 +- ...tes-diagnostics-and-emit-for-decorators.js | 9 +- .../esDecorators/esDecorators-arguments.ts | 7 + 48 files changed, 491 insertions(+), 315 deletions(-) create mode 100644 tests/baselines/reference/esDecorators-arguments.errors.txt create mode 100644 tests/baselines/reference/esDecorators-arguments.js create mode 100644 tests/baselines/reference/esDecorators-arguments.symbols create mode 100644 tests/baselines/reference/esDecorators-arguments.types create mode 100644 tests/cases/conformance/esDecorators/esDecorators-arguments.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fde69cb280116..8e2b0e4aec84d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -31076,13 +31076,20 @@ namespace ts { } return { start, length, sourceFile }; } - function getDiagnosticForCallNode(node: CallLikeExpression, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): DiagnosticWithLocation { + + function getDiagnosticForCallNode(node: CallLikeExpression, message: DiagnosticMessage | DiagnosticMessageChain, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): DiagnosticWithLocation { if (isCallExpression(node)) { const { sourceFile, start, length } = getDiagnosticSpanForCallNode(node); - return createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2, arg3); + if ("message" in message) { // eslint-disable-line local/no-in-operator + return createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2, arg3); + } + return createDiagnosticForFileFromMessageChain(sourceFile, message); } else { - return createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3); + if ("message" in message) { // eslint-disable-line local/no-in-operator + return createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3); + } + return createDiagnosticForNodeFromMessageChain(node, message); } } @@ -31102,7 +31109,7 @@ namespace ts { return constructorSymbol === globalPromiseSymbol; } - function getArgumentArityError(node: CallLikeExpression, signatures: readonly Signature[], args: readonly Expression[]) { + function getArgumentArityError(node: CallLikeExpression, signatures: readonly Signature[], args: readonly Expression[], headMessage?: DiagnosticMessage) { const spreadIndex = getSpreadArgumentIndex(args); if (spreadIndex > -1) { return createDiagnosticForNode(args[spreadIndex], Diagnostics.A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter); @@ -31134,18 +31141,34 @@ namespace ts { if (isVoidPromiseError && isInJSFile(node)) { return getDiagnosticForCallNode(node, Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments); } - const error = hasRestParameter - ? Diagnostics.Expected_at_least_0_arguments_but_got_1 - : isVoidPromiseError - ? Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise - : Diagnostics.Expected_0_arguments_but_got_1; + const error = + isDecorator(node) ? + hasRestParameter ? Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_at_least_0 : + Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_0 : + hasRestParameter ? Diagnostics.Expected_at_least_0_arguments_but_got_1 : + isVoidPromiseError ? Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise : + Diagnostics.Expected_0_arguments_but_got_1; + if (min < args.length && args.length < max) { // between min and max, but with no matching overload + if (headMessage) { + let chain = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, args.length, maxBelow, minAbove); + chain = chainDiagnosticMessages(chain, headMessage); + return getDiagnosticForCallNode(node, chain); + } return getDiagnosticForCallNode(node, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, args.length, maxBelow, minAbove); } else if (args.length < min) { // too short: put the error span on the call expression, not any of the args - const diagnostic = getDiagnosticForCallNode(node, error, parameterRange, args.length); + let diagnostic: Diagnostic; + if (headMessage) { + let chain = chainDiagnosticMessages(/*details*/ undefined, error, parameterRange, args.length); + chain = chainDiagnosticMessages(chain, headMessage); + diagnostic = getDiagnosticForCallNode(node, chain); + } + else { + diagnostic = getDiagnosticForCallNode(node, error, parameterRange, args.length); + } const parameter = closestSignature?.declaration?.parameters[closestSignature.thisParameter ? args.length + 1 : args.length]; if (parameter) { const parameterError = createDiagnosticForNode( @@ -31168,17 +31191,27 @@ namespace ts { end++; } setTextRangePosEnd(errorSpan, pos, end); + if (headMessage) { + let chain = chainDiagnosticMessages(/*details*/ undefined, error, parameterRange, args.length); + chain = chainDiagnosticMessages(chain, headMessage); + return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), errorSpan, chain); + } return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan, error, parameterRange, args.length); } } - function getTypeArgumentArityError(node: Node, signatures: readonly Signature[], typeArguments: NodeArray) { + function getTypeArgumentArityError(node: Node, signatures: readonly Signature[], typeArguments: NodeArray, headMessage?: DiagnosticMessage) { const argCount = typeArguments.length; // No overloads exist if (signatures.length === 1) { const sig = signatures[0]; const min = getMinTypeArgumentCount(sig.typeParameters); const max = length(sig.typeParameters); + if (headMessage) { + let chain = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Expected_0_type_arguments_but_got_1, min < max ? min + "-" + max : min , argCount); + chain = chainDiagnosticMessages(chain, headMessage); + return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), typeArguments, chain); + } return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, min < max ? min + "-" + max : min , argCount); } // Overloads exist @@ -31195,12 +31228,22 @@ namespace ts { } } if (belowArgCount !== -Infinity && aboveArgCount !== Infinity) { + if (headMessage) { + let chain = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments, argCount, belowArgCount, aboveArgCount); + chain = chainDiagnosticMessages(chain, headMessage); + return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), typeArguments, chain); + } return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments, argCount, belowArgCount, aboveArgCount); } + if (headMessage) { + let chain = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); + chain = chainDiagnosticMessages(chain, headMessage); + return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), typeArguments, chain); + } return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } - function resolveCall(node: CallLikeExpression, signatures: readonly Signature[], candidatesOutArray: Signature[] | undefined, checkMode: CheckMode, callChainFlags: SignatureFlags, fallbackError?: DiagnosticMessage): Signature { + function resolveCall(node: CallLikeExpression, signatures: readonly Signature[], candidatesOutArray: Signature[] | undefined, checkMode: CheckMode, callChainFlags: SignatureFlags, headMessage?: DiagnosticMessage): Signature { const isTaggedTemplate = node.kind === SyntaxKind.TaggedTemplateExpression; const isDecorator = node.kind === SyntaxKind.Decorator; const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node); @@ -31319,6 +31362,9 @@ namespace ts { chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error); chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call); } + if (headMessage) { + chain = chainDiagnosticMessages(chain, headMessage); + } const diags = getSignatureApplicabilityError(node, args, last, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, () => chain); if (diags) { for (const d of diags) { @@ -31358,9 +31404,12 @@ namespace ts { const diags = max > 1 ? allDiagnostics[minIndex] : flatten(allDiagnostics); Debug.assert(diags.length > 0, "No errors reported for 3 or fewer overload signatures"); - const chain = chainDiagnosticMessages( + let chain = chainDiagnosticMessages( map(diags, createDiagnosticMessageChainFromDiagnostic), Diagnostics.No_overload_matches_this_call); + if (headMessage) { + chain = chainDiagnosticMessages(chain, headMessage); + } // The below is a spread to guarantee we get a new (mutable) array - our `flatMap` helper tries to do "smart" optimizations where it reuses input // arrays and the emptyArray singleton where possible, which is decidedly not what we want while we're still constructing this diagnostic const related = [...flatMap(diags, d => (d as Diagnostic).relatedInformation) as DiagnosticRelatedInformation[]]; @@ -31377,21 +31426,18 @@ namespace ts { } } else if (candidateForArgumentArityError) { - diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args)); + diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args, headMessage)); } else if (candidateForTypeArgumentError) { - checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression | JsxOpeningLikeElement).typeArguments!, /*reportErrors*/ true, fallbackError); + checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression | JsxOpeningLikeElement).typeArguments!, /*reportErrors*/ true, headMessage); } else { const signaturesWithCorrectTypeArgumentArity = filter(signatures, s => hasCorrectTypeArgumentArity(s, typeArguments)); if (signaturesWithCorrectTypeArgumentArity.length === 0) { - diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments!)); + diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments!, headMessage)); } - else if (!isDecorator) { - diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args)); - } - else if (fallbackError) { - diagnostics.add(getDiagnosticForCallNode(node, fallbackError)); + else { + diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args, headMessage)); } } } @@ -32103,7 +32149,7 @@ namespace ts { return resolveUntypedCall(node); } - if (isPotentiallyUncalledDecorator(node, callSignatures)) { + if (isPotentiallyUncalledDecorator(node, callSignatures) && !isParenthesizedExpression(node.expression)) { const nodeStr = getTextOfNode(node.expression, /*includeTrivia*/ false); error(node, Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr); return resolveErrorCall(node); @@ -37923,7 +37969,7 @@ namespace ts { return Debug.failBadSyntaxKind(node.parent); } - checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage); + checkTypeAssignableTo(returnType, expectedReturnType, node.expression, headMessage); } /** diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 09fbf4728145f..c4dff19180216 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -907,6 +907,14 @@ "category": "Error", "code": 1276 }, + "The runtime will invoke the decorator with {1} arguments, but the decorator expects {0}.": { + "category": "Error", + "code": 1277 + }, + "The runtime will invoke the decorator with {1} arguments, but the decorator expects at least {0}.": { + "category": "Error", + "code": 1278 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index a34b50ea5ed92..953e0da15477e 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -465,12 +465,12 @@ namespace ts { ); } - function createSetFunctionNameHelper(f: Expression, name: Expression): Expression { + function createSetFunctionNameHelper(f: Expression, name: Expression, prefix?: string): Expression { context.requestEmitHelper(setFunctionNameHelper); - return factory.createCallExpression( + return context.factory.createCallExpression( getUnscopedHelperName("__setFunctionName"), /*typeArguments*/ undefined, - [f, name] + prefix ? [f, name, context.factory.createStringLiteral(prefix)] : [f, name] ); } @@ -902,9 +902,9 @@ namespace ts { importName: "__setFunctionName", scoped: false, text: ` - var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { + var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); };` }; diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index 5bf72390957f4..01c6bbc28763e 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -368,10 +368,6 @@ namespace ts { ); } - function createAssign(left: Expression, right: Expression) { - return factory.createExpressionStatement(factory.createAssignment(left, right)); - } - function createClassInfo(node: ClassLikeDeclaration): ClassInfo { let instanceExtraInitializersName: Identifier | undefined; let staticExtraInitializersName: Identifier | undefined; @@ -620,7 +616,7 @@ namespace ts { if (classInfo.classDescriptorName && classInfo.classDecoratorsName && classInfo.classExtraInitializersName && classInfo.classThis) { leadingBlockStatements ??= []; - // __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: "C" }, _classExtraInitializers); + // __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, _classExtraInitializers); const valueProperty = factory.createPropertyAssignment("value", factory.createThis()); const classDescriptor = factory.createObjectLiteralExpression([valueProperty]); const classDescriptorAssignment = factory.createAssignment(classInfo.classDescriptorName, classDescriptor); @@ -821,7 +817,11 @@ namespace ts { } } - function prepareConstructor(parent: ClassLikeDeclaration, classInfo: ClassInfo) { + function prepareConstructor(_parent: ClassLikeDeclaration, classInfo: ClassInfo) { + // Decorated instance members can add "extra" initializers to the instance. If a class contains any instance + // fields, we'll inject the `__runInitializers()` call for these extra initializers into the initializer of + // the first class member that will be initialized. However, if the class does not contain any fields that + // we can piggyback on, we need to synthesize a `__runInitializers()` call in the constructor instead. if (classInfo.instanceExtraInitializersName && !classInfo.hasNonAmbientInstanceFields) { // If there are instance extra initializers we need to add them to the body along with any // field initializers @@ -836,40 +836,6 @@ namespace ts { ) ); - for (const member of parent.members) { - if (isPropertyDeclaration(member) && !isStatic(member)) { - // TODO(rbuckton) - Debug.assertNotNode(member.name, isComputedPropertyName, "Not yet implemented."); - - let initializer = member.initializer; - const initializers = classInfo.memberInfos?.get(member)?.memberInitializersName; - if (initializer || initializers) { - initializer ??= factory.createVoidZero(); - if (initializers) { - initializer = emitHelpers().createRunInitializersHelper( - factory.createThis(), - initializers, - initializer - ); - } - statements.push( - createAssign( - isIdentifier(member.name) || isPrivateIdentifier(member.name) ? - factory.createPropertyAccessExpression( - factory.createThis(), - member.name - ) : - factory.createElementAccessExpression( - factory.createThis(), - member.name - ), - initializer - ) - ); - } - } - } - return statements; } } @@ -879,7 +845,7 @@ namespace ts { const modifiers = visitNodes(node.modifiers, node => tryCast(node, isModifier)); const parameters = visitNodes(node.parameters, visitor, isParameterDeclaration); let body: Block | undefined; - if (node.body && classInfo?.instanceExtraInitializersName) { + if (node.body && classInfo) { // If there are instance extra initializers we need to add them to the body along with any // field initializers const initializerStatements = prepareConstructor(classInfo.class, classInfo); @@ -909,7 +875,14 @@ namespace ts { return updated; } - function partialTransformClassElement(member: TNode, useNamedEvaluation: boolean, classInfo: ClassInfo | undefined, createDescriptor?: (node: TNode, modifiers: ModifiersArray | undefined) => Expression) { + function partialTransformClassElement< + TNode extends MethodDeclaration | PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration + >( + member: TNode, + useNamedEvaluation: boolean, + classInfo: ClassInfo | undefined, + createDescriptor?: (node: TNode, modifiers: ModifiersArray | undefined) => Expression + ) { let referencedName: Expression | undefined; let name: PropertyName | undefined; let initializersName: Identifier | undefined; @@ -1075,6 +1048,8 @@ namespace ts { } if (!some(modifiers) && (isMethodDeclaration(member) || isPropertyDeclaration(member))) { + // Don't emit leading comments on the name for methods and properties without modifiers, otherwise we + // will end up printing duplicate comments. setEmitFlags(name, EmitFlags.NoLeadingComments); } @@ -1194,65 +1169,63 @@ namespace ts { exitClassElement(); - if (hasAccessorModifier(node)) { - if (descriptorName) { - // given: - // accessor #x = 1; - // - // emits: - // static { - // _esDecorate(null, _private_x_descriptor = { get() { return this.#x_1; }, set(value) { this.#x_1 = value; } }, ...) - // } - // ... - // #x_1 = 1; - // get #x() { return _private_x_descriptor.get.call(this); } - // set #x(value) { _private_x_descriptor.set.call(this, value); } - - const commentRange = getCommentRange(node); - const sourceMapRange = getSourceMapRange(node); - - // Since we're creating two declarations where there was previously one, cache - // the expression for any computed property names. - const name = node.name; - let getterName = name; - let setterName = name; - if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression)) { - const cacheAssignment = findComputedPropertyNameCacheAssignment(name); - if (cacheAssignment) { - getterName = factory.updateComputedPropertyName(name, visitNode(name.expression, visitor, isExpression)); - setterName = factory.updateComputedPropertyName(name, cacheAssignment.left); - } - else { - const temp = factory.createTempVariable(hoistVariableDeclaration); - setSourceMapRange(temp, name.expression); - const expression = visitNode(name.expression, visitor, isExpression); - const assignment = factory.createAssignment(temp, expression); - setSourceMapRange(assignment, name.expression); - getterName = factory.updateComputedPropertyName(name, assignment); - setterName = factory.updateComputedPropertyName(name, temp); - } + if (hasAccessorModifier(node) && descriptorName) { + // given: + // accessor #x = 1; + // + // emits: + // static { + // _esDecorate(null, _private_x_descriptor = { get() { return this.#x_1; }, set(value) { this.#x_1 = value; } }, ...) + // } + // ... + // #x_1 = 1; + // get #x() { return _private_x_descriptor.get.call(this); } + // set #x(value) { _private_x_descriptor.set.call(this, value); } + + const commentRange = getCommentRange(node); + const sourceMapRange = getSourceMapRange(node); + + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + const name = node.name; + let getterName = name; + let setterName = name; + if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression)) { + const cacheAssignment = findComputedPropertyNameCacheAssignment(name); + if (cacheAssignment) { + getterName = factory.updateComputedPropertyName(name, visitNode(name.expression, visitor, isExpression)); + setterName = factory.updateComputedPropertyName(name, cacheAssignment.left); + } + else { + const temp = factory.createTempVariable(hoistVariableDeclaration); + setSourceMapRange(temp, name.expression); + const expression = visitNode(name.expression, visitor, isExpression); + const assignment = factory.createAssignment(temp, expression); + setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, assignment); + setterName = factory.updateComputedPropertyName(name, temp); } + } - const modifiersWithoutAccessor = visitNodes(modifiers, node => node.kind !== SyntaxKind.AccessorKeyword ? node : undefined); + const modifiersWithoutAccessor = visitNodes(modifiers, node => node.kind !== SyntaxKind.AccessorKeyword ? node : undefined); - const backingField = createAccessorPropertyBackingField(factory, node, modifiersWithoutAccessor, initializer); - setOriginalNode(backingField, node); - setEmitFlags(backingField, EmitFlags.NoComments); - setSourceMapRange(backingField, sourceMapRange); - setSourceMapRange(backingField.name, node.name); + const backingField = createAccessorPropertyBackingField(factory, node, modifiersWithoutAccessor, initializer); + setOriginalNode(backingField, node); + setEmitFlags(backingField, EmitFlags.NoComments); + setSourceMapRange(backingField, sourceMapRange); + setSourceMapRange(backingField.name, node.name); - const getter = createGetAccessorDescriptorForwarder(modifiersWithoutAccessor, getterName, descriptorName); - setOriginalNode(getter, node); - setCommentRange(getter, commentRange); - setSourceMapRange(getter, sourceMapRange); + const getter = createGetAccessorDescriptorForwarder(modifiersWithoutAccessor, getterName, descriptorName); + setOriginalNode(getter, node); + setCommentRange(getter, commentRange); + setSourceMapRange(getter, sourceMapRange); - const setter = createSetAccessorDescriptorForwarder(modifiersWithoutAccessor, setterName, descriptorName); - setOriginalNode(setter, node); - setEmitFlags(setter, EmitFlags.NoComments); - setSourceMapRange(setter, sourceMapRange); + const setter = createSetAccessorDescriptorForwarder(modifiersWithoutAccessor, setterName, descriptorName); + setOriginalNode(setter, node); + setEmitFlags(setter, EmitFlags.NoComments); + setSourceMapRange(setter, sourceMapRange); - return [backingField, getter, setter]; - } + return [backingField, getter, setter]; } return finishClassElement(factory.updatePropertyDeclaration(node, modifiers, name, /*questionOrExclamationToken*/ undefined, /*type*/ undefined, initializer), node); @@ -1488,6 +1461,27 @@ namespace ts { setOriginalNode(expression, node); setTextRange(expression, node); + // If the result of this expression is discarded (i.e., it's in a position where the result + // will be otherwise unused, such as in an expression statement or the left side of a comma), we + // don't need to create an extra temp variable to hold the result: + // + // source (discarded): + // super.x++; + // generated: + // _a = Reflect.get(_super, "x"), _a++, Reflect.set(_super, "x", _a); + // + // Above, the temp variable `_a` is used to perform the correct coercion (i.e., number or + // bigint). Since the result of the postfix unary is discarded, we don't need to capture the + // result of the expression. + // + // source (not discarded): + // y = super.x++; + // generated: + // y = (_a = Reflect.get(_super, "x"), _b = _a++, Reflect.set(_super, "x", _a), _b); + // + // When the result isn't discarded, we introduce a new temp variable (`_b`) to capture the + // result of the operation so that we can provide it to `y` when the assignment is complete. + const temp = discarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); expression = expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp); expression = factory.createReflectSetCall(classSuper, setterName, expression, classThis); @@ -1859,9 +1853,9 @@ namespace ts { } /** - * Creates a `value`, `get`, or `set` method for a pseudo-{@link PropertyDescriptor} object. + * Creates a `value`, `get`, or `set` method for a pseudo-{@link PropertyDescriptor} object created for a private element. */ - function createDescriptorMethod(original: Node, _name: PropertyName, modifiers: ModifiersArray | undefined, asteriskToken: AsteriskToken | undefined, kind: "value" | "get" | "set", parameters: readonly ParameterDeclaration[], body: Block | undefined) { + function createDescriptorMethod(original: Node, name: PrivateIdentifier, modifiers: ModifiersArray | undefined, asteriskToken: AsteriskToken | undefined, kind: "value" | "get" | "set", parameters: readonly ParameterDeclaration[], body: Block | undefined) { const func = factory.createFunctionExpression( modifiers, asteriskToken, @@ -1875,14 +1869,9 @@ namespace ts { setSourceMapRange(func, moveRangePastDecorators(original)); setEmitFlags(func, EmitFlags.NoComments); - // TODO(rbuckton): handle computed property names - const functionName = isPropertyNameLiteral(_name) || isPrivateIdentifier(_name) ? - factory.createStringLiteralFromNode(_name) : - undefined; - - const namedFunction = functionName ? - emitHelpers().createSetFunctionNameHelper(func, functionName) : - func; + const prefix = kind === "get" || kind === "set" ? kind : undefined; + const functionName = factory.createStringLiteralFromNode(name, /*isSingleQuote*/ undefined); + const namedFunction = emitHelpers().createSetFunctionNameHelper(func, functionName, prefix); const method = factory.createPropertyAssignment(factory.createIdentifier(kind), namedFunction); setOriginalNode(method, original); @@ -1894,7 +1883,7 @@ namespace ts { /** * Creates a pseudo-{@link PropertyDescriptor} object used when decorating a private {@link MethodDeclaration}. */ - function createMethodDescriptorObject(node: MethodDeclaration, modifiers: ModifiersArray | undefined) { + function createMethodDescriptorObject(node: PrivateIdentifierMethodDeclaration, modifiers: ModifiersArray | undefined) { return factory.createObjectLiteralExpression([ createDescriptorMethod( node, @@ -1910,7 +1899,7 @@ namespace ts { /** * Creates a pseudo-{@link PropertyDescriptor} object used when decorating a private {@link GetAccessorDeclaration}. */ - function createGetAccessorDescriptorObject(node: GetAccessorDeclaration, modifiers: ModifiersArray | undefined) { + function createGetAccessorDescriptorObject(node: PrivateIdentifierGetAccessorDeclaration, modifiers: ModifiersArray | undefined) { return factory.createObjectLiteralExpression([ createDescriptorMethod( node, @@ -1926,7 +1915,7 @@ namespace ts { /** * Creates a pseudo-{@link PropertyDescriptor} object used when decorating a private {@link SetAccessorDeclaration}. */ - function createSetAccessorDescriptorObject(node: SetAccessorDeclaration, modifiers: ModifiersArray | undefined) { + function createSetAccessorDescriptorObject(node: PrivateIdentifierSetAccessorDeclaration, modifiers: ModifiersArray | undefined) { return factory.createObjectLiteralExpression([ createDescriptorMethod( node, @@ -1942,7 +1931,7 @@ namespace ts { /** * Creates a pseudo-{@link PropertyDescriptor} object used when decorating an `accessor` {@link PropertyDeclaration} with a private name. */ - function createAccessorPropertyDescriptorObject(node: PropertyDeclaration, modifiers: ModifiersArray | undefined) { + function createAccessorPropertyDescriptorObject(node: PrivateIdentifierPropertyDeclaration, modifiers: ModifiersArray | undefined) { // { // get() { return this.${privateName}; }, // set(value) { this.${privateName} = value; }, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index d716bd4822481..0d2930902116a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1069,6 +1069,11 @@ namespace ts { return createFileDiagnosticFromMessageChain(sourceFile, span.start, span.length, messageChain, relatedInformation); } + export function createDiagnosticForNodeArrayFromMessageChain(sourceFile: SourceFile, nodes: NodeArray, messageChain: DiagnosticMessageChain, relatedInformation?: DiagnosticRelatedInformation[]): DiagnosticWithLocation { + const start = skipTrivia(sourceFile.text, nodes.pos); + return createFileDiagnosticFromMessageChain(sourceFile, start, nodes.end - start, messageChain, relatedInformation); + } + function assertDiagnosticLocation(file: SourceFile | undefined, start: number, length: number) { Debug.assertGreaterThanOrEqual(start, 0); Debug.assertGreaterThanOrEqual(length, 0); diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js index 4a7e70fb1064a..dda249ca52d82 100644 --- a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js @@ -125,9 +125,9 @@ function foo16() { //// [blockScopedVariablesUseBeforeDef.js] -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function foo0() { var a = x; diff --git a/tests/baselines/reference/classStaticBlock18(target=es2015).js b/tests/baselines/reference/classStaticBlock18(target=es2015).js index f80ae863cca61..f9ea77a2e9702 100644 --- a/tests/baselines/reference/classStaticBlock18(target=es2015).js +++ b/tests/baselines/reference/classStaticBlock18(target=es2015).js @@ -15,9 +15,9 @@ function foo () { //// [classStaticBlock18.js] -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function foo() { var _a; diff --git a/tests/baselines/reference/classStaticBlock18(target=es5).js b/tests/baselines/reference/classStaticBlock18(target=es5).js index 814e8b9735d76..5367bf93d89cc 100644 --- a/tests/baselines/reference/classStaticBlock18(target=es5).js +++ b/tests/baselines/reference/classStaticBlock18(target=es5).js @@ -15,9 +15,9 @@ function foo () { //// [classStaticBlock18.js] -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; function foo() { var _a; diff --git a/tests/baselines/reference/decoratorCallGeneric.errors.txt b/tests/baselines/reference/decoratorCallGeneric.errors.txt index 495160a191b0e..bbb0007a0581f 100644 --- a/tests/baselines/reference/decoratorCallGeneric.errors.txt +++ b/tests/baselines/reference/decoratorCallGeneric.errors.txt @@ -1,6 +1,7 @@ -tests/cases/conformance/decorators/decoratorCallGeneric.ts(7,2): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type 'I'. - The types returned by 'm()' are incompatible between these types. - Type 'void' is not assignable to type 'C'. +tests/cases/conformance/decorators/decoratorCallGeneric.ts(7,2): error TS1238: Unable to resolve signature of class decorator when called as an expression. + Argument of type 'typeof C' is not assignable to parameter of type 'I'. + The types returned by 'm()' are incompatible between these types. + Type 'void' is not assignable to type 'C'. ==== tests/cases/conformance/decorators/decoratorCallGeneric.ts (1 errors) ==== @@ -12,9 +13,10 @@ tests/cases/conformance/decorators/decoratorCallGeneric.ts(7,2): error TS2345: A @dec ~~~ -!!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type 'I'. -!!! error TS2345: The types returned by 'm()' are incompatible between these types. -!!! error TS2345: Type 'void' is not assignable to type 'C'. +!!! error TS1238: Unable to resolve signature of class decorator when called as an expression. +!!! error TS1238: Argument of type 'typeof C' is not assignable to parameter of type 'I'. +!!! error TS1238: The types returned by 'm()' are incompatible between these types. +!!! error TS1238: Type 'void' is not assignable to type 'C'. class C { _brand: any; static m() {} diff --git a/tests/baselines/reference/decoratorOnClass8.errors.txt b/tests/baselines/reference/decoratorOnClass8.errors.txt index 4c13520364bd6..eaad1aa7e8212 100644 --- a/tests/baselines/reference/decoratorOnClass8.errors.txt +++ b/tests/baselines/reference/decoratorOnClass8.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. + The runtime will invoke the decorator with 1 arguments, but the decorator expects 2. ==== tests/cases/conformance/decorators/class/decoratorOnClass8.ts (1 errors) ==== @@ -7,5 +8,7 @@ tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS1238 @dec() ~~~~~~ !!! error TS1238: Unable to resolve signature of class decorator when called as an expression. +!!! error TS1238: The runtime will invoke the decorator with 1 arguments, but the decorator expects 2. +!!! related TS6210 tests/cases/conformance/decorators/class/decoratorOnClass8.ts:1:44: An argument for 'paramIndex' was not provided. class C { } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClass8.es6.js b/tests/baselines/reference/decoratorOnClass8.es6.js index b4b890f41c1f1..7e8761f4052cb 100644 --- a/tests/baselines/reference/decoratorOnClass8.es6.js +++ b/tests/baselines/reference/decoratorOnClass8.es6.js @@ -13,9 +13,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; let default_1 = class { }; diff --git a/tests/baselines/reference/decoratorOnClassMethod10.errors.txt b/tests/baselines/reference/decoratorOnClassMethod10.errors.txt index 49c45b4a6f9fc..50e6e832afc5b 100644 --- a/tests/baselines/reference/decoratorOnClassMethod10.errors.txt +++ b/tests/baselines/reference/decoratorOnClassMethod10.errors.txt @@ -1,5 +1,6 @@ -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,6): error TS2345: Argument of type 'C' is not assignable to parameter of type 'Function'. - Type 'C' is missing the following properties from type 'Function': apply, call, bind, prototype, and 3 more. +tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,6): error TS1241: Unable to resolve signature of method decorator when called as an expression. + Argument of type 'C' is not assignable to parameter of type 'Function'. + Type 'C' is missing the following properties from type 'Function': apply, call, bind, prototype, and 3 more. ==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts (1 errors) ==== @@ -8,6 +9,7 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,6) class C { @dec method() {} ~~~ -!!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'Function'. -!!! error TS2345: Type 'C' is missing the following properties from type 'Function': apply, call, bind, prototype, and 3 more. +!!! error TS1241: Unable to resolve signature of method decorator when called as an expression. +!!! error TS1241: Argument of type 'C' is not assignable to parameter of type 'Function'. +!!! error TS1241: Type 'C' is missing the following properties from type 'Function': apply, call, bind, prototype, and 3 more. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassMethod8.errors.txt b/tests/baselines/reference/decoratorOnClassMethod8.errors.txt index ab20c94e5bd8f..4aafd73e4b763 100644 --- a/tests/baselines/reference/decoratorOnClassMethod8.errors.txt +++ b/tests/baselines/reference/decoratorOnClassMethod8.errors.txt @@ -1,5 +1,6 @@ -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression. -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): error TS1270: Decorator function return type 'C' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. +tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,6): error TS1241: Unable to resolve signature of method decorator when called as an expression. + The runtime will invoke the decorator with 3 arguments, but the decorator expects 1. +tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,6): error TS1270: Decorator function return type 'C' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. ==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts (2 errors) ==== @@ -7,8 +8,9 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): class C { @dec method() {} - ~~~~ + ~~~ !!! error TS1241: Unable to resolve signature of method decorator when called as an expression. - ~~~~ +!!! error TS1241: The runtime will invoke the decorator with 3 arguments, but the decorator expects 1. + ~~~ !!! error TS1270: Decorator function return type 'C' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassProperty6.errors.txt b/tests/baselines/reference/decoratorOnClassProperty6.errors.txt index b40a81fe1c948..3beaa87ae2cd5 100644 --- a/tests/baselines/reference/decoratorOnClassProperty6.errors.txt +++ b/tests/baselines/reference/decoratorOnClassProperty6.errors.txt @@ -1,4 +1,5 @@ -tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression. +tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts(4,6): error TS1240: Unable to resolve signature of property decorator when called as an expression. + The runtime will invoke the decorator with 2 arguments, but the decorator expects 1. ==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts (1 errors) ==== @@ -6,6 +7,7 @@ tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts(4 class C { @dec prop; - ~~~~ + ~~~ !!! error TS1240: Unable to resolve signature of property decorator when called as an expression. +!!! error TS1240: The runtime will invoke the decorator with 2 arguments, but the decorator expects 1. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassProperty7.errors.txt b/tests/baselines/reference/decoratorOnClassProperty7.errors.txt index 47f8ad5ae8c18..15707417eef33 100644 --- a/tests/baselines/reference/decoratorOnClassProperty7.errors.txt +++ b/tests/baselines/reference/decoratorOnClassProperty7.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression. + The runtime will invoke the decorator with 2 arguments, but the decorator expects 3. ==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts (1 errors) ==== @@ -8,4 +9,6 @@ tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts(4 @dec prop; ~~~~ !!! error TS1240: Unable to resolve signature of property decorator when called as an expression. +!!! error TS1240: The runtime will invoke the decorator with 2 arguments, but the decorator expects 3. +!!! related TS6210 tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts:1:70: An argument for 'paramIndex' was not provided. } \ No newline at end of file diff --git a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js index 357ef7c064478..5581141881cf6 100644 --- a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js +++ b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js @@ -46,9 +46,9 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; var _a; exports.__esModule = true; diff --git a/tests/baselines/reference/esDecorators-arguments.errors.txt b/tests/baselines/reference/esDecorators-arguments.errors.txt new file mode 100644 index 0000000000000..d686fdee1b8d9 --- /dev/null +++ b/tests/baselines/reference/esDecorators-arguments.errors.txt @@ -0,0 +1,32 @@ +tests/cases/conformance/esDecorators/esDecorators-arguments.ts(1,2): error TS1238: Unable to resolve signature of class decorator when called as an expression. + The runtime will invoke the decorator with 2 arguments, but the decorator expects 0. +tests/cases/conformance/esDecorators/esDecorators-arguments.ts(2,2): error TS1238: Unable to resolve signature of class decorator when called as an expression. + The runtime will invoke the decorator with 2 arguments, but the decorator expects 1. +tests/cases/conformance/esDecorators/esDecorators-arguments.ts(4,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. + The runtime will invoke the decorator with 2 arguments, but the decorator expects 3. +tests/cases/conformance/esDecorators/esDecorators-arguments.ts(5,1): error TS1238: Unable to resolve signature of class decorator when called as an expression. + The runtime will invoke the decorator with 2 arguments, but the decorator expects at least 3. + + +==== tests/cases/conformance/esDecorators/esDecorators-arguments.ts (4 errors) ==== + @(() => {}) + ~~~~~~~~~~ +!!! error TS1238: Unable to resolve signature of class decorator when called as an expression. +!!! error TS1238: The runtime will invoke the decorator with 2 arguments, but the decorator expects 0. + @((a: any) => {}) + ~~~~~~~~~~~~~~~~ +!!! error TS1238: Unable to resolve signature of class decorator when called as an expression. +!!! error TS1238: The runtime will invoke the decorator with 2 arguments, but the decorator expects 1. + @((a: any, b: any) => {}) + @((a: any, b: any, c: any) => {}) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1238: Unable to resolve signature of class decorator when called as an expression. +!!! error TS1238: The runtime will invoke the decorator with 2 arguments, but the decorator expects 3. +!!! related TS6210 tests/cases/conformance/esDecorators/esDecorators-arguments.ts:4:20: An argument for 'c' was not provided. + @((a: any, b: any, c: any, ...d: any[]) => {}) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1238: Unable to resolve signature of class decorator when called as an expression. +!!! error TS1238: The runtime will invoke the decorator with 2 arguments, but the decorator expects at least 3. +!!! related TS6210 tests/cases/conformance/esDecorators/esDecorators-arguments.ts:5:20: An argument for 'c' was not provided. + class C1 {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-arguments.js b/tests/baselines/reference/esDecorators-arguments.js new file mode 100644 index 0000000000000..2ad23d5653bcb --- /dev/null +++ b/tests/baselines/reference/esDecorators-arguments.js @@ -0,0 +1,17 @@ +//// [esDecorators-arguments.ts] +@(() => {}) +@((a: any) => {}) +@((a: any, b: any) => {}) +@((a: any, b: any, c: any) => {}) +@((a: any, b: any, c: any, ...d: any[]) => {}) +class C1 {} + + +//// [esDecorators-arguments.js] +@(() => { }) +@((a) => { }) +@((a, b) => { }) +@((a, b, c) => { }) +@((a, b, c, ...d) => { }) +class C1 { +} diff --git a/tests/baselines/reference/esDecorators-arguments.symbols b/tests/baselines/reference/esDecorators-arguments.symbols new file mode 100644 index 0000000000000..7afcf3345bd75 --- /dev/null +++ b/tests/baselines/reference/esDecorators-arguments.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/esDecorators/esDecorators-arguments.ts === +@(() => {}) +@((a: any) => {}) +>a : Symbol(a, Decl(esDecorators-arguments.ts, 1, 3)) + +@((a: any, b: any) => {}) +>a : Symbol(a, Decl(esDecorators-arguments.ts, 2, 3)) +>b : Symbol(b, Decl(esDecorators-arguments.ts, 2, 10)) + +@((a: any, b: any, c: any) => {}) +>a : Symbol(a, Decl(esDecorators-arguments.ts, 3, 3)) +>b : Symbol(b, Decl(esDecorators-arguments.ts, 3, 10)) +>c : Symbol(c, Decl(esDecorators-arguments.ts, 3, 18)) + +@((a: any, b: any, c: any, ...d: any[]) => {}) +>a : Symbol(a, Decl(esDecorators-arguments.ts, 4, 3)) +>b : Symbol(b, Decl(esDecorators-arguments.ts, 4, 10)) +>c : Symbol(c, Decl(esDecorators-arguments.ts, 4, 18)) +>d : Symbol(d, Decl(esDecorators-arguments.ts, 4, 26)) + +class C1 {} +>C1 : Symbol(C1, Decl(esDecorators-arguments.ts, 0, 0)) + diff --git a/tests/baselines/reference/esDecorators-arguments.types b/tests/baselines/reference/esDecorators-arguments.types new file mode 100644 index 0000000000000..e46e766b84300 --- /dev/null +++ b/tests/baselines/reference/esDecorators-arguments.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/esDecorators/esDecorators-arguments.ts === +@(() => {}) +>(() => {}) : () => void +>() => {} : () => void + +@((a: any) => {}) +>((a: any) => {}) : (a: any) => void +>(a: any) => {} : (a: any) => void +>a : any + +@((a: any, b: any) => {}) +>((a: any, b: any) => {}) : (a: any, b: any) => void +>(a: any, b: any) => {} : (a: any, b: any) => void +>a : any +>b : any + +@((a: any, b: any, c: any) => {}) +>((a: any, b: any, c: any) => {}) : (a: any, b: any, c: any) => void +>(a: any, b: any, c: any) => {} : (a: any, b: any, c: any) => void +>a : any +>b : any +>c : any + +@((a: any, b: any, c: any, ...d: any[]) => {}) +>((a: any, b: any, c: any, ...d: any[]) => {}) : (a: any, b: any, c: any, ...d: any[]) => void +>(a: any, b: any, c: any, ...d: any[]) => {} : (a: any, b: any, c: any, ...d: any[]) => void +>a : any +>b : any +>c : any +>d : any[] + +class C1 {} +>C1 : C1 + diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js index 8b4fa553e28b4..19e95ff8713d4 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js @@ -27,8 +27,8 @@ let C = (() => { (() => { _private_get_method1_decorators = [dec(1)]; _private_set_method1_decorators = [dec(2)]; - __esDecorate(_a, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_method1_get); } } }, null, _instanceExtraInitializers); - __esDecorate(_a, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true, access: { set(value) { __classPrivateFieldSet(this, _C_instances, value, "a", _C_method1_set); } } }, null, _instanceExtraInitializers); + __esDecorate(_a, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_method1_get); } } }, null, _instanceExtraInitializers); + __esDecorate(_a, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true, access: { set(value) { __classPrivateFieldSet(this, _C_instances, value, "a", _C_method1_set); } } }, null, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js index 9df2cdace1ccb..828375c0796f2 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js @@ -18,8 +18,8 @@ let C = (() => { static { _private_get_method1_decorators = [dec(1)]; _private_set_method1_decorators = [dec(2)]; - __esDecorate(this, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true, access: { get() { return this.#method1; } } }, null, _instanceExtraInitializers); - __esDecorate(this, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true, access: { set(value) { this.#method1 = value; } } }, null, _instanceExtraInitializers); + __esDecorate(this, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true, access: { get() { return this.#method1; } } }, null, _instanceExtraInitializers); + __esDecorate(this, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true, access: { set(value) { this.#method1 = value; } } }, null, _instanceExtraInitializers); } get #method1() { return _private_get_method1_descriptor.get.call(this); } set #method1(value) { return _private_set_method1_descriptor.set.call(this, value); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js index eaf6c0c73eb53..4e74094766525 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js @@ -32,8 +32,8 @@ let C = (() => { (() => { _static_private_get_method1_decorators = [dec(1)]; _static_private_set_method1_decorators = [dec(2)]; - __esDecorate(_a, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_method1_get); } } }, null, _staticExtraInitializers); - __esDecorate(_a, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _a, value, "a", _C_method1_set); } } }, null, _staticExtraInitializers); + __esDecorate(_a, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_method1_get); } } }, null, _staticExtraInitializers); + __esDecorate(_a, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _a, value, "a", _C_method1_set); } } }, null, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js index 1ce1cc65fdf2e..4433816961389 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js @@ -28,8 +28,8 @@ let C = (() => { static { _static_private_get_method1_decorators = [dec(1)]; _static_private_set_method1_decorators = [dec(2)]; - __esDecorate(this, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true, access: { get() { return this.#method1; } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true, access: { set(value) { this.#method1 = value; } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true, access: { get() { return this.#method1; } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true, access: { set(value) { this.#method1 = value; } } }, null, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static get #method1() { return _static_private_get_method1_descriptor.get.call(this); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js index b19fdc0eba633..2ebe40799c08c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js @@ -182,13 +182,13 @@ let C = (() => { _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js index d053c26a69a78..466df6dec2463 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js @@ -162,13 +162,13 @@ let C = (() => { _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js index daafd28f72db7..b0e68b8b4fafb 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js @@ -182,13 +182,13 @@ let C = (() => { _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js index ef3e6f39ee1d2..f1cce6e10d08c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js @@ -162,13 +162,13 @@ let C = (() => { _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js index 49a912b9e522c..17759f2a1f388 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js @@ -25,7 +25,7 @@ let C = (() => { _C_field1_set = function _C_field1_set(value) { return _private_field1_descriptor.set.call(this, value); }, (() => { _private_field1_decorators = [dec]; - __esDecorate(_a, _private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, "#field1"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, "#field1") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _C_instances, value, "a", _C_field1_set); } } }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(_a, _private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _C_instances, value, "a", _C_field1_set); } } }, _private_field1_initializers, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js index 63a73bc6e6650..642d2451ada44 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js @@ -15,7 +15,7 @@ let C = (() => { return class C { static { _private_field1_decorators = [dec]; - __esDecorate(this, _private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(this, _private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _private_field1_initializers, _instanceExtraInitializers); } #field1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0)); get #field1() { return _private_field1_descriptor.get.call(this); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js index 7d963bc7b2ff3..de1106088d88b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js @@ -28,7 +28,7 @@ let C = (() => { _C_field1_set = function _C_field1_set(value) { return _static_private_field1_descriptor.set.call(this, value); }, (() => { _static_private_field1_decorators = [dec]; - __esDecorate(_a, _static_private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); }, "#field1"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); }, "#field1") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _a, value, "a", _C_field1_set); } } }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(_a, _static_private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _a, value, "a", _C_field1_set); } } }, _static_private_field1_initializers, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _C_field1_accessor_storage = { value: __runInitializers(this, _static_private_field1_initializers, 0) }, diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js index 1de161594c09c..62555d30e40da 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js @@ -24,7 +24,7 @@ let C = (() => { return class C { static { _static_private_field1_decorators = [dec]; - __esDecorate(this, _static_private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _static_private_field1_initializers, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static #field1_accessor_storage = __runInitializers(this, _static_private_field1_initializers, 0); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js index afbd3e129661c..925af4e40ca15 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js @@ -81,9 +81,9 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i } return useValue ? value : void 0; }; -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); @@ -152,13 +152,13 @@ let C = (() => { _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map index 7b267800acd43..6eb9b74a9df4a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;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lcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;YAeH,MAAC,kGAAG,CAAC,GAAC;YAIG,yEAAI,CAAC,GAAC;QAqBnB,CAAC;QArCG,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAQxB,IAAS,CAAC,uEAAK;QAAf,IAAS,CAAC,4EAAK;;;;;;;;;;8BAlBd,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;6CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;QAfJ,+DAAA,yBAAA,cAAkB,CAAC,YAAA,mOAAA;QAInB,8DAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,wNAAA;QAI7B,8DAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,6NAAA;QA5BhC,kJAAA,MAAM,2CAAK;QAIX,4IAAI,CAAC,2CAAgB;QAIrB,0IAAI,CAAC,mDAAmB;QAwBxB,wUAAc;QAId,0DAAA,uBAAA,gGAAuB,cAAA,EAAvB,uBAAA,qGAAuB,cAAA,8TAAA;QAxBvB,iIAAA,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AgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== //// [esDecorators-classDeclaration-sourceMap.d.ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt index 04349ba143ffa..ea7ac9a95b55b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt @@ -42,9 +42,9 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts >>> } >>> return useValue ? value : void 0; >>>}; ->>>var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +>>>var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { >>> if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; ->>> return Object.defineProperty(f, "name", { configurable: true, value: name }); +>>> return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); >>>}; >>>var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { >>> if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); @@ -530,7 +530,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 6 >Emitted(105, 124) Source(28, 24) + SourceIndex(0) 7 >Emitted(105, 351) Source(28, 24) + SourceIndex(0) --- ->>> __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); +>>> __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); 1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ @@ -540,9 +540,9 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^ 8 > ^ 9 > ^ -10> ^^^^^^^ -11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -12> ^-> +10> ^^^^^^^^^^^^^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^-> 1 > > > @dec @@ -557,7 +557,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 > 9 > } 10> -11> +11> 1 >Emitted(106, 9) Source(32, 5) + SourceIndex(0) 2 >Emitted(106, 71) Source(32, 5) + SourceIndex(0) 3 >Emitted(106, 94) Source(32, 5) + SourceIndex(0) @@ -567,10 +567,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 >Emitted(106, 117) Source(32, 32) + SourceIndex(0) 8 >Emitted(106, 118) Source(32, 33) + SourceIndex(0) 9 >Emitted(106, 119) Source(32, 34) + SourceIndex(0) -10>Emitted(106, 126) Source(32, 34) + SourceIndex(0) -11>Emitted(106, 342) Source(32, 34) + SourceIndex(0) +10>Emitted(106, 133) Source(32, 34) + SourceIndex(0) +11>Emitted(106, 349) Source(32, 34) + SourceIndex(0) --- ->>> __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); +>>> __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ @@ -578,8 +578,8 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 5 > ^^^^^ 6 > ^^^^ 7 > ^ -8 > ^^^^^^^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -592,7 +592,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 6 > ) { 7 > } 8 > -9 > +9 > 1->Emitted(107, 9) Source(36, 5) + SourceIndex(0) 2 >Emitted(107, 71) Source(36, 5) + SourceIndex(0) 3 >Emitted(107, 94) Source(36, 5) + SourceIndex(0) @@ -600,8 +600,8 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 5 >Emitted(107, 109) Source(36, 32) + SourceIndex(0) 6 >Emitted(107, 113) Source(36, 36) + SourceIndex(0) 7 >Emitted(107, 114) Source(36, 37) + SourceIndex(0) -8 >Emitted(107, 121) Source(36, 37) + SourceIndex(0) -9 >Emitted(107, 342) Source(36, 37) + SourceIndex(0) +8 >Emitted(107, 128) Source(36, 37) + SourceIndex(0) +9 >Emitted(107, 349) Source(36, 37) + SourceIndex(0) --- >>> __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); 1 >^^^^^^^^ @@ -658,7 +658,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts >>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -688,17 +688,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 1->Emitted(111, 9) Source(40, 5) + SourceIndex(0) 2 >Emitted(111, 337) Source(40, 19) + SourceIndex(0) --- ->>> __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); +>>> __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldS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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -708,21 +708,21 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > 4 > static accessor #z = 1; 5 > -6 > -7 > -8 > static accessor #z = 1; -9 > -10> +6 > +7 > +8 > static accessor #z = 1; +9 > +10> 1->Emitted(112, 9) Source(44, 5) + SourceIndex(0) 2 >Emitted(112, 67) Source(44, 5) + SourceIndex(0) 3 >Emitted(112, 90) Source(44, 5) + SourceIndex(0) 4 >Emitted(112, 186) Source(44, 28) + SourceIndex(0) -5 >Emitted(112, 193) Source(44, 28) + SourceIndex(0) -6 >Emitted(112, 195) Source(44, 5) + SourceIndex(0) -7 >Emitted(112, 218) Source(44, 5) + SourceIndex(0) -8 >Emitted(112, 319) Source(44, 28) + SourceIndex(0) -9 >Emitted(112, 326) Source(44, 28) + SourceIndex(0) -10>Emitted(112, 644) Source(44, 28) + SourceIndex(0) +5 >Emitted(112, 200) Source(44, 28) + SourceIndex(0) +6 >Emitted(112, 202) Source(44, 5) + SourceIndex(0) +7 >Emitted(112, 225) Source(44, 5) + SourceIndex(0) +8 >Emitted(112, 326) Source(44, 28) + SourceIndex(0) +9 >Emitted(112, 340) Source(44, 28) + SourceIndex(0) +10>Emitted(112, 658) Source(44, 28) + SourceIndex(0) --- >>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); 1 >^^^^^^^^ diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js index fb560f644d27c..7fb69ed69070d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js @@ -81,9 +81,9 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i } return useValue ? value : void 0; }; -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); @@ -137,13 +137,13 @@ let C = (() => { _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map index 430b235683c1c..564a60c08fd9b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;;;kCACF,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;iDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;YAfJ,yDAAA,yBAAA,cAAkB,CAAC,YAAA,mOAAA;YAInB,wDAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,OAAA,wNAAA;YAI7B,wDAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,OAAA,6NAAA;YA5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QUFDLDRFQUFLOztZQW5CYix1REFBQzs7O0lBbUNJLDRFQUFLLENBQUMsR0FBSixDQUFLO0lBSUUsNkZBQUssQ0FBQyxHQUFKLENBQUs7V0F2Q3JCLENBQUMifQ==,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;;;kCACF,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;iDAGH,GAAG,EACH,GAAG;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.d.ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt index 8838715235f28..b1958fccdc643 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt @@ -42,9 +42,9 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts >>> } >>> return useValue ? value : void 0; >>>}; ->>>var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +>>>var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { >>> if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; ->>> return Object.defineProperty(f, "name", { configurable: true, value: name }); +>>> return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); >>>}; >>>var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { >>> if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); @@ -331,7 +331,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 6 >Emitted(90, 122) Source(28, 24) + SourceIndex(0) 7 >Emitted(90, 349) Source(28, 24) + SourceIndex(0) --- ->>> __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); +>>> __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); 1 >^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ @@ -341,9 +341,9 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^ 8 > ^ 9 > ^ -10> ^^^^^^^ -11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -12> ^-> +10> ^^^^^^^^^^^^^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +12> ^-> 1 > > > @dec @@ -358,7 +358,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 > 9 > } 10> -11> +11> 1 >Emitted(91, 13) Source(32, 5) + SourceIndex(0) 2 >Emitted(91, 69) Source(32, 5) + SourceIndex(0) 3 >Emitted(91, 92) Source(32, 5) + SourceIndex(0) @@ -368,10 +368,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 >Emitted(91, 115) Source(32, 32) + SourceIndex(0) 8 >Emitted(91, 116) Source(32, 33) + SourceIndex(0) 9 >Emitted(91, 117) Source(32, 34) + SourceIndex(0) -10>Emitted(91, 124) Source(32, 34) + SourceIndex(0) -11>Emitted(91, 340) Source(32, 34) + SourceIndex(0) +10>Emitted(91, 131) Source(32, 34) + SourceIndex(0) +11>Emitted(91, 347) Source(32, 34) + SourceIndex(0) --- ->>> __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); +>>> __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ @@ -379,8 +379,8 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 5 > ^^^^^ 6 > ^^^^ 7 > ^ -8 > ^^^^^^^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^^^^^^^^^^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -393,7 +393,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 6 > ) { 7 > } 8 > -9 > +9 > 1->Emitted(92, 13) Source(36, 5) + SourceIndex(0) 2 >Emitted(92, 69) Source(36, 5) + SourceIndex(0) 3 >Emitted(92, 92) Source(36, 5) + SourceIndex(0) @@ -401,8 +401,8 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 5 >Emitted(92, 107) Source(36, 32) + SourceIndex(0) 6 >Emitted(92, 111) Source(36, 36) + SourceIndex(0) 7 >Emitted(92, 112) Source(36, 37) + SourceIndex(0) -8 >Emitted(92, 119) Source(36, 37) + SourceIndex(0) -9 >Emitted(92, 340) Source(36, 37) + SourceIndex(0) +8 >Emitted(92, 126) Source(36, 37) + SourceIndex(0) +9 >Emitted(92, 347) Source(36, 37) + SourceIndex(0) --- >>> __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ @@ -459,7 +459,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts >>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -489,17 +489,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 1->Emitted(96, 13) Source(40, 5) + SourceIndex(0) 2 >Emitted(96, 341) Source(40, 19) + SourceIndex(0) --- ->>> __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); +>>> __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -509,21 +509,21 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 > 4 > static accessor #z = 1; 5 > -6 > -7 > -8 > static accessor #z = 1; -9 > -10> +6 > +7 > +8 > static accessor #z = 1; +9 > +10> 1->Emitted(97, 13) Source(44, 5) + SourceIndex(0) 2 >Emitted(97, 65) Source(44, 5) + SourceIndex(0) 3 >Emitted(97, 88) Source(44, 5) + SourceIndex(0) 4 >Emitted(97, 178) Source(44, 28) + SourceIndex(0) -5 >Emitted(97, 185) Source(44, 28) + SourceIndex(0) -6 >Emitted(97, 187) Source(44, 5) + SourceIndex(0) -7 >Emitted(97, 210) Source(44, 5) + SourceIndex(0) -8 >Emitted(97, 305) Source(44, 28) + SourceIndex(0) -9 >Emitted(97, 312) Source(44, 28) + SourceIndex(0) -10>Emitted(97, 630) Source(44, 28) + SourceIndex(0) +5 >Emitted(97, 192) Source(44, 28) + SourceIndex(0) +6 >Emitted(97, 194) Source(44, 5) + SourceIndex(0) +7 >Emitted(97, 217) Source(44, 5) + SourceIndex(0) +8 >Emitted(97, 312) Source(44, 28) + SourceIndex(0) +9 >Emitted(97, 326) Source(44, 28) + SourceIndex(0) +10>Emitted(97, 644) Source(44, 28) + SourceIndex(0) --- >>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js index b8a52016fb320..77b8334f0559e 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js @@ -145,13 +145,13 @@ class C { _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js index 4b4596ed3882a..93f5aae3a7603 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js @@ -124,13 +124,13 @@ class C { _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); diff --git a/tests/baselines/reference/potentiallyUncalledDecorators.errors.txt b/tests/baselines/reference/potentiallyUncalledDecorators.errors.txt index 4fd7d52c64c1a..0899858110c3a 100644 --- a/tests/baselines/reference/potentiallyUncalledDecorators.errors.txt +++ b/tests/baselines/reference/potentiallyUncalledDecorators.errors.txt @@ -2,21 +2,21 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(4,5): error TS1329: 'Input tests/cases/compiler/potentiallyUncalledDecorators.ts(35,1): error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'? tests/cases/compiler/potentiallyUncalledDecorators.ts(37,5): error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'? tests/cases/compiler/potentiallyUncalledDecorators.ts(38,5): error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'? -tests/cases/compiler/potentiallyUncalledDecorators.ts(41,1): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof B'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(43,5): error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(44,5): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(47,1): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof C'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(41,2): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof B'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(43,6): error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(44,6): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(47,2): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof C'. tests/cases/compiler/potentiallyUncalledDecorators.ts(49,5): error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'? tests/cases/compiler/potentiallyUncalledDecorators.ts(50,5): error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'? -tests/cases/compiler/potentiallyUncalledDecorators.ts(53,1): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof D'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(55,5): error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(56,5): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(59,1): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof E'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(61,5): error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(62,5): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(65,1): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof F'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(67,5): error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. -tests/cases/compiler/potentiallyUncalledDecorators.ts(68,5): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(53,2): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof D'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(55,6): error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(56,6): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(59,2): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof E'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(61,6): error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(62,6): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(65,2): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof F'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(67,6): error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. +tests/cases/compiler/potentiallyUncalledDecorators.ts(68,6): error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. ==== tests/cases/compiler/potentiallyUncalledDecorators.ts (19 errors) ==== @@ -69,19 +69,19 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(68,5): error TS1270: Decor } @allRest - ~~~~~~~~ + ~~~~~~~ !!! error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof B'. class B { @allRest foo: any; - ~~~~~~~~ + ~~~~~~~ !!! error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. @allRest bar() { } - ~~~~~~~~ + ~~~~~~~ !!! error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. } @oneOptional - ~~~~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof C'. class C { @oneOptional foo: any; @@ -93,38 +93,38 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(68,5): error TS1270: Decor } @twoOptional - ~~~~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof D'. class D { @twoOptional foo: any; - ~~~~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. @twoOptional bar() { } - ~~~~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. } @threeOptional - ~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~ !!! error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof E'. class E { @threeOptional foo: any; - ~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~ !!! error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. @threeOptional bar() { } - ~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~ !!! error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. } @oneOptionalWithRest - ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~ !!! error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | typeof F'. class F { @oneOptionalWithRest foo: any; - ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~ !!! error TS1271: Decorator function return type is 'OmniDecorator' but is expected to be 'void' or 'any'. @oneOptionalWithRest bar() { } - ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~ !!! error TS1270: Decorator function return type 'OmniDecorator' is not assignable to type 'void | TypedPropertyDescriptor<() => void>'. } diff --git a/tests/baselines/reference/privateNameFieldClassExpression.js b/tests/baselines/reference/privateNameFieldClassExpression.js index 2fbcbf36fc7f3..94720459d5d7c 100644 --- a/tests/baselines/reference/privateNameFieldClassExpression.js +++ b/tests/baselines/reference/privateNameFieldClassExpression.js @@ -15,9 +15,9 @@ class B { //// [privateNameFieldClassExpression.js] -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; var _B_foo, _B_foo2; class B { diff --git a/tests/baselines/reference/privateNameStaticFieldClassExpression.js b/tests/baselines/reference/privateNameStaticFieldClassExpression.js index 68650833542e1..69d37160d618b 100644 --- a/tests/baselines/reference/privateNameStaticFieldClassExpression.js +++ b/tests/baselines/reference/privateNameStaticFieldClassExpression.js @@ -28,9 +28,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function ( if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; var _a, _B_foo, _B_foo2, _b, _c; class B { diff --git a/tests/baselines/reference/privateNameStaticFieldNoInitializer(target=es2015).js b/tests/baselines/reference/privateNameStaticFieldNoInitializer(target=es2015).js index 63cbcdcbbf885..74aec7b6c4e97 100644 --- a/tests/baselines/reference/privateNameStaticFieldNoInitializer(target=es2015).js +++ b/tests/baselines/reference/privateNameStaticFieldNoInitializer(target=es2015).js @@ -9,9 +9,9 @@ class C2 { //// [privateNameStaticFieldNoInitializer.js] -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; var _a, _C_x, _b, _C2_x; const C = (_a = class { diff --git a/tests/baselines/reference/staticFieldWithInterfaceContext.js b/tests/baselines/reference/staticFieldWithInterfaceContext.js index 4f404fded40b1..139d10a4f325e 100644 --- a/tests/baselines/reference/staticFieldWithInterfaceContext.js +++ b/tests/baselines/reference/staticFieldWithInterfaceContext.js @@ -27,9 +27,9 @@ let [ c11 = class { static x = { a: "a" } } ]: I[] = [class { static x = { a: "a //// [staticFieldWithInterfaceContext.js] -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; var c = (_a = /** @class */ (function () { diff --git a/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js b/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js index 91d216fbf5bdf..47c851a2a8ecb 100644 --- a/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js +++ b/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js @@ -1,6 +1,6 @@ -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; var _a; const MyClass = (_a = class { diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js b/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js index 85522f3021846..e6e1d9e3b238b 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js @@ -38,10 +38,11 @@ Output:: 1 import {B} from './b'   ~~~~~~~~~~~~~~~~~~~~~ -a.ts:2:1 - error TS1238: Unable to resolve signature of class decorator when called as an expression. +a.ts:2:2 - error TS1238: Unable to resolve signature of class decorator when called as an expression. + The runtime will invoke the decorator with 2 arguments, but the decorator expects 1. 2 @((_) => {}) -  ~~~~~~~~~~~~ +   ~~~~~~~~~~~ [12:00:20 AM] Found 3 errors. Watching for file changes. @@ -123,9 +124,9 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i } return useValue ? value : void 0; }; -var __setFunctionName = (this && this.__setFunctionName) || function (f, name) { +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: name }); + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; import './b'; export let A = (() => { diff --git a/tests/cases/conformance/esDecorators/esDecorators-arguments.ts b/tests/cases/conformance/esDecorators/esDecorators-arguments.ts new file mode 100644 index 0000000000000..84fd37a420619 --- /dev/null +++ b/tests/cases/conformance/esDecorators/esDecorators-arguments.ts @@ -0,0 +1,7 @@ +// @target: esnext +@(() => {}) +@((a: any) => {}) +@((a: any, b: any) => {}) +@((a: any, b: any, c: any) => {}) +@((a: any, b: any, c: any, ...d: any[]) => {}) +class C1 {} From c837d78d7ee5bab2ab6f2c3c7c24882ca9c31dcf Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 1 Nov 2022 12:14:13 -0400 Subject: [PATCH 25/51] revert change to isParameterPropertyDeclaration --- src/compiler/utilitiesPublic.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index fe2f87bf73200..9df09cb4ee90f 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -260,11 +260,7 @@ namespace ts { export type ParameterPropertyDeclaration = ParameterDeclaration & { parent: ConstructorDeclaration, name: Identifier }; export function isParameterPropertyDeclaration(node: Node, parent: Node): node is ParameterPropertyDeclaration { - return isParameter(node) && - !!node.name && // NOTE: JSDoc parameters may not have names - isIdentifier(node.name) && - isConstructorDeclaration(parent) && - hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier); + return hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier) && parent.kind === SyntaxKind.Constructor; } export function isEmptyBindingPattern(node: BindingName): node is BindingPattern { From c954517d60c5a53e31930a30782c0730c970c352 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 4 Nov 2022 17:56:56 -0400 Subject: [PATCH 26/51] Cleanup of lib.decorators types, added documentation --- src/compiler/checker.ts | 2 +- src/compiler/emitter.ts | 6 +- src/lib/decorators.d.ts | 237 +++++++++++++++++++++++++++++----------- 3 files changed, 175 insertions(+), 70 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8e2b0e4aec84d..d257aadfd8356 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -33323,7 +33323,7 @@ namespace ts { // 5. Apply each decorator for the class, in reverse order (`E1`, `E2`). // // As a result, "current" types at each decorator application are as follows: - // - For `A1`, the "current" types of the class and method their "original" types. + // - For `A1`, the "current" types of the class and method are their "original" types. // - For `A2`, the "current type" of the method is the "output type" of `A1`, and the "current type" of the // class is the type of `SomeClass` where `f` is the "output type" of `A1`. This becomes the "final type" // of `f`. diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 870582f6aabbe..016ff2793f077 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4506,7 +4506,6 @@ namespace ts { // Emit each child. let previousSibling: Node | undefined; - let previousSiblingEmitFlags: EmitFlags | undefined; let previousSourceFileTextKind: ReturnType; let shouldDecreaseIndentAfterEmit = false; for (let i = 0; i < count; i++) { @@ -4526,7 +4525,7 @@ namespace ts { // /* End of parameter a */ -> this comment isn't considered to be trailing comment of parameter "a" due to newline // , if (format & ListFormat.DelimitersMask && previousSibling.end !== (parentNode ? parentNode.end : -1)) { - previousSiblingEmitFlags = getEmitFlags(previousSibling); + const previousSiblingEmitFlags = getEmitFlags(previousSibling); if (!(previousSiblingEmitFlags & EmitFlags.NoTrailingComments)) { emitLeadingCommentsOfPosition(previousSibling.end); } @@ -4572,11 +4571,10 @@ namespace ts { } previousSibling = child; - previousSiblingEmitFlags = undefined; } // Write a trailing comma, if requested. - const emitFlags = previousSibling ? previousSiblingEmitFlags ?? getEmitFlags(previousSibling) : 0; + const emitFlags = previousSibling ? getEmitFlags(previousSibling) : 0; const skipTrailingComments = commentsDisabled || !!(emitFlags & EmitFlags.NoTrailingComments); const emitTrailingComma = hasTrailingComma && (format & ListFormat.AllowTrailingComma) && (format & ListFormat.CommaDelimited); if (emitTrailingComma) { diff --git a/src/lib/decorators.d.ts b/src/lib/decorators.d.ts index 0ace4e41687ed..dc1c1453d9461 100644 --- a/src/lib/decorators.d.ts +++ b/src/lib/decorators.d.ts @@ -1,3 +1,6 @@ +/** + * The decorator context types provided to class member decorators. + */ type ClassMemberDecoratorContext = | ClassMethodDecoratorContext | ClassGetterDecoratorContext @@ -6,6 +9,9 @@ type ClassMemberDecoratorContext = | ClassAccessorDecoratorContext ; +/** + * The decorator context types provided to any decorator. + */ type DecoratorContext = | ClassDecoratorContext | ClassMemberDecoratorContext @@ -14,8 +20,13 @@ type DecoratorContext = /** * Context provided to a class decorator. */ -interface ClassDecoratorContext any = abstract new (...args: any) => any> { +interface ClassDecoratorContext< + Class extends abstract new (...args: any) => any = abstract new (...args: any) => any +> { + /** The kind of element that was decorated. */ readonly kind: "class"; + + /** The name of the decorated class. */ readonly name: string | undefined; /** @@ -38,27 +49,39 @@ interface ClassDecoratorContext any addInitializer(initializer: (this: Class) => void): void; } -// #region type ClassDecoratorFunction - /** - * Describes a function that can be used to decorate a class. + * Describes the call signature of a generic function that can be used to decorate a class. + * @param target The decorated class constructor. + * @param context Additional context about the decorated class. + * @returns A replacement class constructor, or `undefined`. */ -type ClassDecoratorFunction = < - In extends abstract new (...args: any[]) => any, - Out extends abstract new (...args: any[]) => any = In, - Class extends abstract new (...args: any[]) => any = Out ->(target: In, context: ClassDecoratorContext) => Out | void; - -// #endregion +type ClassDecoratorFunction = < + Class extends abstract new (...args: any) => any, +>( + target: Class, + context: ClassDecoratorContext & Overrides +) => Class | void; /** * Context provided to a class method decorator. */ -interface ClassMethodDecoratorContext any = (this: This, ...args: any) => any> { +interface ClassMethodDecoratorContext< + This = unknown, + Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any, +> { + /** The kind of class member that was decorated. */ readonly kind: "method"; + + /** The name of the decorated class member. */ readonly name: string | symbol; + + /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */ readonly static: boolean; + + /** A value indicating whether the class member has a private name. */ readonly private: boolean; + + /** An object that can be used to access the current value of the class member at runtime. */ readonly access: { /** * Gets the current value of the method from the provided receiver. @@ -96,26 +119,37 @@ interface ClassMethodDecoratorContext void): void; } -// #region type ClassMethodDecoratorFunction /** - * Describes a function that can be used to decorate a class method. + * Describes a generic function that can be used to decorate a class method. + * @param target The function for the decorated class method. + * @param context Additional context about the decorated class method. + * @returns A replacement function, or `undefined`. */ -type ClassMethodDecoratorFunction = < +type ClassMethodDecoratorFunction = < This, - In extends (this: This, ...args: any[]) => any, - Out extends (this: This, ...args: any[]) => any = In, - Value extends (this: This, ...args: any[]) => any = Out ->(target: In, context: ClassMethodDecoratorContext & Readonly>) => Out | void; -// #endregion + Value extends (this: This, ...args: any) => any +>(target: Value, context: ClassMethodDecoratorContext & Overrides) => Value | void; /** * Context provided to a class `get` method decorator. */ -interface ClassGetterDecoratorContext { +interface ClassGetterDecoratorContext< + This = unknown, + Value = unknown, +> { + /** The kind of class member that was decorated. */ readonly kind: "getter"; + + /** The name of the decorated class member. */ readonly name: string | symbol; + + /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */ readonly static: boolean; + + /** A value indicating whether the class member has a private name. */ readonly private: boolean; + + /** An object that can be used to access the current value of the class member at runtime. */ readonly access: { /** * Invokes the getter on the provided receiver. @@ -134,26 +168,40 @@ interface ClassGetterDecoratorContext { addInitializer(initializer: (this: This) => void): void; } -// #region type ClassGetterDecoratorFunction /** - * Describes a function that can be used to decorate a class `get` method. + * Describes a generic function that can be used to decorate a class `get` method. + * @param target The getter function for the decorated class `get` method. + * @param context Additional context about the decorated class `get` method. + * @returns A replacement getter function, or `undefined`. */ -type ClassGetterDecoratorFunction = < +type ClassGetterDecoratorFunction = < This, - In, - Out = In, - Value = Out, ->(target: (this: This) => In, context: ClassGetterDecoratorContext) => ((this: This) => Out) | void; -// #endregion + Value, +>( + target: (this: This) => Value, + context: ClassGetterDecoratorContext & Overrides +) => ((this: This) => Value) | void; /** * Context provided to a class `set` method decorator. */ -interface ClassSetterDecoratorContext { +interface ClassSetterDecoratorContext< + This = unknown, + Value = unknown, +> { + /** The kind of class member that was decorated. */ readonly kind: "setter"; + + /** The name of the decorated class member. */ readonly name: string | symbol; + + /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */ readonly static: boolean; + + /** A value indicating whether the class member has a private name. */ readonly private: boolean; + + /** An object that can be used to access the current value of the class member at runtime. */ readonly access: { /** * Invokes the setter on the provided receiver. @@ -172,26 +220,40 @@ interface ClassSetterDecoratorContext { addInitializer(initializer: (this: This) => void): void; } -// #region type ClassSetterDecoratorFunction /** - * Describes a function that can be used to decorate a class `set` method. + * Describes a generic function that can be used to decorate a class `set` method. + * @param target The setter function for the decorated class `set` method. + * @param context Additional context about the decorated class `set` method. + * @returns A replacement setter function, or `undefined`. */ -type ClassSetterDecoratorFunction = < +type ClassSetterDecoratorFunction = < This, - In, - Out = In, - Value = Out ->(target: (this: This, value: In) => void, context: ClassSetterDecoratorContext) => ((this: This, value: Out) => void) | void; -// #endregion + Value, +>( + target: (this: This, value: Value) => void, + context: ClassSetterDecoratorContext & Overrides +) => ((this: This, value: Value) => void) | void; /** * Context provided to a class `accessor` field decorator. */ -interface ClassAccessorDecoratorContext { +interface ClassAccessorDecoratorContext< + This = unknown, + Value = unknown, +> { + /** The kind of class member that was decorated. */ readonly kind: "accessor"; + + /** The name of the decorated class member. */ readonly name: string | symbol; + + /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */ readonly static: boolean; + + /** A value indicating whether the class member has a private name. */ readonly private: boolean; + + /** An object that can be used to access the current value of the class member at runtime. */ readonly access: { /** * Invokes the getter on the provided receiver. @@ -218,40 +280,83 @@ interface ClassAccessorDecoratorContext { addInitializer(initializer: (this: This) => void): void; } -interface ClassAccessorDecoratorTarget { - get(this: This): In; - set(this: This, value: In): void; +/** + * Describes the target provided to class `accessor` field decorators. + */ +interface ClassAccessorDecoratorTarget { + /** + * Invokes the getter that was defined prior to decorator application. + * + * @example + * let value = target.get.call(instance); + */ + get(this: This): Value; + + /** + * Invokes the setter that was defined prior to decorator application. + * + * @example + * target.set.call(instance, value); + */ + set(this: This, value: Value): void; } -interface ClassAccessorDecoratorResult { - get?(this: This): Out; - set?(this: This, value: Out): void; - init?(this: This, value: In): Out +/** + * Describes the allowed return value from a class `accessor` field decorator. + */ +interface ClassAccessorDecoratorResult { + /** + * An optional replacement getter function. If not provided, the existing getter function is used instead. + */ + get?(this: This): Value; + + /** + * An optional replacement setter function. If not provided, the existing setter function is used instead. + */ + set?(this: This, value: Value): void; + + /** + * An optional initializer mutator that is invoked when the underlying field initializer is evaluated. + * @param value The incoming initializer value. + * @returns The replacement initializer value. + */ + init?(this: This, value: Value): Value; } -// #region type ClassAccessorDecoratorFunction /** - * Describes a function that can be used to decorate a class `accessor` field. + * Describes a generic function that can be used to decorate a class `accessor` field. + * @param target The {@link ClassAccessorDecoratorTarget} the decorated class `accessor` field. + * @param context Additional context about the decorated class `accessor` field. + * @returns A {@link ClassAccessorDecoratorResult} that is used to replace the getter or setter or to inject an initializer mutator, or `undefined` to use the existing getter and setter. */ -type ClassAccessorDecoratorFunction = < +type ClassAccessorDecoratorFunction = < This, - In, - Out = In, - Value = Out + Value, >( - target: ClassAccessorDecoratorTarget, - context: ClassAccessorDecoratorContext -) => ClassAccessorDecoratorResult | void; -// #endregion + target: ClassAccessorDecoratorTarget, + context: ClassAccessorDecoratorContext & Overrides +) => ClassAccessorDecoratorResult | void; /** * Context provided to a class field decorator. */ -interface ClassFieldDecoratorContext { +interface ClassFieldDecoratorContext< + This = unknown, + Value = unknown, +> { + /** The kind of class member that was decorated. */ readonly kind: "field"; + + /** The name of the decorated class member. */ readonly name: string | symbol; + + /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */ readonly static: boolean; + + /** A value indicating whether the class member has a private name. */ readonly private: boolean; + + /** An object that can be used to access the current value of the class member at runtime. */ readonly access: { /** * Gets the value of the field on the provided receiver. @@ -272,14 +377,16 @@ interface ClassFieldDecoratorContext { addInitializer(initializer: (this: This) => void): void; } -// #region type ClassFieldDecoratorFunction /** - * Describes a function that can be used to decorate a class field. + * Describes a generic function that can be used to decorate a class field. + * @param target Class field decorators always receive `undefined`. + * @param context Additional context about the decorated class field. + * @returns An initializer mutator function, or `undefined`. */ -type ClassFieldDecoratorFunction = < +type ClassFieldDecoratorFunction = < This, - In, - Out = In, - Value = Out ->(target: undefined, context: ClassAccessorDecoratorContext) => ((this: This, initialValue: In) => Out) | void; -// #endregion + Value, +>( + target: undefined, + context: ClassFieldDecoratorContext & Overrides +) => ((this: This, initialValue: Value) => Value) | void; From d65c50becff8c6ce77b152c89564f00baf62cd4f Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 7 Nov 2022 16:56:25 -0500 Subject: [PATCH 27/51] Fix for missing initializer, some decorators.d.ts type cleanup --- src/compiler/transformers/esDecorators.ts | 2 +- src/lib/decorators.d.ts | 367 +++++++++++++++--- .../unittests/evaluation/esDecorators.ts | 9 + ...ators-classExpression-namedEvaluation.1.js | 8 +- ...tors-classExpression-namedEvaluation.10.js | 14 +- ...tors-classExpression-namedEvaluation.11.js | 4 +- ...ators-classExpression-namedEvaluation.2.js | 12 +- ...ators-classExpression-namedEvaluation.3.js | 6 +- ...ators-classExpression-namedEvaluation.4.js | 6 +- ...ators-classExpression-namedEvaluation.5.js | 2 +- ...ators-classExpression-namedEvaluation.6.js | 2 +- ...ators-classExpression-namedEvaluation.7.js | 2 +- ...ators-classExpression-namedEvaluation.8.js | 2 +- ...ators-classExpression-namedEvaluation.9.js | 2 +- ...rs-emitDecoratorMetadata(target=es2015).js | 8 +- ...rs-emitDecoratorMetadata(target=es2022).js | 8 +- ...ators-emitDecoratorMetadata(target=es5).js | 8 +- 17 files changed, 355 insertions(+), 107 deletions(-) diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index 01c6bbc28763e..d7fa6ef400c4d 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -1139,7 +1139,7 @@ namespace ts { initializer = emitHelpers().createRunInitializersHelper( thisArg ?? factory.createThis(), initializersName, - initializer); + initializer ?? factory.createVoidZero()); } if (!isStatic(node) && classInfo?.instanceExtraInitializersName && !classInfo?.hasInjectedInstanceInitializers) { diff --git a/src/lib/decorators.d.ts b/src/lib/decorators.d.ts index dc1c1453d9461..df3630a9bfda4 100644 --- a/src/lib/decorators.d.ts +++ b/src/lib/decorators.d.ts @@ -19,6 +19,7 @@ type DecoratorContext = /** * Context provided to a class decorator. + * @template Class The type of the decorated class associated with this context. */ interface ClassDecoratorContext< Class extends abstract new (...args: any) => any = abstract new (...args: any) => any @@ -50,20 +51,56 @@ interface ClassDecoratorContext< } /** - * Describes the call signature of a generic function that can be used to decorate a class. - * @param target The decorated class constructor. - * @param context Additional context about the decorated class. - * @returns A replacement class constructor, or `undefined`. + * Describes a function that can be used to decorate a class. + * @template Overrides Constrains the context to specific values for `name`. + * @template Class The constructor type of the class. */ -type ClassDecoratorFunction = < - Class extends abstract new (...args: any) => any, ->( - target: Class, - context: ClassDecoratorContext & Overrides -) => Class | void; +type ClassDecoratorFunction< + Overrides extends { name?: string | undefined } = {}, + Class extends abstract new (...args: any) => any = abstract new (...args: any) => any +> = + /** + * Describes a function that can be used to decorate a class. + * @param target The decorated class constructor. + * @param context Additional context about the decorated class. + * @returns A replacement class constructor, or `undefined`. + */ + ( + target: Class, + context: ClassDecoratorContext & Overrides + ) => Class | void; + +// NOTE: If decorators eventually support type mutation, we will use this definition instead: +// /** +// * Describes a function that can be used to decorate a class. +// * @template Overrides Constrains the context to specific values for `name`. +// * @template In The input constructor type of the class. +// * @template Out The output constructor type of the class. +// * @template Final The final constructor type of the class. +// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. +// */ +// type ClassDecoratorFunction< +// Overrides extends { name?: string | undefined } = {}, +// In extends abstract new (...args: any) => any = abstract new (...args: any) => any, +// Out extends In = In, +// Final extends Out = Out, +// > = +// /** +// * Describes a function that can be used to decorate a class. +// * @param target The decorated class constructor. +// * @param context Additional context about the decorated class. +// * @returns A replacement class constructor, or `undefined`. +// */ +// ( +// target: In, +// context: ClassDecoratorContext & Overrides +// ) => Out | void; /** * Context provided to a class method decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The type of the decorated class method. */ interface ClassMethodDecoratorContext< This = unknown, @@ -120,18 +157,60 @@ interface ClassMethodDecoratorContext< } /** - * Describes a generic function that can be used to decorate a class method. - * @param target The function for the decorated class method. - * @param context Additional context about the decorated class method. - * @returns A replacement function, or `undefined`. + * Describes a function that can be used to decorate a class method. + * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. + * @template This The `this` type of the decorated class element. + * @template Value The function type of the class method. */ -type ClassMethodDecoratorFunction = < - This, - Value extends (this: This, ...args: any) => any ->(target: Value, context: ClassMethodDecoratorContext & Overrides) => Value | void; +type ClassMethodDecoratorFunction< + Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, + This = unknown, + Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any +> = + /** + * Describes a function that can be used to decorate a class method. + * @param target The function for the decorated class method. + * @param context Additional context about the decorated class method. + * @returns A replacement function, or `undefined`. + */ + ( + target: Value, + context: ClassMethodDecoratorContext & Overrides + ) => Value | void; + +// NOTE: If decorators eventually support type mutation, we will use this definition instead: +// /** +// * Describes a function that can be used to decorate a class method. +// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. +// * @template This The final `this` type of the decorated class element. +// * @template In The input function type of the class method. +// * @template Out The output function type of the class method. +// * @template Final The final function type of the class method. +// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. +// */ +// type ClassMethodDecoratorFunction< +// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, +// This = unknown, +// In extends (this: This, ...args: any) => any = (this: This, ...args: any) => any, +// Out extends In = In, +// Final extends Out = Out, +// > = +// /** +// * Describes a function that can be used to decorate a class method. +// * @param target The function for the decorated class method. +// * @param context Additional context about the decorated class method. +// * @returns A replacement function, or `undefined`. +// */ +// ( +// target: In, +// context: ClassMethodDecoratorContext & Overrides +// ) => Out | void; /** - * Context provided to a class `get` method decorator. + * Context provided to a class getter decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The property type of the decorated class getter. */ interface ClassGetterDecoratorContext< This = unknown, @@ -169,21 +248,60 @@ interface ClassGetterDecoratorContext< } /** - * Describes a generic function that can be used to decorate a class `get` method. - * @param target The getter function for the decorated class `get` method. - * @param context Additional context about the decorated class `get` method. - * @returns A replacement getter function, or `undefined`. + * Describes a function that can be used to decorate a class getter. + * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. + * @template This The `this` type of the decorated class element. + * @template Value The property type of the class getter. */ -type ClassGetterDecoratorFunction = < - This, - Value, ->( - target: (this: This) => Value, - context: ClassGetterDecoratorContext & Overrides -) => ((this: This) => Value) | void; +type ClassGetterDecoratorFunction< + Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, + This = unknown, + Value = unknown, +> = + /** + * Describes a function that can be used to decorate a class getter. + * @param target The getter function for the decorated class getter. + * @param context Additional context about the decorated class getter. + * @returns A replacement getter function, or `undefined`. + */ + ( + target: (this: This) => Value, + context: ClassGetterDecoratorContext & Overrides + ) => ((this: This) => Value) | void; + +// NOTE: If decorators eventually support type mutation, we will use this definition instead: +// /** +// * Describes a function that can be used to decorate a class getter. +// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. +// * @template This The final `this` type of the decorated class element. +// * @template In The input property type of the class getter. +// * @template Out The output property type of the class getter. +// * @template Final The final property type of the class getter. +// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. +// */ +// type ClassGetterDecoratorFunction< +// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, +// This = unknown, +// In = unknown, +// Out extends In = In, +// Final extends Out = Out, +// > = +// /** +// * Describes a function that can be used to decorate a class getter. +// * @param target The getter function for the decorated class getter. +// * @param context Additional context about the decorated class getter. +// * @returns A replacement getter function, or `undefined`. +// */ +// ( +// target: (this: This) => In, +// context: ClassGetterDecoratorContext & Overrides +// ) => ((this: This) => Out) | void; /** - * Context provided to a class `set` method decorator. + * Context provided to a class setter decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The type of the decorated class setter. */ interface ClassSetterDecoratorContext< This = unknown, @@ -221,21 +339,61 @@ interface ClassSetterDecoratorContext< } /** - * Describes a generic function that can be used to decorate a class `set` method. - * @param target The setter function for the decorated class `set` method. - * @param context Additional context about the decorated class `set` method. - * @returns A replacement setter function, or `undefined`. + * Describes a function that can be used to decorate a class setter. + * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. + * @template This The `this` type of the decorated class element. + * @template Value The property type of the class setter. + * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. */ -type ClassSetterDecoratorFunction = < - This, - Value, ->( - target: (this: This, value: Value) => void, - context: ClassSetterDecoratorContext & Overrides -) => ((this: This, value: Value) => void) | void; +type ClassSetterDecoratorFunction< + Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, + This = unknown, + Value = unknown, +> = + /** + * Describes a function that can be used to decorate a class setter. + * @param target The setter function for the decorated class setter. + * @param context Additional context about the decorated class setter. + * @returns A replacement setter function, or `undefined`. + */ + ( + target: (this: This, value: Value) => void, + context: ClassSetterDecoratorContext & Overrides + ) => ((this: This, value: Value) => void) | void; + +// NOTE: If decorators eventually support type mutation, we will use this definition instead: +// /** +// * Describes a function that can be used to decorate a class setter. +// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. +// * @template This The final `this` type of the decorated class element. +// * @template In The input property type of the class setter. +// * @template Out The output property type of the class setter. +// * @template Final The final property type of the class setter. +// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. +// */ +// type ClassSetterDecoratorFunction< +// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, +// This = unknown, +// In = unknown, +// Out extends In = In, +// Final extends Out = Out, +// > = +// /** +// * Describes a function that can be used to decorate a class setter. +// * @param target The setter function for the decorated class setter. +// * @param context Additional context about the decorated class setter. +// * @returns A replacement setter function, or `undefined`. +// */ +// ( +// target: (this: This, value: In) => void, +// context: ClassSetterDecoratorContext & Overrides +// ) => ((this: This, value: Out) => void) | void; /** * Context provided to a class `accessor` field decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The type of decorated class field. */ interface ClassAccessorDecoratorContext< This = unknown, @@ -282,6 +440,8 @@ interface ClassAccessorDecoratorContext< /** * Describes the target provided to class `accessor` field decorators. + * @template This The `this` type to which the target applies. + * @template Value The property type for the class `accessor` field. */ interface ClassAccessorDecoratorTarget { /** @@ -303,6 +463,8 @@ interface ClassAccessorDecoratorTarget { /** * Describes the allowed return value from a class `accessor` field decorator. + * @template This The `this` type to which the target applies. + * @template Value The property type for the class `accessor` field. */ interface ClassAccessorDecoratorResult { /** @@ -324,21 +486,61 @@ interface ClassAccessorDecoratorResult { } /** - * Describes a generic function that can be used to decorate a class `accessor` field. - * @param target The {@link ClassAccessorDecoratorTarget} the decorated class `accessor` field. - * @param context Additional context about the decorated class `accessor` field. - * @returns A {@link ClassAccessorDecoratorResult} that is used to replace the getter or setter or to inject an initializer mutator, or `undefined` to use the existing getter and setter. + * Describes a function that can be used to decorate a class `accessor` field. + * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. + * @template This The `this` type of the decorated class element. + * @template Value The property type of the class `accessor` field. + * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. */ -type ClassAccessorDecoratorFunction = < - This, - Value, ->( - target: ClassAccessorDecoratorTarget, - context: ClassAccessorDecoratorContext & Overrides -) => ClassAccessorDecoratorResult | void; +type ClassAccessorDecoratorFunction< + Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, + This = unknown, + Value = unknown, +> = + /** + * Describes a function that can be used to decorate a class `accessor` field. + * @param target The {@link ClassAccessorDecoratorTarget} the decorated class `accessor` field. + * @param context Additional context about the decorated class `accessor` field. + * @returns A {@link ClassAccessorDecoratorResult} that is used to replace the getter or setter or to inject an initializer mutator, or `undefined` to use the existing getter and setter. + */ + ( + target: ClassAccessorDecoratorTarget, + context: ClassAccessorDecoratorContext & Overrides + ) => ClassAccessorDecoratorResult | void; + +// NOTE: If decorators eventually support type mutation, we will use this definition instead: +// /** +// * Describes a function that can be used to decorate a class `accessor` field. +// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. +// * @template This The final `this` type of the decorated class element. +// * @template In The input property type of the class `accessor` field. +// * @template Out The output property type of the class `accessor` field. +// * @template Final The final property type of the class `accessor` field. +// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. +// */ +// type ClassAccessorDecoratorFunction< +// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, +// This = unknown, +// In = unknown, +// Out extends In = In, +// Final extends Out = Out, +// > = +// /** +// * Describes a function that can be used to decorate a class `accessor` field. +// * @param target The {@link ClassAccessorDecoratorTarget} the decorated class `accessor` field. +// * @param context Additional context about the decorated class `accessor` field. +// * @returns A {@link ClassAccessorDecoratorResult} that is used to replace the getter or setter or to inject an initializer mutator, or `undefined` to use the existing getter and setter. +// */ +// ( +// target: ClassAccessorDecoratorTarget, +// context: ClassAccessorDecoratorContext & Overrides +// ) => ClassAccessorDecoratorResult | void; /** * Context provided to a class field decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The type of the decorated class field. */ interface ClassFieldDecoratorContext< This = unknown, @@ -378,15 +580,52 @@ interface ClassFieldDecoratorContext< } /** - * Describes a generic function that can be used to decorate a class field. - * @param target Class field decorators always receive `undefined`. - * @param context Additional context about the decorated class field. - * @returns An initializer mutator function, or `undefined`. + * Describes a function that can be used to decorate a class field. + * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. + * @template This The `this` type of the decorated class element. + * @template Value The property type of the class field. + * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. */ -type ClassFieldDecoratorFunction = < - This, - Value, ->( - target: undefined, - context: ClassFieldDecoratorContext & Overrides -) => ((this: This, initialValue: Value) => Value) | void; +type ClassFieldDecoratorFunction< + Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, + This = unknown, + Value = unknown, +> = + /** + * Describes a function that can be used to decorate a class field. + * @param target Class field decorators always receive `undefined`. + * @param context Additional context about the decorated class field. + * @returns An initializer mutator function, or `undefined`. + */ + ( + target: undefined, + context: ClassFieldDecoratorContext & Overrides + ) => ((this: This, initialValue: Value) => Value) | void; + +// NOTE: If decorators eventually support type mutation, we will use this definition instead: +// /** +// * Describes a function that can be used to decorate a class field. +// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. +// * @template This The final `this` type of the decorated class element. +// * @template In The input property type of the class field. +// * @template Out The output property type of the class field. +// * @template Final The final property type of the class field. +// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. +// */ +// type ClassFieldDecoratorFunction< +// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, +// This = unknown, +// In = unknown, +// Out extends In = In, +// Final extends Out = Out, +// > = +// /** +// * Describes a function that can be used to decorate a class field. +// * @param target Class field decorators always receive `undefined`. +// * @param context Additional context about the decorated class field. +// * @returns An initializer mutator function, or `undefined`. +// */ +// ( +// target: undefined, +// context: ClassFieldDecoratorContext & Overrides +// ) => ((this: This, initialValue: In) => Out) | void; diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts index 6acd666d49c4d..3ff72f4d4a7c8 100644 --- a/src/testRunner/unittests/evaluation/esDecorators.ts +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -1559,6 +1559,15 @@ describe("unittests:: evaluation:: esDecorators", () => { `; assert.strictEqual(C.x, 2); }); + it("undefined initializer works", () => { + const { C } = exec` + export class C { + @((t, c) => () => 2) + static x: any; + } + `; + assert.strictEqual(C.x, 2); + }); it("multiple initializer pipe-throughs applied in reverse order", () => { const { C } = exec` function initializer(x) { return x + 1; } diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js index 680835e999340..ec021a9591411 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js @@ -57,7 +57,7 @@ x = (() => { _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })(); // 13.15.2 RS: Evaluation @@ -87,7 +87,7 @@ x &&= (() => { _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); } - y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; })(); // 13.15.2 RS: Evaluation @@ -117,7 +117,7 @@ x ||= (() => { _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); } - y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; })(); // 13.15.2 RS: Evaluation @@ -147,6 +147,6 @@ x ??= (() => { _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_3); } - y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers, void 0)); }; })(); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js index e25a5327c4254..b1c90d0c13eb1 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js @@ -202,7 +202,7 @@ var _a, _b; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })(); } @@ -219,7 +219,7 @@ var _a, _b; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); } - y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; })(); } @@ -236,7 +236,7 @@ var _a, _b; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); } - y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; })(); } @@ -253,7 +253,7 @@ var _a, _b; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_3); } - y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers, void 0)); }; })(); } @@ -270,7 +270,7 @@ var _a, _b; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_4); } - y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers, void 0)); }; })(); } @@ -308,7 +308,7 @@ var _a, _b; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_5); } - y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers, void 0)); }; })(); } @@ -325,7 +325,7 @@ var _a, _b; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_6); } - y = (__runInitializers(this, _instanceExtraInitializers_6), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_6), __runInitializers(this, _y_initializers, void 0)); }; })(); } diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js index 71a518e184d4f..a81fd637628f8 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js @@ -38,7 +38,7 @@ declare let dec: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })()); // No NamedEvaluation, class name @@ -65,6 +65,6 @@ declare let dec: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); } - y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js index f56b5dc381bd9..ecda4fbed91b1 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js @@ -61,7 +61,7 @@ let x, f; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })() }); ({ "x": (() => { @@ -89,7 +89,7 @@ let x, f; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); } - y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; })() }); ({ 0: (() => { @@ -117,7 +117,7 @@ let x, f; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); } - y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; })() }); ({ ["x"]: (() => { @@ -145,7 +145,7 @@ let x, f; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_3); } - y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers, void 0)); }; })() }); ({ [0]: (() => { @@ -173,7 +173,7 @@ let x, f; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_4); } - y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers, void 0)); }; })() }); ({ [_a = __propKey(f())]: (() => { @@ -201,7 +201,7 @@ let x, f; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_5); } - y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers, void 0)); }; })() }); // __proto__ setters do not perform NamedEvaluation diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js index 4c9c7312c7f9c..c98330fb3ee12 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js @@ -48,7 +48,7 @@ declare let dec: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })(); } @@ -80,7 +80,7 @@ declare let dec: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); } - y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; })(); } @@ -114,7 +114,7 @@ declare let dec: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); } - y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; })(); } diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js index bb343971e86e1..ecc43044211de 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js @@ -49,7 +49,7 @@ declare let dec: any, obj: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })()] = obj; } @@ -83,7 +83,7 @@ declare let dec: any, obj: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); } - y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; })() } = obj; } @@ -115,7 +115,7 @@ declare let dec: any, obj: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); } - y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; })() } = obj; } diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js index 3b2a69fbde964..3adf563dc857b 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js @@ -36,6 +36,6 @@ declare let dec: any, obj: any, x: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })() } = obj); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js index ec0375e58e64c..a957a642d65e7 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js @@ -36,6 +36,6 @@ declare let dec: any, obj: any, x: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })() } = obj); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js index dbc094f55ce93..26ec797feecc0 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js @@ -36,6 +36,6 @@ declare let dec: any, obj: any, x: any; _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })()] = obj; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js index 565472908171c..1c96d010c213b 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js @@ -47,6 +47,6 @@ export default ((() => { _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })()); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js index 1a2ea638154dd..0f44e4a6e3432 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js @@ -38,6 +38,6 @@ module.exports = (() => { _y_decorators = [dec]; __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; })(); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js index eaaf5bb3a9a7d..1f4c456377492 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js @@ -64,7 +64,7 @@ let C = (() => { let _y_initializers = []; var C = _classThis = class { constructor(x) { - this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); } method(x) { } set x(x) { } @@ -89,7 +89,7 @@ let C = (() => { C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); })(); - _classThis.y = __runInitializers(_classThis, _static_y_initializers); + _classThis.y = __runInitializers(_classThis, _static_y_initializers, void 0); (() => { __runInitializers(_classThis, _classExtraInitializers); })(); @@ -112,7 +112,7 @@ let C = (() => { let _y_initializers = []; var C = (_classThis_1 = class { constructor(x) { - this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); } method(x) { } set x(x) { } @@ -137,7 +137,7 @@ let C = (() => { C = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _staticExtraInitializers_1); })(), - _classThis_1.y = __runInitializers(_classThis_1, _static_y_initializers), + _classThis_1.y = __runInitializers(_classThis_1, _static_y_initializers, void 0), (() => { __runInitializers(_classThis_1, _classExtraInitializers_1); })(), diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js index 7dc01fd69adce..e7d106c4d6e39 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js @@ -83,10 +83,10 @@ let C = (() => { constructor(x) { } method(x) { } set x(x) { } - y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); static method(x) { } static set x(x) { } - static y = __runInitializers(_classThis, _static_y_initializers); + static y = __runInitializers(_classThis, _static_y_initializers, void 0); static { __runInitializers(_classThis, _classExtraInitializers); } @@ -129,10 +129,10 @@ let C = (() => { constructor(x) { } method(x) { } set x(x) { } - y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); static method(x) { } static set x(x) { } - static y = __runInitializers(_classThis_1, _static_y_initializers); + static y = __runInitializers(_classThis_1, _static_y_initializers, void 0); static { __runInitializers(_classThis_1, _classExtraInitializers_1); } diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js index 4b5a8db7b19c5..dcc5090805bbf 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js @@ -65,7 +65,7 @@ var C = function () { var _y_initializers = []; var C = _classThis = /** @class */ (function () { function C_1(x) { - this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers)); + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); } C_1.prototype.method = function (x) { }; Object.defineProperty(C_1.prototype, "x", { @@ -99,7 +99,7 @@ var C = function () { C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); })(); - _classThis.y = __runInitializers(_classThis, _static_y_initializers); + _classThis.y = __runInitializers(_classThis, _static_y_initializers, void 0); (function () { __runInitializers(_classThis, _classExtraInitializers); })(); @@ -122,7 +122,7 @@ var C = function () { var _y_initializers = []; var C = (_classThis_1 = /** @class */ (function () { function class_1(x) { - this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers)); + this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); } class_1.prototype.method = function (x) { }; Object.defineProperty(class_1.prototype, "x", { @@ -156,7 +156,7 @@ var C = function () { C = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _staticExtraInitializers_1); })(), - _classThis_1.y = __runInitializers(_classThis_1, _static_y_initializers), + _classThis_1.y = __runInitializers(_classThis_1, _static_y_initializers, void 0), (function () { __runInitializers(_classThis_1, _classExtraInitializers_1); })(), From 995e961d726887141e4c48f29b8610cd2f2a3901 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 8 Nov 2022 18:24:54 -0500 Subject: [PATCH 28/51] Improve importHelper warnings for missing helpers --- src/compiler/checker.ts | 166 +++++++++++++----- src/compiler/factory/utilities.ts | 10 ++ src/compiler/transformers/classFields.ts | 86 ++++----- src/compiler/transformers/esDecorators.ts | 100 ++++++----- src/compiler/types.ts | 20 ++- src/compiler/utilities.ts | 109 ++++++++++++ ...ingEmitHelpers-classDecorator.1.errors.txt | 19 ++ ...ion-missingEmitHelpers-classDecorator.1.js | 33 ++++ ...ingEmitHelpers-classDecorator.2.errors.txt | 22 +++ ...ion-missingEmitHelpers-classDecorator.2.js | 33 ++++ ...ingEmitHelpers-classDecorator.3.errors.txt | 24 +++ ...ion-missingEmitHelpers-classDecorator.3.js | 38 ++++ ...rs-nonStaticPrivateAutoAccessor.errors.txt | 24 +++ ...mitHelpers-nonStaticPrivateAutoAccessor.js | 36 ++++ ...itHelpers-nonStaticPrivateField.errors.txt | 21 +++ ...issingEmitHelpers-nonStaticPrivateField.js | 33 ++++ ...tHelpers-nonStaticPrivateGetter.errors.txt | 24 +++ ...ssingEmitHelpers-nonStaticPrivateGetter.js | 36 ++++ ...tHelpers-nonStaticPrivateMethod.errors.txt | 24 +++ ...ssingEmitHelpers-nonStaticPrivateMethod.js | 36 ++++ ...tHelpers-nonStaticPrivateSetter.errors.txt | 24 +++ ...ssingEmitHelpers-nonStaticPrivateSetter.js | 36 ++++ ...pers-staticComputedAutoAccessor.errors.txt | 28 +++ ...gEmitHelpers-staticComputedAutoAccessor.js | 37 ++++ ...EmitHelpers-staticComputedField.errors.txt | 28 +++ ...-missingEmitHelpers-staticComputedField.js | 35 ++++ ...mitHelpers-staticComputedGetter.errors.txt | 25 +++ ...missingEmitHelpers-staticComputedGetter.js | 34 ++++ ...mitHelpers-staticComputedMethod.errors.txt | 25 +++ ...missingEmitHelpers-staticComputedMethod.js | 34 ++++ ...mitHelpers-staticComputedSetter.errors.txt | 25 +++ ...missingEmitHelpers-staticComputedSetter.js | 34 ++++ ...lpers-staticPrivateAutoAccessor.errors.txt | 24 +++ ...ngEmitHelpers-staticPrivateAutoAccessor.js | 37 ++++ ...gEmitHelpers-staticPrivateField.errors.txt | 21 +++ ...n-missingEmitHelpers-staticPrivateField.js | 34 ++++ ...EmitHelpers-staticPrivateGetter.errors.txt | 24 +++ ...-missingEmitHelpers-staticPrivateGetter.js | 34 ++++ ...EmitHelpers-staticPrivateMethod.errors.txt | 24 +++ ...-missingEmitHelpers-staticPrivateMethod.js | 34 ++++ ...EmitHelpers-staticPrivateSetter.errors.txt | 24 +++ ...-missingEmitHelpers-staticPrivateSetter.js | 34 ++++ ...ingEmitHelpers-classDecorator.1.errors.txt | 20 +++ ...ion-missingEmitHelpers-classDecorator.1.js | 33 ++++ ...ngEmitHelpers-classDecorator.10.errors.txt | 23 +++ ...on-missingEmitHelpers-classDecorator.10.js | 36 ++++ ...ngEmitHelpers-classDecorator.11.errors.txt | 23 +++ ...on-missingEmitHelpers-classDecorator.11.js | 36 ++++ ...ngEmitHelpers-classDecorator.12.errors.txt | 21 +++ ...on-missingEmitHelpers-classDecorator.12.js | 33 ++++ ...ngEmitHelpers-classDecorator.13.errors.txt | 20 +++ ...on-missingEmitHelpers-classDecorator.13.js | 33 ++++ ...ngEmitHelpers-classDecorator.14.errors.txt | 25 +++ ...on-missingEmitHelpers-classDecorator.14.js | 35 ++++ ...ngEmitHelpers-classDecorator.15.errors.txt | 21 +++ ...on-missingEmitHelpers-classDecorator.15.js | 35 ++++ ...ngEmitHelpers-classDecorator.16.errors.txt | 28 +++ ...on-missingEmitHelpers-classDecorator.16.js | 37 ++++ ...ngEmitHelpers-classDecorator.17.errors.txt | 27 +++ ...on-missingEmitHelpers-classDecorator.17.js | 37 ++++ ...ingEmitHelpers-classDecorator.2.errors.txt | 17 ++ ...ion-missingEmitHelpers-classDecorator.2.js | 32 ++++ ...ingEmitHelpers-classDecorator.3.errors.txt | 20 +++ ...ion-missingEmitHelpers-classDecorator.3.js | 32 ++++ ...ingEmitHelpers-classDecorator.4.errors.txt | 23 +++ ...ion-missingEmitHelpers-classDecorator.4.js | 36 ++++ ...ingEmitHelpers-classDecorator.5.errors.txt | 23 +++ ...ion-missingEmitHelpers-classDecorator.5.js | 36 ++++ ...ingEmitHelpers-classDecorator.6.errors.txt | 21 +++ ...ion-missingEmitHelpers-classDecorator.6.js | 33 ++++ ...ingEmitHelpers-classDecorator.7.errors.txt | 23 +++ ...ion-missingEmitHelpers-classDecorator.7.js | 36 ++++ ...ingEmitHelpers-classDecorator.8.errors.txt | 23 +++ ...ion-missingEmitHelpers-classDecorator.8.js | 36 ++++ ...ingEmitHelpers-classDecorator.9.errors.txt | 23 +++ ...ion-missingEmitHelpers-classDecorator.9.js | 36 ++++ ...ion-missingEmitHelpers-classDecorator.1.ts | 15 ++ ...ion-missingEmitHelpers-classDecorator.2.ts | 15 ++ ...ion-missingEmitHelpers-classDecorator.3.ts | 17 ++ ...mitHelpers-nonStaticPrivateAutoAccessor.ts | 17 ++ ...issingEmitHelpers-nonStaticPrivateField.ts | 17 ++ ...ssingEmitHelpers-nonStaticPrivateGetter.ts | 17 ++ ...ssingEmitHelpers-nonStaticPrivateMethod.ts | 17 ++ ...ssingEmitHelpers-nonStaticPrivateSetter.ts | 17 ++ ...gEmitHelpers-staticComputedAutoAccessor.ts | 18 ++ ...-missingEmitHelpers-staticComputedField.ts | 18 ++ ...missingEmitHelpers-staticComputedGetter.ts | 18 ++ ...missingEmitHelpers-staticComputedMethod.ts | 18 ++ ...missingEmitHelpers-staticComputedSetter.ts | 18 ++ ...ngEmitHelpers-staticPrivateAutoAccessor.ts | 17 ++ ...n-missingEmitHelpers-staticPrivateField.ts | 17 ++ ...-missingEmitHelpers-staticPrivateGetter.ts | 17 ++ ...-missingEmitHelpers-staticPrivateMethod.ts | 17 ++ ...-missingEmitHelpers-staticPrivateSetter.ts | 17 ++ ...ion-missingEmitHelpers-classDecorator.1.ts | 14 ++ ...on-missingEmitHelpers-classDecorator.10.ts | 16 ++ ...on-missingEmitHelpers-classDecorator.11.ts | 16 ++ ...on-missingEmitHelpers-classDecorator.12.ts | 14 ++ ...on-missingEmitHelpers-classDecorator.13.ts | 14 ++ ...on-missingEmitHelpers-classDecorator.14.ts | 15 ++ ...on-missingEmitHelpers-classDecorator.15.ts | 14 ++ ...on-missingEmitHelpers-classDecorator.16.ts | 15 ++ ...on-missingEmitHelpers-classDecorator.17.ts | 17 ++ ...ion-missingEmitHelpers-classDecorator.2.ts | 14 ++ ...ion-missingEmitHelpers-classDecorator.3.ts | 14 ++ ...ion-missingEmitHelpers-classDecorator.4.ts | 16 ++ ...ion-missingEmitHelpers-classDecorator.5.ts | 16 ++ ...ion-missingEmitHelpers-classDecorator.6.ts | 14 ++ ...ion-missingEmitHelpers-classDecorator.7.ts | 16 ++ ...ion-missingEmitHelpers-classDecorator.8.ts | 16 ++ ...ion-missingEmitHelpers-classDecorator.9.ts | 16 ++ 111 files changed, 2946 insertions(+), 140 deletions(-) create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.js create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.js create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.ts create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.ts create mode 100644 tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 305d20c38ec4f..0cc5e4e8df3cd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -196,7 +196,9 @@ import { VariableStatement, VarianceFlags, visitEachChild, visitNode, visitNodes, Visitor, VisitResult, VoidExpression, walkUpBindingElementsAndPatterns, walkUpParenthesizedExpressions, walkUpParenthesizedTypes, walkUpParenthesizedTypesAndGetParentAndChild, WhileStatement, WideningContext, WithStatement, YieldExpression, - createDiagnosticForNodeArrayFromMessageChain, isSetAccessorDeclaration, + createDiagnosticForNodeArrayFromMessageChain, isSetAccessorDeclaration, isNamedEvaluationSource, + walkUpOuterExpressions, classOrConstructorParameterIsDecorated, classElementOrClassElementParameterIsDecorated, + isInitializedProperty, getDecorators, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers"; @@ -540,6 +542,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // is because diagnostics can be quite expensive, and we want to allow hosts to bail out if // they no longer need the information (for example, if the user started editing again). let cancellationToken: CancellationToken | undefined; + + const requestedExternalEmitHelperNames = new Set(); let requestedExternalEmitHelpers: ExternalEmitHelpers; let externalHelpersModule: Symbol; @@ -38315,8 +38319,26 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } else if (languageVersion < ScriptTarget.ESNext) { - checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.ESDecorate); - checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.RunInitializers); + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.ESDecorateAndRunInitializers); + if (isClassDeclaration(node)) { + if (!node.name) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.SetFunctionName); + } + else { + const member = getFirstTransformableStaticClassElement(node); + if (member) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.SetFunctionName); + } + } + } + else if (!isClassExpression(node)) { + if (isPrivateIdentifier(node.name) && (isMethodDeclaration(node) || isAccessor(node) || isAutoAccessorPropertyDeclaration(node))) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.SetFunctionName); + } + if (isComputedPropertyName(node.name)) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.PropKey); + } + } } if (compilerOptions.emitDecoratorMetadata) { @@ -41012,9 +41034,59 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return true; } + function getFirstTransformableStaticClassElement(node: ClassLikeDeclaration) { + const willTransformStaticElementsOfDecoratedClass = + !legacyDecorators && languageVersion < ScriptTarget.ESNext && + classOrConstructorParameterIsDecorated(/*useLegacyDecorators*/ false, node); + const willTransformPrivateElementsOrClassStaticBlocks = languageVersion <= ScriptTarget.ES2022; + const willTransformInitializers = !useDefineForClassFields || languageVersion < ScriptTarget.ES2022; + if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) { + for (const member of node.members) { + if (willTransformStaticElementsOfDecoratedClass && classElementOrClassElementParameterIsDecorated(/*useLegacyDecorators*/ false, member, node)) { + return firstOrUndefined(getDecorators(node)) ?? node; + } + else if (willTransformPrivateElementsOrClassStaticBlocks) { + if (isClassStaticBlockDeclaration(member)) { + return member; + } + else if (isStatic(member)) { + if (isPrivateIdentifierClassElementDeclaration(member) || + willTransformInitializers && isInitializedProperty(member)) { + return member; + } + } + } + } + } + } + + function checkClassExpressionExternalHelpers(node: ClassExpression) { + if (node.name) return; + + const parent = walkUpOuterExpressions(node); + if (!isNamedEvaluationSource(parent)) return; + + const willTransformESDecorators = !legacyDecorators && languageVersion < ScriptTarget.ESNext; + let location: Node | undefined; + if (willTransformESDecorators && classOrConstructorParameterIsDecorated(/*useLegacyDecorators*/ false, node)) { + location = firstOrUndefined(getDecorators(node)) ?? node; + } + else { + location = getFirstTransformableStaticClassElement(node); + } + + if (location) { + checkExternalEmitHelpers(location, ExternalEmitHelpers.SetFunctionName); + if ((isPropertyAssignment(parent) || isPropertyDeclaration(parent) || isBindingElement(parent)) && isComputedPropertyName(parent.name)) { + checkExternalEmitHelpers(location, ExternalEmitHelpers.PropKey); + } + } + } + function checkClassExpression(node: ClassExpression): Type { checkClassLikeDeclaration(node); checkNodeDeferred(node); + checkClassExpressionExternalHelpers(node); return getTypeOfSymbol(getSymbolOfNode(node)); } @@ -45046,24 +45118,28 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; for (let helper = ExternalEmitHelpers.FirstEmitHelper; helper <= ExternalEmitHelpers.LastEmitHelper; helper <<= 1) { if (uncheckedHelpers & helper) { - const name = getHelperName(helper); - const symbol = getSymbol(helpersModule.exports!, escapeLeadingUnderscores(name), SymbolFlags.Value); - if (!symbol) { - error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name); - } - else if (helper & ExternalEmitHelpers.ClassPrivateFieldGet) { - if (!some(getSignaturesOfSymbol(symbol), signature => getParameterCount(signature) > 3)) { - error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4); + for (const name of getHelperNames(helper)) { + if (requestedExternalEmitHelperNames.has(name)) continue; + requestedExternalEmitHelperNames.add(name); + + const symbol = getSymbol(helpersModule.exports!, escapeLeadingUnderscores(name), SymbolFlags.Value); + if (!symbol) { + error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name); } - } - else if (helper & ExternalEmitHelpers.ClassPrivateFieldSet) { - if (!some(getSignaturesOfSymbol(symbol), signature => getParameterCount(signature) > 4)) { - error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5); + else if (helper & ExternalEmitHelpers.ClassPrivateFieldGet) { + if (!some(getSignaturesOfSymbol(symbol), signature => getParameterCount(signature) > 3)) { + error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4); + } } - } - else if (helper & ExternalEmitHelpers.SpreadArray) { - if (!some(getSignaturesOfSymbol(symbol), signature => getParameterCount(signature) > 2)) { - error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3); + else if (helper & ExternalEmitHelpers.ClassPrivateFieldSet) { + if (!some(getSignaturesOfSymbol(symbol), signature => getParameterCount(signature) > 4)) { + error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5); + } + } + else if (helper & ExternalEmitHelpers.SpreadArray) { + if (!some(getSignaturesOfSymbol(symbol), signature => getParameterCount(signature) > 2)) { + error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3); + } } } } @@ -45074,33 +45150,33 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } - function getHelperName(helper: ExternalEmitHelpers) { + function getHelperNames(helper: ExternalEmitHelpers) { switch (helper) { - case ExternalEmitHelpers.Extends: return "__extends"; - case ExternalEmitHelpers.Assign: return "__assign"; - case ExternalEmitHelpers.Rest: return "__rest"; - case ExternalEmitHelpers.Decorate: return "__decorate"; - case ExternalEmitHelpers.Metadata: return "__metadata"; - case ExternalEmitHelpers.Param: return "__param"; - case ExternalEmitHelpers.Awaiter: return "__awaiter"; - case ExternalEmitHelpers.Generator: return "__generator"; - case ExternalEmitHelpers.Values: return "__values"; - case ExternalEmitHelpers.Read: return "__read"; - case ExternalEmitHelpers.SpreadArray: return "__spreadArray"; - case ExternalEmitHelpers.Await: return "__await"; - case ExternalEmitHelpers.AsyncGenerator: return "__asyncGenerator"; - case ExternalEmitHelpers.AsyncDelegator: return "__asyncDelegator"; - case ExternalEmitHelpers.AsyncValues: return "__asyncValues"; - case ExternalEmitHelpers.ExportStar: return "__exportStar"; - case ExternalEmitHelpers.ImportStar: return "__importStar"; - case ExternalEmitHelpers.ImportDefault: return "__importDefault"; - case ExternalEmitHelpers.MakeTemplateObject: return "__makeTemplateObject"; - case ExternalEmitHelpers.ClassPrivateFieldGet: return "__classPrivateFieldGet"; - case ExternalEmitHelpers.ClassPrivateFieldSet: return "__classPrivateFieldSet"; - case ExternalEmitHelpers.ClassPrivateFieldIn: return "__classPrivateFieldIn"; - case ExternalEmitHelpers.CreateBinding: return "__createBinding"; - case ExternalEmitHelpers.ESDecorate: return "__esDecorate"; - case ExternalEmitHelpers.RunInitializers: return "__runInitializers"; + case ExternalEmitHelpers.Extends: return ["__extends"]; + case ExternalEmitHelpers.Assign: return ["__assign"]; + case ExternalEmitHelpers.Rest: return ["__rest"]; + case ExternalEmitHelpers.Decorate: return legacyDecorators ? ["__decorate"] : ["__esDecorate", "__runInitializers"]; + case ExternalEmitHelpers.Metadata: return ["__metadata"]; + case ExternalEmitHelpers.Param: return ["__param"]; + case ExternalEmitHelpers.Awaiter: return ["__awaiter"]; + case ExternalEmitHelpers.Generator: return ["__generator"]; + case ExternalEmitHelpers.Values: return ["__values"]; + case ExternalEmitHelpers.Read: return ["__read"]; + case ExternalEmitHelpers.SpreadArray: return ["__spreadArray"]; + case ExternalEmitHelpers.Await: return ["__await"]; + case ExternalEmitHelpers.AsyncGenerator: return ["__asyncGenerator"]; + case ExternalEmitHelpers.AsyncDelegator: return ["__asyncDelegator"]; + case ExternalEmitHelpers.AsyncValues: return ["__asyncValues"]; + case ExternalEmitHelpers.ExportStar: return ["__exportStar"]; + case ExternalEmitHelpers.ImportStar: return ["__importStar"]; + case ExternalEmitHelpers.ImportDefault: return ["__importDefault"]; + case ExternalEmitHelpers.MakeTemplateObject: return ["__makeTemplateObject"]; + case ExternalEmitHelpers.ClassPrivateFieldGet: return ["__classPrivateFieldGet"]; + case ExternalEmitHelpers.ClassPrivateFieldSet: return ["__classPrivateFieldSet"]; + case ExternalEmitHelpers.ClassPrivateFieldIn: return ["__classPrivateFieldIn"]; + case ExternalEmitHelpers.CreateBinding: return ["__createBinding"]; + case ExternalEmitHelpers.SetFunctionName: return ["__setFunctionName"]; + case ExternalEmitHelpers.PropKey: return ["__propKey"]; default: return Debug.fail("Unrecognized helper"); } } diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 1b9f5b65587fd..98e519265bf92 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -522,6 +522,16 @@ export function skipOuterExpressions(node: Node, kinds = OuterExpressionKinds.Al return node; } +/** @internal */ +export function walkUpOuterExpressions(node: Expression, kinds = OuterExpressionKinds.All): Node { + let parent = node.parent; + while (isOuterExpression(parent, kinds)) { + parent = parent.parent; + Debug.assert(parent); + } + return parent; +} + /** @internal */ export function skipAssertions(node: Expression): Expression; /** @internal */ diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 89408a7016853..ef923ee6cc80b 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -35,13 +35,14 @@ import { VariableStatement, visitArray, visitEachChild, visitFunctionBody, visitIterationBody, visitNode, visitNodes, visitParameterList, VisitResult, PrivateIdentifierKind, LexicalEnvironment, PrivateEnvironment, getInternalEmitFlags, InternalEmitFlags, PropertyAssignment, VariableDeclaration, BindingElement, ExportAssignment, - ParenthesizedExpression, PartiallyEmittedExpression, CommaListExpression, isProtoSetter, ArrayAssignmentElement, + ParenthesizedExpression, PartiallyEmittedExpression, CommaListExpression, ArrayAssignmentElement, find, findComputedPropertyNameCacheAssignment, flattenCommaList, getPrivateIdentifier, isBindingName, isCallToHelper, isClassExpression, isClassLike, isExpressionStatement, isLeftHandSideExpression, isObjectLiteralExpression, isOmittedExpression, isPropertyNameLiteral, newPrivateEnvironment, ObjectAssignmentElement, OmittedExpression, PrivateIdentifierAccessorDeclaration, PrivateIdentifierMethodDeclaration, setPrivateIdentifier, ShorthandPropertyAssignment, SpreadAssignment, - SpreadElement, visitCommaListElements, Visitor, accessPrivateIdentifier as accessPrivateIdentifierCommon, Bundle + SpreadElement, visitCommaListElements, Visitor, accessPrivateIdentifier as accessPrivateIdentifierCommon, Bundle, + isNamedEvaluation, AnonymousFunctionDefinition } from "../_namespaces/ts"; const enum ClassPropertySubstitutionFlags { @@ -455,7 +456,7 @@ export function transformClassFields(context: TransformationContext): (x: Source const receiver = visitNode(node.right, visitor, isExpression); return setOriginalNode( - context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), + emitHelpers().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node ); } @@ -472,8 +473,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // a. Let _popValue_ be ? NamedEvaluation of |AssignmentExpression| with argument _propKey_. // ... - if (!isProtoSetter(node.name) && - isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { + if (isNamedEvaluation(node.name, isAnonymousClassNeedingAssignedName)) { const { referencedName, name } = visitReferencedPropertyName(node.name); const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); return factory.updatePropertyAssignment(node, name, initializer); @@ -517,8 +517,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // a. Let _value_ be ? NamedEvaluation of |Initializer| with argument _bindingId_. // ... - if (isIdentifier(node.name) && node.initializer && - isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); const name = visitNode(node.name, visitor, isBindingName); const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, assignedName), isExpression); @@ -545,8 +544,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. // ... - if (!node.dotDotDotToken && isIdentifier(node.name) && node.initializer && - isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); const propertyName = visitNode(node.propertyName, visitor, isPropertyName); const name = visitNode(node.name, visitor, isBindingName); @@ -560,14 +558,14 @@ export function transformClassFields(context: TransformationContext): (x: Source function visitExportAssignment(node: ExportAssignment) { // 16.2.3.7 RS: Evaluation // ExportDeclaration : `export` `default` AssignmentExpression `;` - // 1. If IsAnonymmousFunctionDefinition(|AssignmentExpression|) is *true*, then + // 1. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true*, then // a. Let _value_ be ? NamedEvaluation of |AssignmentExpression| with argument `"default"`. // ... // NOTE: Since emit for `export =` translates to `module.exports = ...`, the assigned nameof the class // is `""`. - if (isAnonymousClassDeclarationNeedingAssignedName(node.expression)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const assignedName = factory.createStringLiteral(node.isExportEquals ? "" : "default"); const modifiers = visitNodes(node.modifiers, visitor, isModifier); const expression = visitNode(node.expression, node => namedEvaluationVisitor(node, assignedName), isExpression); @@ -756,7 +754,7 @@ export function transformClassFields(context: TransformationContext): (x: Source ); } - if (node.initializer && isAnonymousClassDeclarationNeedingAssignedName(node.initializer)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const { referencedName, name } = visitReferencedPropertyName(node.name); return factory.updatePropertyDeclaration( node, @@ -780,7 +778,7 @@ export function transformClassFields(context: TransformationContext): (x: Source const expr = getPropertyNameExpressionIfNeeded( node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields, - /*captureReferencedName*/ !!node.initializer && isAnonymousClassDeclarationNeedingAssignedName(node.initializer)); + /*captureReferencedName*/ isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)); if (expr) { getPendingExpressions().push(...flattenCommaList(expr)); } @@ -837,21 +835,21 @@ export function transformClassFields(context: TransformationContext): (x: Source switch (info.kind) { case PrivateIdentifierKind.Accessor: - return context.getEmitHelperFactory().createClassPrivateFieldGetHelper( + return emitHelpers().createClassPrivateFieldGetHelper( receiver, info.brandCheckIdentifier, info.kind, info.getterName ); case PrivateIdentifierKind.Method: - return context.getEmitHelperFactory().createClassPrivateFieldGetHelper( + return emitHelpers().createClassPrivateFieldGetHelper( receiver, info.brandCheckIdentifier, info.kind, info.methodName ); case PrivateIdentifierKind.Field: - return context.getEmitHelperFactory().createClassPrivateFieldGetHelper( + return emitHelpers().createClassPrivateFieldGetHelper( receiver, info.brandCheckIdentifier, info.kind, @@ -1146,8 +1144,7 @@ export function transformClassFields(context: TransformationContext): (x: Source } } - function isAnonymousClassDeclarationNeedingAssignedName(node: Expression) { - node = skipOuterExpressions(node); + function isAnonymousClassNeedingAssignedName(node: AnonymousFunctionDefinition) { if (isClassExpression(node) && !node.name) { const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node); const classStaticBlock = find(staticPropertiesOrClassStaticBlocks, isClassStaticBlockDeclaration); @@ -1218,19 +1215,11 @@ export function transformClassFields(context: TransformationContext): (x: Source // a. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. // ... - switch (node.operatorToken.kind) { - case SyntaxKind.EqualsToken: - case SyntaxKind.AmpersandAmpersandEqualsToken: - case SyntaxKind.BarBarEqualsToken: - case SyntaxKind.QuestionQuestionEqualsToken: - if (isIdentifier(node.left) && - isAnonymousClassDeclarationNeedingAssignedName(node.right)) { - const assignedName = getAssignedNameOfIdentifier(node.left, node.right); - const left = visitNode(node.left, visitor, isExpression); - const right = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); - return factory.updateBinaryExpression(node, left, node.operatorToken, right); - } - break; + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + const assignedName = getAssignedNameOfIdentifier(node.left, node.right); + const left = visitNode(node.left, visitor, isExpression); + const right = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); + return factory.updateBinaryExpression(node, left, node.operatorToken, right); } if (isPrivateIdentifierPropertyAccessExpression(node.left)) { @@ -1398,7 +1387,7 @@ export function transformClassFields(context: TransformationContext): (x: Source switch(info.kind) { case PrivateIdentifierKind.Accessor: - return context.getEmitHelperFactory().createClassPrivateFieldSetHelper( + return emitHelpers().createClassPrivateFieldSetHelper( receiver, info.brandCheckIdentifier, right, @@ -1406,7 +1395,7 @@ export function transformClassFields(context: TransformationContext): (x: Source info.setterName ); case PrivateIdentifierKind.Method: - return context.getEmitHelperFactory().createClassPrivateFieldSetHelper( + return emitHelpers().createClassPrivateFieldSetHelper( receiver, info.brandCheckIdentifier, right, @@ -1414,7 +1403,7 @@ export function transformClassFields(context: TransformationContext): (x: Source /* f */ undefined ); case PrivateIdentifierKind.Field: - return context.getEmitHelperFactory().createClassPrivateFieldSetHelper( + return emitHelpers().createClassPrivateFieldSetHelper( receiver, info.brandCheckIdentifier, right, @@ -2153,7 +2142,7 @@ export function transformClassFields(context: TransformationContext): (x: Source const emitAssignment = !useDefineForClassFields; let referencedName: Expression | undefined; - if (!!property.initializer && isAnonymousClassDeclarationNeedingAssignedName(property.initializer)) { + if (isNamedEvaluation(property, isAnonymousClassNeedingAssignedName)) { if (isPropertyNameLiteral(property.name) || isPrivateIdentifier(property.name)) { referencedName = factory.createStringLiteralFromNode(property.name); } @@ -2657,22 +2646,18 @@ export function transformClassFields(context: TransformationContext): (x: Source // i. Let _v_ be ? NamedEvaluation of |Initializer| with argument _lref_.[[ReferencedName]]. // ... - if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { - const assignmentTarget = visitDestructuringAssignmentTarget(node.left); - let initializer: Expression; - if (isIdentifier(node.left) && - isAnonymousClassDeclarationNeedingAssignedName(node.right)) { - const assignedName = getAssignedNameOfIdentifier(node.left, node.right); - initializer = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); - } - else { - initializer = visitNode(node.right, visitor, isExpression); - } - return factory.updateBinaryExpression(node, assignmentTarget, node.operatorToken, initializer); + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + const left = visitDestructuringAssignmentTarget(node.left); + const assignedName = getAssignedNameOfIdentifier(node.left, node.right); + const right = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); + return factory.updateBinaryExpression(node, left, node.operatorToken, right); } - else { - return visitDestructuringAssignmentTarget(node); + if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { + const left = visitDestructuringAssignmentTarget(node.left); + const right = visitNode(node.right, visitor, isExpression); + return factory.updateBinaryExpression(node, left, node.operatorToken, right); } + return visitDestructuringAssignmentTarget(node); } function visitAssignmentRestElement(node: SpreadElement) { @@ -2728,8 +2713,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _P_. // ... - if (node.objectAssignmentInitializer && - isAnonymousClassDeclarationNeedingAssignedName(node.objectAssignmentInitializer)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const assignedName = getAssignedNameOfIdentifier(node.name, node.objectAssignmentInitializer); const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, node => namedEvaluationVisitor(node, assignedName), isExpression); return factory.updateShorthandPropertyAssignment(node, node.name, objectAssignmentInitializer); diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index 0db9af98995b1..2a8a66b1bf899 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -1,5 +1,5 @@ import { - addEmitHelpers, addInternalEmitFlags, addRange, AllDecorators, append, ArrayAssignmentElement, AssignmentPattern, + addEmitHelpers, addInternalEmitFlags, addRange, AllDecorators, AnonymousFunctionDefinition, append, ArrayAssignmentElement, AssignmentPattern, AsteriskToken, BinaryExpression, BindingElement, Block, Bundle, CallExpression, chainBundle, childIsDecorated, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, classOrConstructorParameterIsDecorated, ClassStaticBlockDeclaration, CommaListExpression, ComputedPropertyName, ConstructorDeclaration, @@ -16,9 +16,9 @@ import { isDestructuringAssignment, isElementAccessExpression, isEmptyStringLiteral, isExpression, isForInitializer, isFunctionExpression, isGeneratedIdentifier, isGetAccessor, isGetAccessorDeclaration, isHeritageClause, isIdentifier, isIdentifierText, isLeftHandSideExpression, isMethodDeclaration, isMethodOrAccessor, isModifier, - isNamedClassElement, isObjectLiteralElementLike, isObjectLiteralExpression, isOmittedExpression, isParameter, + isNamedClassElement, isNamedEvaluation, isObjectLiteralElementLike, isObjectLiteralExpression, isOmittedExpression, isParameter, isParameterDeclaration, isParenthesizedExpression, isPrivateIdentifier, isPrivateIdentifierClassElementDeclaration, - isPropertyAssignment, isPropertyDeclaration, isPropertyName, isPropertyNameLiteral, isProtoSetter, isSetAccessor, + isPropertyAssignment, isPropertyDeclaration, isPropertyName, isPropertyNameLiteral, isSetAccessor, isSetAccessorDeclaration, isShorthandPropertyAssignment, isSimpleInlineableExpression, isSpreadAssignment, isSpreadElement, isStatement, isStatic, isStaticModifier, isStringLiteral, isSuperProperty, isTemplateLiteral, LeftHandSideExpression, Map, map, MethodDeclaration, ModifierFlags, ModifiersArray, moveRangePastDecorators, @@ -1161,7 +1161,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // a. Let _value_ be ? NamedEvaluation of |Initializer| with argument _functionObject_.[[ClassFieldInitializerName]]. // ... - const useNamedEvaluation = !!node.initializer && isDecoratedAnonymousClassExpression(node.initializer); + const useNamedEvaluation = isNamedEvaluation(node, isAnonymousClassNeedingAssignedName); const { modifiers, name, referencedName, initializersName, descriptorName, thisArg } = partialTransformClassElement(node, useNamedEvaluation, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : undefined); startLexicalEnvironment(); @@ -1321,15 +1321,48 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc } function visitParameterDeclaration(node: ParameterDeclaration) { - const updated = factory.updateParameterDeclaration( - node, - /*modifiers*/ undefined, - node.dotDotDotToken, - visitNode(node.name, visitor, isBindingName), - /*questionToken*/ undefined, - /*type*/ undefined, - visitNode(node.initializer, visitor, isExpression) - ); + // 8.6.3 RS: IteratorBindingInitialization + // SingleNameBinding : BindingIdentifier Initializer? + // ... + // 5. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + // + // 14.3.3.3 RS: KeyedBindingInitialization + // SingleNameBinding : BindingIdentifier Initializer? + // ... + // 4. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + + let updated: ParameterDeclaration; + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); + const name = visitNode(node.name, visitor, isBindingName); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, assignedName), isExpression); + updated = factory.updateParameterDeclaration( + node, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, + name, + /*questionToken*/ undefined, + /*type*/ undefined, + initializer); + } + else { + updated = factory.updateParameterDeclaration( + node, + /*modifiers*/ undefined, + node.dotDotDotToken, + visitNode(node.name, visitor, isBindingName), + /*questionToken*/ undefined, + /*type*/ undefined, + visitNode(node.initializer, visitor, isExpression) + ); + } + if (updated !== node) { // While we emit the source map for the node after skipping decorators and modifiers, // we need to emit the comments for the original range. @@ -1341,8 +1374,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc return updated; } - function isDecoratedAnonymousClassExpression(node: Expression) { - node = skipOuterExpressions(node); + function isAnonymousClassNeedingAssignedName(node: AnonymousFunctionDefinition) { return isClassExpression(node) && !node.name && isDecoratedClassLike(node); } @@ -1394,19 +1426,11 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // a. Let _rval_ be ? NamedEvaluation of |AssignmentExpression| with argument _lref_.[[ReferencedName]]. // ... - switch (node.operatorToken.kind) { - case SyntaxKind.EqualsToken: - case SyntaxKind.AmpersandAmpersandEqualsToken: - case SyntaxKind.BarBarEqualsToken: - case SyntaxKind.QuestionQuestionEqualsToken: - if (isIdentifier(node.left) && - isDecoratedAnonymousClassExpression(node.right)) { - const assignedName = getAssignedNameOfIdentifier(node.left, node.right); - const left = visitNode(node.left, visitor, isExpression); - const right = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); - return factory.updateBinaryExpression(node, left, node.operatorToken, right); - } - break; + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + const assignedName = getAssignedNameOfIdentifier(node.left, node.right); + const left = visitNode(node.left, visitor, isExpression); + const right = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); + return factory.updateBinaryExpression(node, left, node.operatorToken, right); } if (isSuperProperty(node.left) && classThis && classSuper) { @@ -1588,8 +1612,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // a. Let _popValue_ be ? NamedEvaluation of |AssignmentExpression| with argument _propKey_. // ... - if (!isProtoSetter(node.name) && - isDecoratedAnonymousClassExpression(node.initializer)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const { referencedName, name } = visitReferencedPropertyName(node.name); const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); return factory.updatePropertyAssignment(node, name, initializer); @@ -1613,8 +1636,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // a. Let _value_ be ? NamedEvaluation of |Initializer| with argument _bindingId_. // ... - if (isIdentifier(node.name) && node.initializer && - isDecoratedAnonymousClassExpression(node.initializer)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); const name = visitNode(node.name, visitor, isBindingName); const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, assignedName), isExpression); @@ -1641,9 +1663,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. // ... - if (!node.dotDotDotToken && - isIdentifier(node.name) && node.initializer && - isDecoratedAnonymousClassExpression(node.initializer)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); const propertyName = visitNode(node.propertyName, visitor, isPropertyName); const name = visitNode(node.name, visitor, isBindingName); @@ -1696,8 +1716,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { const assignmentTarget = visitDestructuringAssignmentTarget(node.left); let initializer: Expression; - if (isIdentifier(node.left) && - isDecoratedAnonymousClassExpression(node.right)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const assignedName = getAssignedNameOfIdentifier(node.left, node.right); initializer = visitNode(node.right, node => namedEvaluationVisitor(node, assignedName), isExpression); } @@ -1763,8 +1782,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _P_. // ... - if (node.objectAssignmentInitializer && - isDecoratedAnonymousClassExpression(node.objectAssignmentInitializer)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const assignedName = getAssignedNameOfIdentifier(node.name, node.objectAssignmentInitializer); const name = visitNode(node.name, visitor, isIdentifier); const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, node => namedEvaluationVisitor(node, assignedName), isExpression); @@ -1804,14 +1822,14 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc function visitExportAssignment(node: ExportAssignment) { // 16.2.3.7 RS: Evaluation // ExportDeclaration : `export` `default` AssignmentExpression `;` - // 1. If IsAnonymmousFunctionDefinition(|AssignmentExpression|) is *true*, then + // 1. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true*, then // a. Let _value_ be ? NamedEvaluation of |AssignmentExpression| with argument `"default"`. // ... // NOTE: Since emit for `export =` translates to `module.exports = ...`, the assigned nameof the class // is `""`. - if (isDecoratedAnonymousClassExpression(node.expression)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const referencedName = factory.createStringLiteral(node.isExportEquals ? "" : "default"); const modifiers = visitNodes(node.modifiers, visitor, isModifier); const expression = visitNode(node.expression, node => namedEvaluationVisitor(node, referencedName), isExpression); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 04c4004d2b792..39827c32b0c7e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -532,8 +532,11 @@ export type PunctuationSyntaxKind = | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken + | SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.BarBarToken + | SyntaxKind.BarBarEqualsToken | SyntaxKind.QuestionQuestionToken + | SyntaxKind.QuestionQuestionEqualsToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken @@ -1318,6 +1321,9 @@ export type QuestionToken = PunctuationToken; export type ExclamationToken = PunctuationToken; export type ColonToken = PunctuationToken; export type EqualsToken = PunctuationToken; +export type AmpersandAmpersandEqualsToken = PunctuationToken; +export type BarBarEqualsToken = PunctuationToken; +export type QuestionQuestionEqualsToken = PunctuationToken; export type AsteriskToken = PunctuationToken; export type EqualsGreaterThanToken = PunctuationToken; export type PlusToken = PunctuationToken; @@ -7583,6 +7589,7 @@ export const enum ExternalEmitHelpers { Assign = 1 << 1, // __assign (used by Jsx and ESNext object spread transformations) Rest = 1 << 2, // __rest (used by ESNext object rest transformation) Decorate = 1 << 3, // __decorate (used by TypeScript decorators transformation) + ESDecorateAndRunInitializers = Decorate, // __esDecorate and __runInitializers (used by ECMAScript decorators transformation) Metadata = 1 << 4, // __metadata (used by TypeScript decorators transformation) Param = 1 << 5, // __param (used by TypeScript decorators transformation) Awaiter = 1 << 6, // __awaiter (used by ES2017 async functions transformation) @@ -7602,10 +7609,11 @@ export const enum ExternalEmitHelpers { ClassPrivateFieldSet = 1 << 20, // __classPrivateFieldSet (used by the class private field transformation) ClassPrivateFieldIn = 1 << 21, // __classPrivateFieldIn (used by the class private field transformation) CreateBinding = 1 << 22, // __createBinding (use by the module transform for (re)exports and namespace imports) - ESDecorate = 1 << 23, // __esDecorate (used by ECMAScript decorators transformation) - RunInitializers = 1 << 24, // __runInitializers (used by ECMAScript decorators transformation) + SetFunctionName = 1 << 23, // __setFunctionName (used by class fields and ECMAScript decorators) + PropKey = 1 << 24, // __propKey (used by class fields and ECMAScript decorators) + FirstEmitHelper = Extends, - LastEmitHelper = RunInitializers, + LastEmitHelper = PropKey, // Helpers included by ES2015 for..of ForOfIncludes = Values, @@ -7695,6 +7703,12 @@ export type OuterExpression = | NonNullExpression | PartiallyEmittedExpression; +/** @internal */ +export type WrappedExpression = + | OuterExpression & { readonly expression: WrappedExpression } + | T + ; + export type TypeOfTag = "undefined" | "number" | "bigint" | "boolean" | "string" | "symbol" | "object" | "function"; /** @internal */ diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 91ae905fe65ba..e6a0c826d28aa 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -91,6 +91,7 @@ import { ValidImportTypeNode, VariableDeclaration, VariableDeclarationInitializedTo, VariableDeclarationList, VariableLikeDeclaration, VariableStatement, version, WhileStatement, WithStatement, WriteFileCallback, WriteFileCallbackData, YieldExpression, ClassExpression, InternalEmitFlags, isMethodDeclaration, + AmpersandAmpersandEqualsToken, BarBarEqualsToken, QuestionQuestionEqualsToken, WrappedExpression, } from "./_namespaces/ts"; /** @internal */ @@ -4004,6 +4005,114 @@ export function isProtoSetter(node: PropertyName) { isStringLiteral(node) && node.text === "__proto__"; } +/** @internal */ +export type AnonymousFunctionDefinition = + | ClassExpression & { readonly name?: undefined } + | FunctionExpression & { readonly name?: undefined } + | ArrowFunction + ; + +/** + * Indicates whether an expression is an anonymous function definition. + * + * @see https://tc39.es/ecma262/#sec-isanonymousfunctiondefinition + * @internal + */ +export function isAnonymousFunctionDefinition(node: Expression, cb?: (node: AnonymousFunctionDefinition) => boolean): node is WrappedExpression { + node = skipOuterExpressions(node); + switch (node.kind) { + case SyntaxKind.ClassExpression: + case SyntaxKind.FunctionExpression: + if ((node as ClassExpression | FunctionExpression).name) { + return false; + } + break; + case SyntaxKind.ArrowFunction: + break; + default: + return false; + } + return typeof cb === "function" ? cb(node as AnonymousFunctionDefinition) : true; +} + +/** @internal */ +export type NamedEvaluationSource = + | PropertyAssignment & { readonly name: Identifier } + | ShorthandPropertyAssignment & { readonly objectAssignmentInitializer: Expression } + | VariableDeclaration & { readonly name: Identifier, readonly initializer: Expression } + | ParameterDeclaration & { readonly name: Identifier, readonly initializer: Expression, readonly dotDotDotToken: undefined } + | BindingElement & { readonly name: Identifier, readonly initializer: Expression, readonly dotDotDotToken: undefined } + | PropertyDeclaration & { readonly initializer: Expression } + | AssignmentExpression & { readonly left: Identifier } + | ExportAssignment + ; + +/** + * Indicates whether a node is a potential source of an assigned name for a class, function, or arrow function. + * + * @internal + */ +export function isNamedEvaluationSource(node: Node): node is NamedEvaluationSource { + switch (node.kind) { + case SyntaxKind.PropertyAssignment: + return !isProtoSetter((node as PropertyAssignment).name); + case SyntaxKind.ShorthandPropertyAssignment: + return !!(node as ShorthandPropertyAssignment).objectAssignmentInitializer; + case SyntaxKind.VariableDeclaration: + return isIdentifier((node as VariableDeclaration).name) && !!(node as VariableDeclaration).initializer; + case SyntaxKind.Parameter: + return isIdentifier((node as ParameterDeclaration).name) && !!(node as VariableDeclaration).initializer && !(node as BindingElement).dotDotDotToken; + case SyntaxKind.BindingElement: + return isIdentifier((node as BindingElement).name) && !!(node as VariableDeclaration).initializer && !(node as BindingElement).dotDotDotToken; + case SyntaxKind.PropertyDeclaration: + return !!(node as PropertyDeclaration).initializer; + case SyntaxKind.BinaryExpression: + switch ((node as BinaryExpression).operatorToken.kind) { + case SyntaxKind.EqualsToken: + case SyntaxKind.AmpersandAmpersandEqualsToken: + case SyntaxKind.BarBarEqualsToken: + case SyntaxKind.QuestionQuestionEqualsToken: + return isIdentifier((node as BinaryExpression).left); + } + break; + case SyntaxKind.ExportAssignment: + return true; + } + return false; +} + +/** @internal */ +export type NamedEvaluation = + | PropertyAssignment & { readonly name: Identifier, readonly initializer: WrappedExpression } + | ShorthandPropertyAssignment & { readonly objectAssignmentInitializer: WrappedExpression } + | VariableDeclaration & { readonly name: Identifier, readonly initializer: WrappedExpression } + | ParameterDeclaration & { readonly name: Identifier, readonly dotDotDotToken: undefined, readonly initializer: WrappedExpression } + | BindingElement & { readonly name: Identifier, readonly dotDotDotToken: undefined, readonly initializer: WrappedExpression } + | PropertyDeclaration & { readonly initializer: WrappedExpression } + | AssignmentExpression & { readonly left: Identifier, readonly right: WrappedExpression } + | ExportAssignment & { readonly expression: WrappedExpression } + ; + +/** @internal */ +export function isNamedEvaluation(node: Node, cb?: (node: AnonymousFunctionDefinition) => boolean): node is NamedEvaluation { + if (!isNamedEvaluationSource(node)) return false; + switch (node.kind) { + case SyntaxKind.PropertyAssignment: + return isAnonymousFunctionDefinition(node.initializer, cb); + case SyntaxKind.ShorthandPropertyAssignment: + return isAnonymousFunctionDefinition(node.objectAssignmentInitializer, cb); + case SyntaxKind.VariableDeclaration: + case SyntaxKind.Parameter: + case SyntaxKind.BindingElement: + case SyntaxKind.PropertyDeclaration: + return isAnonymousFunctionDefinition(node.initializer, cb); + case SyntaxKind.BinaryExpression: + return isAnonymousFunctionDefinition(node.right, cb); + case SyntaxKind.ExportAssignment: + return isAnonymousFunctionDefinition(node.expression, cb); + } +} + /** @internal */ export function isPushOrUnshiftIdentifier(node: Identifier) { return node.escapedText === "push" || node.escapedText === "unshift"; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.errors.txt new file mode 100644 index 0000000000000..b4a5e19c465c1 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(6,1): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(6,1): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (2 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers + @dec class C {} + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.js new file mode 100644 index 0000000000000..d5480454cf474 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers +@dec class C {} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers +let C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return C = _classThis; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.errors.txt new file mode 100644 index 0000000000000..f329ab98d8afa --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(6,16): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(6,16): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(6,16): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + export default @dec class {} + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.js new file mode 100644 index 0000000000000..c39b9a4c0a89d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +export default @dec class {} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +exports.default = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var default_1 = class { + static { + tslib_1.__setFunctionName(this, "default"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + default_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return default_1 = _classThis; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.errors.txt new file mode 100644 index 0000000000000..48fb852a9e9d7 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(6,1): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(6,1): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(6,1): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + @dec class C { + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + static #foo() {} + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.js new file mode 100644 index 0000000000000..75f96af51fcdc --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +@dec class C { + static #foo() {} +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __setFunctionName +let C = (() => { + var _foo; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { tslib_1.__setFunctionName(this, "C"); } + static { _foo = function _foo() { }; } + static { + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return C = _classThis; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.errors.txt new file mode 100644 index 0000000000000..20e1ff75616de --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + class C { + @dec accessor #x: any; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js new file mode 100644 index 0000000000000..a1e7b88bb4a74 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec accessor #x: any; +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __setFunctionName +let C = (() => { + let _instanceExtraInitializers = []; + let _private_x_decorators; + let _private_x_initializers = []; + let _private_x_descriptor; + return class C { + static { + _private_x_decorators = [dec]; + tslib_1.__esDecorate(this, _private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _private_x_decorators, { kind: "accessor", name: "#x", static: false, private: true, access: { get() { return this.#x; }, set(value) { this.#x = value; } } }, _private_x_initializers, _instanceExtraInitializers); + } + #x_accessor_storage = (tslib_1.__runInitializers(this, _instanceExtraInitializers), tslib_1.__runInitializers(this, _private_x_initializers, void 0)); + get #x() { return _private_x_descriptor.get.call(this); } + set #x(value) { return _private_x_descriptor.set.call(this, value); } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.errors.txt new file mode 100644 index 0000000000000..52f7b2a37331e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (2 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers + class C { + @dec #x: any; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js new file mode 100644 index 0000000000000..9bc20142419c6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers +class C { + @dec #x: any; +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers +let C = (() => { + let _instanceExtraInitializers = []; + let _private_x_decorators; + let _private_x_initializers = []; + return class C { + static { + _private_x_decorators = [dec]; + tslib_1.__esDecorate(null, null, _private_x_decorators, { kind: "field", name: "#x", static: false, private: true, access: { get() { return this.#x; }, set(value) { this.#x = value; } } }, _private_x_initializers, _instanceExtraInitializers); + } + #x = (tslib_1.__runInitializers(this, _instanceExtraInitializers), tslib_1.__runInitializers(this, _private_x_initializers, void 0)); + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.errors.txt new file mode 100644 index 0000000000000..95028c51f878b --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + class C { + @dec get #foo() { return 1; } + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.js new file mode 100644 index 0000000000000..9ed858c954f83 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec get #foo() { return 1; } +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __setFunctionName +let C = (() => { + let _instanceExtraInitializers = []; + let _private_get_foo_decorators; + let _private_get_foo_descriptor; + return class C { + static { + _private_get_foo_decorators = [dec]; + tslib_1.__esDecorate(this, _private_get_foo_descriptor = { get: tslib_1.__setFunctionName(function () { return 1; }, "#foo", "get") }, _private_get_foo_decorators, { kind: "getter", name: "#foo", static: false, private: true, access: { get() { return this.#foo; } } }, null, _instanceExtraInitializers); + } + get #foo() { return _private_get_foo_descriptor.get.call(this); } + constructor() { + tslib_1.__runInitializers(this, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.errors.txt new file mode 100644 index 0000000000000..eddaa367ef1f0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + class C { + @dec #foo() {} + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.js new file mode 100644 index 0000000000000..d9b8dfbdfd8ae --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec #foo() {} +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __setFunctionName +let C = (() => { + let _instanceExtraInitializers = []; + let _private_foo_decorators; + let _private_foo_descriptor; + return class C { + static { + _private_foo_decorators = [dec]; + tslib_1.__esDecorate(this, _private_foo_descriptor = { value: tslib_1.__setFunctionName(function () { }, "#foo") }, _private_foo_decorators, { kind: "method", name: "#foo", static: false, private: true, access: { get() { return this.#foo; } } }, null, _instanceExtraInitializers); + } + get #foo() { return _private_foo_descriptor.value; } + constructor() { + tslib_1.__runInitializers(this, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.errors.txt new file mode 100644 index 0000000000000..4918fb7d81b11 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + class C { + @dec set #foo(value: number) { } + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.js new file mode 100644 index 0000000000000..187f2c363711a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec set #foo(value: number) { } +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __setFunctionName +let C = (() => { + let _instanceExtraInitializers = []; + let _private_set_foo_decorators; + let _private_set_foo_descriptor; + return class C { + static { + _private_set_foo_decorators = [dec]; + tslib_1.__esDecorate(this, _private_set_foo_descriptor = { set: tslib_1.__setFunctionName(function (value) { }, "#foo", "set") }, _private_set_foo_decorators, { kind: "setter", name: "#foo", static: false, private: true, access: { set(value) { this.#foo = value; } } }, null, _instanceExtraInitializers); + } + set #foo(value) { return _private_set_foo_descriptor.set.call(this, value); } + constructor() { + tslib_1.__runInitializers(this, _instanceExtraInitializers); + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.errors.txt new file mode 100644 index 0000000000000..184ef3fff1b78 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.errors.txt @@ -0,0 +1,28 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,26): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (4 errors) ==== + export {} + + declare var dec: any; + declare var x: any; + + // needs: __esDecorate, __runInitializers, __propKey + class C { + @dec static accessor [x]: any; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~ +!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js new file mode 100644 index 0000000000000..47a7c226c32ca --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js @@ -0,0 +1,37 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static accessor [x]: any; +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __propKey +let C = (() => { + var _a; + let _staticExtraInitializers = []; + let _static_member_decorators; + let _static_member_initializers = []; + return class C { + static { + tslib_1.__esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static #_a_accessor_storage = tslib_1.__runInitializers(this, _static_member_initializers, void 0); + static get [(_static_member_decorators = [dec], _a = tslib_1.__propKey(x))]() { return this.#_a_accessor_storage; } + static set [_a](value) { this.#_a_accessor_storage = value; } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.errors.txt new file mode 100644 index 0000000000000..051a26fa44576 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.errors.txt @@ -0,0 +1,28 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,17): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (4 errors) ==== + export {} + + declare var dec: any; + declare var x: any; + + // needs: __esDecorate, __runInitializers, __propKey + class C { + @dec static [x]: any; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~ +!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js new file mode 100644 index 0000000000000..e7b54bd71e341 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static [x]: any; +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __propKey +let C = (() => { + var _a; + let _staticExtraInitializers = []; + let _static_member_decorators; + let _static_member_initializers = []; + return class C { + static { + tslib_1.__esDecorate(null, null, _static_member_decorators, { kind: "field", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static [(_static_member_decorators = [dec], _a = tslib_1.__propKey(x))] = tslib_1.__runInitializers(this, _static_member_initializers, void 0); + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.errors.txt new file mode 100644 index 0000000000000..73d4ec0b5baa0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + declare var x: any; + + // needs: __esDecorate, __runInitializers, __propKey + class C { + @dec static get [x]() { return 1; } + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.js new file mode 100644 index 0000000000000..47cf10a839bac --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.js @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static get [x]() { return 1; } +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __propKey +let C = (() => { + var _a; + let _staticExtraInitializers = []; + let _static_get_member_decorators; + return class C { + static { + tslib_1.__esDecorate(this, null, _static_get_member_decorators, { kind: "getter", name: _a, static: true, private: false, access: { get() { return this[_a]; } } }, null, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static get [(_static_get_member_decorators = [dec], _a = tslib_1.__propKey(x))]() { return 1; } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.errors.txt new file mode 100644 index 0000000000000..7e8b7178baa9f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + declare var x: any; + + // needs: __esDecorate, __runInitializers, __propKey + class C { + @dec static [x]() {} + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.js new file mode 100644 index 0000000000000..8acc54b323702 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.js @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static [x]() {} +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __propKey +let C = (() => { + var _a; + let _staticExtraInitializers = []; + let _static_member_decorators; + return class C { + static { + tslib_1.__esDecorate(this, null, _static_member_decorators, { kind: "method", name: _a, static: true, private: false, access: { get() { return this[_a]; } } }, null, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static [(_static_member_decorators = [dec], _a = tslib_1.__propKey(x))]() { } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.errors.txt new file mode 100644 index 0000000000000..f2abd8dbc08b7 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(8,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + declare var x: any; + + // needs: __esDecorate, __runInitializers, __propKey + class C { + @dec static set [x](value: number) { } + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.js new file mode 100644 index 0000000000000..5f1d7838c7ac1 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.js @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static set [x](value: number) { } +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __propKey +let C = (() => { + var _a; + let _staticExtraInitializers = []; + let _static_set_member_decorators; + return class C { + static { + tslib_1.__esDecorate(this, null, _static_set_member_decorators, { kind: "setter", name: _a, static: true, private: false, access: { set(value) { this[_a] = value; } } }, null, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static set [(_static_set_member_decorators = [dec], _a = tslib_1.__propKey(x))](value) { } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.errors.txt new file mode 100644 index 0000000000000..f646bc14d7f87 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + class C { + @dec static accessor #x: any; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js new file mode 100644 index 0000000000000..4d5d9628a341e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js @@ -0,0 +1,37 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec static accessor #x: any; +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __setFunctionName +let C = (() => { + let _staticExtraInitializers = []; + let _static_private_x_decorators; + let _static_private_x_initializers = []; + let _static_private_x_descriptor; + return class C { + static { + _static_private_x_decorators = [dec]; + tslib_1.__esDecorate(this, _static_private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _static_private_x_decorators, { kind: "accessor", name: "#x", static: true, private: true, access: { get() { return this.#x; }, set(value) { this.#x = value; } } }, _static_private_x_initializers, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static #x_accessor_storage = tslib_1.__runInitializers(this, _static_private_x_initializers, void 0); + static get #x() { return _static_private_x_descriptor.get.call(this); } + static set #x(value) { return _static_private_x_descriptor.set.call(this, value); } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.errors.txt new file mode 100644 index 0000000000000..870355e1ae4b4 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (2 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers + class C { + @dec static #x: any; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js new file mode 100644 index 0000000000000..3aad3e1f2c419 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers +class C { + @dec static #x: any; +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers +let C = (() => { + let _staticExtraInitializers = []; + let _static_private_x_decorators; + let _static_private_x_initializers = []; + return class C { + static { + _static_private_x_decorators = [dec]; + tslib_1.__esDecorate(null, null, _static_private_x_decorators, { kind: "field", name: "#x", static: true, private: true, access: { get() { return this.#x; }, set(value) { this.#x = value; } } }, _static_private_x_initializers, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static #x = tslib_1.__runInitializers(this, _static_private_x_initializers, void 0); + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.errors.txt new file mode 100644 index 0000000000000..3dd2e89933683 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + class C { + @dec static get #foo() { return 1; } + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.js new file mode 100644 index 0000000000000..88c17479bff7d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.js @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec static get #foo() { return 1; } +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __setFunctionName +let C = (() => { + let _staticExtraInitializers = []; + let _static_private_get_foo_decorators; + let _static_private_get_foo_descriptor; + return class C { + static { + _static_private_get_foo_decorators = [dec]; + tslib_1.__esDecorate(this, _static_private_get_foo_descriptor = { get: tslib_1.__setFunctionName(function () { return 1; }, "#foo", "get") }, _static_private_get_foo_decorators, { kind: "getter", name: "#foo", static: true, private: true, access: { get() { return this.#foo; } } }, null, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static get #foo() { return _static_private_get_foo_descriptor.get.call(this); } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.errors.txt new file mode 100644 index 0000000000000..150ad6c264762 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + class C { + @dec static #foo() {} + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.js new file mode 100644 index 0000000000000..520a21480c202 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.js @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec static #foo() {} +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __setFunctionName +let C = (() => { + let _staticExtraInitializers = []; + let _static_private_foo_decorators; + let _static_private_foo_descriptor; + return class C { + static { + _static_private_foo_decorators = [dec]; + tslib_1.__esDecorate(this, _static_private_foo_descriptor = { value: tslib_1.__setFunctionName(function () { }, "#foo") }, _static_private_foo_decorators, { kind: "method", name: "#foo", static: true, private: true, access: { get() { return this.#foo; } } }, null, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static get #foo() { return _static_private_foo_descriptor.value; } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.errors.txt new file mode 100644 index 0000000000000..fb8b86e40bd26 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classDeclaration/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classDeclaration/main.ts (3 errors) ==== + export {} + + declare var dec: any; + + // needs: __esDecorate, __runInitializers, __setFunctionName + class C { + @dec static set #foo(value: number) { } + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + } + +==== tests/cases/conformance/esDecorators/classDeclaration/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.js new file mode 100644 index 0000000000000..f01772347b935 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.js @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.ts] //// + +//// [main.ts] +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec static set #foo(value: number) { } +} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// needs: __esDecorate, __runInitializers, __setFunctionName +let C = (() => { + let _staticExtraInitializers = []; + let _static_private_set_foo_decorators; + let _static_private_set_foo_descriptor; + return class C { + static { + _static_private_set_foo_decorators = [dec]; + tslib_1.__esDecorate(this, _static_private_set_foo_descriptor = { set: tslib_1.__setFunctionName(function (value) { }, "#foo", "set") }, _static_private_set_foo_decorators, { kind: "setter", name: "#foo", static: true, private: true, access: { set(value) { this.#foo = value; } } }, null, _staticExtraInitializers); + tslib_1.__runInitializers(this, _staticExtraInitializers); + } + static set #foo(value) { return _static_private_set_foo_descriptor.set.call(this, value); } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.errors.txt new file mode 100644 index 0000000000000..e3d8c00a64979 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(4,18): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(4,18): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(4,18): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + declare var dec: any; + + // uses: __esDecorate, __runInitializers, __setFunctionName + export const C = @dec class {}; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.js new file mode 100644 index 0000000000000..50b51a2c16037 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.ts] //// + +//// [main.ts] +declare var dec: any; + +// uses: __esDecorate, __runInitializers, __setFunctionName +export const C = @dec class {}; + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.C = void 0; +const tslib_1 = require("tslib"); +// uses: __esDecorate, __runInitializers, __setFunctionName +exports.C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; +})(); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.errors.txt new file mode 100644 index 0000000000000..9804546976d04 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(7,7): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,7): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,7): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + var C; + + // uses __esDecorate, __runInitializers, __setFunctionName + C &&= @dec class {}; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.js new file mode 100644 index 0000000000000..197a8d003d7ba --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +C &&= @dec class {}; + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +var C; +// uses __esDecorate, __runInitializers, __setFunctionName +C &&= (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; +})(); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.errors.txt new file mode 100644 index 0000000000000..479a3df608e1f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(7,7): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,7): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,7): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + var C; + + // uses __esDecorate, __runInitializers, __setFunctionName + C ??= @dec class {}; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.js new file mode 100644 index 0000000000000..3f059fb32ab25 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +C ??= @dec class {}; + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +var C; +// uses __esDecorate, __runInitializers, __setFunctionName +C ??= (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; +})(); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.errors.txt new file mode 100644 index 0000000000000..791caf9a98ca9 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(5,16): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(5,16): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(5,16): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + // uses __esDecorate, __runInitializers, __setFunctionName + function f(C = @dec class {}) {} + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.js new file mode 100644 index 0000000000000..c5b94a7fee6d5 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +function f(C = @dec class {}) {} + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// uses __esDecorate, __runInitializers, __setFunctionName +function f(C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; +})()) { } diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.errors.txt new file mode 100644 index 0000000000000..85bf23275d22e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(4,20): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(4,20): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(4,20): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + declare var dec: any; + + // uses __esDecorate, __runInitializers, __setFunctionName + export const C = ((@dec class {})); + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.js new file mode 100644 index 0000000000000..838ba46d2d42c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.ts] //// + +//// [main.ts] +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +export const C = ((@dec class {})); + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.C = void 0; +const tslib_1 = require("tslib"); +// uses __esDecorate, __runInitializers, __setFunctionName +exports.C = (((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; +})())); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.errors.txt new file mode 100644 index 0000000000000..7837d61dfe11b --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(6,9): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(6,9): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(6,9): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(6,9): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (4 errors) ==== + export {}; + declare var dec: any; + declare var x: any; + + // uses __esDecorate, __runInitializers, __setFunctionName, __propKey + ({ [x]: @dec class {} }); + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.js new file mode 100644 index 0000000000000..d1b27d09603f9 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; +declare var x: any; + +// uses __esDecorate, __runInitializers, __setFunctionName, __propKey +({ [x]: @dec class {} }); + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +var _a; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// uses __esDecorate, __runInitializers, __setFunctionName, __propKey +({ [_a = tslib_1.__propKey(x)]: (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, _a); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; + })() }); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.errors.txt new file mode 100644 index 0000000000000..43c15ecf8b4c4 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(5,15): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(5,15): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(5,15): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + // uses __esDecorate, __runInitializers, __setFunctionName + class C { D = @dec class {} } + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.js new file mode 100644 index 0000000000000..76e9f13ae66a2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +class C { D = @dec class {} } + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// uses __esDecorate, __runInitializers, __setFunctionName +class C { + D = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "D"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; + })(); +} diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.errors.txt new file mode 100644 index 0000000000000..c23b36e86e18e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.errors.txt @@ -0,0 +1,28 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(6,11): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. +tests/cases/conformance/esDecorators/classExpression/main.ts(6,17): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(6,17): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(6,17): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(6,17): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (5 errors) ==== + export {}; + declare var dec: any; + declare var x: any; + + // uses __esDecorate, __runInitializers, __setFunctionName, __propKey + class C { [x] = @dec class {} } + ~~~ +!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.js new file mode 100644 index 0000000000000..e61323d969d00 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.js @@ -0,0 +1,37 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; +declare var x: any; + +// uses __esDecorate, __runInitializers, __setFunctionName, __propKey +class C { [x] = @dec class {} } + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +var _a; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// uses __esDecorate, __runInitializers, __setFunctionName, __propKey +class C { + [_a = tslib_1.__propKey(x)] = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, _a); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; + })(); +} diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.errors.txt new file mode 100644 index 0000000000000..ec8070313f8b1 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(8,5): error TS2538: Type 'any' cannot be used as an index type. +tests/cases/conformance/esDecorators/classExpression/main.ts(8,13): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(8,13): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(8,13): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (4 errors) ==== + export {}; + declare var dec: any; + declare var x: any; + + var C; + + // uses __esDecorate, __runInitializers, __setFunctionName, __propKey + ({ [x]: C = @dec class {} } = {}); + ~ +!!! error TS2538: Type 'any' cannot be used as an index type. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.js new file mode 100644 index 0000000000000..0c3cc126a9c3a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.js @@ -0,0 +1,37 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; +declare var x: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName, __propKey +({ [x]: C = @dec class {} } = {}); + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +var C; +// uses __esDecorate, __runInitializers, __setFunctionName, __propKey +({ [x]: C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; + })() } = {}); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.errors.txt new file mode 100644 index 0000000000000..a625da3033607 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(4,18): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(4,18): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (2 errors) ==== + declare var dec: any; + + // uses: __esDecorate, __runInitializers + export const C = @dec class C {}; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.js new file mode 100644 index 0000000000000..a6ab301b3cdfa --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.js @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.ts] //// + +//// [main.ts] +declare var dec: any; + +// uses: __esDecorate, __runInitializers +export const C = @dec class C {}; + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.C = void 0; +const tslib_1 = require("tslib"); +// uses: __esDecorate, __runInitializers +exports.C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var C = class { + static { + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + C = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return C = _classThis; +})(); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.errors.txt new file mode 100644 index 0000000000000..5a207f9520711 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(4,17): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(4,17): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(4,17): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + declare var dec: any; + + // uses __esDecorate, __runInitializers, __setFunctionName + export default (@dec class {}); + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.js new file mode 100644 index 0000000000000..bd13effbc5b9e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.js @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.ts] //// + +//// [main.ts] +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +export default (@dec class {}); + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// uses __esDecorate, __runInitializers, __setFunctionName +exports.default = ((() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "default"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; +})()); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.errors.txt new file mode 100644 index 0000000000000..b601b6f9a5905 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,5): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + var C; + + // uses __esDecorate, __runInitializers, __setFunctionName + C = @dec class {}; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.js new file mode 100644 index 0000000000000..1e5e1f8b11b5f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +C = @dec class {}; + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +var C; +// uses __esDecorate, __runInitializers, __setFunctionName +C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; +})(); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.errors.txt new file mode 100644 index 0000000000000..40dea14b07a85 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(7,6): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,6): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,6): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + var C; + + // uses __esDecorate, __runInitializers, __setFunctionName + [C = @dec class {}] = []; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.js new file mode 100644 index 0000000000000..e772afc6a295a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +[C = @dec class {}] = []; + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +var C; +// uses __esDecorate, __runInitializers, __setFunctionName +[C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; + })()] = []; diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.errors.txt new file mode 100644 index 0000000000000..2195aed383ddd --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(5,7): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(5,7): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(5,7): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + // uses __esDecorate, __runInitializers, __setFunctionName + ({ C: @dec class {} }); + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.js new file mode 100644 index 0000000000000..6206e34b9b454 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +({ C: @dec class {} }); + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +// uses __esDecorate, __runInitializers, __setFunctionName +({ C: (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; + })() }); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.errors.txt new file mode 100644 index 0000000000000..a31911e9b4a85 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(7,11): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,11): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,11): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + var C; + + // uses __esDecorate, __runInitializers, __setFunctionName + ({ C: C = @dec class {} } = {}); + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.js new file mode 100644 index 0000000000000..d428e95b2f5d5 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +({ C: C = @dec class {} } = {}); + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +var C; +// uses __esDecorate, __runInitializers, __setFunctionName +({ C: C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; + })() } = {}); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.errors.txt new file mode 100644 index 0000000000000..52a3e6fdd6a83 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(7,8): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,8): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,8): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + var C; + + // uses __esDecorate, __runInitializers, __setFunctionName + ({ C = @dec class {} } = {}); + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.js new file mode 100644 index 0000000000000..e5118d682d071 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +({ C = @dec class {} } = {}); + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +var C; +// uses __esDecorate, __runInitializers, __setFunctionName +({ C = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; + })() } = {}); diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.errors.txt b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.errors.txt new file mode 100644 index 0000000000000..7cdac9c21fd48 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/esDecorators/classExpression/main.ts(7,7): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,7): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/esDecorators/classExpression/main.ts(7,7): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/esDecorators/classExpression/main.ts (3 errors) ==== + export {}; + declare var dec: any; + + var C; + + // uses __esDecorate, __runInitializers, __setFunctionName + C ||= @dec class {}; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + +==== tests/cases/conformance/esDecorators/classExpression/tslib.d.ts (0 errors) ==== + export {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.js b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.js new file mode 100644 index 0000000000000..12695aac79984 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.ts] //// + +//// [main.ts] +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +C ||= @dec class {}; + +//// [tslib.d.ts] +export {} + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +var C; +// uses __esDecorate, __runInitializers, __setFunctionName +C ||= (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var class_1 = class { + static { + tslib_1.__setFunctionName(this, "C"); + tslib_1.__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + class_1 = _classThis = _classDescriptor.value; + tslib_1.__runInitializers(_classThis, _classExtraInitializers); + } + }; + return class_1 = _classThis; +})(); diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.ts new file mode 100644 index 0000000000000..63686e666ea78 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.1.ts @@ -0,0 +1,15 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers +@dec class C {} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.ts new file mode 100644 index 0000000000000..63287e6dd791d --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.2.ts @@ -0,0 +1,15 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +export default @dec class {} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.ts new file mode 100644 index 0000000000000..83c367398e598 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-classDecorator.3.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +@dec class C { + static #foo() {} +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.ts new file mode 100644 index 0000000000000..edc47ae8d7631 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec accessor #x: any; +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.ts new file mode 100644 index 0000000000000..972f4718020b6 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers +class C { + @dec #x: any; +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.ts new file mode 100644 index 0000000000000..895c5a4f660d8 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec get #foo() { return 1; } +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.ts new file mode 100644 index 0000000000000..b577e8ab54e3e --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec #foo() {} +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.ts new file mode 100644 index 0000000000000..55a75695ce08d --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec set #foo(value: number) { } +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.ts new file mode 100644 index 0000000000000..be04ebabb440a --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.ts @@ -0,0 +1,18 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static accessor [x]: any; +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.ts new file mode 100644 index 0000000000000..76043d03f4a35 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.ts @@ -0,0 +1,18 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static [x]: any; +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.ts new file mode 100644 index 0000000000000..33b3e0049e123 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.ts @@ -0,0 +1,18 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static get [x]() { return 1; } +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.ts new file mode 100644 index 0000000000000..3ddb03a280818 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.ts @@ -0,0 +1,18 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static [x]() {} +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.ts new file mode 100644 index 0000000000000..ace3d97bb0cdd --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.ts @@ -0,0 +1,18 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; +declare var x: any; + +// needs: __esDecorate, __runInitializers, __propKey +class C { + @dec static set [x](value: number) { } +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.ts new file mode 100644 index 0000000000000..9f120b5d9c266 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec static accessor #x: any; +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.ts new file mode 100644 index 0000000000000..6b8976acde175 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers +class C { + @dec static #x: any; +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.ts new file mode 100644 index 0000000000000..f90692e9f8e2c --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec static get #foo() { return 1; } +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.ts new file mode 100644 index 0000000000000..a2b07839c80c5 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec static #foo() {} +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.ts new file mode 100644 index 0000000000000..817e1c59fd076 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {} + +declare var dec: any; + +// needs: __esDecorate, __runInitializers, __setFunctionName +class C { + @dec static set #foo(value: number) { } +} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.ts new file mode 100644 index 0000000000000..8503a44c9a844 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.1.ts @@ -0,0 +1,14 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts + +declare var dec: any; + +// uses: __esDecorate, __runInitializers, __setFunctionName +export const C = @dec class {}; + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.ts new file mode 100644 index 0000000000000..28244c4dda57b --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.10.ts @@ -0,0 +1,16 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +C &&= @dec class {}; + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.ts new file mode 100644 index 0000000000000..540552ad6666f --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.11.ts @@ -0,0 +1,16 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +C ??= @dec class {}; + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.ts new file mode 100644 index 0000000000000..f3bef01d8c223 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.12.ts @@ -0,0 +1,14 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +function f(C = @dec class {}) {} + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.ts new file mode 100644 index 0000000000000..8c21f5bb1ebd9 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.13.ts @@ -0,0 +1,14 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts + +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +export const C = ((@dec class {})); + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.ts new file mode 100644 index 0000000000000..32e9c21ee82bd --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.14.ts @@ -0,0 +1,15 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; +declare var x: any; + +// uses __esDecorate, __runInitializers, __setFunctionName, __propKey +({ [x]: @dec class {} }); + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.ts new file mode 100644 index 0000000000000..e0783f42eb5f5 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.15.ts @@ -0,0 +1,14 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +class C { D = @dec class {} } + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.ts new file mode 100644 index 0000000000000..42c7295f03d89 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.16.ts @@ -0,0 +1,15 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; +declare var x: any; + +// uses __esDecorate, __runInitializers, __setFunctionName, __propKey +class C { [x] = @dec class {} } + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.ts new file mode 100644 index 0000000000000..de4d06ca09593 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.17.ts @@ -0,0 +1,17 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; +declare var x: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName, __propKey +({ [x]: C = @dec class {} } = {}); + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.ts new file mode 100644 index 0000000000000..a5916578ac586 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.2.ts @@ -0,0 +1,14 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts + +declare var dec: any; + +// uses: __esDecorate, __runInitializers +export const C = @dec class C {}; + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.ts new file mode 100644 index 0000000000000..fbc70ef161c65 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.3.ts @@ -0,0 +1,14 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts + +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +export default (@dec class {}); + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.ts new file mode 100644 index 0000000000000..230b275438645 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.4.ts @@ -0,0 +1,16 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +C = @dec class {}; + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.ts new file mode 100644 index 0000000000000..dfaf9482b7201 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.5.ts @@ -0,0 +1,16 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +[C = @dec class {}] = []; + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.ts new file mode 100644 index 0000000000000..7f5bb9060ef45 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.6.ts @@ -0,0 +1,14 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +// uses __esDecorate, __runInitializers, __setFunctionName +({ C: @dec class {} }); + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.ts new file mode 100644 index 0000000000000..3c3bbe513a1a7 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.7.ts @@ -0,0 +1,16 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +({ C: C = @dec class {} } = {}); + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.ts new file mode 100644 index 0000000000000..cb81e5fc84553 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.8.ts @@ -0,0 +1,16 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +({ C = @dec class {} } = {}); + +// @filename: tslib.d.ts +export {} diff --git a/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.ts b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.ts new file mode 100644 index 0000000000000..7e6581daeb66e --- /dev/null +++ b/tests/cases/conformance/esDecorators/classExpression/esDecorators-classExpression-missingEmitHelpers-classDecorator.9.ts @@ -0,0 +1,16 @@ +// @target: es2022 +// @importHelpers: true +// @module: commonjs +// @moduleResolution: classic +// @noTypesAndSymbols: true +// @filename: main.ts +export {}; +declare var dec: any; + +var C; + +// uses __esDecorate, __runInitializers, __setFunctionName +C ||= @dec class {}; + +// @filename: tslib.d.ts +export {} From 0d9504e20bec0e68032d5ca9b688e3b384ce6a89 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 9 Nov 2022 14:54:42 -0500 Subject: [PATCH 29/51] Handle named evaluation in parameters, fix test failures --- src/compiler/transformers/classFields.ts | 41 ++++++++++++++++++- .../reference/api/tsserverlibrary.d.ts | 5 ++- tests/baselines/reference/api/typescript.d.ts | 5 ++- .../capturedParametersInInitializers2.js | 5 +++ ...ldInParameterInitializer(target=es2015).js | 5 +++ ...FieldInParameterInitializer(target=es5).js | 5 +++ .../staticFieldWithInterfaceContext.js | 1 + 7 files changed, 63 insertions(+), 4 deletions(-) diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index ef923ee6cc80b..9f3a81f9f59d2 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -42,7 +42,7 @@ import { ObjectAssignmentElement, OmittedExpression, PrivateIdentifierAccessorDeclaration, PrivateIdentifierMethodDeclaration, setPrivateIdentifier, ShorthandPropertyAssignment, SpreadAssignment, SpreadElement, visitCommaListElements, Visitor, accessPrivateIdentifier as accessPrivateIdentifierCommon, Bundle, - isNamedEvaluation, AnonymousFunctionDefinition + isNamedEvaluation, AnonymousFunctionDefinition, ParameterDeclaration } from "../_namespaces/ts"; const enum ClassPropertySubstitutionFlags { @@ -281,6 +281,8 @@ export function transformClassFields(context: TransformationContext): (x: Source return visitVariableStatement(node as VariableStatement); case SyntaxKind.VariableDeclaration: return visitVariableDeclaration(node as VariableDeclaration); + case SyntaxKind.Parameter: + return visitParameterDeclaration(node as ParameterDeclaration); case SyntaxKind.BindingElement: return visitBindingElement(node as BindingElement); case SyntaxKind.ExportAssignment: @@ -473,7 +475,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // a. Let _popValue_ be ? NamedEvaluation of |AssignmentExpression| with argument _propKey_. // ... - if (isNamedEvaluation(node.name, isAnonymousClassNeedingAssignedName)) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const { referencedName, name } = visitReferencedPropertyName(node.name); const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, referencedName), isExpression); return factory.updatePropertyAssignment(node, name, initializer); @@ -527,6 +529,41 @@ export function transformClassFields(context: TransformationContext): (x: Source return visitEachChild(node, visitor, context); } + function visitParameterDeclaration(node: ParameterDeclaration) { + // 8.6.3 RS: IteratorBindingInitialization + // SingleNameBinding : BindingIdentifier Initializer? + // ... + // 5. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + // + // 14.3.3.3 RS: KeyedBindingInitialization + // SingleNameBinding : BindingIdentifier Initializer? + // ... + // 4. If |Initializer| is present and _v_ is *undefined*, then + // a. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then + // i. Set _v_ to ? NamedEvaluation of |Initializer| with argument _bindingId_. + // ... + + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); + const name = visitNode(node.name, visitor, isBindingName); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, assignedName), isExpression); + return factory.updateParameterDeclaration( + node, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, + name, + /*questionToken*/ undefined, + /*type*/ undefined, + initializer + ); + } + + return visitEachChild(node, visitor, context); + } + function visitBindingElement(node: BindingElement) { // 8.6.3 RS: IteratorBindingInitialization // SingleNameBinding : BindingIdentifier Initializer? diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index c7fa9074ea0e1..f077a679313b7 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4453,7 +4453,7 @@ declare namespace ts { type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; - type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; + type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.BarBarToken | SyntaxKind.BarBarEqualsToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionQuestionEqualsToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; @@ -4598,6 +4598,9 @@ declare namespace ts { type ExclamationToken = PunctuationToken; type ColonToken = PunctuationToken; type EqualsToken = PunctuationToken; + type AmpersandAmpersandEqualsToken = PunctuationToken; + type BarBarEqualsToken = PunctuationToken; + type QuestionQuestionEqualsToken = PunctuationToken; type AsteriskToken = PunctuationToken; type EqualsGreaterThanToken = PunctuationToken; type PlusToken = PunctuationToken; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index a98d6466e0073..5c0fde8c3da0a 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -515,7 +515,7 @@ declare namespace ts { type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; - type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; + type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.BarBarToken | SyntaxKind.BarBarEqualsToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionQuestionEqualsToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; @@ -660,6 +660,9 @@ declare namespace ts { type ExclamationToken = PunctuationToken; type ColonToken = PunctuationToken; type EqualsToken = PunctuationToken; + type AmpersandAmpersandEqualsToken = PunctuationToken; + type BarBarEqualsToken = PunctuationToken; + type QuestionQuestionEqualsToken = PunctuationToken; type AsteriskToken = PunctuationToken; type EqualsGreaterThanToken = PunctuationToken; type PlusToken = PunctuationToken; diff --git a/tests/baselines/reference/capturedParametersInInitializers2.js b/tests/baselines/reference/capturedParametersInInitializers2.js index da1f63b58e622..1e84e0fe23685 100644 --- a/tests/baselines/reference/capturedParametersInInitializers2.js +++ b/tests/baselines/reference/capturedParametersInInitializers2.js @@ -15,6 +15,10 @@ function foo2(y = class {[x] = x}, x = 1) { } //// [capturedParametersInInitializers2.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; function foo(y, x, z) { var _a; if (y === void 0) { y = (_a = /** @class */ (function () { @@ -29,6 +33,7 @@ function foo(y, x, z) { class_1.prototype[z] = function () { return z; }; return class_1; }()), + __setFunctionName(_a, "y"), _a.c = x, _a); } if (x === void 0) { x = 1; } diff --git a/tests/baselines/reference/classWithStaticFieldInParameterInitializer(target=es2015).js b/tests/baselines/reference/classWithStaticFieldInParameterInitializer(target=es2015).js index fd89bcefa8bb3..c00b4efd32d10 100644 --- a/tests/baselines/reference/classWithStaticFieldInParameterInitializer(target=es2015).js +++ b/tests/baselines/reference/classWithStaticFieldInParameterInitializer(target=es2015).js @@ -3,8 +3,13 @@ ((b = class { static x = 1 }) => {})(); //// [classWithStaticFieldInParameterInitializer.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; // https://github.com/microsoft/TypeScript/issues/36295 ((b) => { var _a; if (b === void 0) { b = (_a = class { }, + __setFunctionName(_a, "b"), _a.x = 1, _a); } })(); diff --git a/tests/baselines/reference/classWithStaticFieldInParameterInitializer(target=es5).js b/tests/baselines/reference/classWithStaticFieldInParameterInitializer(target=es5).js index 30142396a8e64..c50fa92916a5c 100644 --- a/tests/baselines/reference/classWithStaticFieldInParameterInitializer(target=es5).js +++ b/tests/baselines/reference/classWithStaticFieldInParameterInitializer(target=es5).js @@ -3,6 +3,10 @@ ((b = class { static x = 1 }) => {})(); //// [classWithStaticFieldInParameterInitializer.js] +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; // https://github.com/microsoft/TypeScript/issues/36295 (function (b) { var _a; @@ -11,6 +15,7 @@ } return class_1; }()), + __setFunctionName(_a, "b"), _a.x = 1, _a); } })(); diff --git a/tests/baselines/reference/staticFieldWithInterfaceContext.js b/tests/baselines/reference/staticFieldWithInterfaceContext.js index 139d10a4f325e..eb51f8dad1a6f 100644 --- a/tests/baselines/reference/staticFieldWithInterfaceContext.js +++ b/tests/baselines/reference/staticFieldWithInterfaceContext.js @@ -60,6 +60,7 @@ function f(c) { } return class_3; }()), + __setFunctionName(_a, "c"), _a.x = { a: "a" }, _a); } } From c83e46d45d421c8d7277919235fd4c01b87b7c99 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 9 Nov 2022 15:19:43 -0500 Subject: [PATCH 30/51] Remove src/lib/decorators.parameters.d.ts --- src/lib/decorators.parameters.d.ts | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 src/lib/decorators.parameters.d.ts diff --git a/src/lib/decorators.parameters.d.ts b/src/lib/decorators.parameters.d.ts deleted file mode 100644 index 8e12faa924f2b..0000000000000 --- a/src/lib/decorators.parameters.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -interface ParameterDecoratorContext { - readonly kind: "parameter"; - readonly index: number; - readonly name: string | undefined; - readonly rest: boolean; - addInitializer(initializer: (this: Func) => void): void; -} - -type ParameterDecoratorFunction = < - Func extends Function, - This, - In, - Out = In ->(target: undefined, context: ParameterDecoratorContext) => ((this: This, initialValue: In) => Out) | void; From f4294f39c5ed798f01d252b3f901c7739eda45ca Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 9 Nov 2022 16:59:29 -0500 Subject: [PATCH 31/51] Remove *DecoratorFunctionTypes --- src/compiler/commandLineParser.ts | 1 - src/harness/fourslashInterfaceImpl.ts | 6 - src/lib/decorators.d.ts | 301 +----------------- src/lib/libs.json | 1 - .../Parse --lib option with extra comma.js | 2 +- ... --lib option with trailing white-space.js | 2 +- .../Parse invalid option of library flags.js | 2 +- ...does-not-add-color-when-NO_COLOR-is-set.js | 2 +- ...-when-host-can't-provide-terminal-width.js | 2 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 2 +- 10 files changed, 7 insertions(+), 314 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 19cd9a7cdc5fb..697aba006587c 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -118,7 +118,6 @@ const libEntries: [string, string][] = [ ["esnext.weakref", "lib.es2021.weakref.d.ts"], ["decorators", "lib.decorators.d.ts"], ["decorators.legacy", "lib.decorators.legacy.d.ts"], - ["decorators.parameters", "lib.decorators.parameters.d.ts"], ]; /** diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 2fbe2a044bf2f..cf664bc129709 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1169,19 +1169,13 @@ export namespace Completion { typeEntry("ClassMemberDecoratorContext"), typeEntry("DecoratorContext"), interfaceEntry("ClassDecoratorContext"), - typeEntry("ClassDecoratorFunction"), interfaceEntry("ClassMethodDecoratorContext"), - typeEntry("ClassMethodDecoratorFunction"), interfaceEntry("ClassGetterDecoratorContext"), - typeEntry("ClassGetterDecoratorFunction"), interfaceEntry("ClassSetterDecoratorContext"), - typeEntry("ClassSetterDecoratorFunction"), interfaceEntry("ClassAccessorDecoratorContext"), interfaceEntry("ClassAccessorDecoratorTarget"), interfaceEntry("ClassAccessorDecoratorResult"), - typeEntry("ClassAccessorDecoratorFunction"), interfaceEntry("ClassFieldDecoratorContext"), - typeEntry("ClassFieldDecoratorFunction"), typeEntry("PromiseConstructorLike"), interfaceEntry("PromiseLike"), interfaceEntry("Promise"), diff --git a/src/lib/decorators.d.ts b/src/lib/decorators.d.ts index df3630a9bfda4..490e788d9391f 100644 --- a/src/lib/decorators.d.ts +++ b/src/lib/decorators.d.ts @@ -22,7 +22,7 @@ type DecoratorContext = * @template Class The type of the decorated class associated with this context. */ interface ClassDecoratorContext< - Class extends abstract new (...args: any) => any = abstract new (...args: any) => any + Class extends abstract new (...args: any) => any = abstract new (...args: any) => any, > { /** The kind of element that was decorated. */ readonly kind: "class"; @@ -50,52 +50,6 @@ interface ClassDecoratorContext< addInitializer(initializer: (this: Class) => void): void; } -/** - * Describes a function that can be used to decorate a class. - * @template Overrides Constrains the context to specific values for `name`. - * @template Class The constructor type of the class. - */ -type ClassDecoratorFunction< - Overrides extends { name?: string | undefined } = {}, - Class extends abstract new (...args: any) => any = abstract new (...args: any) => any -> = - /** - * Describes a function that can be used to decorate a class. - * @param target The decorated class constructor. - * @param context Additional context about the decorated class. - * @returns A replacement class constructor, or `undefined`. - */ - ( - target: Class, - context: ClassDecoratorContext & Overrides - ) => Class | void; - -// NOTE: If decorators eventually support type mutation, we will use this definition instead: -// /** -// * Describes a function that can be used to decorate a class. -// * @template Overrides Constrains the context to specific values for `name`. -// * @template In The input constructor type of the class. -// * @template Out The output constructor type of the class. -// * @template Final The final constructor type of the class. -// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. -// */ -// type ClassDecoratorFunction< -// Overrides extends { name?: string | undefined } = {}, -// In extends abstract new (...args: any) => any = abstract new (...args: any) => any, -// Out extends In = In, -// Final extends Out = Out, -// > = -// /** -// * Describes a function that can be used to decorate a class. -// * @param target The decorated class constructor. -// * @param context Additional context about the decorated class. -// * @returns A replacement class constructor, or `undefined`. -// */ -// ( -// target: In, -// context: ClassDecoratorContext & Overrides -// ) => Out | void; - /** * Context provided to a class method decorator. * @template This The type on which the class element will be defined. For a static class element, this will be @@ -156,56 +110,6 @@ interface ClassMethodDecoratorContext< addInitializer(initializer: (this: This) => void): void; } -/** - * Describes a function that can be used to decorate a class method. - * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. - * @template This The `this` type of the decorated class element. - * @template Value The function type of the class method. - */ -type ClassMethodDecoratorFunction< - Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, - This = unknown, - Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any -> = - /** - * Describes a function that can be used to decorate a class method. - * @param target The function for the decorated class method. - * @param context Additional context about the decorated class method. - * @returns A replacement function, or `undefined`. - */ - ( - target: Value, - context: ClassMethodDecoratorContext & Overrides - ) => Value | void; - -// NOTE: If decorators eventually support type mutation, we will use this definition instead: -// /** -// * Describes a function that can be used to decorate a class method. -// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. -// * @template This The final `this` type of the decorated class element. -// * @template In The input function type of the class method. -// * @template Out The output function type of the class method. -// * @template Final The final function type of the class method. -// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. -// */ -// type ClassMethodDecoratorFunction< -// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, -// This = unknown, -// In extends (this: This, ...args: any) => any = (this: This, ...args: any) => any, -// Out extends In = In, -// Final extends Out = Out, -// > = -// /** -// * Describes a function that can be used to decorate a class method. -// * @param target The function for the decorated class method. -// * @param context Additional context about the decorated class method. -// * @returns A replacement function, or `undefined`. -// */ -// ( -// target: In, -// context: ClassMethodDecoratorContext & Overrides -// ) => Out | void; - /** * Context provided to a class getter decorator. * @template This The type on which the class element will be defined. For a static class element, this will be @@ -247,56 +151,6 @@ interface ClassGetterDecoratorContext< addInitializer(initializer: (this: This) => void): void; } -/** - * Describes a function that can be used to decorate a class getter. - * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. - * @template This The `this` type of the decorated class element. - * @template Value The property type of the class getter. - */ -type ClassGetterDecoratorFunction< - Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, - This = unknown, - Value = unknown, -> = - /** - * Describes a function that can be used to decorate a class getter. - * @param target The getter function for the decorated class getter. - * @param context Additional context about the decorated class getter. - * @returns A replacement getter function, or `undefined`. - */ - ( - target: (this: This) => Value, - context: ClassGetterDecoratorContext & Overrides - ) => ((this: This) => Value) | void; - -// NOTE: If decorators eventually support type mutation, we will use this definition instead: -// /** -// * Describes a function that can be used to decorate a class getter. -// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. -// * @template This The final `this` type of the decorated class element. -// * @template In The input property type of the class getter. -// * @template Out The output property type of the class getter. -// * @template Final The final property type of the class getter. -// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. -// */ -// type ClassGetterDecoratorFunction< -// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, -// This = unknown, -// In = unknown, -// Out extends In = In, -// Final extends Out = Out, -// > = -// /** -// * Describes a function that can be used to decorate a class getter. -// * @param target The getter function for the decorated class getter. -// * @param context Additional context about the decorated class getter. -// * @returns A replacement getter function, or `undefined`. -// */ -// ( -// target: (this: This) => In, -// context: ClassGetterDecoratorContext & Overrides -// ) => ((this: This) => Out) | void; - /** * Context provided to a class setter decorator. * @template This The type on which the class element will be defined. For a static class element, this will be @@ -338,57 +192,6 @@ interface ClassSetterDecoratorContext< addInitializer(initializer: (this: This) => void): void; } -/** - * Describes a function that can be used to decorate a class setter. - * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. - * @template This The `this` type of the decorated class element. - * @template Value The property type of the class setter. - * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. - */ -type ClassSetterDecoratorFunction< - Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, - This = unknown, - Value = unknown, -> = - /** - * Describes a function that can be used to decorate a class setter. - * @param target The setter function for the decorated class setter. - * @param context Additional context about the decorated class setter. - * @returns A replacement setter function, or `undefined`. - */ - ( - target: (this: This, value: Value) => void, - context: ClassSetterDecoratorContext & Overrides - ) => ((this: This, value: Value) => void) | void; - -// NOTE: If decorators eventually support type mutation, we will use this definition instead: -// /** -// * Describes a function that can be used to decorate a class setter. -// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. -// * @template This The final `this` type of the decorated class element. -// * @template In The input property type of the class setter. -// * @template Out The output property type of the class setter. -// * @template Final The final property type of the class setter. -// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. -// */ -// type ClassSetterDecoratorFunction< -// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, -// This = unknown, -// In = unknown, -// Out extends In = In, -// Final extends Out = Out, -// > = -// /** -// * Describes a function that can be used to decorate a class setter. -// * @param target The setter function for the decorated class setter. -// * @param context Additional context about the decorated class setter. -// * @returns A replacement setter function, or `undefined`. -// */ -// ( -// target: (this: This, value: In) => void, -// context: ClassSetterDecoratorContext & Overrides -// ) => ((this: This, value: Out) => void) | void; - /** * Context provided to a class `accessor` field decorator. * @template This The type on which the class element will be defined. For a static class element, this will be @@ -485,57 +288,6 @@ interface ClassAccessorDecoratorResult { init?(this: This, value: Value): Value; } -/** - * Describes a function that can be used to decorate a class `accessor` field. - * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. - * @template This The `this` type of the decorated class element. - * @template Value The property type of the class `accessor` field. - * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. - */ -type ClassAccessorDecoratorFunction< - Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, - This = unknown, - Value = unknown, -> = - /** - * Describes a function that can be used to decorate a class `accessor` field. - * @param target The {@link ClassAccessorDecoratorTarget} the decorated class `accessor` field. - * @param context Additional context about the decorated class `accessor` field. - * @returns A {@link ClassAccessorDecoratorResult} that is used to replace the getter or setter or to inject an initializer mutator, or `undefined` to use the existing getter and setter. - */ - ( - target: ClassAccessorDecoratorTarget, - context: ClassAccessorDecoratorContext & Overrides - ) => ClassAccessorDecoratorResult | void; - -// NOTE: If decorators eventually support type mutation, we will use this definition instead: -// /** -// * Describes a function that can be used to decorate a class `accessor` field. -// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. -// * @template This The final `this` type of the decorated class element. -// * @template In The input property type of the class `accessor` field. -// * @template Out The output property type of the class `accessor` field. -// * @template Final The final property type of the class `accessor` field. -// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. -// */ -// type ClassAccessorDecoratorFunction< -// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, -// This = unknown, -// In = unknown, -// Out extends In = In, -// Final extends Out = Out, -// > = -// /** -// * Describes a function that can be used to decorate a class `accessor` field. -// * @param target The {@link ClassAccessorDecoratorTarget} the decorated class `accessor` field. -// * @param context Additional context about the decorated class `accessor` field. -// * @returns A {@link ClassAccessorDecoratorResult} that is used to replace the getter or setter or to inject an initializer mutator, or `undefined` to use the existing getter and setter. -// */ -// ( -// target: ClassAccessorDecoratorTarget, -// context: ClassAccessorDecoratorContext & Overrides -// ) => ClassAccessorDecoratorResult | void; - /** * Context provided to a class field decorator. * @template This The type on which the class element will be defined. For a static class element, this will be @@ -578,54 +330,3 @@ interface ClassFieldDecoratorContext< */ addInitializer(initializer: (this: This) => void): void; } - -/** - * Describes a function that can be used to decorate a class field. - * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. - * @template This The `this` type of the decorated class element. - * @template Value The property type of the class field. - * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. - */ -type ClassFieldDecoratorFunction< - Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, - This = unknown, - Value = unknown, -> = - /** - * Describes a function that can be used to decorate a class field. - * @param target Class field decorators always receive `undefined`. - * @param context Additional context about the decorated class field. - * @returns An initializer mutator function, or `undefined`. - */ - ( - target: undefined, - context: ClassFieldDecoratorContext & Overrides - ) => ((this: This, initialValue: Value) => Value) | void; - -// NOTE: If decorators eventually support type mutation, we will use this definition instead: -// /** -// * Describes a function that can be used to decorate a class field. -// * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`. -// * @template This The final `this` type of the decorated class element. -// * @template In The input property type of the class field. -// * @template Out The output property type of the class field. -// * @template Final The final property type of the class field. -// * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type. -// */ -// type ClassFieldDecoratorFunction< -// Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}, -// This = unknown, -// In = unknown, -// Out extends In = In, -// Final extends Out = Out, -// > = -// /** -// * Describes a function that can be used to decorate a class field. -// * @param target Class field decorators always receive `undefined`. -// * @param context Additional context about the decorated class field. -// * @returns An initializer mutator function, or `undefined`. -// */ -// ( -// target: undefined, -// context: ClassFieldDecoratorContext & Overrides -// ) => ((this: This, initialValue: In) => Out) | void; diff --git a/src/lib/libs.json b/src/lib/libs.json index 80a0de3c554e6..11da5b16775b2 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -65,7 +65,6 @@ "esnext.intl", "decorators", "decorators.legacy", - "decorators.parameters", // Default libraries "es5.full", "es2015.full", diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js index 2b4aa30f111a3..341a72d6d9012 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: es7,0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy', 'decorators.parameters'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js index 3a5113f9c931c..634cad9056da8 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: es7,0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy', 'decorators.parameters'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js index a3ff4f9f3a381..6f5b7ce7c3273 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js @@ -10,4 +10,4 @@ WatchOptions:: FileNames:: 0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy', 'decorators.parameters'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.sharedmemory', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref', 'decorators', 'decorators.legacy'. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js index 274b1f0a01b0d..3840be0955b03 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js @@ -110,7 +110,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl, decorators, decorators.legacy, decorators.parameters +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl, decorators, decorators.legacy default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index f3a6daba2bd6d..06b7b61d3be12 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -110,7 +110,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl, decorators, decorators.legacy, decorators.parameters +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl, decorators, decorators.legacy default: undefined --allowJs diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index f3a6daba2bd6d..06b7b61d3be12 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -110,7 +110,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl, decorators, decorators.legacy, decorators.parameters +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext, dom, dom.iterable, webworker, webworker.importscripts, webworker.iterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise/esnext.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array/esnext.array, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, esnext.intl, decorators, decorators.legacy default: undefined --allowJs From 1fbaa5c52058c222348c07e0ad7ae49682d222e3 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 15 Nov 2022 00:01:00 -0500 Subject: [PATCH 32/51] Fix inconsistent indentation due to merge --- src/compiler/emitter.ts | 10 +++++----- src/compiler/factory/utilities.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4f5733b80b6b4..ef7526ff8f7a2 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4330,7 +4330,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri let mode: "modifiers" | "decorators" | undefined; let start = 0; let pos = 0; - let lastModifier: ModifierLike | undefined; + let lastModifier: ModifierLike | undefined; while (start < modifiers.length) { while (pos < modifiers.length) { lastModifier = modifiers[pos]; @@ -4615,11 +4615,11 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri // /* End of parameter a */ -> this comment isn't considered to be trailing comment of parameter "a" due to newline // , if (format & ListFormat.DelimitersMask && previousSibling.end !== (parentNode ? parentNode.end : -1)) { - const previousSiblingEmitFlags = getEmitFlags(previousSibling); - if (!(previousSiblingEmitFlags & EmitFlags.NoTrailingComments)) { + const previousSiblingEmitFlags = getEmitFlags(previousSibling); + if (!(previousSiblingEmitFlags & EmitFlags.NoTrailingComments)) { emitLeadingCommentsOfPosition(previousSibling.end); } - } + } writeDelimiter(format); recordBundleFileInternalSectionEnd(previousSourceFileTextKind); @@ -5284,7 +5284,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri function generateNameCached(node: Node, privateName: boolean, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string) { const nodeId = getNodeId(node); const cache = privateName ? nodeIdToGeneratedPrivateName : nodeIdToGeneratedName; - return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags ?? GeneratedIdentifierFlags.None, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix))); + return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags ?? GeneratedIdentifierFlags.None, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix))); } /** diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 98e519265bf92..bc6d30e0ac874 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -499,7 +499,7 @@ export function isOuterExpression(node: Node, kinds = OuterExpressionKinds.All): return (kinds & OuterExpressionKinds.Parentheses) !== 0; case SyntaxKind.TypeAssertionExpression: case SyntaxKind.AsExpression: - case SyntaxKind.ExpressionWithTypeArguments: + case SyntaxKind.ExpressionWithTypeArguments: case SyntaxKind.SatisfiesExpression: return (kinds & OuterExpressionKinds.TypeAssertions) !== 0; case SyntaxKind.NonNullExpression: From 4841c5f3de0dc3ccd39927eb03ceeb8c9c2c4ea2 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 14 Dec 2022 10:07:09 -0500 Subject: [PATCH 33/51] Add cache for decorator context override type --- src/compiler/checker.ts | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a5b06a6051acd..4177b19534abc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1812,6 +1812,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const stringMappingTypes = new Map(); const substitutionTypes = new Map(); const subtypeReductionCache = new Map(); + const decoratorContextOverrideTypeCache = new Map(); const cachedTypes = new Map(); const evolvingArrayTypes: EvolvingArrayType[] = []; const undefinedProperties: SymbolTable = new Map(); @@ -34221,26 +34222,22 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return tryCreateTypeReference(getGlobalClassFieldDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); } - function tryCreateClassMemberDecoratorContextOverrideType(nameType?: Type, isStatic?: boolean, isPrivate?: boolean) { - let members: SymbolTable | undefined; - if (nameType !== undefined) { - const symbol = createProperty("name" as __String, nameType); - members ??= createSymbolTable(); - members.set(symbol.escapedName, symbol); - } - if (isPrivate !== undefined) { - const symbol = createProperty("private" as __String, isPrivate ? trueType : falseType); - members ??= createSymbolTable(); - members.set(symbol.escapedName, symbol); - } - if (isStatic !== undefined) { - const symbol = createProperty("static" as __String, isStatic ? trueType : falseType); - members ??= createSymbolTable(); - members.set(symbol.escapedName, symbol); - } - if (members) { - return createAnonymousType(/*symbol*/ undefined, members, emptyArray, emptyArray, emptyArray); + /** + * Gets a type like `{ name: "foo", private: false, static: true }` that is used to provided member-specific + * details that will be intersected with a decorator context type. + */ + function getClassMemberDecoratorContextOverrideType(nameType: Type, isPrivate: boolean, isStatic: boolean) { + const key = `${isPrivate ? "p" : "P"}${isStatic ? "s" : "S"}${nameType.id}` as const; + let overrideType = decoratorContextOverrideTypeCache.get(key); + if (!overrideType) { + const members = createSymbolTable(); + members.set("name" as __String, createProperty("name" as __String, nameType)); + members.set("private" as __String, createProperty("private" as __String, isPrivate ? trueType : falseType)); + members.set("static" as __String, createProperty("static" as __String, isStatic ? trueType : falseType)); + overrideType = createAnonymousType(/*symbol*/ undefined, members, emptyArray, emptyArray, emptyArray); + decoratorContextOverrideTypeCache.set(key, overrideType); } + return overrideType; } function createClassMemberDecoratorContextTypeForNode(node: MethodDeclaration | AccessorDeclaration | PropertyDeclaration, thisType: Type, valueType: Type) { @@ -34254,8 +34251,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { isAutoAccessorPropertyDeclaration(node) ? createClassAccessorDecoratorContextType(thisType, valueType) : isPropertyDeclaration(node) ? createClassFieldDecoratorContextType(thisType, valueType) : Debug.failBadSyntaxKind(node); - const overrideType = tryCreateClassMemberDecoratorContextOverrideType(nameType, isStatic, isPrivate); - return overrideType ? getIntersectionType([contextType, overrideType]) : contextType; + const overrideType = getClassMemberDecoratorContextOverrideType(nameType, isPrivate, isStatic); + return getIntersectionType([contextType, overrideType]); } From 1746823b1ea0e947aa8416e3e9ef5b0ed0acd5b1 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 15 Dec 2022 19:38:34 -0500 Subject: [PATCH 34/51] Update syntactic diagnostics for JS files --- src/compiler/diagnosticMessages.json | 4 ++ src/compiler/factory/nodeTests.ts | 6 +++ src/compiler/program.ts | 37 +++++++++++++++++-- .../reference/decoratorInJsFile1.errors.txt | 5 +-- ...classDeclaration-exportModifier.errors.txt | 35 ++++++++++++++++++ ...rs-classDeclaration-exportModifier.symbols | 35 ++++++++++++++++++ ...tors-classDeclaration-exportModifier.types | 35 ++++++++++++++++++ .../getSupportedCodeFixes-can-be-proxied.js | 3 ++ ...orators-classDeclaration-exportModifier.ts | 33 +++++++++++++++++ 9 files changed, 186 insertions(+), 7 deletions(-) create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-exportModifier.errors.txt create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-exportModifier.symbols create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-exportModifier.types create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-exportModifier.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 372c7e4347c1a..949763f8397ad 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -6456,6 +6456,10 @@ "category": "Error", "code": 8037 }, + "Decorators must come after 'export' or 'export default' in JavaScript files.": { + "category": "Error", + "code": 8038 + }, "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.": { "category": "Error", diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index 874b443d9bdc5..fe6d87cd7d977 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -40,6 +40,7 @@ import { DebuggerStatement, Decorator, DefaultClause, + DefaultKeyword, DeleteExpression, DoStatement, DotDotDotToken, @@ -332,6 +333,11 @@ export function isExportModifier(node: Node): node is ExportKeyword { return node.kind === SyntaxKind.ExportKeyword; } +/** @internal */ +export function isDefaultModifier(node: Node): node is DefaultKeyword { + return node.kind === SyntaxKind.DefaultKeyword; +} + /** @internal */ export function isAsyncModifier(node: Node): node is AsyncKeyword { return node.kind === SyntaxKind.AsyncKeyword; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 17939485aeec0..03f1d06fa5a9e 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -10,7 +10,8 @@ import { AssertClause, BuilderProgram, CancellationToken, - canHaveModifiers, + canHaveDecorators, + canHaveIllegalDecorators, chainDiagnosticMessages, changeExtension, changesAffectingProgramStructure, @@ -88,6 +89,7 @@ import { FileReference, filter, find, + findIndex, firstDefined, firstDefinedIterator, flatMap, @@ -170,9 +172,12 @@ import { isArrayLiteralExpression, isBuildInfoFile, isCheckJsEnabledForFile, + isClassDeclaration, isDeclarationFileName, isDecorator, + isDefaultModifier, isExportDeclaration, + isExportModifier, isExternalModule, isExternalModuleNameRelative, isIdentifierText, @@ -187,6 +192,7 @@ import { isModifier, isModuleDeclaration, isObjectLiteralExpression, + isParameter, isPlainJsFile, isRequireCall, isRootedDiskPath, @@ -2933,8 +2939,33 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } function walkArray(nodes: NodeArray, parent: Node) { - if (canHaveModifiers(parent) && parent.modifiers === nodes && some(nodes, isDecorator) && !options.experimentalDecorators) { - diagnostics.push(createDiagnosticForNode(parent, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); + if (canHaveIllegalDecorators(parent)) { + const decorator = find(parent.decoratorsAndModifiers, isDecorator); + if (decorator) { + // report illegal decorator + diagnostics.push(createDiagnosticForNode(decorator, Diagnostics.Decorators_are_not_valid_here)); + } + } + else if (canHaveDecorators(parent) && parent.modifiers) { + const decoratorIndex = findIndex(parent.modifiers, isDecorator); + if (decoratorIndex >= 0) { + if (isParameter(parent) && !options.experimentalDecorators) { + // report illegall decorator on parameter + diagnostics.push(createDiagnosticForNode(parent.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here)); + } + else if (isClassDeclaration(parent)) { + const exportIndex = findIndex(parent.modifiers, isExportModifier); + const defaultIndex = findIndex(parent.modifiers, isDefaultModifier); + if (exportIndex >= 0 && decoratorIndex < exportIndex) { + // report illegal decorator before `export default` + diagnostics.push(createDiagnosticForNode(parent.modifiers[decoratorIndex], Diagnostics.Decorators_must_come_after_export_or_export_default_in_JavaScript_files)); + } + else if (defaultIndex >= 0 && decoratorIndex < defaultIndex) { + // report illegal decorator before `export default` + diagnostics.push(createDiagnosticForNode(parent.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here)); + } + } + } } switch (parent.kind) { diff --git a/tests/baselines/reference/decoratorInJsFile1.errors.txt b/tests/baselines/reference/decoratorInJsFile1.errors.txt index e436dfca859d7..3524eb863e51e 100644 --- a/tests/baselines/reference/decoratorInJsFile1.errors.txt +++ b/tests/baselines/reference/decoratorInJsFile1.errors.txt @@ -1,12 +1,9 @@ -tests/cases/compiler/a.js(2,7): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. tests/cases/compiler/a.js(3,12): error TS8010: Type annotations can only be used in TypeScript files. -==== tests/cases/compiler/a.js (2 errors) ==== +==== tests/cases/compiler/a.js (1 errors) ==== @SomeDecorator class SomeClass { - ~~~~~~~~~ -!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. foo(x: number) { ~~~~~~ !!! error TS8010: Type annotations can only be used in TypeScript files. diff --git a/tests/baselines/reference/esDecorators-classDeclaration-exportModifier.errors.txt b/tests/baselines/reference/esDecorators-classDeclaration-exportModifier.errors.txt new file mode 100644 index 0000000000000..e782ff4f31aa8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-exportModifier.errors.txt @@ -0,0 +1,35 @@ +tests/cases/conformance/esDecorators/classDeclaration/file1.js(2,1): error TS8038: Decorators must come after 'export' or 'export default' in JavaScript files. +tests/cases/conformance/esDecorators/classDeclaration/file2.js(2,1): error TS8038: Decorators must come after 'export' or 'export default' in JavaScript files. +tests/cases/conformance/esDecorators/classDeclaration/file3.js(2,8): error TS1206: Decorators are not valid here. + + +==== tests/cases/conformance/esDecorators/classDeclaration/global.js (0 errors) ==== + /** @type {*} */ + var dec; + +==== tests/cases/conformance/esDecorators/classDeclaration/file1.js (1 errors) ==== + // error + @dec export class C1 { } + ~~~~ +!!! error TS8038: Decorators must come after 'export' or 'export default' in JavaScript files. + +==== tests/cases/conformance/esDecorators/classDeclaration/file2.js (1 errors) ==== + // error + @dec export default class C2 {} + ~~~~ +!!! error TS8038: Decorators must come after 'export' or 'export default' in JavaScript files. + +==== tests/cases/conformance/esDecorators/classDeclaration/file3.js (1 errors) ==== + // error + export @dec default class C3 {} + ~~~~ +!!! error TS1206: Decorators are not valid here. + +==== tests/cases/conformance/esDecorators/classDeclaration/file4.js (0 errors) ==== + // ok + export @dec class C4 {} + +==== tests/cases/conformance/esDecorators/classDeclaration/file5.js (0 errors) ==== + // ok + export default @dec class C5 {} + \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-exportModifier.symbols b/tests/baselines/reference/esDecorators-classDeclaration-exportModifier.symbols new file mode 100644 index 0000000000000..524fc5929e6c1 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-exportModifier.symbols @@ -0,0 +1,35 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/global.js === +/** @type {*} */ +var dec; +>dec : Symbol(dec, Decl(global.js, 1, 3)) + +=== tests/cases/conformance/esDecorators/classDeclaration/file1.js === +// error +@dec export class C1 { } +>dec : Symbol(dec, Decl(global.js, 1, 3)) +>C1 : Symbol(C1, Decl(file1.js, 0, 0)) + +=== tests/cases/conformance/esDecorators/classDeclaration/file2.js === +// error +@dec export default class C2 {} +>dec : Symbol(dec, Decl(global.js, 1, 3)) +>C2 : Symbol(C2, Decl(file2.js, 0, 0)) + +=== tests/cases/conformance/esDecorators/classDeclaration/file3.js === +// error +export @dec default class C3 {} +>dec : Symbol(dec, Decl(global.js, 1, 3)) +>C3 : Symbol(C3, Decl(file3.js, 0, 0)) + +=== tests/cases/conformance/esDecorators/classDeclaration/file4.js === +// ok +export @dec class C4 {} +>dec : Symbol(dec, Decl(global.js, 1, 3)) +>C4 : Symbol(C4, Decl(file4.js, 0, 0)) + +=== tests/cases/conformance/esDecorators/classDeclaration/file5.js === +// ok +export default @dec class C5 {} +>dec : Symbol(dec, Decl(global.js, 1, 3)) +>C5 : Symbol(C5, Decl(file5.js, 0, 0)) + diff --git a/tests/baselines/reference/esDecorators-classDeclaration-exportModifier.types b/tests/baselines/reference/esDecorators-classDeclaration-exportModifier.types new file mode 100644 index 0000000000000..ab0e682a437f0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-exportModifier.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/global.js === +/** @type {*} */ +var dec; +>dec : any + +=== tests/cases/conformance/esDecorators/classDeclaration/file1.js === +// error +@dec export class C1 { } +>dec : any +>C1 : C1 + +=== tests/cases/conformance/esDecorators/classDeclaration/file2.js === +// error +@dec export default class C2 {} +>dec : any +>C2 : C2 + +=== tests/cases/conformance/esDecorators/classDeclaration/file3.js === +// error +export @dec default class C3 {} +>dec : any +>C3 : C3 + +=== tests/cases/conformance/esDecorators/classDeclaration/file4.js === +// ok +export @dec class C4 {} +>dec : any +>C4 : C4 + +=== tests/cases/conformance/esDecorators/classDeclaration/file5.js === +// ok +export default @dec class C5 {} +>dec : any +>C5 : C5 + diff --git a/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js b/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js index 52912ad4de76c..f25447cca46d0 100644 --- a/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js +++ b/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js @@ -1407,6 +1407,7 @@ Info 32 [00:01:13.000] response: "8035", "8036", "8037", + "8038", "9005", "9006", "17000", @@ -2735,6 +2736,7 @@ Info 38 [00:01:19.000] response: "8035", "8036", "8037", + "8038", "9005", "9006", "17000", @@ -3975,6 +3977,7 @@ Info 40 [00:01:21.000] response: "8035", "8036", "8037", + "8038", "9005", "9006", "17000", diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-exportModifier.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-exportModifier.ts new file mode 100644 index 0000000000000..7f545eab89ec3 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-exportModifier.ts @@ -0,0 +1,33 @@ +// @target: esnext +// @module: esnext +// @allowJs: true +// @noEmit: true +// @filename: global.js + +/** @type {*} */ +var dec; + +// @filename: file1.js + +// error +@dec export class C1 { } + +// @filename: file2.js + +// error +@dec export default class C2 {} + +// @filename: file3.js + +// error +export @dec default class C3 {} + +// @filename: file4.js + +// ok +export @dec class C4 {} + +// @filename: file5.js + +// ok +export default @dec class C5 {} From 50ac2b8aa8a0c4e312e45dabe73b6a4f9f7ee360 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 15 Dec 2022 19:52:12 -0500 Subject: [PATCH 35/51] Remove 'Experimental decorators' warning from diagnosticMessages.json --- src/compiler/diagnosticMessages.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d1613e8fbdce8..6aacb8cf4763d 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -687,10 +687,6 @@ "category": "Error", "code": 1218 }, - "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.": { - "category": "Error", - "code": 1219 - }, "Generators are not allowed in an ambient context.": { "category": "Error", "code": 1221 From 50ae4dfa941a44b9f7ec3d5d68504247a7373454 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 5 Jan 2023 12:06:41 -0500 Subject: [PATCH 36/51] Remove 'experimentalDecorators' quick fix --- src/compiler/commandLineParser.ts | 3 +- src/compiler/diagnosticMessages.json | 2 +- src/services/_namespaces/ts.codefix.ts | 1 - .../fixEnableExperimentalDecorators.ts | 41 ------------------- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- ...tes-diagnostics-and-emit-for-decorators.js | 24 +++++++++-- .../getSupportedCodeFixes-can-be-proxied.js | 3 -- 17 files changed, 35 insertions(+), 61 deletions(-) delete mode 100644 src/services/codefixes/fixEnableExperimentalDecorators.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 7a961166278b7..3d43e9621ea44 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1156,10 +1156,11 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ { name: "experimentalDecorators", type: "boolean", + affectsEmit: true, affectsSemanticDiagnostics: true, affectsBuildInfo: true, category: Diagnostics.Language_and_Environment, - description: Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators, + description: Diagnostics.Enable_experimental_support_for_legacy_experimental_decorators, defaultValueDescription: false, }, { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6aacb8cf4763d..aa86c3bc737ee 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -5631,7 +5631,7 @@ "category": "Message", "code": 6629 }, - "Enable experimental support for TC39 stage 2 draft decorators.": { + "Enable experimental support for legacy experimental decorators.": { "category": "Message", "code": 6630 }, diff --git a/src/services/_namespaces/ts.codefix.ts b/src/services/_namespaces/ts.codefix.ts index 23e971449be17..5270a0c664e26 100644 --- a/src/services/_namespaces/ts.codefix.ts +++ b/src/services/_namespaces/ts.codefix.ts @@ -34,7 +34,6 @@ export * from "../codefixes/fixCannotFindModule"; export * from "../codefixes/fixClassDoesntImplementInheritedAbstractMember"; export * from "../codefixes/fixClassSuperMustPrecedeThisAccess"; export * from "../codefixes/fixConstructorForDerivedNeedSuperCall"; -export * from "../codefixes/fixEnableExperimentalDecorators"; export * from "../codefixes/fixEnableJsxFlag"; export * from "../codefixes/fixNaNEquality"; export * from "../codefixes/fixModuleAndTargetOptions"; diff --git a/src/services/codefixes/fixEnableExperimentalDecorators.ts b/src/services/codefixes/fixEnableExperimentalDecorators.ts deleted file mode 100644 index 271c9b969118c..0000000000000 --- a/src/services/codefixes/fixEnableExperimentalDecorators.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { - Diagnostics, - factory, - textChanges, - TsConfigSourceFile, -} from "../_namespaces/ts"; -import { - codeFixAll, - createCodeFixActionWithoutFixAll, - registerCodeFix, - setJsonCompilerOptionValue, -} from "../_namespaces/ts.codefix"; - -const fixId = "enableExperimentalDecorators"; -const errorCodes = [ - Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning.code -]; -registerCodeFix({ - errorCodes, - getCodeActions: function getCodeActionsToEnableExperimentalDecorators(context) { - const { configFile } = context.program.getCompilerOptions(); - if (configFile === undefined) { - return undefined; - } - - const changes = textChanges.ChangeTracker.with(context, changeTracker => doChange(changeTracker, configFile)); - return [createCodeFixActionWithoutFixAll(fixId, changes, Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)]; - }, - fixIds: [fixId], - getAllCodeActions: context => codeFixAll(context, errorCodes, (changes) => { - const { configFile } = context.program.getCompilerOptions(); - if (configFile === undefined) { - return undefined; - } - doChange(changes, configFile); - }), -}); - -function doChange(changeTracker: textChanges.ChangeTracker, configFile: TsConfigSourceFile) { - setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", factory.createTrue()); -} diff --git a/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json index 278a4b9acc500..be9f0ccf62804 100644 --- a/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json index 278a4b9acc500..be9f0ccf62804 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json index 278a4b9acc500..be9f0ccf62804 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json index 09409f72b56f8..a9ff6b25f62d2 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 8e62af7a4e98b..a2bdc0a6007ad 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 668c2673716dc..d26985ee059e8 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -14,7 +14,7 @@ "target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ "jsx": "react", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json index c061d6de30f84..58c8f396e9fa8 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 225eaf0502755..6d85a454761e8 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ "lib": ["es5","es2015.promise"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index 278a4b9acc500..be9f0ccf62804 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 4cccea8eff898..3daf44e308f9a 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ "lib": ["es5","es2015.core"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json index a4f8d9b3abbb0..dd87e265e2a22 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -14,7 +14,7 @@ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js b/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js index e6e1d9e3b238b..6de22d4a5fcc4 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-diagnostics-and-emit-for-decorators.js @@ -164,7 +164,7 @@ Output:: 1 import {B} from './b'   ~~~~~~~~~~~~~~~~~~~~~ -[12:00:24 AM] Found 1 error. Watching for file changes. +[12:00:30 AM] Found 1 error. Watching for file changes. @@ -201,6 +201,24 @@ FsWatchesRecursive:: exitCode:: ExitStatus.undefined +//// [/b.js] file written with same contents +//// [/a.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +import './b'; +let A = class A { + constructor(p) { } +}; +A = __decorate([ + ((_) => { }) +], A); +export { A }; + + Change:: Enable emitDecoratorMetadata @@ -211,9 +229,9 @@ Input:: Output:: >> Screen clear -[12:00:27 AM] File change detected. Starting incremental compilation... +[12:00:33 AM] File change detected. Starting incremental compilation... -[12:00:34 AM] Found 0 errors. Watching for file changes. +[12:00:40 AM] Found 0 errors. Watching for file changes. diff --git a/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js b/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js index 482056a3a3d67..6b20820d344cf 100644 --- a/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js +++ b/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js @@ -356,7 +356,6 @@ Info 32 [00:01:13.000] response: "2653", "17009", "2377", - "1219", "17004", "2845", "1378", @@ -1688,7 +1687,6 @@ Info 38 [00:01:19.000] response: "2653", "17009", "2377", - "1219", "17004", "2845", "1378", @@ -2932,7 +2930,6 @@ Info 40 [00:01:21.000] response: "2653", "17009", "2377", - "1219", "17004", "2845", "1378", From ae3885a7f0d2a8f20af940028cd4a133bae72e4c Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 10 Jan 2023 16:56:18 -0500 Subject: [PATCH 37/51] Simplify decorators+modifiers merge --- src/compiler/binder.ts | 2 +- src/compiler/checker.ts | 11 +- src/compiler/emitter.ts | 79 +++++---- src/compiler/factory/nodeConverters.ts | 3 +- src/compiler/factory/nodeFactory.ts | 165 +++++------------- src/compiler/parser.ts | 102 ++++------- src/compiler/program.ts | 2 +- src/compiler/transformers/declarations.ts | 6 +- src/compiler/types.ts | 116 +++++------- src/compiler/visitorPublic.ts | 22 +-- .../4.8/mergeDecoratorsAndModifiers.ts | 154 ++++++++-------- src/services/codefixes/generateAccessors.ts | 2 +- src/testRunner/unittests/factory.ts | 3 +- .../reference/api/tsserverlibrary.d.ts | 70 ++++---- tests/baselines/reference/api/typescript.d.ts | 70 ++++---- 15 files changed, 332 insertions(+), 475 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 822c5f0d92042..fc23222eb520b 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -3024,7 +3024,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { } function bindNamespaceExportDeclaration(node: NamespaceExportDeclaration) { - if (some(node.decoratorsAndModifiers)) { + if (some(node.modifiers)) { file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Modifiers_cannot_appear_here)); } const diag = !isSourceFile(node.parent) ? Diagnostics.Global_module_exports_may_only_appear_at_top_level diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b3112ad886677..f5de460e383eb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -46534,8 +46534,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { * undefined: Need to do full checking on the modifiers. */ function reportObviousModifierErrors(node: HasModifiers | HasIllegalModifiers): boolean | undefined { - const unmodified = canHaveModifiers(node) ? !node.modifiers : !node.decoratorsAndModifiers; - if (unmodified) return false; + if (!node.modifiers) return false; const modifier = findFirstIllegalModifier(node); return modifier && grammarErrorOnFirstToken(modifier, Diagnostics.Modifiers_cannot_appear_here); @@ -46572,7 +46571,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { case SyntaxKind.NamespaceExportDeclaration: case SyntaxKind.FunctionType: case SyntaxKind.MissingDeclaration: - return find(node.decoratorsAndModifiers, isModifier); + return find(node.modifiers, isModifier); default: if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { return undefined; @@ -46602,7 +46601,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function findFirstIllegalDecorator(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators): Decorator | undefined { - if (canHaveIllegalDecorators(node)) return find(node.decoratorsAndModifiers, isDecorator); + return canHaveIllegalDecorators(node) ? find(node.modifiers, isDecorator) : undefined; } function checkGrammarAsyncModifier(node: Node, asyncModifier: Node): boolean { @@ -46947,8 +46946,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } } - else if (canHaveIllegalModifiers(prop) && prop.decoratorsAndModifiers) { - for (const mod of prop.decoratorsAndModifiers) { + else if (canHaveIllegalModifiers(prop) && prop.modifiers) { + for (const mod of prop.modifiers) { if (isModifier(mod)) { grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 15088267c9fb7..aad103f49d45e 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2527,7 +2527,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri // function emitTypeParameter(node: TypeParameterDeclaration) { - emitModifiers(node, node.modifiers); + emitModifierList(node, node.modifiers); emit(node.name); if (node.constraint) { writeSpace(); @@ -2544,7 +2544,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitParameter(node: ParameterDeclaration) { - emitDecoratorsAndModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ true); emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); @@ -2568,7 +2568,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri // function emitPropertySignature(node: PropertySignature) { - emitModifiers(node, node.modifiers); + emitModifierList(node, node.modifiers); emitNodeWithWriter(node.name, writeProperty); emit(node.questionToken); emitTypeAnnotation(node.type); @@ -2576,7 +2576,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitPropertyDeclaration(node: PropertyDeclaration) { - emitDecoratorsAndModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ true); emit(node.name); emit(node.questionToken); emit(node.exclamationToken); @@ -2587,7 +2587,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri function emitMethodSignature(node: MethodSignature) { pushNameGenerationScope(node); - emitModifiers(node, node.modifiers); + emitModifierList(node, node.modifiers); emit(node.name); emit(node.questionToken); emitTypeParameters(node, node.typeParameters); @@ -2598,7 +2598,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitMethodDeclaration(node: MethodDeclaration) { - emitDecoratorsAndModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ true); emit(node.asteriskToken); emit(node.name); emit(node.questionToken); @@ -2611,13 +2611,13 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitConstructor(node: ConstructorDeclaration) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); writeKeyword("constructor"); emitSignatureAndBody(node, emitSignatureHead); } function emitAccessorDeclaration(node: AccessorDeclaration) { - const pos = emitDecoratorsAndModifiers(node, node.modifiers); + const pos = emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ true); const token = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.GetKeyword : SyntaxKind.SetKeyword; emitTokenWithComment(token, pos, writeKeyword, node); writeSpace(); @@ -2646,7 +2646,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitIndexSignature(node: IndexSignatureDeclaration) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); emitParametersForIndexSignature(node, node.parameters); emitTypeAnnotation(node.type); writeTrailingSemicolon(); @@ -2720,7 +2720,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri function emitConstructorType(node: ConstructorTypeNode) { pushNameGenerationScope(node); - emitModifiers(node, node.modifiers); + emitModifierList(node, node.modifiers); writeKeyword("new"); writeSpace(); emitTypeParameters(node, node.typeParameters); @@ -3108,7 +3108,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitArrowFunction(node: ArrowFunction) { - emitModifiers(node, node.modifiers); + emitModifierList(node, node.modifiers); emitSignatureAndBody(node, emitArrowFunctionHead); } @@ -3383,7 +3383,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitVariableStatement(node: VariableStatement) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); emit(node.declarationList); writeTrailingSemicolon(); } @@ -3664,7 +3664,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitFunctionDeclarationOrExpression(node: FunctionDeclaration | FunctionExpression) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); writeKeyword("function"); emit(node.asteriskToken); writeSpace(); @@ -3795,7 +3795,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri forEach(node.members, generateMemberNames); - emitDecoratorsAndModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ true); emitTokenWithComment(SyntaxKind.ClassKeyword, moveRangePastModifiers(node).pos, writeKeyword, node); if (node.name) { writeSpace(); @@ -3827,7 +3827,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri // we can step out of it when emitting a computed property. pushPrivateNameGenerationScope(TempFlags.Auto, /*newReservedMemberNames*/ undefined); - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); writeKeyword("interface"); writeSpace(); emit(node.name); @@ -3842,7 +3842,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitTypeAliasDeclaration(node: TypeAliasDeclaration) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); writeKeyword("type"); writeSpace(); emit(node.name); @@ -3855,7 +3855,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitEnumDeclaration(node: EnumDeclaration) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); writeKeyword("enum"); writeSpace(); emit(node.name); @@ -3867,7 +3867,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitModuleDeclaration(node: ModuleDeclaration) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); if (~node.flags & NodeFlags.GlobalAugmentation) { writeKeyword(node.flags & NodeFlags.Namespace ? "namespace" : "module"); writeSpace(); @@ -3900,7 +3900,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitImportEqualsDeclaration(node: ImportEqualsDeclaration) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); emitTokenWithComment(SyntaxKind.ImportKeyword, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { @@ -3925,7 +3925,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitImportDeclaration(node: ImportDeclaration) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); emitTokenWithComment(SyntaxKind.ImportKeyword, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.importClause) { @@ -3987,7 +3987,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitExportDeclaration(node: ExportDeclaration) { - emitModifiers(node, node.modifiers); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false); let nextPos = emitTokenWithComment(SyntaxKind.ExportKeyword, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { @@ -4717,16 +4717,19 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri write = savedWrite; } - function emitDecoratorsAndModifiers(node: Node, modifiers: NodeArray | undefined) { + function emitDecoratorsAndModifiers(node: Node, modifiers: NodeArray | undefined, allowDecorators: boolean) { if (modifiers?.length) { if (every(modifiers, isModifier)) { // if all modifier-likes are `Modifier`, simply emit the array as modifiers. - return emitModifiers(node, modifiers as NodeArray); + return emitModifierList(node, modifiers as NodeArray); } if (every(modifiers, isDecorator)) { - // if all modifier-likes are `Decorator`, simply emit the array as decorators. - return emitDecorators(node, modifiers as NodeArray); + if (allowDecorators) { + // if all modifier-likes are `Decorator`, simply emit the array as decorators. + return emitDecoratorList(node, modifiers as NodeArray); + } + return node.pos; } onBeforeEmitNodeArray?.(modifiers); @@ -4754,16 +4757,18 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri const textRange: TextRange = { pos: -1, end: -1 }; if (start === 0) textRange.pos = modifiers.pos; if (pos === modifiers.length - 1) textRange.end = modifiers.end; - emitNodeListItems( - emit, - node, - modifiers, - lastMode === "modifiers" ? ListFormat.Modifiers : ListFormat.Decorators, - /*parenthesizerRule*/ undefined, - start, - pos - start, - /*hasTrailingComma*/ false, - textRange); + if (lastMode === "modifiers" || allowDecorators) { + emitNodeListItems( + emit, + node, + modifiers, + lastMode === "modifiers" ? ListFormat.Modifiers : ListFormat.Decorators, + /*parenthesizerRule*/ undefined, + start, + pos - start, + /*hasTrailingComma*/ false, + textRange); + } start = pos; lastMode = mode; pos++; @@ -4779,7 +4784,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri return node.pos; } - function emitModifiers(node: Node, modifiers: NodeArray | undefined): number { + function emitModifierList(node: Node, modifiers: NodeArray | undefined): number { emitList(node, modifiers, ListFormat.Modifiers); const lastModifier = lastOrUndefined(modifiers); return lastModifier && !positionIsSynthesized(lastModifier.end) ? lastModifier.end : node.pos; @@ -4848,7 +4853,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } } - function emitDecorators(parentNode: Node, decorators: NodeArray | undefined): number { + function emitDecoratorList(parentNode: Node, decorators: NodeArray | undefined): number { emitList(parentNode, decorators, ListFormat.Decorators); const lastDecorator = lastOrUndefined(decorators); return lastDecorator && !positionIsSynthesized(lastDecorator.end) ? lastDecorator.end : parentNode.pos; diff --git a/src/compiler/factory/nodeConverters.ts b/src/compiler/factory/nodeConverters.ts index e506391a78b78..1541d56bf0232 100644 --- a/src/compiler/factory/nodeConverters.ts +++ b/src/compiler/factory/nodeConverters.ts @@ -10,6 +10,7 @@ import { Debug, Expression, FunctionDeclaration, + getModifiers, getStartsOnNewLine, isArrayBindingPattern, isArrayLiteralExpression, @@ -58,7 +59,7 @@ export function createNodeConverters(factory: NodeFactory): NodeConverters { function convertToFunctionExpression(node: FunctionDeclaration) { if (!node.body) return Debug.fail(`Cannot convert a FunctionDeclaration without a body`); const updated = factory.createFunctionExpression( - node.modifiers, + getModifiers(node), node.asteriskToken, node.name, node.typeParameters, diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 4bcd0b97a9f0f..3d077f0b1078e 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1824,7 +1824,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.body = body; node.transformFlags = propagateChildFlags(body) | TransformFlags.ContainsClassFields; - node.decoratorsAndModifiers = undefined; // initialized by parser for grammar errors + node.modifiers = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) @@ -1847,14 +1847,14 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateClassStaticBlockDeclaration(updated: Mutable, original: ClassStaticBlockDeclaration) { if (updated !== original) { // copy children used only for error reporting - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + updated.modifiers = original.modifiers; } return update(updated, original); } // @api function createConstructorDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined ) { @@ -1869,7 +1869,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode (propagateChildFlags(node.body) & ~TransformFlags.ContainsPossibleTopLevelAwait) | TransformFlags.ContainsES2015; - node.decoratorsAndModifiers = undefined; // initialized by parser for grammar errors node.typeParameters = undefined; // initialized by parser for grammar errors node.type = undefined; // initialized by parser for grammar errors node.typeArguments = undefined; // used in quick info @@ -1885,7 +1884,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function updateConstructorDeclaration( node: ConstructorDeclaration, - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined ) { @@ -1898,10 +1897,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateConstructorDeclaration(updated: Mutable, original: ConstructorDeclaration) { if (updated !== original) { - // copy children used only for error reporting - if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; - } updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -2107,7 +2102,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function createIndexSignature( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined ): IndexSignatureDeclaration { @@ -2117,7 +2112,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.type = type!; // TODO(rbuckton): We mark this as required in IndexSignatureDeclaration, but it looks like the parser allows it to be elided. node.transformFlags = TransformFlags.ContainsTypeScript; - node.decoratorsAndModifiers = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) @@ -2129,7 +2123,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function updateIndexSignature( node: IndexSignatureDeclaration, - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode ) { @@ -2214,7 +2208,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.type = type; node.transformFlags = TransformFlags.ContainsTypeScript; - node.decoratorsAndModifiers = undefined; // initialized by parser for grammar errors + node.modifiers = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) @@ -2240,7 +2234,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateFunctionTypeNode(updated: Mutable, original: FunctionTypeNode) { if (updated !== original) { // copy children used only for error reporting - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + updated.modifiers = original.modifiers; } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -3807,7 +3801,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } // @api - function createVariableStatement(modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]) { + function createVariableStatement(modifiers: readonly ModifierLike[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]) { const node = createBaseNode(SyntaxKind.VariableStatement); node.modifiers = asNodeArray(modifiers); node.declarationList = isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -3818,7 +3812,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.transformFlags = TransformFlags.ContainsTypeScript; } - node.decoratorsAndModifiers = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) node.flowNode = undefined; // initialized by binder (FlowContainer) @@ -3826,7 +3819,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } // @api - function updateVariableStatement(node: VariableStatement, modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList) { + function updateVariableStatement(node: VariableStatement, modifiers: readonly ModifierLike[] | undefined, declarationList: VariableDeclarationList) { return node.modifiers !== modifiers || node.declarationList !== declarationList ? update(createVariableStatement(modifiers, declarationList), node) @@ -4307,8 +4300,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode TransformFlags.ContainsHoistedDeclarationOrCompletion; } - node.decoratorsAndModifiers = undefined; // initialized by parser for grammar errors - node.typeArguments = undefined; // used in quick info node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) @@ -4345,7 +4336,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode if (updated !== original) { // copy children used only for error reporting if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + updated.modifiers = original.modifiers; } } return finishUpdateBaseSignatureDeclaration(updated, original); @@ -4408,7 +4399,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function createInterfaceDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, @@ -4422,7 +4413,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.members = createNodeArray(members); node.transformFlags = TransformFlags.ContainsTypeScript; - node.decoratorsAndModifiers = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) return node; @@ -4431,7 +4421,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function updateInterfaceDeclaration( node: InterfaceDeclaration, - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, @@ -4442,23 +4432,13 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members - ? finishUpdateInterfaceDeclaration(createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members), node) + ? update(createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members), node) : node; } - function finishUpdateInterfaceDeclaration(updated: Mutable, original: InterfaceDeclaration) { - if (updated !== original) { - // copy children used only for error reporting - if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; - } - } - return update(updated, original); - } - // @api function createTypeAliasDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode @@ -4470,7 +4450,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.type = type; node.transformFlags = TransformFlags.ContainsTypeScript; - node.decoratorsAndModifiers = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) @@ -4481,7 +4460,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function updateTypeAliasDeclaration( node: TypeAliasDeclaration, - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode @@ -4490,23 +4469,13 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode || node.name !== name || node.typeParameters !== typeParameters || node.type !== type - ? finishUpdateTypeAliasDeclaration(createTypeAliasDeclaration(modifiers, name, typeParameters, type), node) + ? update(createTypeAliasDeclaration(modifiers, name, typeParameters, type), node) : node; } - function finishUpdateTypeAliasDeclaration(updated: Mutable, original: TypeAliasDeclaration) { - if (updated !== original) { - // copy children used only for error reporting - if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; - } - } - return update(updated, original); - } - // @api function createEnumDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, members: readonly EnumMember[] ) { @@ -4521,7 +4490,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode TransformFlags.ContainsTypeScript; node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Enum declarations cannot contain `await` - node.decoratorsAndModifiers = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) return node; @@ -4530,29 +4498,19 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function updateEnumDeclaration( node: EnumDeclaration, - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: Identifier, members: readonly EnumMember[]) { return node.modifiers !== modifiers || node.name !== name || node.members !== members - ? finishUpdateEnumDeclaration(createEnumDeclaration(modifiers, name, members), node) + ? update(createEnumDeclaration(modifiers, name, members), node) : node; } - function finishUpdateEnumDeclaration(updated: Mutable, original: EnumDeclaration) { - if (updated !== original) { - // copy children used only for error reporting - if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; - } - } - return update(updated, original); - } - // @api function createModuleDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags = NodeFlags.None @@ -4574,7 +4532,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Module declarations cannot contain `await`. - node.decoratorsAndModifiers = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) @@ -4585,27 +4542,17 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function updateModuleDeclaration( node: ModuleDeclaration, - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined ) { return node.modifiers !== modifiers || node.name !== name || node.body !== body - ? finishUpdateModuleDeclaration(createModuleDeclaration(modifiers, name, body, node.flags), node) + ? update(createModuleDeclaration(modifiers, name, body, node.flags), node) : node; } - function finishUpdateModuleDeclaration(updated: Mutable, original: ModuleDeclaration) { - if (updated !== original) { - // copy children used only for error reporting - if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; - } - } - return update(updated, original); - } - // @api function createModuleBlock(statements: readonly Statement[]) { const node = createBaseNode(SyntaxKind.ModuleBlock); @@ -4650,7 +4597,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode propagateIdentifierNameFlags(node.name) | TransformFlags.ContainsTypeScript; - node.decoratorsAndModifiers = undefined; // initialized by parser to report grammar errors + node.modifiers = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) return node; @@ -4666,14 +4613,14 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateNamespaceExportDeclaration(updated: Mutable, original: NamespaceExportDeclaration) { if (updated !== original) { // copy children used only for error reporting - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + updated.modifiers = original.modifiers; } return update(updated, original); } // @api function createImportEqualsDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference @@ -4694,7 +4641,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Import= declaration is always parsed in an Await context - node.decoratorsAndModifiers = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) return node; @@ -4703,7 +4649,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function updateImportEqualsDeclaration( node: ImportEqualsDeclaration, - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference @@ -4712,23 +4658,13 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode || node.isTypeOnly !== isTypeOnly || node.name !== name || node.moduleReference !== moduleReference - ? finishUpdateImportEqualsDeclaration(createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node) + ? update(createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node) : node; } - function finishUpdateImportEqualsDeclaration(updated: Mutable, original: ImportEqualsDeclaration) { - if (updated !== original) { - // copy children used only for error reporting - if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; - } - } - return update(updated, original); - } - // @api function createImportDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined @@ -4743,7 +4679,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context - node.decoratorsAndModifiers = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) return node; @@ -4752,7 +4687,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function updateImportDeclaration( node: ImportDeclaration, - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined @@ -4761,20 +4696,10 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.assertClause !== assertClause - ? finishUpdateImportDeclaration(createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause), node) + ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause), node) : node; } - function finishUpdateImportDeclaration(updated: Mutable, original: ImportDeclaration) { - if (updated !== original) { - // copy children used only for error reporting - if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; - } - } - return update(updated, original); - } - // @api function createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause { const node = createBaseDeclaration(SyntaxKind.ImportClause); @@ -4924,7 +4849,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function createExportAssignment( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression ) { @@ -4937,7 +4862,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.expression); node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context - node.decoratorsAndModifiers = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) return node; @@ -4946,25 +4870,15 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function updateExportAssignment( node: ExportAssignment, - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, expression: Expression ) { return node.modifiers !== modifiers || node.expression !== expression - ? finishUpdateExportAssignment(createExportAssignment(modifiers, node.isExportEquals, expression), node) + ? update(createExportAssignment(modifiers, node.isExportEquals, expression), node) : node; } - function finishUpdateExportAssignment(updated: Mutable, original: ExportAssignment) { - if (updated !== original) { - // copy children used only for error reporting - if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; - } - } - return update(updated, original); - } - // @api function createExportDeclaration( modifiers: readonly Modifier[] | undefined, @@ -4985,7 +4899,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context - node.decoratorsAndModifiers = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.jsDocCache = undefined; // initialized by parser (JsDocContainer) return node; @@ -5013,7 +4926,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode if (updated !== original) { // copy children used only for error reporting if (updated.modifiers === original.modifiers) { - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + updated.modifiers = original.modifiers; } } return update(updated, original); @@ -5931,7 +5844,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode propagateNameFlags(node.name) | propagateChildFlags(node.initializer); - node.decoratorsAndModifiers = undefined; // initialized by parser to report grammar errors + node.modifiers = undefined; // initialized by parser to report grammar errors node.questionToken = undefined; // initialized by parser to report grammar errors node.exclamationToken = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) @@ -5951,7 +5864,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // copy children used only for error reporting if (updated !== original) { // copy children used only for error reporting - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; } @@ -5969,7 +5882,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode TransformFlags.ContainsES2015; node.equalsToken = undefined; // initialized by parser to report grammar errors - node.decoratorsAndModifiers = undefined; // initialized by parser to report grammar errors + node.modifiers = undefined; // initialized by parser to report grammar errors node.questionToken = undefined; // initialized by parser to report grammar errors node.exclamationToken = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) @@ -5988,7 +5901,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateShorthandPropertyAssignment(updated: Mutable, original: ShorthandPropertyAssignment) { if (updated !== original) { // copy children used only for error reporting - updated.decoratorsAndModifiers = original.decoratorsAndModifiers; + updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; updated.equalsToken = original.equalsToken; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9e9048940a187..52f6e473096d8 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -86,9 +86,7 @@ import { ExpressionWithTypeArguments, ExternalModuleReference, fileExtensionIsOneOf, - filter, findIndex, - first, firstOrUndefined, forEach, ForEachChildNodes, @@ -151,7 +149,6 @@ import { isLeftHandSideExpression, isLiteralKind, isMetaProperty, - isModifier, isModifierKind, isNonNullExpression, isPrivateIdentifier, @@ -229,7 +226,6 @@ import { JsxTokenSyntaxKind, LabeledStatement, LanguageVariant, - last, lastOrUndefined, LeftHandSideExpression, LiteralExpression, @@ -502,7 +498,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.expression); }, [SyntaxKind.ShorthandPropertyAssignment]: function forEachChildInShorthandPropertyAssignment(node: ShorthandPropertyAssignment, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || @@ -536,7 +532,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.initializer); }, [SyntaxKind.PropertyAssignment]: function forEachChildInPropertyAssignment(node: PropertyAssignment, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || @@ -555,7 +551,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.initializer); }, [SyntaxKind.IndexSignature]: function forEachChildInIndexSignature(node: IndexSignatureDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); @@ -567,7 +563,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.type); }, [SyntaxKind.FunctionType]: function forEachChildInFunctionType(node: FunctionTypeNode, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); @@ -594,7 +590,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.type); }, [SyntaxKind.Constructor]: function forEachChildInConstructor(node: ConstructorDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || @@ -618,7 +614,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.body); }, [SyntaxKind.FunctionDeclaration]: function forEachChildInFunctionDeclaration(node: FunctionDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || @@ -644,7 +640,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.body); }, [SyntaxKind.ClassStaticBlockDeclaration]: function forEachChildInClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.body); }, [SyntaxKind.TypeReference]: function forEachChildInTypeReference(node: TypeReferenceNode, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { @@ -802,7 +798,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.endOfFileToken); }, [SyntaxKind.VariableStatement]: function forEachChildInVariableStatement(node: VariableStatement, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); }, [SyntaxKind.VariableDeclarationList]: function forEachChildInVariableDeclarationList(node: VariableDeclarationList, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { @@ -886,20 +882,20 @@ const forEachChildTable: ForEachChildTable = { [SyntaxKind.ClassDeclaration]: forEachChildInClassDeclarationOrExpression, [SyntaxKind.ClassExpression]: forEachChildInClassDeclarationOrExpression, [SyntaxKind.InterfaceDeclaration]: function forEachChildInInterfaceDeclaration(node: InterfaceDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); }, [SyntaxKind.TypeAliasDeclaration]: function forEachChildInTypeAliasDeclaration(node: TypeAliasDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); }, [SyntaxKind.EnumDeclaration]: function forEachChildInEnumDeclaration(node: EnumDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); }, @@ -908,17 +904,17 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.initializer); }, [SyntaxKind.ModuleDeclaration]: function forEachChildInModuleDeclaration(node: ModuleDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); }, [SyntaxKind.ImportEqualsDeclaration]: function forEachChildInImportEqualsDeclaration(node: ImportEqualsDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); }, [SyntaxKind.ImportDeclaration]: function forEachChildInImportDeclaration(node: ImportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || visitNode(cbNode, node.assertClause); @@ -935,7 +931,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.value); }, [SyntaxKind.NamespaceExportDeclaration]: function forEachChildInNamespaceExportDeclaration(node: NamespaceExportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name); }, [SyntaxKind.NamespaceImport]: function forEachChildInNamespaceImport(node: NamespaceImport, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { @@ -947,7 +943,7 @@ const forEachChildTable: ForEachChildTable = { [SyntaxKind.NamedImports]: forEachChildInNamedImportsOrExports, [SyntaxKind.NamedExports]: forEachChildInNamedImportsOrExports, [SyntaxKind.ExportDeclaration]: function forEachChildInExportDeclaration(node: ExportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || visitNode(cbNode, node.assertClause); @@ -955,7 +951,7 @@ const forEachChildTable: ForEachChildTable = { [SyntaxKind.ImportSpecifier]: forEachChildInImportOrExportSpecifier, [SyntaxKind.ExportSpecifier]: forEachChildInImportOrExportSpecifier, [SyntaxKind.ExportAssignment]: function forEachChildInExportAssignment(node: ExportAssignment, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers ?? node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); }, [SyntaxKind.TemplateExpression]: function forEachChildInTemplateExpression(node: TemplateExpression, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { @@ -988,7 +984,7 @@ const forEachChildTable: ForEachChildTable = { return visitNode(cbNode, node.expression); }, [SyntaxKind.MissingDeclaration]: function forEachChildInMissingDeclaration(node: MissingDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.decoratorsAndModifiers); + return visitNodes(cbNode, cbNodes, node.modifiers); }, [SyntaxKind.CommaListExpression]: function forEachChildInCommaListExpression(node: CommaListExpression, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNodes(cbNode, cbNodes, node.elements); @@ -4113,8 +4109,7 @@ namespace Parser { const parameters = parseBracketedList(ParsingContext.Parameters, () => parseParameter(/*inOuterAwaitContext*/ false), SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); const type = parseTypeAnnotation(); parseTypeMemberSemicolon(); - const node = factory.createIndexSignature(extractModifiers(modifiers), parameters, type); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createIndexSignature(modifiers, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -4367,7 +4362,7 @@ namespace Parser { const node = isConstructorType ? factory.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory.createFunctionTypeNode(typeParameters, parameters, type); - if (!isConstructorType) (node as Mutable).decoratorsAndModifiers = modifiers; + if (!isConstructorType) (node as Mutable).modifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -6535,7 +6530,7 @@ namespace Parser { node = factory.createPropertyAssignment(name, initializer); } // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker - node.decoratorsAndModifiers = modifiers; + node.modifiers = modifiers; node.questionToken = questionToken; node.exclamationToken = exclamationToken; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -7256,7 +7251,7 @@ namespace Parser { // would follow. For recovery and error reporting purposes, return an incomplete declaration. const missing = createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected); setTextRangePos(missing, pos); - (missing as Mutable).decoratorsAndModifiers = modifiersIn; + (missing as Mutable).modifiers = modifiersIn; return missing; } return undefined!; // TODO: GH#18217 @@ -7417,9 +7412,7 @@ namespace Parser { function parseVariableStatement(pos: number, hasJSDoc: boolean, modifiers: NodeArray | undefined): VariableStatement { const declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); - const node = factory.createVariableStatement(extractModifiers(modifiers), declarationList); - // Decorators are not allowed on a variable statement, so we keep track of them to report them in the grammar checker. - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createVariableStatement(modifiers, declarationList); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7438,8 +7431,7 @@ namespace Parser { const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false); const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, Diagnostics.or_expected); setAwaitContext(savedAwaitContext); - const node = factory.createFunctionDeclaration(extractModifiers(modifiers), asteriskToken, name, typeParameters, parameters, type, body); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7462,10 +7454,9 @@ namespace Parser { const parameters = parseParameters(SignatureFlags.None); const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false); const body = parseFunctionBlockOrSemicolon(SignatureFlags.None, Diagnostics.or_expected); - const node = factory.createConstructorDeclaration(extractModifiers(modifiers), parameters, body); + const node = factory.createConstructorDeclaration(modifiers, parameters, body); // Attach invalid nodes if they exist so that we can report them in the grammar checker. - (node as Mutable).decoratorsAndModifiers = modifiers; (node as Mutable).typeParameters = typeParameters; (node as Mutable).type = type; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -7629,7 +7620,7 @@ namespace Parser { parseExpectedToken(SyntaxKind.StaticKeyword); const body = parseClassStaticBlockBody(); const node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); - (node as Mutable).decoratorsAndModifiers = modifiers; + (node as Mutable).modifiers = modifiers; return node; } @@ -7731,16 +7722,6 @@ namespace Parser { return list && createNodeArray(list, pos); } - function extractModifiers(modifiersIn: NodeArray | undefined) { - const modifiersOut = filter(modifiersIn, isModifier); - if (modifiersOut === modifiersIn) return modifiersIn as NodeArray; - if (some(modifiersOut)) { - const modifiers = factory.createNodeArray(modifiersOut); - return setTextRangePosEnd(modifiers, first(modifiers).pos, last(modifiers).end); - } - return undefined; - } - function parseModifiersForArrowFunction(): NodeArray | undefined { let modifiers: NodeArray | undefined; if (token() === SyntaxKind.AsyncKeyword) { @@ -7823,7 +7804,7 @@ namespace Parser { const missing = createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Expression_expected); setTextRangePos(missing, pos); - (missing as Mutable).decoratorsAndModifiers = modifiers; + (missing as Mutable).modifiers = modifiers; return missing; } @@ -7926,8 +7907,7 @@ namespace Parser { const typeParameters = parseTypeParameters(); const heritageClauses = parseHeritageClauses(); const members = parseObjectTypeMembers(); - const node = factory.createInterfaceDeclaration(extractModifiers(modifiers), name, typeParameters, heritageClauses, members); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7938,8 +7918,7 @@ namespace Parser { parseExpected(SyntaxKind.EqualsToken); const type = token() === SyntaxKind.IntrinsicKeyword && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); - const node = factory.createTypeAliasDeclaration(extractModifiers(modifiers), name, typeParameters, type); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7966,8 +7945,7 @@ namespace Parser { else { members = createMissingList(); } - const node = factory.createEnumDeclaration(extractModifiers(modifiers), name, members); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createEnumDeclaration(modifiers, name, members); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7992,8 +7970,7 @@ namespace Parser { const body = parseOptional(SyntaxKind.DotToken) ? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*modifiers*/ undefined, NodeFlags.NestedNamespace | namespaceFlag) as NamespaceDeclaration : parseModuleBlock(); - const node = factory.createModuleDeclaration(extractModifiers(modifiers), name, body, flags); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createModuleDeclaration(modifiers, name, body, flags); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -8016,8 +7993,7 @@ namespace Parser { else { parseSemicolon(); } - const node = factory.createModuleDeclaration(extractModifiers(modifiersIn), name, body, flags); - (node as Mutable).decoratorsAndModifiers = modifiersIn; + const node = factory.createModuleDeclaration(modifiersIn, name, body, flags); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -8063,7 +8039,7 @@ namespace Parser { parseSemicolon(); const node = factory.createNamespaceExportDeclaration(name); // NamespaceExportDeclaration nodes cannot have decorators or modifiers, so we attach them here so we can report them in the grammar checker - (node as Mutable).decoratorsAndModifiers = modifiers; + (node as Mutable).modifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -8110,8 +8086,7 @@ namespace Parser { } parseSemicolon(); - const node = factory.createImportDeclaration(extractModifiers(modifiers), importClause, moduleSpecifier, assertClause); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -8163,8 +8138,7 @@ namespace Parser { parseExpected(SyntaxKind.EqualsToken); const moduleReference = parseModuleReference(); parseSemicolon(); - const node = factory.createImportEqualsDeclaration(extractModifiers(modifiers), isTypeOnly, identifier, moduleReference); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); const finished = withJSDoc(finishNode(node, pos), hasJSDoc); return finished; } @@ -8372,8 +8346,7 @@ namespace Parser { } parseSemicolon(); setAwaitContext(savedAwaitContext); - const node = factory.createExportDeclaration(extractModifiers(modifiers), isTypeOnly, exportClause, moduleSpecifier, assertClause); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -8390,8 +8363,7 @@ namespace Parser { const expression = parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); parseSemicolon(); setAwaitContext(savedAwaitContext); - const node = factory.createExportAssignment(extractModifiers(modifiers), isExportEquals, expression); - (node as Mutable).decoratorsAndModifiers = modifiers; + const node = factory.createExportAssignment(modifiers, isExportEquals, expression); return withJSDoc(finishNode(node, pos), hasJSDoc); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 80caada1f92d0..d9c223049d226 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2943,7 +2943,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg function walkArray(nodes: NodeArray, parent: Node) { if (canHaveIllegalDecorators(parent)) { - const decorator = find(parent.decoratorsAndModifiers, isDecorator); + const decorator = find(parent.modifiers, isDecorator); if (decorator) { // report illegal decorator diagnostics.push(createDiagnosticForNode(decorator, Diagnostics.Decorators_are_not_valid_here)); diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index cce16221d24c4..edf6d34020dd2 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -850,13 +850,13 @@ export function transformDeclarations(context: TransformationContext) { } } - function updateParamsList(node: Node, params: NodeArray, modifierMask?: ModifierFlags) { + function updateParamsList(node: Node, params: NodeArray, modifierMask?: ModifierFlags): NodeArray { if (hasEffectiveModifier(node, ModifierFlags.Private)) { - return undefined!; // TODO: GH#18217 + return factory.createNodeArray(); } const newParams = map(params, p => ensureParameter(p, modifierMask)); if (!newParams) { - return undefined!; // TODO: GH#18217 + return factory.createNodeArray(); } return factory.createNodeArray(newParams, params.hasTrailingComma); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 3929a764dbfa9..4879a669b9d94 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1975,7 +1975,7 @@ export interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer readonly initializer: Expression; // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; // property assignment cannot have decorators or modifiers + /** @internal */ readonly modifiers?: NodeArray | undefined; // property assignment cannot have decorators or modifiers /** @internal */ readonly questionToken?: QuestionToken | undefined; // property assignment cannot have a question token /** @internal */ readonly exclamationToken?: ExclamationToken | undefined; // property assignment cannot have an exclamation token } @@ -1990,7 +1990,7 @@ export interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDoc readonly objectAssignmentInitializer?: Expression; // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; // shorthand property assignment cannot have decorators or modifiers + /** @internal */ readonly modifiers?: NodeArray | undefined; // shorthand property assignment cannot have decorators or modifiers /** @internal */ readonly questionToken?: QuestionToken | undefined; // shorthand property assignment cannot have a question token /** @internal */ readonly exclamationToken?: ExclamationToken | undefined; // shorthand property assignment cannot have an exclamation token } @@ -2062,12 +2062,9 @@ export type FunctionLike = SignatureDeclaration; export interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement, LocalsContainer { readonly kind: SyntaxKind.FunctionDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name?: Identifier; readonly body?: FunctionBody; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; // functions cannot have decorators } export interface MethodSignature extends SignatureDeclarationBase, TypeElement, LocalsContainer { @@ -2100,11 +2097,10 @@ export interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassEle export interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.Constructor; readonly parent: ClassLikeDeclaration; - readonly modifiers?: NodeArray | undefined; + readonly modifiers?: NodeArray | undefined; readonly body?: FunctionBody | undefined; // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; // constructors cannot have decorators /** @internal */ readonly typeParameters?: NodeArray; // A constructor cannot have type parameters /** @internal */ readonly type?: TypeNode; // A constructor cannot have a return type annotation } @@ -2147,11 +2143,8 @@ export type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaratio export interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement, LocalsContainer { readonly kind: SyntaxKind.IndexSignature; readonly parent: ObjectTypeDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly type: TypeNode; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer, LocalsContainer { @@ -2163,7 +2156,7 @@ export interface ClassStaticBlockDeclaration extends ClassElement, JSDocContaine /** @internal */ returnFlowNode?: FlowNode; // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; + /** @internal */ readonly modifiers?: NodeArray | undefined; } export interface TypeNode extends Node { @@ -2212,7 +2205,7 @@ export interface FunctionTypeNode extends FunctionOrConstructorTypeNodeBase, Loc readonly kind: SyntaxKind.FunctionType; // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; + /** @internal */ readonly modifiers?: NodeArray | undefined; } export interface ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase, LocalsContainer { @@ -3333,7 +3326,7 @@ export interface MissingDeclaration extends DeclarationStatement, PrimaryExpress readonly name?: Identifier; // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; + /** @internal */ readonly modifiers?: NodeArray | undefined; } export type BlockLike = @@ -3351,11 +3344,8 @@ export interface Block extends Statement, LocalsContainer { export interface VariableStatement extends Statement, FlowContainer { readonly kind: SyntaxKind.VariableStatement; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly declarationList: VariableDeclarationList; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface ExpressionStatement extends Statement, FlowContainer { @@ -3562,14 +3552,11 @@ export interface TypeElement extends NamedDeclaration { export interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.InterfaceDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly typeParameters?: NodeArray; readonly heritageClauses?: NodeArray; readonly members: NodeArray; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface HeritageClause extends Node { @@ -3581,13 +3568,10 @@ export interface HeritageClause extends Node { export interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.TypeAliasDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly typeParameters?: NodeArray; readonly type: TypeNode; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface EnumMember extends NamedDeclaration, JSDocContainer { @@ -3601,12 +3585,9 @@ export interface EnumMember extends NamedDeclaration, JSDocContainer { export interface EnumDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.EnumDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly members: NodeArray; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export type ModuleName = @@ -3627,12 +3608,9 @@ export interface AmbientModuleDeclaration extends ModuleDeclaration { export interface ModuleDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.ModuleDeclaration; readonly parent: ModuleBody | SourceFile; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: ModuleName; readonly body?: ModuleBody | JSDocNamespaceDeclaration; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export type NamespaceBody = @@ -3674,16 +3652,13 @@ export type ModuleReference = export interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ImportEqualsDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly isTypeOnly: boolean; // 'EntityName' for an internal module reference, 'ExternalModuleReference' for an external // module reference. readonly moduleReference: ModuleReference; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface ExternalModuleReference extends Node { @@ -3699,14 +3674,11 @@ export interface ExternalModuleReference extends Node { export interface ImportDeclaration extends Statement { readonly kind: SyntaxKind.ImportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly importClause?: ImportClause; /** If this is not a StringLiteral it will be a grammar error. */ readonly moduleSpecifier: Expression; readonly assertClause?: AssertClause; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export type NamedImportBindings = @@ -3766,22 +3738,19 @@ export interface NamespaceExportDeclaration extends DeclarationStatement, JSDocC readonly name: Identifier; // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; + /** @internal */ readonly modifiers?: NodeArray | undefined; } export interface ExportDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly isTypeOnly: boolean; /** Will not be assigned in the case of `export * from "foo";` */ readonly exportClause?: NamedExportBindings; /** If this is not a StringLiteral it will be a grammar error. */ readonly moduleSpecifier?: Expression; readonly assertClause?: AssertClause; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface NamedImports extends Node { @@ -3841,12 +3810,9 @@ export type TypeOnlyAliasDeclaration = export interface ExportAssignment extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportAssignment; readonly parent: SourceFile; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly isExportEquals?: boolean; readonly expression: Expression; - - // The following properties are used only to report grammar errors - /** @internal */ readonly decoratorsAndModifiers?: NodeArray | undefined; } export interface FileReference extends TextRange { @@ -8255,8 +8221,8 @@ export interface NodeFactory { updateMethodSignature(node: MethodSignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): MethodSignature; createMethodDeclaration(modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; updateMethodDeclaration(node: MethodDeclaration, modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; - createConstructorDeclaration(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; - updateConstructorDeclaration(node: ConstructorDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + createConstructorDeclaration(modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + updateConstructorDeclaration(node: ConstructorDeclaration, modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; createGetAccessorDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; updateGetAccessorDeclaration(node: GetAccessorDeclaration, modifiers: readonly ModifierLike[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; createSetAccessorDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; @@ -8265,9 +8231,9 @@ export interface NodeFactory { updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; createConstructSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; - createIndexSignature(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; - /** @internal */ createIndexSignature(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): IndexSignatureDeclaration; // eslint-disable-line @typescript-eslint/unified-signatures - updateIndexSignature(node: IndexSignatureDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + createIndexSignature(modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + /** @internal */ createIndexSignature(modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): IndexSignatureDeclaration; // eslint-disable-line @typescript-eslint/unified-signatures + updateIndexSignature(node: IndexSignatureDeclaration, modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; updateTemplateLiteralTypeSpan(node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; createClassStaticBlockDeclaration(body: Block): ClassStaticBlockDeclaration; @@ -8431,8 +8397,8 @@ export interface NodeFactory { createBlock(statements: readonly Statement[], multiLine?: boolean): Block; updateBlock(node: Block, statements: readonly Statement[]): Block; - createVariableStatement(modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]): VariableStatement; - updateVariableStatement(node: VariableStatement, modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList): VariableStatement; + createVariableStatement(modifiers: readonly ModifierLike[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]): VariableStatement; + updateVariableStatement(node: VariableStatement, modifiers: readonly ModifierLike[] | undefined, declarationList: VariableDeclarationList): VariableStatement; createEmptyStatement(): EmptyStatement; createExpressionStatement(expression: Expression): ExpressionStatement; updateExpressionStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; @@ -8473,24 +8439,24 @@ export interface NodeFactory { updateFunctionDeclaration(node: FunctionDeclaration, modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; createClassDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; updateClassDeclaration(node: ClassDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; - createInterfaceDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; - updateInterfaceDeclaration(node: InterfaceDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; - createTypeAliasDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; - updateTypeAliasDeclaration(node: TypeAliasDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; - createEnumDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; - updateEnumDeclaration(node: EnumDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; - createModuleDeclaration(modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; - updateModuleDeclaration(node: ModuleDeclaration, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; + createInterfaceDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; + updateInterfaceDeclaration(node: InterfaceDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; + createTypeAliasDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; + updateTypeAliasDeclaration(node: TypeAliasDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; + createEnumDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; + updateEnumDeclaration(node: EnumDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; + createModuleDeclaration(modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; + updateModuleDeclaration(node: ModuleDeclaration, modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; createModuleBlock(statements: readonly Statement[]): ModuleBlock; updateModuleBlock(node: ModuleBlock, statements: readonly Statement[]): ModuleBlock; createCaseBlock(clauses: readonly CaseOrDefaultClause[]): CaseBlock; updateCaseBlock(node: CaseBlock, clauses: readonly CaseOrDefaultClause[]): CaseBlock; createNamespaceExportDeclaration(name: string | Identifier): NamespaceExportDeclaration; updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration; - createImportEqualsDeclaration(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - createImportDeclaration(modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; - updateImportDeclaration(node: ImportDeclaration, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; + createImportEqualsDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; + updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; createAssertClause(elements: NodeArray, multiLine?: boolean): AssertClause; @@ -8507,10 +8473,10 @@ export interface NodeFactory { updateNamedImports(node: NamedImports, elements: readonly ImportSpecifier[]): NamedImports; createImportSpecifier(isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; - createExportAssignment(modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; - updateExportAssignment(node: ExportAssignment, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment; - createExportDeclaration(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; - updateExportDeclaration(node: ExportDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; + createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; + updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment; + createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; + updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; createNamedExports(elements: readonly ExportSpecifier[]): NamedExports; updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports; createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 8917e55173a51..291b5c7017ae6 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -627,7 +627,7 @@ const visitEachChildTable: VisitEachChildTable = { [SyntaxKind.Constructor]: function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateConstructorDeclaration(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body!, visitor, context, nodeVisitor)); }, @@ -672,7 +672,7 @@ const visitEachChildTable: VisitEachChildTable = { [SyntaxKind.IndexSignature]: function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateIndexSignature(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), nodesVisitor(node.parameters, visitor, isParameterDeclaration), nodeVisitor(node.type, visitor, isTypeNode)); }, @@ -1058,7 +1058,7 @@ const visitEachChildTable: VisitEachChildTable = { [SyntaxKind.VariableStatement]: function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateVariableStatement(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), nodeVisitor(node.declarationList, visitor, isVariableDeclarationList)); }, @@ -1189,7 +1189,7 @@ const visitEachChildTable: VisitEachChildTable = { [SyntaxKind.InterfaceDeclaration]: function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateInterfaceDeclaration(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), nodeVisitor(node.name, visitor, isIdentifier), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, isHeritageClause), @@ -1198,7 +1198,7 @@ const visitEachChildTable: VisitEachChildTable = { [SyntaxKind.TypeAliasDeclaration]: function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeAliasDeclaration(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), nodeVisitor(node.name, visitor, isIdentifier), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodeVisitor(node.type, visitor, isTypeNode)); @@ -1206,14 +1206,14 @@ const visitEachChildTable: VisitEachChildTable = { [SyntaxKind.EnumDeclaration]: function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateEnumDeclaration(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), nodeVisitor(node.name, visitor, isIdentifier), nodesVisitor(node.members, visitor, isEnumMember)); }, [SyntaxKind.ModuleDeclaration]: function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateModuleDeclaration(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), nodeVisitor(node.name, visitor, isModuleName), nodeVisitor(node.body, visitor, isModuleBody)); }, @@ -1235,7 +1235,7 @@ const visitEachChildTable: VisitEachChildTable = { [SyntaxKind.ImportEqualsDeclaration]: function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportEqualsDeclaration(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), node.isTypeOnly, nodeVisitor(node.name, visitor, isIdentifier), nodeVisitor(node.moduleReference, visitor, isModuleReference)); @@ -1243,7 +1243,7 @@ const visitEachChildTable: VisitEachChildTable = { [SyntaxKind.ImportDeclaration]: function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportDeclaration(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), nodeVisitor(node.importClause, visitor, isImportClause), nodeVisitor(node.moduleSpecifier, visitor, isExpression), nodeVisitor(node.assertClause, visitor, isAssertClause)); @@ -1292,13 +1292,13 @@ const visitEachChildTable: VisitEachChildTable = { [SyntaxKind.ExportAssignment]: function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExportAssignment(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), nodeVisitor(node.expression, visitor, isExpression)); }, [SyntaxKind.ExportDeclaration]: function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExportDeclaration(node, - nodesVisitor(node.modifiers, visitor, isModifier), + nodesVisitor(node.modifiers, visitor, isModifierLike), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, isExpression), diff --git a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts b/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts index d23969ccda6be..cbfd4b00d069f 100644 --- a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts +++ b/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts @@ -44,6 +44,7 @@ import { isIdentifier, isImportClause, isModifier, + isModifierLike, isModuleBody, isModuleName, isModuleReference, @@ -134,7 +135,7 @@ declare module "../../compiler/types" { // Module transform: converted from interface augmentation export interface ShorthandPropertyAssignment { /** @deprecated A shorthand property assignment cannot have modifiers */ - readonly modifiers?: NodeArray | undefined; + readonly modifiers?: NodeArray | undefined; /** @deprecated A shorthand property assignment cannot have a question token */ readonly questionToken?: QuestionToken | undefined; @@ -311,7 +312,6 @@ declare module "../../compiler/types" { } const MUST_MERGE: DeprecationOptions = { since: "4.8", warnAfter: "4.9.0-0", message: "Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter." }; -const DISALLOW_DECORATORS: DeprecationOptions = { since: "4.8", warnAfter: "4.9.0-0", message: `Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.` }; const DISALLOW_DECORATORS_AND_MODIFIERS: DeprecationOptions = { since: "4.8", warnAfter: "4.9.0-0", message: `Decorators and modifiers are no longer supported for this function. Callers should switch to an overload that does not accept the 'decorators' and 'modifiers' parameters.` }; function patchNodeFactory(factory: NodeFactory) { @@ -553,7 +553,7 @@ function patchNodeFactory(factory: NodeFactory) { factory.createConstructorDeclaration = buildOverload("createConstructorDeclaration") .overload({ - 0(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration { + 0(modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration { return createConstructorDeclaration(modifiers, parameters, body); }, @@ -564,24 +564,24 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, parameters, body, other]) => (other === undefined) && - (modifiers === undefined || !some(modifiers, isDecorator)) && - (parameters === undefined || !some(parameters, isModifier)) && + (modifiers === undefined || isArray(modifiers)) && + (parameters !== undefined && !some(parameters, isModifier)) && (body === undefined || !isArray(body)), 1: ([decorators, modifiers, parameters, body]) => (decorators === undefined || !some(decorators, isModifier)) && (modifiers === undefined || !some(modifiers, isParameter)) && - (parameters === undefined || isArray(parameters)) && + (parameters !== undefined && isArray(parameters)) && (body === undefined || isBlock(body)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateConstructorDeclaration = buildOverload("updateConstructorDeclaration") .overload({ - 0(node: ConstructorDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration { + 0(node: ConstructorDeclaration, modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration { return updateConstructorDeclaration(node, modifiers, parameters, body); }, @@ -592,18 +592,18 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, parameters, body, other]) => (other === undefined) && - (modifiers === undefined || !some(modifiers, isDecorator)) && - (parameters === undefined || !some(parameters, isModifier)) && + (modifiers === undefined || isArray(modifiers)) && + (parameters !== undefined && !some(parameters, isModifier)) && (body === undefined || !isArray(body)), 1: ([, decorators, modifiers, parameters, body]) => (decorators === undefined || !some(decorators, isModifier)) && (modifiers === undefined || !some(modifiers, isParameter)) && - (parameters === undefined || isArray(parameters)) && + (parameters !== undefined && isArray(parameters)) && (body === undefined || isBlock(body)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); @@ -621,14 +621,14 @@ function patchNodeFactory(factory: NodeFactory) { 0: ([, name, parameters, type, body, other]) => (other === undefined) && (name === undefined || !isArray(name)) && - (parameters === undefined || isArray(parameters)) && + (parameters !== undefined && isArray(parameters)) && (type === undefined || !isArray(type)) && (body === undefined || isBlock(body)), 1: ([, modifiers, name, parameters, type, body]) => (modifiers === undefined || isArray(modifiers)) && (name === undefined || !isArray(name)) && - (parameters === undefined || isArray(parameters)) && + (parameters !== undefined && isArray(parameters)) && (type === undefined || isTypeNode(type)) && (body === undefined || isBlock(body)), }) @@ -725,7 +725,7 @@ function patchNodeFactory(factory: NodeFactory) { factory.createIndexSignature = buildOverload("createIndexSignature") .overload({ - 0(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): IndexSignatureDeclaration { + 0(modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): IndexSignatureDeclaration { return createIndexSignature(modifiers, parameters, type); }, @@ -736,24 +736,24 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, parameters, type, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && - (parameters === undefined || every(parameters, isParameter)) && + (modifiers === undefined || isArray(modifiers)) && + (parameters !== undefined && every(parameters, isParameter)) && (type === undefined || !isArray(type)), 1: ([decorators, modifiers, parameters, type]) => (decorators === undefined || every(decorators, isDecorator)) && (modifiers === undefined || every(modifiers, isModifier)) && - (parameters === undefined || isArray(parameters)) && + (parameters !== undefined && isArray(parameters)) && (type === undefined || isTypeNode(type)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateIndexSignature = buildOverload("updateIndexSignature") .overload({ - 0(node: IndexSignatureDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration { + 0(node: IndexSignatureDeclaration, modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration { return updateIndexSignature(node, modifiers, parameters, type); }, @@ -764,18 +764,18 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, parameters, type, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && - (parameters === undefined || every(parameters, isParameter)) && + (modifiers === undefined || isArray(modifiers)) && + (parameters !== undefined && every(parameters, isParameter)) && (type === undefined || !isArray(type)), 1: ([, decorators, modifiers, parameters, type]) => (decorators === undefined || every(decorators, isDecorator)) && (modifiers === undefined || every(modifiers, isModifier)) && - (parameters === undefined || isArray(parameters)) && + (parameters !== undefined && isArray(parameters)) && (type === undefined || isTypeNode(type)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); @@ -797,7 +797,7 @@ function patchNodeFactory(factory: NodeFactory) { 1: ([decorators, modifiers, body]) => (decorators === undefined || isArray(decorators)) && - (modifiers === undefined || isArray(decorators)) && + (modifiers === undefined || isArray(modifiers)) && (body === undefined || isBlock(body)), }) .deprecate({ @@ -857,7 +857,7 @@ function patchNodeFactory(factory: NodeFactory) { (members === undefined || isArray(members)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); @@ -887,7 +887,7 @@ function patchNodeFactory(factory: NodeFactory) { (members === undefined || isArray(members)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); @@ -921,7 +921,7 @@ function patchNodeFactory(factory: NodeFactory) { (body === undefined || isBlock(body)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); @@ -955,7 +955,7 @@ function patchNodeFactory(factory: NodeFactory) { (body === undefined || isBlock(body)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); @@ -1016,7 +1016,7 @@ function patchNodeFactory(factory: NodeFactory) { factory.createInterfaceDeclaration = buildOverload("createInterfaceDeclaration") .overload({ - 0(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration { + 0(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration { return createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members); }, @@ -1027,7 +1027,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, name, typeParameters, heritageClauses, members, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (name === undefined || !isArray(name)) && (typeParameters === undefined || isArray(typeParameters)) && (heritageClauses === undefined || every(heritageClauses, isHeritageClause)) && @@ -1042,13 +1042,13 @@ function patchNodeFactory(factory: NodeFactory) { (members === undefined || every(members, isTypeElement)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateInterfaceDeclaration = buildOverload("updateInterfaceDeclaration") .overload({ - 0(node: InterfaceDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration { + 0(node: InterfaceDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration { return updateInterfaceDeclaration(node, modifiers, name, typeParameters, heritageClauses, members); }, @@ -1059,7 +1059,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, name, typeParameters, heritageClauses, members, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (name === undefined || !isArray(name)) && (typeParameters === undefined || isArray(typeParameters)) && (heritageClauses === undefined || every(heritageClauses, isHeritageClause)) && @@ -1074,13 +1074,13 @@ function patchNodeFactory(factory: NodeFactory) { (members === undefined || every(members, isTypeElement)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.createTypeAliasDeclaration = buildOverload("createTypeAliasDeclaration") .overload({ - 0(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration { + 0(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration { return createTypeAliasDeclaration(modifiers, name, typeParameters, type); }, @@ -1091,7 +1091,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, name, typeParameters, type, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (name === undefined || !isArray(name)) && (typeParameters === undefined || isArray(typeParameters)) && (type === undefined || !isArray(type)), @@ -1104,13 +1104,13 @@ function patchNodeFactory(factory: NodeFactory) { (type === undefined || isTypeNode(type)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateTypeAliasDeclaration = buildOverload("updateTypeAliasDeclaration") .overload({ - 0(node: TypeAliasDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration { + 0(node: TypeAliasDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration { return updateTypeAliasDeclaration(node, modifiers, name, typeParameters, type); }, @@ -1121,7 +1121,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, name, typeParameters, type, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (name === undefined || !isArray(name)) && (typeParameters === undefined || isArray(typeParameters)) && (type === undefined || !isArray(type)), @@ -1134,13 +1134,13 @@ function patchNodeFactory(factory: NodeFactory) { (type === undefined || isTypeNode(type)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.createEnumDeclaration = buildOverload("createEnumDeclaration") .overload({ - 0(modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration { + 0(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration { return createEnumDeclaration(modifiers, name, members); }, @@ -1151,7 +1151,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, name, members, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (name === undefined || !isArray(name)) && (members === undefined || isArray(members)), @@ -1162,13 +1162,13 @@ function patchNodeFactory(factory: NodeFactory) { (members === undefined || isArray(members)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateEnumDeclaration = buildOverload("updateEnumDeclaration") .overload({ - 0(node: EnumDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration { + 0(node: EnumDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration { return updateEnumDeclaration(node, modifiers, name, members); }, @@ -1179,7 +1179,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, name, members, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (name === undefined || !isArray(name)) && (members === undefined || isArray(members)), @@ -1190,13 +1190,13 @@ function patchNodeFactory(factory: NodeFactory) { (members === undefined || isArray(members)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.createModuleDeclaration = buildOverload("createModuleDeclaration") .overload({ - 0(modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration { + 0(modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration { return createModuleDeclaration(modifiers, name, body, flags); }, @@ -1207,7 +1207,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, name, body, flags, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (name !== undefined && !isArray(name)) && (body === undefined || isModuleBody(body)) && (flags === undefined || typeof flags === "number"), @@ -1220,13 +1220,13 @@ function patchNodeFactory(factory: NodeFactory) { (flags === undefined || typeof flags === "number"), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateModuleDeclaration = buildOverload("updateModuleDeclaration") .overload({ - 0(node: ModuleDeclaration, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration { + 0(node: ModuleDeclaration, modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration { return updateModuleDeclaration(node, modifiers, name, body); }, @@ -1237,7 +1237,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, name, body, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (name === undefined || !isArray(name)) && (body === undefined || isModuleBody(body)), @@ -1248,13 +1248,13 @@ function patchNodeFactory(factory: NodeFactory) { (body === undefined || isModuleBody(body)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.createImportEqualsDeclaration = buildOverload("createImportEqualsDeclaration") .overload({ - 0(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration { + 0(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration { return createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference); }, @@ -1265,7 +1265,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, isTypeOnly, name, moduleReference, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (isTypeOnly === undefined || typeof isTypeOnly === "boolean") && (typeof name !== "boolean") && (typeof moduleReference !== "string"), @@ -1278,13 +1278,13 @@ function patchNodeFactory(factory: NodeFactory) { (moduleReference !== undefined && isModuleReference(moduleReference)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateImportEqualsDeclaration = buildOverload("updateImportEqualsDeclaration") .overload({ - 0(node: ImportEqualsDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration { + 0(node: ImportEqualsDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration { return updateImportEqualsDeclaration(node, modifiers, isTypeOnly, name, moduleReference); }, @@ -1295,7 +1295,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, isTypeOnly, name, moduleReference, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (isTypeOnly === undefined || typeof isTypeOnly === "boolean") && (typeof name !== "boolean") && (typeof moduleReference !== "string"), @@ -1308,13 +1308,13 @@ function patchNodeFactory(factory: NodeFactory) { (moduleReference !== undefined && isModuleReference(moduleReference)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.createImportDeclaration = buildOverload("createImportDeclaration") .overload({ - 0(modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration { + 0(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration { return createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); }, @@ -1325,7 +1325,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, importClause, moduleSpecifier, assertClause, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (importClause === undefined || !isArray(importClause)) && (moduleSpecifier !== undefined && isExpression(moduleSpecifier)) && (assertClause === undefined || isAssertClause(assertClause)), @@ -1338,13 +1338,13 @@ function patchNodeFactory(factory: NodeFactory) { (assertClause === undefined || isAssertClause(assertClause)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateImportDeclaration = buildOverload("updateImportDeclaration") .overload({ - 0(node: ImportDeclaration, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration { + 0(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration { return updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, assertClause); }, @@ -1355,7 +1355,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, importClause, moduleSpecifier, assertClause, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (importClause === undefined || !isArray(importClause)) && (moduleSpecifier === undefined || isExpression(moduleSpecifier)) && (assertClause === undefined || isAssertClause(assertClause)), @@ -1368,13 +1368,13 @@ function patchNodeFactory(factory: NodeFactory) { (assertClause === undefined || isAssertClause(assertClause)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.createExportAssignment = buildOverload("createExportAssignment") .overload({ - 0(modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment { + 0(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment { return createExportAssignment(modifiers, isExportEquals, expression); }, @@ -1385,7 +1385,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, isExportEquals, expression, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (isExportEquals === undefined || typeof isExportEquals === "boolean") && (typeof expression === "object"), @@ -1396,13 +1396,13 @@ function patchNodeFactory(factory: NodeFactory) { (expression !== undefined && isExpression(expression)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateExportAssignment = buildOverload("updateExportAssignment") .overload({ - 0(node: ExportAssignment, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment { + 0(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment { return updateExportAssignment(node, modifiers, expression); }, @@ -1413,7 +1413,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, expression, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (expression !== undefined && !isArray(expression)), 1: ([, decorators, modifiers, expression]) => @@ -1422,13 +1422,13 @@ function patchNodeFactory(factory: NodeFactory) { (expression !== undefined && isExpression(expression)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.createExportDeclaration = buildOverload("createExportDeclaration") .overload({ - 0(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration { + 0(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration { return createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); }, @@ -1439,7 +1439,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (typeof isTypeOnly === "boolean") && (typeof exportClause !== "boolean") && (moduleSpecifier === undefined || isExpression(moduleSpecifier)) && @@ -1454,13 +1454,13 @@ function patchNodeFactory(factory: NodeFactory) { (assertClause === undefined || isAssertClause(assertClause)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); factory.updateExportDeclaration = buildOverload("updateExportDeclaration") .overload({ - 0(node: ExportDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration { + 0(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration { return updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); }, @@ -1471,7 +1471,7 @@ function patchNodeFactory(factory: NodeFactory) { .bind({ 0: ([, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause, other]) => (other === undefined) && - (modifiers === undefined || every(modifiers, isModifier)) && + (modifiers === undefined || every(modifiers, isModifierLike)) && (typeof isTypeOnly === "boolean") && (typeof exportClause !== "boolean") && (moduleSpecifier === undefined || isExpression(moduleSpecifier)) && @@ -1486,7 +1486,7 @@ function patchNodeFactory(factory: NodeFactory) { (assertClause === undefined || isAssertClause(assertClause)), }) .deprecate({ - 1: DISALLOW_DECORATORS + 1: MUST_MERGE }) .finish(); } diff --git a/src/services/codefixes/generateAccessors.ts b/src/services/codefixes/generateAccessors.ts index 96bee0d7f458b..54f864722826e 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -213,7 +213,7 @@ function generateGetAccessor(fieldName: AcceptedNameType, accessorName: Accepted return factory.createGetAccessorDeclaration( modifiers, accessorName, - /*parameters*/ undefined!, // TODO: GH#18217 + [], type, factory.createBlock([ factory.createReturnStatement( diff --git a/src/testRunner/unittests/factory.ts b/src/testRunner/unittests/factory.ts index 4961f47ba0bdb..ba452391c80c1 100644 --- a/src/testRunner/unittests/factory.ts +++ b/src/testRunner/unittests/factory.ts @@ -1,5 +1,6 @@ import * as ts from "../_namespaces/ts"; import { setEnableDeprecationWarnings } from "../../deprecatedCompat/deprecate"; +import { Modifier } from "../_namespaces/ts"; describe("unittests:: FactoryAPI", () => { function assertSyntaxKind(node: ts.Node, expected: ts.SyntaxKind) { @@ -111,7 +112,7 @@ describe("unittests:: FactoryAPI", () => { assert.doesNotThrow(() => ts.factory.updateConstructorDeclaration( ctor, ctor.decorators, - ctor.modifiers, + ctor.modifiers as readonly Modifier[] | undefined, ctor.parameters, ctor.body, )); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 29a5d2a39ef88..926cf4f29a83e 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4739,7 +4739,7 @@ declare namespace ts { } interface ShorthandPropertyAssignment { /** @deprecated A shorthand property assignment cannot have modifiers */ - readonly modifiers?: NodeArray | undefined; + readonly modifiers?: NodeArray | undefined; /** @deprecated A shorthand property assignment cannot have a question token */ readonly questionToken?: QuestionToken | undefined; /** @deprecated A shorthand property assignment cannot have an exclamation token */ @@ -4783,7 +4783,7 @@ declare namespace ts { type FunctionLike = SignatureDeclaration; interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement, LocalsContainer { readonly kind: SyntaxKind.FunctionDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name?: Identifier; readonly body?: FunctionBody; } @@ -4803,7 +4803,7 @@ declare namespace ts { interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.Constructor; readonly parent: ClassLikeDeclaration; - readonly modifiers?: NodeArray | undefined; + readonly modifiers?: NodeArray | undefined; readonly body?: FunctionBody | undefined; } /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ @@ -4829,7 +4829,7 @@ declare namespace ts { interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement, LocalsContainer { readonly kind: SyntaxKind.IndexSignature; readonly parent: ObjectTypeDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly type: TypeNode; } interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer, LocalsContainer { @@ -5423,7 +5423,7 @@ declare namespace ts { } interface VariableStatement extends Statement, FlowContainer { readonly kind: SyntaxKind.VariableStatement; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly declarationList: VariableDeclarationList; } interface ExpressionStatement extends Statement, FlowContainer { @@ -5560,7 +5560,7 @@ declare namespace ts { } interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.InterfaceDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly typeParameters?: NodeArray; readonly heritageClauses?: NodeArray; @@ -5574,7 +5574,7 @@ declare namespace ts { } interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.TypeAliasDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly typeParameters?: NodeArray; readonly type: TypeNode; @@ -5587,7 +5587,7 @@ declare namespace ts { } interface EnumDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.EnumDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly members: NodeArray; } @@ -5596,7 +5596,7 @@ declare namespace ts { interface ModuleDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.ModuleDeclaration; readonly parent: ModuleBody | SourceFile; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: ModuleName; readonly body?: ModuleBody | JSDocNamespaceDeclaration; } @@ -5624,7 +5624,7 @@ declare namespace ts { interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ImportEqualsDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly isTypeOnly: boolean; readonly moduleReference: ModuleReference; @@ -5637,7 +5637,7 @@ declare namespace ts { interface ImportDeclaration extends Statement { readonly kind: SyntaxKind.ImportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly importClause?: ImportClause; /** If this is not a StringLiteral it will be a grammar error. */ readonly moduleSpecifier: Expression; @@ -5682,7 +5682,7 @@ declare namespace ts { interface ExportDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly isTypeOnly: boolean; /** Will not be assigned in the case of `export * from "foo";` */ readonly exportClause?: NamedExportBindings; @@ -5750,7 +5750,7 @@ declare namespace ts { interface ExportAssignment extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportAssignment; readonly parent: SourceFile; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly isExportEquals?: boolean; readonly expression: Expression; } @@ -7512,8 +7512,8 @@ declare namespace ts { updateMethodSignature(node: MethodSignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): MethodSignature; createMethodDeclaration(modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; updateMethodDeclaration(node: MethodDeclaration, modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; - createConstructorDeclaration(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; - updateConstructorDeclaration(node: ConstructorDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + createConstructorDeclaration(modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + updateConstructorDeclaration(node: ConstructorDeclaration, modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; createGetAccessorDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; updateGetAccessorDeclaration(node: GetAccessorDeclaration, modifiers: readonly ModifierLike[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; createSetAccessorDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; @@ -7522,8 +7522,8 @@ declare namespace ts { updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; createConstructSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; - createIndexSignature(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; - updateIndexSignature(node: IndexSignatureDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + createIndexSignature(modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + updateIndexSignature(node: IndexSignatureDeclaration, modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; updateTemplateLiteralTypeSpan(node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; createClassStaticBlockDeclaration(body: Block): ClassStaticBlockDeclaration; @@ -7659,8 +7659,8 @@ declare namespace ts { createSemicolonClassElement(): SemicolonClassElement; createBlock(statements: readonly Statement[], multiLine?: boolean): Block; updateBlock(node: Block, statements: readonly Statement[]): Block; - createVariableStatement(modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]): VariableStatement; - updateVariableStatement(node: VariableStatement, modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList): VariableStatement; + createVariableStatement(modifiers: readonly ModifierLike[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]): VariableStatement; + updateVariableStatement(node: VariableStatement, modifiers: readonly ModifierLike[] | undefined, declarationList: VariableDeclarationList): VariableStatement; createEmptyStatement(): EmptyStatement; createExpressionStatement(expression: Expression): ExpressionStatement; updateExpressionStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; @@ -7701,24 +7701,24 @@ declare namespace ts { updateFunctionDeclaration(node: FunctionDeclaration, modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; createClassDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; updateClassDeclaration(node: ClassDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; - createInterfaceDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; - updateInterfaceDeclaration(node: InterfaceDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; - createTypeAliasDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; - updateTypeAliasDeclaration(node: TypeAliasDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; - createEnumDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; - updateEnumDeclaration(node: EnumDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; - createModuleDeclaration(modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; - updateModuleDeclaration(node: ModuleDeclaration, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; + createInterfaceDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; + updateInterfaceDeclaration(node: InterfaceDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; + createTypeAliasDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; + updateTypeAliasDeclaration(node: TypeAliasDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; + createEnumDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; + updateEnumDeclaration(node: EnumDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; + createModuleDeclaration(modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; + updateModuleDeclaration(node: ModuleDeclaration, modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; createModuleBlock(statements: readonly Statement[]): ModuleBlock; updateModuleBlock(node: ModuleBlock, statements: readonly Statement[]): ModuleBlock; createCaseBlock(clauses: readonly CaseOrDefaultClause[]): CaseBlock; updateCaseBlock(node: CaseBlock, clauses: readonly CaseOrDefaultClause[]): CaseBlock; createNamespaceExportDeclaration(name: string | Identifier): NamespaceExportDeclaration; updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration; - createImportEqualsDeclaration(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - createImportDeclaration(modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; - updateImportDeclaration(node: ImportDeclaration, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; + createImportEqualsDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; + updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; createAssertClause(elements: NodeArray, multiLine?: boolean): AssertClause; @@ -7735,10 +7735,10 @@ declare namespace ts { updateNamedImports(node: NamedImports, elements: readonly ImportSpecifier[]): NamedImports; createImportSpecifier(isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; - createExportAssignment(modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; - updateExportAssignment(node: ExportAssignment, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment; - createExportDeclaration(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; - updateExportDeclaration(node: ExportDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; + createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; + updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment; + createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; + updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; createNamedExports(elements: readonly ExportSpecifier[]): NamedExports; updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports; createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 0ae2cc055e33b..97988204dc3eb 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -804,7 +804,7 @@ declare namespace ts { } interface ShorthandPropertyAssignment { /** @deprecated A shorthand property assignment cannot have modifiers */ - readonly modifiers?: NodeArray | undefined; + readonly modifiers?: NodeArray | undefined; /** @deprecated A shorthand property assignment cannot have a question token */ readonly questionToken?: QuestionToken | undefined; /** @deprecated A shorthand property assignment cannot have an exclamation token */ @@ -848,7 +848,7 @@ declare namespace ts { type FunctionLike = SignatureDeclaration; interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement, LocalsContainer { readonly kind: SyntaxKind.FunctionDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name?: Identifier; readonly body?: FunctionBody; } @@ -868,7 +868,7 @@ declare namespace ts { interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.Constructor; readonly parent: ClassLikeDeclaration; - readonly modifiers?: NodeArray | undefined; + readonly modifiers?: NodeArray | undefined; readonly body?: FunctionBody | undefined; } /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ @@ -894,7 +894,7 @@ declare namespace ts { interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement, LocalsContainer { readonly kind: SyntaxKind.IndexSignature; readonly parent: ObjectTypeDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly type: TypeNode; } interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer, LocalsContainer { @@ -1488,7 +1488,7 @@ declare namespace ts { } interface VariableStatement extends Statement, FlowContainer { readonly kind: SyntaxKind.VariableStatement; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly declarationList: VariableDeclarationList; } interface ExpressionStatement extends Statement, FlowContainer { @@ -1625,7 +1625,7 @@ declare namespace ts { } interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.InterfaceDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly typeParameters?: NodeArray; readonly heritageClauses?: NodeArray; @@ -1639,7 +1639,7 @@ declare namespace ts { } interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.TypeAliasDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly typeParameters?: NodeArray; readonly type: TypeNode; @@ -1652,7 +1652,7 @@ declare namespace ts { } interface EnumDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.EnumDeclaration; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly members: NodeArray; } @@ -1661,7 +1661,7 @@ declare namespace ts { interface ModuleDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.ModuleDeclaration; readonly parent: ModuleBody | SourceFile; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: ModuleName; readonly body?: ModuleBody | JSDocNamespaceDeclaration; } @@ -1689,7 +1689,7 @@ declare namespace ts { interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ImportEqualsDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly name: Identifier; readonly isTypeOnly: boolean; readonly moduleReference: ModuleReference; @@ -1702,7 +1702,7 @@ declare namespace ts { interface ImportDeclaration extends Statement { readonly kind: SyntaxKind.ImportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly importClause?: ImportClause; /** If this is not a StringLiteral it will be a grammar error. */ readonly moduleSpecifier: Expression; @@ -1747,7 +1747,7 @@ declare namespace ts { interface ExportDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly isTypeOnly: boolean; /** Will not be assigned in the case of `export * from "foo";` */ readonly exportClause?: NamedExportBindings; @@ -1815,7 +1815,7 @@ declare namespace ts { interface ExportAssignment extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportAssignment; readonly parent: SourceFile; - readonly modifiers?: NodeArray; + readonly modifiers?: NodeArray; readonly isExportEquals?: boolean; readonly expression: Expression; } @@ -3577,8 +3577,8 @@ declare namespace ts { updateMethodSignature(node: MethodSignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): MethodSignature; createMethodDeclaration(modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; updateMethodDeclaration(node: MethodDeclaration, modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): MethodDeclaration; - createConstructorDeclaration(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; - updateConstructorDeclaration(node: ConstructorDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + createConstructorDeclaration(modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; + updateConstructorDeclaration(node: ConstructorDeclaration, modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined): ConstructorDeclaration; createGetAccessorDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; updateGetAccessorDeclaration(node: GetAccessorDeclaration, modifiers: readonly ModifierLike[] | undefined, name: PropertyName, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): GetAccessorDeclaration; createSetAccessorDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | PropertyName, parameters: readonly ParameterDeclaration[], body: Block | undefined): SetAccessorDeclaration; @@ -3587,8 +3587,8 @@ declare namespace ts { updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): CallSignatureDeclaration; createConstructSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray | undefined, parameters: NodeArray, type: TypeNode | undefined): ConstructSignatureDeclaration; - createIndexSignature(modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; - updateIndexSignature(node: IndexSignatureDeclaration, modifiers: readonly Modifier[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + createIndexSignature(modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; + updateIndexSignature(node: IndexSignatureDeclaration, modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode): IndexSignatureDeclaration; createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; updateTemplateLiteralTypeSpan(node: TemplateLiteralTypeSpan, type: TypeNode, literal: TemplateMiddle | TemplateTail): TemplateLiteralTypeSpan; createClassStaticBlockDeclaration(body: Block): ClassStaticBlockDeclaration; @@ -3724,8 +3724,8 @@ declare namespace ts { createSemicolonClassElement(): SemicolonClassElement; createBlock(statements: readonly Statement[], multiLine?: boolean): Block; updateBlock(node: Block, statements: readonly Statement[]): Block; - createVariableStatement(modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]): VariableStatement; - updateVariableStatement(node: VariableStatement, modifiers: readonly Modifier[] | undefined, declarationList: VariableDeclarationList): VariableStatement; + createVariableStatement(modifiers: readonly ModifierLike[] | undefined, declarationList: VariableDeclarationList | readonly VariableDeclaration[]): VariableStatement; + updateVariableStatement(node: VariableStatement, modifiers: readonly ModifierLike[] | undefined, declarationList: VariableDeclarationList): VariableStatement; createEmptyStatement(): EmptyStatement; createExpressionStatement(expression: Expression): ExpressionStatement; updateExpressionStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; @@ -3766,24 +3766,24 @@ declare namespace ts { updateFunctionDeclaration(node: FunctionDeclaration, modifiers: readonly ModifierLike[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined): FunctionDeclaration; createClassDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; updateClassDeclaration(node: ClassDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier | undefined, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly ClassElement[]): ClassDeclaration; - createInterfaceDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; - updateInterfaceDeclaration(node: InterfaceDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; - createTypeAliasDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; - updateTypeAliasDeclaration(node: TypeAliasDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; - createEnumDeclaration(modifiers: readonly Modifier[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; - updateEnumDeclaration(node: EnumDeclaration, modifiers: readonly Modifier[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; - createModuleDeclaration(modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; - updateModuleDeclaration(node: ModuleDeclaration, modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; + createInterfaceDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; + updateInterfaceDeclaration(node: InterfaceDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, heritageClauses: readonly HeritageClause[] | undefined, members: readonly TypeElement[]): InterfaceDeclaration; + createTypeAliasDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; + updateTypeAliasDeclaration(node: TypeAliasDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode): TypeAliasDeclaration; + createEnumDeclaration(modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, members: readonly EnumMember[]): EnumDeclaration; + updateEnumDeclaration(node: EnumDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier, members: readonly EnumMember[]): EnumDeclaration; + createModuleDeclaration(modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags): ModuleDeclaration; + updateModuleDeclaration(node: ModuleDeclaration, modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined): ModuleDeclaration; createModuleBlock(statements: readonly Statement[]): ModuleBlock; updateModuleBlock(node: ModuleBlock, statements: readonly Statement[]): ModuleBlock; createCaseBlock(clauses: readonly CaseOrDefaultClause[]): CaseBlock; updateCaseBlock(node: CaseBlock, clauses: readonly CaseOrDefaultClause[]): CaseBlock; createNamespaceExportDeclaration(name: string | Identifier): NamespaceExportDeclaration; updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration; - createImportEqualsDeclaration(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - createImportDeclaration(modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; - updateImportDeclaration(node: ImportDeclaration, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; + createImportEqualsDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; + createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; + updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; createAssertClause(elements: NodeArray, multiLine?: boolean): AssertClause; @@ -3800,10 +3800,10 @@ declare namespace ts { updateNamedImports(node: NamedImports, elements: readonly ImportSpecifier[]): NamedImports; createImportSpecifier(isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; - createExportAssignment(modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; - updateExportAssignment(node: ExportAssignment, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment; - createExportDeclaration(modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; - updateExportDeclaration(node: ExportDeclaration, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; + createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; + updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment; + createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; + updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; createNamedExports(elements: readonly ExportSpecifier[]): NamedExports; updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports; createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; From fb0b9ee775a0aa929ddd14c7d8541d6598b150ef Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 10 Jan 2023 17:20:20 -0500 Subject: [PATCH 38/51] Remove stub variables for potential type mutations --- src/compiler/checker.ts | 95 ++++++++++++----------------------------- 1 file changed, 27 insertions(+), 68 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f5de460e383eb..2adf0d6d5a8d0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15488,7 +15488,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function getGlobalClassAccessorDecoratorResultType(reportErrors: boolean) { - return (deferredGlobalClassAccessorDecoratorResultType ??= getGlobalType("ClassAccessorDecoratorResult" as __String, /*arity*/ 3, reportErrors)) ?? emptyGenericType; + return (deferredGlobalClassAccessorDecoratorResultType ??= getGlobalType("ClassAccessorDecoratorResult" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; } function getGlobalClassFieldDecoratorContextType(reportErrors: boolean) { @@ -34402,14 +34402,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return tryCreateTypeReference(getGlobalClassAccessorDecoratorTargetType(/*reportError*/ true), [thisType, valueType]); } - function createClassAccessorDecoratorResultType(thisType: Type, inputType: Type, outputType: Type) { - return tryCreateTypeReference(getGlobalClassAccessorDecoratorResultType(/*reportError*/ true), [thisType, inputType, outputType]); + function createClassAccessorDecoratorResultType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassAccessorDecoratorResultType(/*reportError*/ true), [thisType, valueType]); } - function createClassFieldDecoratorInitializerMutatorType(thisType: Type, inputType: Type, outputType: Type) { + function createClassFieldDecoratorInitializerMutatorType(thisType: Type, valueType: Type) { const thisParam = createParameter("this" as __String, thisType); - const valueParam = createParameter("value" as __String, outputType); - return createFunctionType(/*typeParameters*/ undefined, thisParam, [valueParam], inputType, /*typePredicate*/ undefined, 1); + const valueParam = createParameter("value" as __String, valueType); + return createFunctionType(/*typeParameters*/ undefined, thisParam, [valueParam], valueType, /*typePredicate*/ undefined, 1); } /** @@ -34431,10 +34431,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { */ function getESDecoratorCallSignature(decorator: Decorator) { // We are considering a future change that would allow the type of a decorator to affect the type of the - // class and its members, such as a `@Stringify` decorator changing the type of a `number` field to - // `string`, or a `@Callable` decorator adding a call signature to a `class`. For now, the type arguments - // for the various context types that will eventually change to reflect such mutations will be stubbed out - // with fixed types so that we have a convenient place to apply these mutations. + // class and its members, such as a `@Stringify` decorator changing the type of a `number` field to `string`, or + // a `@Callable` decorator adding a call signature to a `class`. The type arguments for the various context + // types may eventually change to reflect such mutations. // // In some cases we describe such potential mutations as coming from a "prior decorator application". It is // important to note that, while decorators are *evaluated* left to right, they are *applied* right to left @@ -34523,22 +34522,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // argument will be the "final type" of the class after all decorators are applied. const node = parent as ClassDeclaration | ClassExpression; - - // TODO: This should eventually correspond with the "output type" of any prior decorator, or - // the type of the class after all member decorator type mutations have been applied. - const inputType = getTypeOfSymbol(getSymbolOfDeclaration(node)); - - // TODO: This should eventually be a type variable that is allowed to be any valid `function` - // type, and whose type will be inferred from decorator application and used as either - // the "input type" of the next decorator, or the "final type" of the class. - const outputType = inputType; - - // TODO: This should eventually be a type variable that is the result of the type mutations from - // all decorators. - const finalType = outputType; - - const contextType = createClassDecoratorContextType(finalType); - links.decoratorSignature = createESDecoratorCallSignature(inputType, contextType, outputType); + const targetType = getTypeOfSymbol(getSymbolOfDeclaration(node)); + const contextType = createClassDecoratorContextType(targetType); + links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, targetType); break; } @@ -34560,24 +34546,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // In all three cases, the `This` type argument is the "final type" of either the class or // instance, depending on whether the member was `static`. - // TODO: This should eventually correspond with either the "output type" of any prior decorator - // or the "original type" of the member. - const inputType = + const valueType = isMethodDeclaration(node) ? getOrCreateTypeFromSignature(getSignatureFromDeclaration(node)) : getTypeOfNode(node); - // TODO: This should eventually be a type variable whose type will be inferred from decorator - // application and used as either the "input type" of the next decorator, or the - // "final type" of the member. - const outputType = inputType; - - // TODO: This should eventually be a type variable that is the result of the type mutations from - // all decorators of the member. - const finalType = outputType; - - // TODO: This should eventually be a type variable that is the result of the type mutations from - // all decorators applied to the class and its members. - const finalThisType = hasStaticModifier(node) ? + const thisType = hasStaticModifier(node) ? getTypeOfSymbol(getSymbolOfDeclaration(node.parent)) : getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node.parent)); @@ -34585,17 +34558,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // something like `() => inputType`, for setters it's `(value: inputType) => void` and for // methods it is just the input type. const targetType = - isGetAccessorDeclaration(node) ? createGetterFunctionType(inputType) : - isSetAccessorDeclaration(node) ? createSetterFunctionType(inputType) : - inputType; + isGetAccessorDeclaration(node) ? createGetterFunctionType(valueType) : + isSetAccessorDeclaration(node) ? createSetterFunctionType(valueType) : + valueType; - const contextType = createClassMemberDecoratorContextTypeForNode(node, finalThisType, finalType); + const contextType = createClassMemberDecoratorContextTypeForNode(node, thisType, valueType); // We also wrap the "output type", as needed. const returnType = - isGetAccessorDeclaration(node) ? createGetterFunctionType(outputType) : - isSetAccessorDeclaration(node) ? createSetterFunctionType(outputType) : - outputType; + isGetAccessorDeclaration(node) ? createGetterFunctionType(valueType) : + isSetAccessorDeclaration(node) ? createSetterFunctionType(valueType) : + valueType; links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, returnType); break; @@ -34611,22 +34584,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // depending on whether the member was `static`, and the `Value` type argument corresponds to // the "final type" of the value stored in the field. - // TODO: This should eventually correspond with either the "output type" of any prior decorator - // or the "original type" of the member. - const inputType = getTypeOfNode(node); - - // TODO: This should eventually be a type variable whose type will be inferred from decorator - // application and used as either the "input type" of the next decorator, or the - // "final type" of the member. - const outputType = inputType; - - // TODO: This should eventually be a type variable that is the result of the type mutations from - // all decorators of the member. - const finalType = outputType; - - // TODO: This should eventually be a type variable that is the result of the type mutations from - // all decorators applied to the class and its members. - const finalThisType = hasStaticModifier(node) ? + const valueType = getTypeOfNode(node); + const thisType = hasStaticModifier(node) ? getTypeOfSymbol(getSymbolOfDeclaration(node.parent)) : getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node.parent)); @@ -34634,18 +34593,18 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // runtime-generated getter and setter that are added to the class/prototype. The `target` of a // regular field decorator is always `undefined` as it isn't installed until it is initialized. const targetType = - hasAccessorModifier(node) ? createClassAccessorDecoratorTargetType(finalThisType, inputType) : + hasAccessorModifier(node) ? createClassAccessorDecoratorTargetType(thisType, valueType) : undefinedType; - const contextType = createClassMemberDecoratorContextTypeForNode(node, finalThisType, finalType); + const contextType = createClassMemberDecoratorContextTypeForNode(node, thisType, valueType); // We wrap the "output type" depending on the declaration. For auto-accessors, we wrap the // "output type" in a `ClassAccessorDecoratorResult` type, which allows for // mutation of the runtime-generated getter and setter, as well as the injection of an // initializer mutator. For regular fields, we wrap the "output type" in an initializer mutator. const returnType = - hasAccessorModifier(node) ? createClassAccessorDecoratorResultType(finalThisType, inputType, finalType) : - createClassFieldDecoratorInitializerMutatorType(finalThisType, inputType, finalType); + hasAccessorModifier(node) ? createClassAccessorDecoratorResultType(thisType, valueType) : + createClassFieldDecoratorInitializerMutatorType(thisType, valueType); links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, returnType); break; From 6656953ac21ab72a69c28fa423fc48108e60fad3 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 11 Jan 2023 09:59:19 -0500 Subject: [PATCH 39/51] Fix static accessor initialization order --- src/compiler/transformers/classFields.ts | 74 +++++++----- ...ation-classThisReference(target=es2022).js | 10 +- ...ervation(module=commonjs,target=es2022).js | 10 +- ...eservation(module=esnext,target=es2022).js | 10 +- ...on-fields-staticAccessor(target=es2022).js | 4 +- ...ion-fields-staticPrivate(target=es2022).js | 4 +- ...ds-staticPrivateAccessor(target=es2022).js | 4 +- ...assDeclaration-sourceMap(target=es2022).js | 8 +- ...eclaration-sourceMap(target=es2022).js.map | 4 +- ...ion-sourceMap(target=es2022).sourcemap.txt | 110 ++++++++---------- ...sion-commentPreservation(target=es2022).js | 7 ++ 11 files changed, 132 insertions(+), 113 deletions(-) diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 35bc4c738fc52..f32c76f8dc79d 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -891,40 +891,40 @@ export function transformClassFields(context: TransformationContext): (x: Source const commentRange = getCommentRange(node); const sourceMapRange = getSourceMapRange(node); - // Since we're creating two declarations where there was previously one, cache - // the expression for any computed property names. - const name = node.name; - let getterName = name; - let setterName = name; - if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression)) { - const cacheAssignment = findComputedPropertyNameCacheAssignment(name); - if (cacheAssignment) { - getterName = factory.updateComputedPropertyName(name, visitNode(name.expression, visitor, isExpression)); - setterName = factory.updateComputedPropertyName(name, cacheAssignment.left); - } - else { - const temp = factory.createTempVariable(hoistVariableDeclaration); - setSourceMapRange(temp, name.expression); - const expression = visitNode(name.expression, visitor, isExpression); - const assignment = factory.createAssignment(temp, expression); - setSourceMapRange(assignment, name.expression); - getterName = factory.updateComputedPropertyName(name, assignment); - setterName = factory.updateComputedPropertyName(name, temp); - } + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + const name = node.name; + let getterName = name; + let setterName = name; + if (isComputedPropertyName(name) && !isSimpleInlineableExpression(name.expression)) { + const cacheAssignment = findComputedPropertyNameCacheAssignment(name); + if (cacheAssignment) { + getterName = factory.updateComputedPropertyName(name, visitNode(name.expression, visitor, isExpression)); + setterName = factory.updateComputedPropertyName(name, cacheAssignment.left); } + else { + const temp = factory.createTempVariable(hoistVariableDeclaration); + setSourceMapRange(temp, name.expression); + const expression = visitNode(name.expression, visitor, isExpression); + const assignment = factory.createAssignment(temp, expression); + setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, assignment); + setterName = factory.updateComputedPropertyName(name, temp); + } + } + const modifiers = visitNodes(node.modifiers, m => isAccessorModifier(m) ? undefined : m); + const backingField = createAccessorPropertyBackingField(factory, node, modifiers, node.initializer); + setOriginalNode(backingField, node); + setEmitFlags(backingField, EmitFlags.NoComments); + setSourceMapRange(backingField, sourceMapRange); - const backingField = createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); - setOriginalNode(backingField, node); - setEmitFlags(backingField, EmitFlags.NoComments); - setSourceMapRange(backingField, sourceMapRange); - - const getter = createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + const getter = createAccessorPropertyGetRedirector(factory, node, modifiers, getterName); setOriginalNode(getter, node); setCommentRange(getter, commentRange); setSourceMapRange(getter, sourceMapRange); - const setter = createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + const setter = createAccessorPropertySetRedirector(factory, node, modifiers, setterName); setOriginalNode(setter, node); setEmitFlags(setter, EmitFlags.NoComments); setSourceMapRange(setter, sourceMapRange); @@ -938,8 +938,22 @@ export function transformClassFields(context: TransformationContext): (x: Source const info = accessPrivateIdentifier(node.name); Debug.assert(info, "Undeclared private name for property declaration."); - // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. - return info.isValid ? undefined : node; + // Leave invalid code untransformed + if (!info.isValid) { + return node; + } + + // If we encounter a valid private static field and we're not transforming + // class static blocks, initialize it + if (info.isStatic && !shouldTransformPrivateElementsOrClassStaticBlocks) { + // TODO: fix + const statement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (statement) { + return factory.createClassStaticBlockDeclaration(factory.createBlock([statement], /*multiLine*/ true)); + } + } + + return undefined; } if (shouldTransformInitializersUsingSet && !isStatic(node) && lexicalEnvironment?.data && lexicalEnvironment.data.facts & ClassFacts.WillHoistInitializersToConstructor) { @@ -2278,7 +2292,7 @@ export function transformClassFields(context: TransformationContext): (x: Source */ function addPropertyOrClassStaticBlockStatements(statements: Statement[], properties: readonly (PropertyDeclaration | ClassStaticBlockDeclaration)[], receiver: LeftHandSideExpression) { for (const property of properties) { - if (isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields && !(getInternalEmitFlags(property) & InternalEmitFlags.TransformPrivateStaticElements)) { + if (isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks) { continue; } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js index d618f317f5248..384f95606c9c6 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js @@ -26,6 +26,9 @@ let C = (() => { } static { _classThis; } static x = _classThis; + static { + _a_accessor_storage = { value: _classThis }; + } static get a() { return __classPrivateFieldGet(this, _classThis, "f", _a_accessor_storage); } static set a(value) { __classPrivateFieldSet(this, _classThis, value, "f", _a_accessor_storage); } static m() { this; } @@ -34,12 +37,5 @@ let C = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - Object.defineProperty(_classThis, "x", { - enumerable: true, - configurable: true, - writable: true, - value: _classThis - }); - _a_accessor_storage = { value: _classThis }; return C = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js index 466df6dec2463..427fa7c1ba01c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js @@ -187,13 +187,17 @@ let C = (() => { /*16*/ get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + static { + /*28*/ + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + } + static { + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + } static { __runInitializers(_classThis, _classExtraInitializers); } }; - /*28*/ - _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; - _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; return C = _classThis; })(); //// [file2.js] diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js index f1cce6e10d08c..6fa846bd3861b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js @@ -187,13 +187,17 @@ let C = (() => { /*16*/ get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + static { + /*28*/ + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + } + static { + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + } static { __runInitializers(_classThis, _classExtraInitializers); } }; - /*28*/ - _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; - _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; return C = _classThis; })(); //// [file2.js] diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js index ca078be2cf36f..17c09315a7b6e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js @@ -59,6 +59,9 @@ let D = (() => { __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); D = _classThis = _classDescriptor.value; } + static { + _field1_accessor_storage = { value: 1 }; + } static get field1() { return __classPrivateFieldGet(this, _classThis, "f", _field1_accessor_storage); } static set field1(value) { __classPrivateFieldSet(this, _classThis, value, "f", _field1_accessor_storage); } static { @@ -69,6 +72,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - _field1_accessor_storage = { value: 1 }; return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js index c1266008d01ac..cfc79ec2db943 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js @@ -41,6 +41,9 @@ let D = (() => { __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); D = _classThis = _classDescriptor.value; } + static { + _field1 = { value: 0 }; + } static { __classPrivateFieldGet(_classThis, _classThis, "f", _field1); __classPrivateFieldSet(_classThis, _classThis, 1, "f", _field1); @@ -49,6 +52,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - _field1 = { value: 0 }; return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js index 4c29b857e2138..c00732342110c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js @@ -45,6 +45,9 @@ let D = (() => { __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); D = _classThis = _classDescriptor.value; } + static { + _field1_accessor_storage = { value: 0 }; + } static { __classPrivateFieldGet(_classThis, _classThis, "a", _field1_get); __classPrivateFieldSet(_classThis, _classThis, 1, "a", _field1_set); @@ -53,6 +56,5 @@ let D = (() => { __runInitializers(_classThis, _classExtraInitializers); } }; - _field1_accessor_storage = { value: 0 }; return D = _classThis; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js index 7fb69ed69070d..f8e1d06505a9a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js @@ -157,12 +157,16 @@ let C = (() => { #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + static { + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + } + static { + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + } static { __runInitializers(_classThis, _classExtraInitializers); } }; - _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; - _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; return C = _classThis; })(); //# sourceMappingURL=esDecorators-classDeclaration-sourceMap.js.map diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map index 564a60c08fd9b..60a00edd6f1c0 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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WMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;;;kCACF,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;iDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;YAfJ,yDAAA,yBAAA,cAAkB,CAAC,YAAA,mOAAA;YAInB,wDAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,wNAAA;YAI7B,wDAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,6NAAA;YA5BhC,4IAAA,MAAM,2CAAK;YAIX,sIAAI,CAAC,2CAAgB;YAIrB,oIAAI,CAAC,mDAAmB;YAwBxB,wUAAc;YAId,oDAAA,uBAAA,0FAAuB,cAAA,EAAvB,uBAAA,+FAAuB,cAAA,8TAAA;YAxBvB,iIAAA,CAAC,uBAAD,CAAC,8DAAK;YAIN,oIAAS,CAAC,uBAAD,CAAC,8DAAK;YAnBnB,4IAwCC;YAxCK,CAAC;YAAD,wDAAC;;QAGH,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,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xDQUFDLENBQUMsQ0FBQyxDQUFDO1FBSXJCLElBQUksQ0FBQyxDQUFDLEtBQWEsSUFBSSxDQUFDO1FBSXhCLENBQUMsa0dBQUcsQ0FBQyxHQUFDO1FBSU4saUVBQWEsQ0FBQyxFQUFDO1FBQWYsSUFBUyxDQUFDLHVFQUFLO1FBQWYsSUFBUyxDQUFDLDRFQUFLOztZQWdCUiw0RUFBSyxDQUFDLEdBQUosQ0FBSzs7O1lBSUUsNkZBQUssQ0FBQyxHQUFKLENBQUs7OztZQXZDckIsdURBQUM7OztXQUFELENBQUMifQ==,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== //// [esDecorators-classDeclaration-sourceMap.d.ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt index b1958fccdc643..0353946d30856 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt @@ -785,43 +785,13 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 4 >Emitted(110, 90) Source(24, 20) + SourceIndex(0) --- >>> static { ->>> __runInitializers(_classThis, _classExtraInitializers); +>>> _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; 1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > -2 > C -1 >Emitted(112, 13) Source(5, 7) + SourceIndex(0) -2 >Emitted(112, 68) Source(5, 8) + SourceIndex(0) ---- ->>> } ->>> }; ->>> _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^-> -1 > { - > @dec - > @dec - > method() {} - > - > @dec - > @dec - > get x() { return 1; } - > - > @dec - > @dec - > set x(value: number) { } - > - > @dec - > @dec - > y = 1; - > - > @dec - > @dec - > accessor z = 1; +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +1 > > > @dec > @dec @@ -838,44 +808,58 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > @dec > static -2 > #y = -3 > 1 -4 > -5 > = 1; -1 >Emitted(115, 5) Source(40, 12) + SourceIndex(0) -2 >Emitted(115, 81) Source(40, 17) + SourceIndex(0) -3 >Emitted(115, 82) Source(40, 18) + SourceIndex(0) -4 >Emitted(115, 85) Source(40, 14) + SourceIndex(0) -5 >Emitted(115, 86) Source(40, 19) + SourceIndex(0) +2 > #y = +3 > 1 +4 > +5 > = 1; +1 >Emitted(112, 13) Source(40, 12) + SourceIndex(0) +2 >Emitted(112, 89) Source(40, 17) + SourceIndex(0) +3 >Emitted(112, 90) Source(40, 18) + SourceIndex(0) +4 >Emitted(112, 93) Source(40, 14) + SourceIndex(0) +5 >Emitted(112, 94) Source(40, 19) + SourceIndex(0) --- ->>> _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^ -5 > ^ -1-> +>>> } +>>> static { +>>> _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +1 > > > @dec > @dec > static accessor -2 > #z = -3 > 1 -4 > -5 > = 1; -1->Emitted(116, 5) Source(44, 21) + SourceIndex(0) -2 >Emitted(116, 98) Source(44, 26) + SourceIndex(0) -3 >Emitted(116, 99) Source(44, 27) + SourceIndex(0) -4 >Emitted(116, 102) Source(44, 23) + SourceIndex(0) -5 >Emitted(116, 103) Source(44, 28) + SourceIndex(0) +2 > #z = +3 > 1 +4 > +5 > = 1; +1 >Emitted(115, 13) Source(44, 21) + SourceIndex(0) +2 >Emitted(115, 106) Source(44, 26) + SourceIndex(0) +3 >Emitted(115, 107) Source(44, 27) + SourceIndex(0) +4 >Emitted(115, 110) Source(44, 23) + SourceIndex(0) +5 >Emitted(115, 111) Source(44, 28) + SourceIndex(0) --- +>>> } +>>> static { +>>> __runInitializers(_classThis, _classExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > C +1 >Emitted(118, 13) Source(5, 7) + SourceIndex(0) +2 >Emitted(118, 68) Source(5, 8) + SourceIndex(0) +--- +>>> } +>>> }; >>> return C = _classThis; 1 >^^^^^^^^^^^ 2 > ^ 1 > 2 > C -1 >Emitted(117, 12) Source(5, 7) + SourceIndex(0) -2 >Emitted(117, 13) Source(5, 8) + SourceIndex(0) +1 >Emitted(121, 12) Source(5, 7) + SourceIndex(0) +2 >Emitted(121, 13) Source(5, 8) + SourceIndex(0) --- >>>})(); >>>//# sourceMappingURL=esDecorators-classDeclaration-sourceMap.js.map=================================================================== diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js index 93f5aae3a7603..54187066a7796 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js @@ -149,6 +149,13 @@ class C { /*17*/ get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + static { + /*29*/ + _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; + } + static { + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + } static { __runInitializers(_classThis, _classExtraInitializers); } From 3cc86d9e6fb2455101f8f1c50787898074f1717c Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 11 Jan 2023 10:39:56 -0500 Subject: [PATCH 40/51] Accept baselines --- ...tedPackageJsonRedirect(moduleresolution=node16).trace.json | 4 ++++ ...dPackageJsonRedirect(moduleresolution=nodenext).trace.json | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=node16).trace.json b/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=node16).trace.json index 4d8ad876095fe..986ba264c0f45 100644 --- a/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=node16).trace.json +++ b/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=node16).trace.json @@ -27,5 +27,9 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=nodenext).trace.json b/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=nodenext).trace.json index 77e7411b6622e..5dfb35ce7971f 100644 --- a/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=nodenext).trace.json +++ b/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=nodenext).trace.json @@ -27,5 +27,9 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file From 57ef107148cd52e20e6376a11ff216efb89698c9 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 11 Jan 2023 13:01:01 -0500 Subject: [PATCH 41/51] Fix class decorator+static auto-accessor transformation --- src/compiler/transformers/classFields.ts | 11 +++-- ...ervation(module=commonjs,target=es2022).js | 10 ++--- ...eservation(module=esnext,target=es2022).js | 10 ++--- ...assDeclaration-sourceMap(target=es2022).js | 10 ++--- ...eclaration-sourceMap(target=es2022).js.map | 4 +- ...ion-sourceMap(target=es2022).sourcemap.txt | 45 +++++++++---------- ...sion-commentPreservation(target=es2022).js | 10 ++--- 7 files changed, 52 insertions(+), 48 deletions(-) diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index f32c76f8dc79d..c1b54cce90363 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -2028,13 +2028,18 @@ export function transformClassFields(context: TransformationContext): (x: Source } } - if (shouldTransformAutoAccessors && (shouldTransformPrivateElementsOrClassStaticBlocks || shouldTransformPrivateStaticElementsInClass)) { + if (shouldTransformAutoAccessorsInCurrentClass()) { for (const member of node.members) { if (isAutoAccessorPropertyDeclaration(member)) { - if (shouldTransformAutoAccessors || shouldTransformPrivateStaticElementsInClass && hasStaticModifier(member) && isPrivateIdentifier(member.name)) { - const storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + const storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + if (shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformPrivateStaticElementsInClass && hasStaticModifier(member)) { addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); } + else { + const privateEnv = getPrivateIdentifierEnvironment(); + setPrivateIdentifier(privateEnv, storageName, { kind: "untransformed" }); + } } } } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js index 427fa7c1ba01c..15ca42528ca0f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js @@ -122,7 +122,7 @@ class G { //// [file1.js] /*1*/ let C = (() => { - var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set; let _classDecorators = [dec, dec]; let _classDescriptor; let _classExtraInitializers = []; @@ -149,7 +149,7 @@ let C = (() => { let _z_initializers = []; var C = class { static { __setFunctionName(this, "C"); } - static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } + static { _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } static { _method_decorators = [dec, dec]; _get_x_decorators = [dec, dec]; @@ -183,10 +183,10 @@ let C = (() => { set x(value) { } /*13*/ y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); + #z_accessor_storage = __runInitializers(this, _z_initializers, 1); /*16*/ - get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } - set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + get z() { return this.#z_accessor_storage; } + set z(value) { this.#z_accessor_storage = value; } static { /*28*/ _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js index 6fa846bd3861b..c0d108a0f3220 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js @@ -122,7 +122,7 @@ class G { //// [file1.js] /*1*/ let C = (() => { - var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set; let _classDecorators = [dec, dec]; let _classDescriptor; let _classExtraInitializers = []; @@ -149,7 +149,7 @@ let C = (() => { let _z_initializers = []; var C = class { static { __setFunctionName(this, "C"); } - static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } + static { _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } static { _method_decorators = [dec, dec]; _get_x_decorators = [dec, dec]; @@ -183,10 +183,10 @@ let C = (() => { set x(value) { } /*13*/ y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); + #z_accessor_storage = __runInitializers(this, _z_initializers, 1); /*16*/ - get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } - set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + get z() { return this.#z_accessor_storage; } + set z(value) { this.#z_accessor_storage = value; } static { /*28*/ _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js index f8e1d06505a9a..f0e99117857fc 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js @@ -97,7 +97,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function ( return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; let C = (() => { - var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set; let _classDecorators = [dec, dec]; let _classDescriptor; let _classExtraInitializers = []; @@ -124,7 +124,7 @@ let C = (() => { let _z_initializers = []; var C = class { static { __setFunctionName(this, "C"); } - static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } + static { _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } static { _method_decorators = [dec, dec]; _get_x_decorators = [dec, dec]; @@ -154,9 +154,9 @@ let C = (() => { get x() { return 1; } set x(value) { } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); - get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } - set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + #z_accessor_storage = __runInitializers(this, _z_initializers, 1); + get z() { return this.#z_accessor_storage; } + set z(value) { this.#z_accessor_storage = value; } static { _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map index 60a00edd6f1c0..452ee677cbdce 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;;;kCACF,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;iDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EAC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GAAJ,CAAK;;;YAvCrB,uDAAC;;;WAAD,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fZXNEZWNvcmF0ZSA9ICh0aGlzICYmIHRoaXMuX19lc0RlY29yYXRlKSB8fCBmdW5jdGlvbiAoY3RvciwgZGVzY3JpcHRvckluLCBkZWNvcmF0b3JzLCBjb250ZXh0SW4sIGluaXRpYWxpemVycywgZXh0cmFJbml0aWFsaXplcnMpIHsNCiAgICBmdW5jdGlvbiBhY2NlcHQoZikgeyBpZiAoZiAhPT0gdm9pZCAwICYmIHR5cGVvZiBmICE9PSAiZnVuY3Rpb24iKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJGdW5jdGlvbiBleHBlY3RlZCIpOyByZXR1cm4gZjsgfQ0KICAgIHZhciBraW5kID0gY29udGV4dEluLmtpbmQsIGtleSA9IGtpbmQgPT09ICJnZXR0ZXIiID8gImdldCIgOiBraW5kID09PSAic2V0dGVyIiA/ICJzZXQiIDogInZhbHVlIjsNCiAgICB2YXIgdGFyZ2V0ID0gIWRlc2NyaXB0b3JJbiAmJiBjdG9yID8gY29udGV4dEluWyJzdGF0aWMiXSA/IGN0b3IgOiBjdG9yLnByb3RvdHlwZSA6IG51bGw7DQogICAgdmFyIGRlc2NyaXB0b3IgPSBkZXNjcmlwdG9ySW4gfHwgKHRhcmdldCA/IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodGFyZ2V0LCBjb250ZXh0SW4ubmFtZSkgOiB7fSk7DQogICAgdmFyIF8sIGRvbmUgPSBmYWxzZTsNCiAgICBmb3IgKHZhciBpID0gZGVjb3JhdG9ycy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkgew0KICAgICAgICB2YXIgY29udGV4dCA9IHt9Ow0KICAgICAgICBmb3IgKHZhciBwIGluIGNvbnRleHRJbikgY29udGV4dFtwXSA9IHAgPT09ICJhY2Nlc3MiID8ge30gOiBjb250ZXh0SW5bcF07DQogICAgICAgIGZvciAodmF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iAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== //// [esDecorators-classDeclaration-sourceMap.d.ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt index 0353946d30856..1eb2c24c0addd 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt @@ -60,7 +60,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts >>>let C = (() => { 1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >declare var dec: any; > >@dec @@ -70,7 +70,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 1 >Emitted(50, 5) Source(5, 7) + SourceIndex(0) 2 >Emitted(50, 6) Source(5, 8) + SourceIndex(0) --- ->>> var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage; +>>> var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set; >>> let _classDecorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 > ^^^ @@ -120,7 +120,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 >Emitted(76, 10) Source(5, 8) + SourceIndex(0) --- >>> static { __setFunctionName(this, "C"); } ->>> static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } +>>> static { _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } >>> static { >>> _method_decorators = [dec, dec]; 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -736,45 +736,44 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 4 >Emitted(107, 109) Source(20, 10) + SourceIndex(0) 5 >Emitted(107, 112) Source(20, 11) + SourceIndex(0) --- ->>> #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); +>>> #z_accessor_storage = __runInitializers(this, _z_initializers, 1); 1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^ -5 > ^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ 1 > > > @dec > @dec > 2 > accessor z = -3 > 1 -4 > ; +3 > 1 +4 > ; 1 >Emitted(108, 9) Source(24, 5) + SourceIndex(0) -2 >Emitted(108, 74) Source(24, 18) + SourceIndex(0) -3 >Emitted(108, 75) Source(24, 19) + SourceIndex(0) -4 >Emitted(108, 77) Source(24, 20) + SourceIndex(0) +2 >Emitted(108, 72) Source(24, 18) + SourceIndex(0) +3 >Emitted(108, 73) Source(24, 19) + SourceIndex(0) +4 >Emitted(108, 75) Source(24, 20) + SourceIndex(0) --- ->>> get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } -1->^^^^^^^^ +>>> get z() { return this.#z_accessor_storage; } +1 >^^^^^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^-> +1 > 2 > accessor 3 > z 4 > = 1; -1->Emitted(109, 9) Source(24, 5) + SourceIndex(0) +1 >Emitted(109, 9) Source(24, 5) + SourceIndex(0) 2 >Emitted(109, 13) Source(24, 14) + SourceIndex(0) 3 >Emitted(109, 14) Source(24, 15) + SourceIndex(0) -4 >Emitted(109, 85) Source(24, 20) + SourceIndex(0) +4 >Emitted(109, 53) Source(24, 20) + SourceIndex(0) --- ->>> set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } +>>> set z(value) { this.#z_accessor_storage = value; } 1->^^^^^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> 2 > accessor 3 > z @@ -782,7 +781,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 1->Emitted(110, 9) Source(24, 5) + SourceIndex(0) 2 >Emitted(110, 13) Source(24, 14) + SourceIndex(0) 3 >Emitted(110, 14) Source(24, 15) + SourceIndex(0) -4 >Emitted(110, 90) Source(24, 20) + SourceIndex(0) +4 >Emitted(110, 59) Source(24, 20) + SourceIndex(0) --- >>> static { >>> _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js index 54187066a7796..909243acb719d 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js @@ -85,7 +85,7 @@ class C { //// [esDecorators-classExpression-commentPreservation.js] /*1*/ ((() => { - var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _z_1_accessor_storage, _a; + var _method_get, _x_get, _x_set, _y, _z_accessor_storage, _z_get, _z_set, _a; let _classDecorators = [dec, dec]; let _classDescriptor; let _classExtraInitializers = []; @@ -111,7 +111,7 @@ class C { let _z_decorators; let _z_initializers = []; var C = (_a = class { - static { _z_1_accessor_storage = new WeakMap(), _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } + static { _method_get = function _method_get() { return _static_private_method_descriptor.value; }, _x_get = function _x_get() { return _static_private_get_x_descriptor.get.call(this); }, _x_set = function _x_set(value) { return _static_private_set_x_descriptor.set.call(this, value); }, _z_get = function _z_get() { return _static_private_z_descriptor.get.call(this); }, _z_set = function _z_set(value) { return _static_private_z_descriptor.set.call(this, value); }; } static { _method_decorators = [dec, dec]; _get_x_decorators = [dec, dec]; @@ -145,10 +145,10 @@ class C { set x(value) { } /*14*/ y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); - #z_1_accessor_storage = __runInitializers(this, _z_initializers, 1); + #z_accessor_storage = __runInitializers(this, _z_initializers, 1); /*17*/ - get z() { return __classPrivateFieldGet(this, _z_1_accessor_storage, "f"); } - set z(value) { __classPrivateFieldSet(this, _z_1_accessor_storage, value, "f"); } + get z() { return this.#z_accessor_storage; } + set z(value) { this.#z_accessor_storage = value; } static { /*29*/ _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; From 844c303d679bf8a60e4dd404bc5eb939c8353dd1 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 11 Jan 2023 13:26:28 -0500 Subject: [PATCH 42/51] Add additional contextual typing test --- .../esDecorators-contextualTypes.2.js | 57 +++++++++ .../esDecorators-contextualTypes.2.symbols | 110 ++++++++++++++++ .../esDecorators-contextualTypes.2.types | 121 ++++++++++++++++++ .../esDecorators-contextualTypes.2.ts | 33 +++++ 4 files changed, 321 insertions(+) create mode 100644 tests/baselines/reference/esDecorators-contextualTypes.2.js create mode 100644 tests/baselines/reference/esDecorators-contextualTypes.2.symbols create mode 100644 tests/baselines/reference/esDecorators-contextualTypes.2.types create mode 100644 tests/cases/conformance/esDecorators/esDecorators-contextualTypes.2.ts diff --git a/tests/baselines/reference/esDecorators-contextualTypes.2.js b/tests/baselines/reference/esDecorators-contextualTypes.2.js new file mode 100644 index 0000000000000..b21efbebed9c4 --- /dev/null +++ b/tests/baselines/reference/esDecorators-contextualTypes.2.js @@ -0,0 +1,57 @@ +//// [esDecorators-contextualTypes.2.ts] +class C { + @boundMethodLogger("Yadda", /*bound*/ true) + foo() { + this.fooHelper(); + } + + fooHelper() { + console.log("Behold! The actual method implementation!") + } +}; +export { C }; + +function boundMethodLogger(source: string, bound = true) { + return function loggedDecorator( + target: (this: This, ...args: Args) => Return, + context: ClassMethodDecoratorContext Return> + ): ((this: This, ...args: Args) => Return) { + + if (bound) { + context.addInitializer(function () { + (this as any)[context.name] = (this as any)[context.name].bind(this); + }); + } + + return function (this, ...args) { + console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`); + return target.apply(this, args); + } + } +} + +//// [esDecorators-contextualTypes.2.js] +class C { + @boundMethodLogger("Yadda", /*bound*/ true) + foo() { + this.fooHelper(); + } + fooHelper() { + console.log("Behold! The actual method implementation!"); + } +} +; +export { C }; +function boundMethodLogger(source, bound = true) { + return function loggedDecorator(target, context) { + if (bound) { + context.addInitializer(function () { + this[context.name] = this[context.name].bind(this); + }); + } + return function (...args) { + console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`); + return target.apply(this, args); + }; + }; +} diff --git a/tests/baselines/reference/esDecorators-contextualTypes.2.symbols b/tests/baselines/reference/esDecorators-contextualTypes.2.symbols new file mode 100644 index 0000000000000..200247e987242 --- /dev/null +++ b/tests/baselines/reference/esDecorators-contextualTypes.2.symbols @@ -0,0 +1,110 @@ +=== tests/cases/conformance/esDecorators/esDecorators-contextualTypes.2.ts === +class C { +>C : Symbol(C, Decl(esDecorators-contextualTypes.2.ts, 0, 0)) + + @boundMethodLogger("Yadda", /*bound*/ true) +>boundMethodLogger : Symbol(boundMethodLogger, Decl(esDecorators-contextualTypes.2.ts, 10, 13)) + + foo() { +>foo : Symbol(C.foo, Decl(esDecorators-contextualTypes.2.ts, 0, 9)) + + this.fooHelper(); +>this.fooHelper : Symbol(C.fooHelper, Decl(esDecorators-contextualTypes.2.ts, 4, 5)) +>this : Symbol(C, Decl(esDecorators-contextualTypes.2.ts, 0, 0)) +>fooHelper : Symbol(C.fooHelper, Decl(esDecorators-contextualTypes.2.ts, 4, 5)) + } + + fooHelper() { +>fooHelper : Symbol(C.fooHelper, Decl(esDecorators-contextualTypes.2.ts, 4, 5)) + + console.log("Behold! The actual method implementation!") +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) + } +}; +export { C }; +>C : Symbol(C, Decl(esDecorators-contextualTypes.2.ts, 10, 8)) + +function boundMethodLogger(source: string, bound = true) { +>boundMethodLogger : Symbol(boundMethodLogger, Decl(esDecorators-contextualTypes.2.ts, 10, 13)) +>This : Symbol(This, Decl(esDecorators-contextualTypes.2.ts, 12, 27)) +>Args : Symbol(Args, Decl(esDecorators-contextualTypes.2.ts, 12, 32)) +>Return : Symbol(Return, Decl(esDecorators-contextualTypes.2.ts, 12, 52)) +>source : Symbol(source, Decl(esDecorators-contextualTypes.2.ts, 12, 61)) +>bound : Symbol(bound, Decl(esDecorators-contextualTypes.2.ts, 12, 76)) + + return function loggedDecorator( +>loggedDecorator : Symbol(loggedDecorator, Decl(esDecorators-contextualTypes.2.ts, 13, 10)) + + target: (this: This, ...args: Args) => Return, +>target : Symbol(target, Decl(esDecorators-contextualTypes.2.ts, 13, 36)) +>this : Symbol(this, Decl(esDecorators-contextualTypes.2.ts, 14, 17)) +>This : Symbol(This, Decl(esDecorators-contextualTypes.2.ts, 12, 27)) +>args : Symbol(args, Decl(esDecorators-contextualTypes.2.ts, 14, 28)) +>Args : Symbol(Args, Decl(esDecorators-contextualTypes.2.ts, 12, 32)) +>Return : Symbol(Return, Decl(esDecorators-contextualTypes.2.ts, 12, 52)) + + context: ClassMethodDecoratorContext Return> +>context : Symbol(context, Decl(esDecorators-contextualTypes.2.ts, 14, 54)) +>ClassMethodDecoratorContext : Symbol(ClassMethodDecoratorContext, Decl(lib.decorators.d.ts, --, --)) +>This : Symbol(This, Decl(esDecorators-contextualTypes.2.ts, 12, 27)) +>this : Symbol(this, Decl(esDecorators-contextualTypes.2.ts, 15, 52)) +>This : Symbol(This, Decl(esDecorators-contextualTypes.2.ts, 12, 27)) +>args : Symbol(args, Decl(esDecorators-contextualTypes.2.ts, 15, 63)) +>Args : Symbol(Args, Decl(esDecorators-contextualTypes.2.ts, 12, 32)) +>Return : Symbol(Return, Decl(esDecorators-contextualTypes.2.ts, 12, 52)) + + ): ((this: This, ...args: Args) => Return) { +>this : Symbol(this, Decl(esDecorators-contextualTypes.2.ts, 16, 9)) +>This : Symbol(This, Decl(esDecorators-contextualTypes.2.ts, 12, 27)) +>args : Symbol(args, Decl(esDecorators-contextualTypes.2.ts, 16, 20)) +>Args : Symbol(Args, Decl(esDecorators-contextualTypes.2.ts, 12, 32)) +>Return : Symbol(Return, Decl(esDecorators-contextualTypes.2.ts, 12, 52)) + + if (bound) { +>bound : Symbol(bound, Decl(esDecorators-contextualTypes.2.ts, 12, 76)) + + context.addInitializer(function () { +>context.addInitializer : Symbol(ClassMethodDecoratorContext.addInitializer, Decl(lib.decorators.d.ts, --, --)) +>context : Symbol(context, Decl(esDecorators-contextualTypes.2.ts, 14, 54)) +>addInitializer : Symbol(ClassMethodDecoratorContext.addInitializer, Decl(lib.decorators.d.ts, --, --)) + + (this as any)[context.name] = (this as any)[context.name].bind(this); +>this : Symbol(this, Decl(lib.decorators.d.ts, --, --)) +>context.name : Symbol(ClassMethodDecoratorContext.name, Decl(lib.decorators.d.ts, --, --)) +>context : Symbol(context, Decl(esDecorators-contextualTypes.2.ts, 14, 54)) +>name : Symbol(ClassMethodDecoratorContext.name, Decl(lib.decorators.d.ts, --, --)) +>this : Symbol(this, Decl(lib.decorators.d.ts, --, --)) +>context.name : Symbol(ClassMethodDecoratorContext.name, Decl(lib.decorators.d.ts, --, --)) +>context : Symbol(context, Decl(esDecorators-contextualTypes.2.ts, 14, 54)) +>name : Symbol(ClassMethodDecoratorContext.name, Decl(lib.decorators.d.ts, --, --)) +>this : Symbol(this, Decl(lib.decorators.d.ts, --, --)) + + }); + } + + return function (this, ...args) { +>this : Symbol(this, Decl(esDecorators-contextualTypes.2.ts, 24, 25)) +>args : Symbol(args, Decl(esDecorators-contextualTypes.2.ts, 24, 30)) + + console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>source : Symbol(source, Decl(esDecorators-contextualTypes.2.ts, 12, 61)) +>context.name.toString : Symbol(toString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>context.name : Symbol(ClassMethodDecoratorContext.name, Decl(lib.decorators.d.ts, --, --)) +>context : Symbol(context, Decl(esDecorators-contextualTypes.2.ts, 14, 54)) +>name : Symbol(ClassMethodDecoratorContext.name, Decl(lib.decorators.d.ts, --, --)) +>toString : Symbol(toString, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + return target.apply(this, args); +>target.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>target : Symbol(target, Decl(esDecorators-contextualTypes.2.ts, 13, 36)) +>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --)) +>this : Symbol(this, Decl(esDecorators-contextualTypes.2.ts, 24, 25)) +>args : Symbol(args, Decl(esDecorators-contextualTypes.2.ts, 24, 30)) + } + } +} diff --git a/tests/baselines/reference/esDecorators-contextualTypes.2.types b/tests/baselines/reference/esDecorators-contextualTypes.2.types new file mode 100644 index 0000000000000..3a4dbb0c519fa --- /dev/null +++ b/tests/baselines/reference/esDecorators-contextualTypes.2.types @@ -0,0 +1,121 @@ +=== tests/cases/conformance/esDecorators/esDecorators-contextualTypes.2.ts === +class C { +>C : C + + @boundMethodLogger("Yadda", /*bound*/ true) +>boundMethodLogger("Yadda", /*bound*/ true) : (target: (this: C) => void, context: ClassMethodDecoratorContext void>) => (this: C) => void +>boundMethodLogger : (source: string, bound?: boolean) => (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext Return>) => (this: This, ...args: Args) => Return +>"Yadda" : "Yadda" +>true : true + + foo() { +>foo : () => void + + this.fooHelper(); +>this.fooHelper() : void +>this.fooHelper : () => void +>this : this +>fooHelper : () => void + } + + fooHelper() { +>fooHelper : () => void + + console.log("Behold! The actual method implementation!") +>console.log("Behold! The actual method implementation!") : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>"Behold! The actual method implementation!" : "Behold! The actual method implementation!" + } +}; +export { C }; +>C : typeof C + +function boundMethodLogger(source: string, bound = true) { +>boundMethodLogger : (source: string, bound?: boolean) => (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext Return>) => (this: This, ...args: Args) => Return +>source : string +>bound : boolean +>true : true + + return function loggedDecorator( +>function loggedDecorator( target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext Return> ): ((this: This, ...args: Args) => Return) { if (bound) { context.addInitializer(function () { (this as any)[context.name] = (this as any)[context.name].bind(this); }); } return function (this, ...args) { console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`); return target.apply(this, args); } } : (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext Return>) => (this: This, ...args: Args) => Return +>loggedDecorator : (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext Return>) => (this: This, ...args: Args) => Return + + target: (this: This, ...args: Args) => Return, +>target : (this: This, ...args: Args) => Return +>this : This +>args : Args + + context: ClassMethodDecoratorContext Return> +>context : ClassMethodDecoratorContext Return> +>this : This +>args : Args + + ): ((this: This, ...args: Args) => Return) { +>this : This +>args : Args + + if (bound) { +>bound : boolean + + context.addInitializer(function () { +>context.addInitializer(function () { (this as any)[context.name] = (this as any)[context.name].bind(this); }) : void +>context.addInitializer : (initializer: (this: This) => void) => void +>context : ClassMethodDecoratorContext Return> +>addInitializer : (initializer: (this: This) => void) => void +>function () { (this as any)[context.name] = (this as any)[context.name].bind(this); } : (this: This) => void + + (this as any)[context.name] = (this as any)[context.name].bind(this); +>(this as any)[context.name] = (this as any)[context.name].bind(this) : any +>(this as any)[context.name] : any +>(this as any) : any +>this as any : any +>this : This +>context.name : string | symbol +>context : ClassMethodDecoratorContext Return> +>name : string | symbol +>(this as any)[context.name].bind(this) : any +>(this as any)[context.name].bind : any +>(this as any)[context.name] : any +>(this as any) : any +>this as any : any +>this : This +>context.name : string | symbol +>context : ClassMethodDecoratorContext Return> +>name : string | symbol +>bind : any +>this : This + + }); + } + + return function (this, ...args) { +>function (this, ...args) { console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`); return target.apply(this, args); } : (this: This, ...args: Args) => any +>this : This +>args : Args + + console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`); +>console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>`<${source}>: I'm logging stuff from ${context.name.toString()}!` : string +>source : string +>context.name.toString() : string +>context.name.toString : (() => string) | (() => string) +>context.name : string | symbol +>context : ClassMethodDecoratorContext Return> +>name : string | symbol +>toString : (() => string) | (() => string) + + return target.apply(this, args); +>target.apply(this, args) : any +>target.apply : (this: Function, thisArg: any, argArray?: any) => any +>target : (this: This, ...args: Args) => Return +>apply : (this: Function, thisArg: any, argArray?: any) => any +>this : This +>args : Args + } + } +} diff --git a/tests/cases/conformance/esDecorators/esDecorators-contextualTypes.2.ts b/tests/cases/conformance/esDecorators/esDecorators-contextualTypes.2.ts new file mode 100644 index 0000000000000..ed7a9972123f0 --- /dev/null +++ b/tests/cases/conformance/esDecorators/esDecorators-contextualTypes.2.ts @@ -0,0 +1,33 @@ +// @target: esnext +// @module: esnext + +class C { + @boundMethodLogger("Yadda", /*bound*/ true) + foo() { + this.fooHelper(); + } + + fooHelper() { + console.log("Behold! The actual method implementation!") + } +}; +export { C }; + +function boundMethodLogger(source: string, bound = true) { + return function loggedDecorator( + target: (this: This, ...args: Args) => Return, + context: ClassMethodDecoratorContext Return> + ): ((this: This, ...args: Args) => Return) { + + if (bound) { + context.addInitializer(function () { + (this as any)[context.name] = (this as any)[context.name].bind(this); + }); + } + + return function (this, ...args) { + console.log(`<${source}>: I'm logging stuff from ${context.name.toString()}!`); + return target.apply(this, args); + } + } +} \ No newline at end of file From 0d41f51ad130a183ae8ea8b0070ef80bf6b4c634 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 11 Jan 2023 16:05:30 -0500 Subject: [PATCH 43/51] Amend decorator evaluation order --- src/compiler/checker.ts | 8 +- src/compiler/transformers/esDecorators.ts | 20 +- .../unittests/evaluation/esDecorators.ts | 90 ++++++++- ...ervation(module=commonjs,target=es2015).js | 4 +- ...ervation(module=commonjs,target=es2022).js | 4 +- ...eservation(module=esnext,target=es2015).js | 4 +- ...eservation(module=esnext,target=es2022).js | 4 +- ...assDeclaration-sourceMap(target=es2015).js | 4 +- ...eclaration-sourceMap(target=es2015).js.map | 4 +- ...ion-sourceMap(target=es2015).sourcemap.txt | 172 +++++++++--------- ...assDeclaration-sourceMap(target=es2022).js | 4 +- ...eclaration-sourceMap(target=es2022).js.map | 4 +- ...ion-sourceMap(target=es2022).sourcemap.txt | 172 +++++++++--------- ...sion-commentPreservation(target=es2015).js | 4 +- ...sion-commentPreservation(target=es2022).js | 4 +- 15 files changed, 294 insertions(+), 208 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cbee853f9786a..85ed56160d9ad 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34486,13 +34486,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // // Per [the specification][1], decorators are applied in the following order: // - // 1. For each static method (incl. get/set methods), in document order: + // 1. For each static method (incl. get/set methods and `accessor` fields), in document order: // a. Apply each decorator for that method, in reverse order (`A1`, `A2`). - // 2. For each instance method (incl. get/set methods), in document order: + // 2. For each instance method (incl. get/set methods and `accessor` fields), in document order: // a. Apply each decorator for that method, in reverse order (`B1`, `B2`). - // 3. For each static field (incl. auto-accessors), in document order: + // 3. For each static field (excl. auto-accessors), in document order: // a. Apply each decorator for that field, in reverse order (`C1`, `C2`). - // 4. For each instance field (incl. auto-accessors), in document order: + // 4. For each instance field (excl. auto-accessors), in document order: // a. Apply each decorator for that field, in reverse order (`D1`, `D2`). // 5. Apply each decorator for the class, in reverse order (`E1`, `E2`). // diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index 59264367468d2..a9189525a65e7 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -51,10 +51,10 @@ import { // - 15.8.19 RS: ClassDefinitionEvaluation, Step 23. // - 15.8.15 RS: ClassFieldDefinitionEvaluation, Step 1. // - 15.4.5 RS: MethodDefinitionEvaluation, Step 1. -// 5. Static non-field element decorators are applied -// 6. Non-static non-field element decorators are applied -// 7. Static field element decorators are applied -// 8. Non-static field element decorators are applied +// 5. Static non-field (method/getter/setter/auto-accessor) element decorators are applied +// 6. Non-static non-field (method/getter/setter/auto-accessor) element decorators are applied +// 7. Static field (excl. auto-accessor) element decorators are applied +// 8. Non-static field (excl. auto-accessor) element decorators are applied // 9. Class decorators are applied // 10. Class binding is initialized // 11. Static extra initializers are evaluated @@ -952,16 +952,16 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc pendingExpressions ??= []; pendingExpressions.push(memberDecoratorsAssignment); - // 5. Static non-field element decorators are applied - // 6. Non-static non-field element decorators are applied - // 7. Static field element decorators are applied - // 8. Non-static field element decorators are applied + // 5. Static non-field (method/getter/setter/auto-accessor) element decorators are applied + // 6. Non-static non-field (method/getter/setter/auto-accessor) element decorators are applied + // 7. Static field (excl. auto-accessor) element decorators are applied + // 8. Non-static field (excl. auto-accessor) element decorators are applied const statements = - isMethodOrAccessor(member) ? + isMethodOrAccessor(member) || isAutoAccessorPropertyDeclaration(member) ? isStatic(member) ? classInfo.staticNonFieldDecorationStatements ??= [] : classInfo.nonStaticNonFieldDecorationStatements ??= [] : - isPropertyDeclaration(member) ? + isPropertyDeclaration(member) && !isAutoAccessorPropertyDeclaration(member) ? isStatic(member) ? classInfo.staticFieldDecorationStatements ??= [] : classInfo.nonStaticFieldDecorationStatements ??= [] : diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts index 23b4e99f464b7..3cb8cf1117275 100644 --- a/src/testRunner/unittests/evaluation/esDecorators.ts +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -1764,7 +1764,7 @@ describe("unittests:: evaluation:: esDecorators", () => { return x; }; })) - static x = order.push("static field initializer evaluation"); + static z = order.push("static field initializer evaluation"); static [(order.push("static computed property name evaluation"), "y")]() {} @@ -1822,7 +1822,39 @@ describe("unittests:: evaluation:: esDecorators", () => { order.push("static method extra initializer evaluation 2b"); }); })) - static z() {} + static x() {} + + @(order.push("static auto-accessor decorator evaluation 1"), ((t, c) => { + order.push("static auto-accessor decorator application 1"); + c.addInitializer(() => { + order.push("static auto-accessor extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("static auto-accessor extra initializer evaluation 1b"); + }); + return { + init: x => { + order.push("static auto-accessor injected initializer evaluation 1"); + return x; + } + }; + })) + @(order.push("static auto-accessor decorator evaluation 2"), ((t, c) => { + order.push("static auto-accessor decorator application 2"); + c.addInitializer(() => { + order.push("static auto-accessor extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("static auto-accessor extra initializer evaluation 2b"); + }); + return { + init: x => { + order.push("static auto-accessor injected initializer evaluation 2"); + return x; + } + }; + })) + static accessor w = order.push("static auto-accessor initializer evaluation"); @(order.push("instance method decorator evaluation 1"), ((t, c) => { order.push("instance method decorator application 1"); @@ -1843,6 +1875,38 @@ describe("unittests:: evaluation:: esDecorators", () => { }); })) c() {} + + @(order.push("instance auto-accessor decorator evaluation 1"), ((t, c) => { + order.push("instance auto-accessor decorator application 1"); + c.addInitializer(() => { + order.push("instance auto-accessor extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("instance auto-accessor extra initializer evaluation 1b"); + }); + return { + init: x => { + order.push("instance auto-accessor injected initializer evaluation 1"); + return x; + } + }; + })) + @(order.push("instance auto-accessor decorator evaluation 2"), ((t, c) => { + order.push("instance auto-accessor decorator application 2"); + c.addInitializer(() => { + order.push("instance auto-accessor extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("instance auto-accessor extra initializer evaluation 2b"); + }); + return { + init: x => { + order.push("instance auto-accessor injected initializer evaluation 2"); + return x; + } + }; + })) + accessor d = order.push("instance auto-accessor initializer evaluation"); } order.push("instance construction"); @@ -1866,18 +1930,26 @@ describe("unittests:: evaluation:: esDecorators", () => { "instance computed property name evaluation", "static method decorator evaluation 1", "static method decorator evaluation 2", + "static auto-accessor decorator evaluation 1", + "static auto-accessor decorator evaluation 2", "instance method decorator evaluation 1", "instance method decorator evaluation 2", + "instance auto-accessor decorator evaluation 1", + "instance auto-accessor decorator evaluation 2", // NOTE: at this point, all of the class elements have been collected. // next, for each static method, in document order, we apply that method's decorators in reverse order: "static method decorator application 2", "static method decorator application 1", + "static auto-accessor decorator application 2", + "static auto-accessor decorator application 1", // NOTE: at this point, all non-private static methods are defined on the class. // next, for each instance method, in document order, we apply that method's decorators in reverse order: "instance method decorator application 2", "instance method decorator application 1", + "instance auto-accessor decorator application 2", + "instance auto-accessor decorator application 1", // NOTE: at this point, all non-private instance methods are defined on the prototype. // next, for each static field, in document order, we apply that field's decorators in reverse order: @@ -1904,6 +1976,10 @@ describe("unittests:: evaluation:: esDecorators", () => { "static method extra initializer evaluation 2b", "static method extra initializer evaluation 1a", "static method extra initializer evaluation 1b", + "static auto-accessor extra initializer evaluation 2a", + "static auto-accessor extra initializer evaluation 2b", + "static auto-accessor extra initializer evaluation 1a", + "static auto-accessor extra initializer evaluation 1b", "static field extra initializer evaluation 2a", "static field extra initializer evaluation 2b", "static field extra initializer evaluation 1a", @@ -1915,6 +1991,9 @@ describe("unittests:: evaluation:: esDecorators", () => { "static field initializer evaluation", "static field injected initializer evaluation 2", "static field injected initializer evaluation 1", + "static auto-accessor initializer evaluation", + "static auto-accessor injected initializer evaluation 2", + "static auto-accessor injected initializer evaluation 1", // NOTE: at this point, static private fields will be installed (TODO: on the replacement class) // finally, class extra initializers are applied in the order they were added (i.e., methods before fields, @@ -1944,6 +2023,10 @@ describe("unittests:: evaluation:: esDecorators", () => { "instance method extra initializer evaluation 2b", "instance method extra initializer evaluation 1a", "instance method extra initializer evaluation 1b", + "instance auto-accessor extra initializer evaluation 2a", + "instance auto-accessor extra initializer evaluation 2b", + "instance auto-accessor extra initializer evaluation 1a", + "instance auto-accessor extra initializer evaluation 1b", "instance field extra initializer evaluation 2a", "instance field extra initializer evaluation 2b", "instance field extra initializer evaluation 1a", @@ -1954,6 +2037,9 @@ describe("unittests:: evaluation:: esDecorators", () => { "instance field initializer evaluation", "instance field injected initializer evaluation 2", "instance field injected initializer evaluation 1", + "instance auto-accessor initializer evaluation", + "instance auto-accessor injected initializer evaluation 2", + "instance auto-accessor injected initializer evaluation 1", // NOTE: at this point, instance private fields will be installed. // finally, statements in the constructor after the call to `super()` are evaluated: diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js index 2ebe40799c08c..6fb4fb7cba781 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js @@ -184,13 +184,13 @@ let C = (() => { __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js index 15ca42528ca0f..195327cc07ebc 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js @@ -164,13 +164,13 @@ let C = (() => { __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js index b0e68b8b4fafb..d497215f2d7dd 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js @@ -184,13 +184,13 @@ let C = (() => { __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js index c0d108a0f3220..53cdeb1a9eff0 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js @@ -164,13 +164,13 @@ let C = (() => { __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js index 925af4e40ca15..dda9b66f3cc5a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js @@ -154,13 +154,13 @@ let C = (() => { __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map index 6eb9b74a9df4a..e4e11c0af6b24 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;YAeH,MAAC,kGAAG,CAAC,GAAC;YAIG,yEAAI,CAAC,GAAC;QAqBnB,CAAC;QArCG,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAQxB,IAAS,CAAC,uEAAK;QAAf,IAAS,CAAC,4EAAK;;;;;;;;;;8BAlBd,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;6CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;QAfJ,+DAAA,yBAAA,cAAkB,CAAC,YAAA,mOAAA;QAInB,8DAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,wNAAA;QAI7B,8DAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,6NAAA;QA5BhC,kJAAA,MAAM,2CAAK;QAIX,4IAAI,CAAC,2CAAgB;QAIrB,0IAAI,CAAC,mDAAmB;QAwBxB,wUAAc;QAId,0DAAA,uBAAA,gGAAuB,cAAA,EAAvB,uBAAA,qGAAuB,cAAA,8TAAA;QAxBvB,iIAAA,CAAC,uBAAD,CAAC,8DAAK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AgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;YAeH,MAAC,kGAAG,CAAC,GAAC;YAIG,yEAAI,CAAC,GAAC;QAqBnB,CAAC;QArCG,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAQxB,IAAS,CAAC,uEAAK;QAAf,IAAS,CAAC,4EAAK;;;;;;;;;;8BAlBd,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;6CAGH,GAAG,EACH,GAAG;4CAGH,GA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BQWdCO1FBSXJCLDBJQUFJLENBQUMsbURBQW1CO1FBUXhCLDBJQUFTLENBQUMsdUJBQUQsQ0FBQyw4REFBSztRQWdCZix3VUFBYztRQXBCZCxpSUFBQSxDQUFDLHVCQUFELENBQUMsOERBQUs7UUFmVix3SkF3Q0M7UUF4Q0ssQ0FBQztRQUFELHdEQUFDOztJQW1DSSw0RUFBSyxDQUFDLEdBQUosQ0FBSztJQUlFLDZGQUFLLENBQUMsR0FBSixDQUFLOztRQXZDckIsdURBQUM7O1dBQUQsQ0FBQyJ9,ZGVjbGFyZSB2YXIgZGVjOiBhbnk7CgpAZGVjCkBkZWMKY2xhc3MgQyB7CiAgICBAZGVjCiAgICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== //// [esDecorators-classDeclaration-sourceMap.d.ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt index ea7ac9a95b55b..ee8dabe539f8d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt @@ -580,6 +580,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^ 8 > ^^^^^^^^^^^^^^ 9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -603,6 +604,46 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 >Emitted(107, 128) Source(36, 37) + SourceIndex(0) 9 >Emitted(107, 349) Source(36, 37) + SourceIndex(0) --- +>>> __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> + > + > @dec + > @dec + > static #y = 1; + > + > @dec + > @dec + > +2 > +3 > +4 > static accessor #z = 1; +5 > +6 > +7 > +8 > static accessor #z = 1; +9 > +10> +1->Emitted(108, 9) Source(44, 5) + SourceIndex(0) +2 >Emitted(108, 67) Source(44, 5) + SourceIndex(0) +3 >Emitted(108, 90) Source(44, 5) + SourceIndex(0) +4 >Emitted(108, 186) Source(44, 28) + SourceIndex(0) +5 >Emitted(108, 200) Source(44, 28) + SourceIndex(0) +6 >Emitted(108, 202) Source(44, 5) + SourceIndex(0) +7 >Emitted(108, 225) Source(44, 5) + SourceIndex(0) +8 >Emitted(108, 326) Source(44, 28) + SourceIndex(0) +9 >Emitted(108, 340) Source(44, 28) + SourceIndex(0) +10>Emitted(108, 658) Source(44, 28) + SourceIndex(0) +--- >>> __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); 1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -612,10 +653,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > 3 > method 4 > () {} -1 >Emitted(108, 9) Source(8, 5) + SourceIndex(0) -2 >Emitted(108, 155) Source(8, 5) + SourceIndex(0) -3 >Emitted(108, 161) Source(8, 11) + SourceIndex(0) -4 >Emitted(108, 204) Source(8, 16) + SourceIndex(0) +1 >Emitted(109, 9) Source(8, 5) + SourceIndex(0) +2 >Emitted(109, 155) Source(8, 5) + SourceIndex(0) +3 >Emitted(109, 161) Source(8, 11) + SourceIndex(0) +4 >Emitted(109, 204) Source(8, 16) + SourceIndex(0) --- >>> __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); 1 >^^^^^^^^ @@ -631,17 +672,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > get 3 > x 4 > () { return 1; } -1 >Emitted(109, 9) Source(12, 5) + SourceIndex(0) -2 >Emitted(109, 149) Source(12, 9) + SourceIndex(0) -3 >Emitted(109, 150) Source(12, 10) + SourceIndex(0) -4 >Emitted(109, 193) Source(12, 26) + SourceIndex(0) +1 >Emitted(110, 9) Source(12, 5) + SourceIndex(0) +2 >Emitted(110, 149) Source(12, 9) + SourceIndex(0) +3 >Emitted(110, 150) Source(12, 10) + SourceIndex(0) +4 >Emitted(110, 193) Source(12, 26) + SourceIndex(0) --- >>> __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^ 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -650,15 +691,19 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > set 3 > x 4 > (value: number) { } -1->Emitted(110, 9) Source(16, 5) + SourceIndex(0) -2 >Emitted(110, 147) Source(16, 9) + SourceIndex(0) -3 >Emitted(110, 148) Source(16, 10) + SourceIndex(0) -4 >Emitted(110, 199) Source(16, 29) + SourceIndex(0) +1->Emitted(111, 9) Source(16, 5) + SourceIndex(0) +2 >Emitted(111, 147) Source(16, 9) + SourceIndex(0) +3 >Emitted(111, 148) Source(16, 10) + SourceIndex(0) +4 >Emitted(111, 199) Source(16, 29) + SourceIndex(0) --- ->>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); +>>> __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); 1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -667,7 +712,23 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > > @dec > @dec - > accessor z = 1; + > +2 > accessor +3 > z +4 > +5 > z +6 > = 1; +1->Emitted(112, 9) Source(24, 5) + SourceIndex(0) +2 >Emitted(112, 147) Source(24, 14) + SourceIndex(0) +3 >Emitted(112, 148) Source(24, 15) + SourceIndex(0) +4 >Emitted(112, 171) Source(24, 14) + SourceIndex(0) +5 >Emitted(112, 172) Source(24, 15) + SourceIndex(0) +6 >Emitted(112, 234) Source(24, 20) + SourceIndex(0) +--- +>>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> > > @dec > @dec @@ -685,44 +746,8 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > 2 > static #y = 1; -1->Emitted(111, 9) Source(40, 5) + SourceIndex(0) -2 >Emitted(111, 337) Source(40, 19) + SourceIndex(0) ---- ->>> __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> - > - > @dec - > @dec - > -2 > -3 > -4 > static accessor #z = 1; -5 > -6 > -7 > -8 > static accessor #z = 1; -9 > -10> -1->Emitted(112, 9) Source(44, 5) + SourceIndex(0) -2 >Emitted(112, 67) Source(44, 5) + SourceIndex(0) -3 >Emitted(112, 90) Source(44, 5) + SourceIndex(0) -4 >Emitted(112, 186) Source(44, 28) + SourceIndex(0) -5 >Emitted(112, 200) Source(44, 28) + SourceIndex(0) -6 >Emitted(112, 202) Source(44, 5) + SourceIndex(0) -7 >Emitted(112, 225) Source(44, 5) + SourceIndex(0) -8 >Emitted(112, 326) Source(44, 28) + SourceIndex(0) -9 >Emitted(112, 340) Source(44, 28) + SourceIndex(0) -10>Emitted(112, 658) Source(44, 28) + SourceIndex(0) +1->Emitted(113, 9) Source(40, 5) + SourceIndex(0) +2 >Emitted(113, 337) Source(40, 19) + SourceIndex(0) --- >>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); 1 >^^^^^^^^ @@ -731,43 +756,18 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 4 > ^^^^^^^^^^^^^^^^^^^^^^^ 5 > ^ 6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^^^-> 1 > 2 > 3 > y 4 > 5 > y 6 > = 1; -1 >Emitted(113, 9) Source(20, 5) + SourceIndex(0) -2 >Emitted(113, 138) Source(20, 5) + SourceIndex(0) -3 >Emitted(113, 139) Source(20, 6) + SourceIndex(0) -4 >Emitted(113, 162) Source(20, 5) + SourceIndex(0) -5 >Emitted(113, 163) Source(20, 6) + SourceIndex(0) -6 >Emitted(113, 225) Source(20, 11) + SourceIndex(0) ---- ->>> __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); -1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> - > - > @dec - > @dec - > -2 > accessor -3 > z -4 > -5 > z -6 > = 1; -1->Emitted(114, 9) Source(24, 5) + SourceIndex(0) -2 >Emitted(114, 147) Source(24, 14) + SourceIndex(0) -3 >Emitted(114, 148) Source(24, 15) + SourceIndex(0) -4 >Emitted(114, 171) Source(24, 14) + SourceIndex(0) -5 >Emitted(114, 172) Source(24, 15) + SourceIndex(0) -6 >Emitted(114, 234) Source(24, 20) + SourceIndex(0) +1 >Emitted(114, 9) Source(20, 5) + SourceIndex(0) +2 >Emitted(114, 138) Source(20, 5) + SourceIndex(0) +3 >Emitted(114, 139) Source(20, 6) + SourceIndex(0) +4 >Emitted(114, 162) Source(20, 5) + SourceIndex(0) +5 >Emitted(114, 163) Source(20, 6) + SourceIndex(0) +6 >Emitted(114, 225) Source(20, 11) + SourceIndex(0) --- >>> __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); 1 >^^^^^^^^ diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js index f0e99117857fc..7bf84d19a768f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js @@ -139,13 +139,13 @@ let C = (() => { __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map index 452ee677cbdce..3d865067c01f7 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;;;kCACF,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;iDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;YAfJ,yDAAA,yBAAA,cAAkB,CAAC,YAAA,mOAAA;YAInB,wDAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,wNAAA;YAI7B,wDAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,6NAAA;YA5BhC,4IAAA,MAAM,2CAAK;YAIX,sIAAI,CAAC,2CAAgB;YAIrB,oIAAI,CAAC,mDAAmB;YAwBxB,wUAAc;YAId,oDAAA,uBAAA,0FAAuB,cAAA,EAAvB,uBAAA,+FAAuB,cAAA,8TAAA;YAxBvB,iIAAA,CAAC,uBAAD,CAAC,8DAAK;YAIN,oIAAS,CAAC,uBAAD,CAAC,8DAAK;YAnBnB,4IAwCC;YAxCK,CAAC;YAAD,wDAAC;;QAGH,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAIxB,CAAC,kGAAG,CAA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BkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;;;kCACF,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;iDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;YAfJ,yDAAA,yBAAA,cAAkB,CAAC,YAAA,mOAAA;YAInB,wDAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,wNAAA;YAI7B,wDAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,6NAAA;YAQhC,oDAAA,uBAAA,0FAAuB,cAAA,EAAvB,uBAAA,+FAAuB,cAAA,8TAAA;YApCvB,4IAAA,MAAM,2CAAK;YAIX,sIAAI,CAAC,2CAAgB;YAIrB,oIAAI,CAAC,mDAAmB;YAQxB,oIAAS,CAAC,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ICBAZGVjCiAgICBtZXRob2QoKSB7fQoKICAgIEBkZWMKICAgIEBkZWMKICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHNldCB4KHZhbHVlOiBudW1iZXIpIHsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHkgPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIGFjY2Vzc29yIHogPSAxOwoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== //// [esDecorators-classDeclaration-sourceMap.d.ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt index 1eb2c24c0addd..42f14322e0221 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt @@ -381,6 +381,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^ 8 > ^^^^^^^^^^^^^^ 9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -404,6 +405,46 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 >Emitted(92, 126) Source(36, 37) + SourceIndex(0) 9 >Emitted(92, 347) Source(36, 37) + SourceIndex(0) --- +>>> __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> + > + > @dec + > @dec + > static #y = 1; + > + > @dec + > @dec + > +2 > +3 > +4 > static accessor #z = 1; +5 > +6 > +7 > +8 > static accessor #z = 1; +9 > +10> +1->Emitted(93, 13) Source(44, 5) + SourceIndex(0) +2 >Emitted(93, 65) Source(44, 5) + SourceIndex(0) +3 >Emitted(93, 88) Source(44, 5) + SourceIndex(0) +4 >Emitted(93, 178) Source(44, 28) + SourceIndex(0) +5 >Emitted(93, 192) Source(44, 28) + SourceIndex(0) +6 >Emitted(93, 194) Source(44, 5) + SourceIndex(0) +7 >Emitted(93, 217) Source(44, 5) + SourceIndex(0) +8 >Emitted(93, 312) Source(44, 28) + SourceIndex(0) +9 >Emitted(93, 326) Source(44, 28) + SourceIndex(0) +10>Emitted(93, 644) Source(44, 28) + SourceIndex(0) +--- >>> __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -413,10 +454,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > 3 > method 4 > () {} -1 >Emitted(93, 13) Source(8, 5) + SourceIndex(0) -2 >Emitted(93, 153) Source(8, 5) + SourceIndex(0) -3 >Emitted(93, 159) Source(8, 11) + SourceIndex(0) -4 >Emitted(93, 202) Source(8, 16) + SourceIndex(0) +1 >Emitted(94, 13) Source(8, 5) + SourceIndex(0) +2 >Emitted(94, 153) Source(8, 5) + SourceIndex(0) +3 >Emitted(94, 159) Source(8, 11) + SourceIndex(0) +4 >Emitted(94, 202) Source(8, 16) + SourceIndex(0) --- >>> __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ @@ -432,17 +473,17 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > get 3 > x 4 > () { return 1; } -1 >Emitted(94, 13) Source(12, 5) + SourceIndex(0) -2 >Emitted(94, 147) Source(12, 9) + SourceIndex(0) -3 >Emitted(94, 148) Source(12, 10) + SourceIndex(0) -4 >Emitted(94, 191) Source(12, 26) + SourceIndex(0) +1 >Emitted(95, 13) Source(12, 5) + SourceIndex(0) +2 >Emitted(95, 147) Source(12, 9) + SourceIndex(0) +3 >Emitted(95, 148) Source(12, 10) + SourceIndex(0) +4 >Emitted(95, 191) Source(12, 26) + SourceIndex(0) --- >>> __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^ 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -451,15 +492,19 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > set 3 > x 4 > (value: number) { } -1->Emitted(95, 13) Source(16, 5) + SourceIndex(0) -2 >Emitted(95, 145) Source(16, 9) + SourceIndex(0) -3 >Emitted(95, 146) Source(16, 10) + SourceIndex(0) -4 >Emitted(95, 197) Source(16, 29) + SourceIndex(0) +1->Emitted(96, 13) Source(16, 5) + SourceIndex(0) +2 >Emitted(96, 145) Source(16, 9) + SourceIndex(0) +3 >Emitted(96, 146) Source(16, 10) + SourceIndex(0) +4 >Emitted(96, 197) Source(16, 29) + SourceIndex(0) --- ->>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); +>>> __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -468,7 +513,23 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > > @dec > @dec - > accessor z = 1; + > +2 > accessor +3 > z +4 > +5 > z +6 > = 1; +1->Emitted(97, 13) Source(24, 5) + SourceIndex(0) +2 >Emitted(97, 145) Source(24, 14) + SourceIndex(0) +3 >Emitted(97, 146) Source(24, 15) + SourceIndex(0) +4 >Emitted(97, 169) Source(24, 14) + SourceIndex(0) +5 >Emitted(97, 170) Source(24, 15) + SourceIndex(0) +6 >Emitted(97, 232) Source(24, 20) + SourceIndex(0) +--- +>>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> > > @dec > @dec @@ -486,44 +547,8 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > 2 > static #y = 1; -1->Emitted(96, 13) Source(40, 5) + SourceIndex(0) -2 >Emitted(96, 341) Source(40, 19) + SourceIndex(0) ---- ->>> __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -9 > ^^^^^^^^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> - > - > @dec - > @dec - > -2 > -3 > -4 > static accessor #z = 1; -5 > -6 > -7 > -8 > static accessor #z = 1; -9 > -10> -1->Emitted(97, 13) Source(44, 5) + SourceIndex(0) -2 >Emitted(97, 65) Source(44, 5) + SourceIndex(0) -3 >Emitted(97, 88) Source(44, 5) + SourceIndex(0) -4 >Emitted(97, 178) Source(44, 28) + SourceIndex(0) -5 >Emitted(97, 192) Source(44, 28) + SourceIndex(0) -6 >Emitted(97, 194) Source(44, 5) + SourceIndex(0) -7 >Emitted(97, 217) Source(44, 5) + SourceIndex(0) -8 >Emitted(97, 312) Source(44, 28) + SourceIndex(0) -9 >Emitted(97, 326) Source(44, 28) + SourceIndex(0) -10>Emitted(97, 644) Source(44, 28) + SourceIndex(0) +1->Emitted(98, 13) Source(40, 5) + SourceIndex(0) +2 >Emitted(98, 341) Source(40, 19) + SourceIndex(0) --- >>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ @@ -532,43 +557,18 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 4 > ^^^^^^^^^^^^^^^^^^^^^^^ 5 > ^ 6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^-> 1 > 2 > 3 > y 4 > 5 > y 6 > = 1; -1 >Emitted(98, 13) Source(20, 5) + SourceIndex(0) -2 >Emitted(98, 142) Source(20, 5) + SourceIndex(0) -3 >Emitted(98, 143) Source(20, 6) + SourceIndex(0) -4 >Emitted(98, 166) Source(20, 5) + SourceIndex(0) -5 >Emitted(98, 167) Source(20, 6) + SourceIndex(0) -6 >Emitted(98, 229) Source(20, 11) + SourceIndex(0) ---- ->>> __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); -1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> - > - > @dec - > @dec - > -2 > accessor -3 > z -4 > -5 > z -6 > = 1; -1->Emitted(99, 13) Source(24, 5) + SourceIndex(0) -2 >Emitted(99, 145) Source(24, 14) + SourceIndex(0) -3 >Emitted(99, 146) Source(24, 15) + SourceIndex(0) -4 >Emitted(99, 169) Source(24, 14) + SourceIndex(0) -5 >Emitted(99, 170) Source(24, 15) + SourceIndex(0) -6 >Emitted(99, 232) Source(24, 20) + SourceIndex(0) +1 >Emitted(99, 13) Source(20, 5) + SourceIndex(0) +2 >Emitted(99, 142) Source(20, 5) + SourceIndex(0) +3 >Emitted(99, 143) Source(20, 6) + SourceIndex(0) +4 >Emitted(99, 166) Source(20, 5) + SourceIndex(0) +5 >Emitted(99, 167) Source(20, 6) + SourceIndex(0) +6 >Emitted(99, 229) Source(20, 11) + SourceIndex(0) --- >>> __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); 1 >^^^^^^^^^^^^ diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js index 77b8334f0559e..bbbeacc0424ba 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js @@ -147,13 +147,13 @@ class C { __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js index 909243acb719d..f3a2a6bcf58a4 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js @@ -126,13 +126,13 @@ class C { __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); From e52ee015af17ce6e4a903e60ed030c8c1fa66827 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 11 Jan 2023 16:30:07 -0500 Subject: [PATCH 44/51] Test evaluation order against multiple targets --- .../unittests/evaluation/esDecorators.ts | 623 +++++++++--------- 1 file changed, 319 insertions(+), 304 deletions(-) diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts index 3cb8cf1117275..6ec9e33219cd9 100644 --- a/src/testRunner/unittests/evaluation/esDecorators.ts +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -1,5 +1,6 @@ import * as evaluator from "../../_namespaces/evaluator"; import * as ts from "../../_namespaces/ts"; +import { ScriptTarget } from "../../_namespaces/ts"; describe("unittests:: evaluation:: esDecorators", () => { const options: ts.CompilerOptions = { target: ts.ScriptTarget.ES2021 }; @@ -1705,348 +1706,362 @@ describe("unittests:: evaluation:: esDecorators", () => { }); }); - it("class definition evaluation order", () => { - const { order } = exec` - export const order = []; + const nodeVersion = ts.Version.tryParse(process.version); + const supportsClassStaticBlock = nodeVersion && nodeVersion.major >= 16; - class Base { - constructor() { - order.push("superclass construction"); - } - } - - @(order.push("class decorator evaluation 1"), ((t, c) => { - order.push("class decorator application 1"); - c.addInitializer(() => { - order.push("class extra initializer evaluation 1a"); - }); - c.addInitializer(() => { - order.push("class extra initializer evaluation 1b"); - }); - })) - @(order.push("class decorator evaluation 2"), ((t, c) => { - order.push("class decorator application 2"); - c.addInitializer(() => { - order.push("class extra initializer evaluation 2a"); - }); - c.addInitializer(() => { - order.push("class extra initializer evaluation 2b"); - }); - })) - class Derived extends (order.push("heritage clause evaluation"), Base) { - static { - order.push("static block evaluation"); - } - - @(order.push("static field decorator evaluation 1"), ((t, c) => { - order.push("static field decorator application 1"); - c.addInitializer(() => { - order.push("static field extra initializer evaluation 1a"); - }); - c.addInitializer(() => { - order.push("static field extra initializer evaluation 1b"); - }); - return x => { - order.push("static field injected initializer evaluation 1"); - return x; - }; - })) - @(order.push("static field decorator evaluation 2"), ((t, c) => { - order.push("static field decorator application 2"); - c.addInitializer(() => { - order.push("static field extra initializer evaluation 2a"); - }); - c.addInitializer(() => { - order.push("static field extra initializer evaluation 2b"); - }); - return x => { - order.push("static field injected initializer evaluation 2"); - return x; - }; - })) - static z = order.push("static field initializer evaluation"); - - static [(order.push("static computed property name evaluation"), "y")]() {} - - @(order.push("instance field decorator evaluation 1"), ((t, c) => { - order.push("instance field decorator application 1"); - c.addInitializer(() => { - order.push("instance field extra initializer evaluation 1a"); - }); - c.addInitializer(() => { - order.push("instance field extra initializer evaluation 1b"); - }); - return x => { - order.push("instance field injected initializer evaluation 1"); - return x; - }; - })) - @(order.push("instance field decorator evaluation 2"), ((t, c) => { - order.push("instance field decorator application 2"); - c.addInitializer(() => { - order.push("instance field extra initializer evaluation 2a"); - }); - c.addInitializer(() => { - order.push("instance field extra initializer evaluation 2b"); - }); - return x => { - order.push("instance field injected initializer evaluation 2"); - return x; - }; - })) - a = order.push("instance field initializer evaluation"); + const targets = [ + // NOTE: Class static blocks weren't supported in Node v14 + ...(supportsClassStaticBlock ? [ScriptTarget.ES2022] : []), + ScriptTarget.ES2021, + ScriptTarget.ES2015, + ]; + for (const target of targets) { + const options: ts.CompilerOptions = { target }; + const exec = (array: TemplateStringsArray) => evaluator.evaluateTypeScript(array[0], options); - [(order.push("instance computed property name evaluation"), "b")]() {} + it(`class definition evaluation order (${ts.Debug.formatEnum(target, (ts as any).ScriptTarget)})`, () => { + const { order } = exec` + export const order = []; - constructor() { - order.push("pre-super constructor evaluation"); - super(); - order.push("post-super constructor evaluation"); + class Base { + constructor() { + order.push("superclass construction"); + } } - @(order.push("static method decorator evaluation 1"), ((t, c) => { - order.push("static method decorator application 1"); + @(order.push("class decorator evaluation 1"), ((t, c) => { + order.push("class decorator application 1"); c.addInitializer(() => { - order.push("static method extra initializer evaluation 1a"); + order.push("class extra initializer evaluation 1a"); }); c.addInitializer(() => { - order.push("static method extra initializer evaluation 1b"); + order.push("class extra initializer evaluation 1b"); }); })) - @(order.push("static method decorator evaluation 2"), ((t, c) => { - order.push("static method decorator application 2"); + @(order.push("class decorator evaluation 2"), ((t, c) => { + order.push("class decorator application 2"); c.addInitializer(() => { - order.push("static method extra initializer evaluation 2a"); + order.push("class extra initializer evaluation 2a"); }); c.addInitializer(() => { - order.push("static method extra initializer evaluation 2b"); + order.push("class extra initializer evaluation 2b"); }); })) - static x() {} + class Derived extends (order.push("heritage clause evaluation"), Base) { + static { + order.push("static block evaluation"); + } - @(order.push("static auto-accessor decorator evaluation 1"), ((t, c) => { - order.push("static auto-accessor decorator application 1"); - c.addInitializer(() => { - order.push("static auto-accessor extra initializer evaluation 1a"); - }); - c.addInitializer(() => { - order.push("static auto-accessor extra initializer evaluation 1b"); - }); - return { - init: x => { - order.push("static auto-accessor injected initializer evaluation 1"); + @(order.push("static field decorator evaluation 1"), ((t, c) => { + order.push("static field decorator application 1"); + c.addInitializer(() => { + order.push("static field extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("static field extra initializer evaluation 1b"); + }); + return x => { + order.push("static field injected initializer evaluation 1"); return x; - } - }; - })) - @(order.push("static auto-accessor decorator evaluation 2"), ((t, c) => { - order.push("static auto-accessor decorator application 2"); - c.addInitializer(() => { - order.push("static auto-accessor extra initializer evaluation 2a"); - }); - c.addInitializer(() => { - order.push("static auto-accessor extra initializer evaluation 2b"); - }); - return { - init: x => { - order.push("static auto-accessor injected initializer evaluation 2"); + }; + })) + @(order.push("static field decorator evaluation 2"), ((t, c) => { + order.push("static field decorator application 2"); + c.addInitializer(() => { + order.push("static field extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("static field extra initializer evaluation 2b"); + }); + return x => { + order.push("static field injected initializer evaluation 2"); return x; - } - }; - })) - static accessor w = order.push("static auto-accessor initializer evaluation"); + }; + })) + static z = order.push("static field initializer evaluation"); - @(order.push("instance method decorator evaluation 1"), ((t, c) => { - order.push("instance method decorator application 1"); - c.addInitializer(() => { - order.push("instance method extra initializer evaluation 1a"); - }); - c.addInitializer(() => { - order.push("instance method extra initializer evaluation 1b"); - }); - })) - @(order.push("instance method decorator evaluation 2"), ((t, c) => { - order.push("instance method decorator application 2"); - c.addInitializer(() => { - order.push("instance method extra initializer evaluation 2a"); - }); - c.addInitializer(() => { - order.push("instance method extra initializer evaluation 2b"); - }); - })) - c() {} + static [(order.push("static computed property name evaluation"), "y")]() {} - @(order.push("instance auto-accessor decorator evaluation 1"), ((t, c) => { - order.push("instance auto-accessor decorator application 1"); - c.addInitializer(() => { - order.push("instance auto-accessor extra initializer evaluation 1a"); - }); - c.addInitializer(() => { - order.push("instance auto-accessor extra initializer evaluation 1b"); - }); - return { - init: x => { - order.push("instance auto-accessor injected initializer evaluation 1"); + @(order.push("instance field decorator evaluation 1"), ((t, c) => { + order.push("instance field decorator application 1"); + c.addInitializer(() => { + order.push("instance field extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("instance field extra initializer evaluation 1b"); + }); + return x => { + order.push("instance field injected initializer evaluation 1"); return x; - } - }; - })) - @(order.push("instance auto-accessor decorator evaluation 2"), ((t, c) => { - order.push("instance auto-accessor decorator application 2"); - c.addInitializer(() => { - order.push("instance auto-accessor extra initializer evaluation 2a"); - }); - c.addInitializer(() => { - order.push("instance auto-accessor extra initializer evaluation 2b"); - }); - return { - init: x => { - order.push("instance auto-accessor injected initializer evaluation 2"); + }; + })) + @(order.push("instance field decorator evaluation 2"), ((t, c) => { + order.push("instance field decorator application 2"); + c.addInitializer(() => { + order.push("instance field extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("instance field extra initializer evaluation 2b"); + }); + return x => { + order.push("instance field injected initializer evaluation 2"); return x; - } - }; - })) - accessor d = order.push("instance auto-accessor initializer evaluation"); - } + }; + })) + a = order.push("instance field initializer evaluation"); - order.push("instance construction"); - new Derived(); - order.push("done"); - `; + [(order.push("instance computed property name evaluation"), "b")]() {} - // TODO: static private method and field evaluation order when that is supported. - assert.deepEqual(order, [ - // first, we evaluate the class decorator expressions and heritage clause in document order: - "class decorator evaluation 1", - "class decorator evaluation 2", - "heritage clause evaluation", + constructor() { + order.push("pre-super constructor evaluation"); + super(); + order.push("post-super constructor evaluation"); + } - // next, we evaluate decorators interleaved with computed property names in document order: - "static field decorator evaluation 1", - "static field decorator evaluation 2", - "static computed property name evaluation", - "instance field decorator evaluation 1", - "instance field decorator evaluation 2", - "instance computed property name evaluation", - "static method decorator evaluation 1", - "static method decorator evaluation 2", - "static auto-accessor decorator evaluation 1", - "static auto-accessor decorator evaluation 2", - "instance method decorator evaluation 1", - "instance method decorator evaluation 2", - "instance auto-accessor decorator evaluation 1", - "instance auto-accessor decorator evaluation 2", - // NOTE: at this point, all of the class elements have been collected. + @(order.push("static method decorator evaluation 1"), ((t, c) => { + order.push("static method decorator application 1"); + c.addInitializer(() => { + order.push("static method extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("static method extra initializer evaluation 1b"); + }); + })) + @(order.push("static method decorator evaluation 2"), ((t, c) => { + order.push("static method decorator application 2"); + c.addInitializer(() => { + order.push("static method extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("static method extra initializer evaluation 2b"); + }); + })) + static x() {} - // next, for each static method, in document order, we apply that method's decorators in reverse order: - "static method decorator application 2", - "static method decorator application 1", - "static auto-accessor decorator application 2", - "static auto-accessor decorator application 1", - // NOTE: at this point, all non-private static methods are defined on the class. + @(order.push("static auto-accessor decorator evaluation 1"), ((t, c) => { + order.push("static auto-accessor decorator application 1"); + c.addInitializer(() => { + order.push("static auto-accessor extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("static auto-accessor extra initializer evaluation 1b"); + }); + return { + init: x => { + order.push("static auto-accessor injected initializer evaluation 1"); + return x; + } + }; + })) + @(order.push("static auto-accessor decorator evaluation 2"), ((t, c) => { + order.push("static auto-accessor decorator application 2"); + c.addInitializer(() => { + order.push("static auto-accessor extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("static auto-accessor extra initializer evaluation 2b"); + }); + return { + init: x => { + order.push("static auto-accessor injected initializer evaluation 2"); + return x; + } + }; + })) + static accessor w = order.push("static auto-accessor initializer evaluation"); - // next, for each instance method, in document order, we apply that method's decorators in reverse order: - "instance method decorator application 2", - "instance method decorator application 1", - "instance auto-accessor decorator application 2", - "instance auto-accessor decorator application 1", - // NOTE: at this point, all non-private instance methods are defined on the prototype. + @(order.push("instance method decorator evaluation 1"), ((t, c) => { + order.push("instance method decorator application 1"); + c.addInitializer(() => { + order.push("instance method extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("instance method extra initializer evaluation 1b"); + }); + })) + @(order.push("instance method decorator evaluation 2"), ((t, c) => { + order.push("instance method decorator application 2"); + c.addInitializer(() => { + order.push("instance method extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("instance method extra initializer evaluation 2b"); + }); + })) + c() {} - // next, for each static field, in document order, we apply that field's decorators in reverse order: - "static field decorator application 2", - "static field decorator application 1", - // NOTE: at this point, static fields have not yet been applied + @(order.push("instance auto-accessor decorator evaluation 1"), ((t, c) => { + order.push("instance auto-accessor decorator application 1"); + c.addInitializer(() => { + order.push("instance auto-accessor extra initializer evaluation 1a"); + }); + c.addInitializer(() => { + order.push("instance auto-accessor extra initializer evaluation 1b"); + }); + return { + init: x => { + order.push("instance auto-accessor injected initializer evaluation 1"); + return x; + } + }; + })) + @(order.push("instance auto-accessor decorator evaluation 2"), ((t, c) => { + order.push("instance auto-accessor decorator application 2"); + c.addInitializer(() => { + order.push("instance auto-accessor extra initializer evaluation 2a"); + }); + c.addInitializer(() => { + order.push("instance auto-accessor extra initializer evaluation 2b"); + }); + return { + init: x => { + order.push("instance auto-accessor injected initializer evaluation 2"); + return x; + } + }; + })) + accessor d = order.push("instance auto-accessor initializer evaluation"); + } - // next, for each instance field, in document order, we apply that field's decorators in reverse order: - "instance field decorator application 2", - "instance field decorator application 1", - // NOTE: at this point, instance fields have not yet been applied + order.push("instance construction"); + new Derived(); + order.push("done"); + `; - // next, apply class decorators in reverse order: - "class decorator application 2", - "class decorator application 1", - // NOTE: at this point, any constructor replacement has occurred. - // NOTE: at this point the local class binding (i.e., the class name) has been initialized and can be - // referenced - // NOTE: at this point, static private methods will be installed (TODO: on the replacement class) + // TODO: static private method and field evaluation order when that is supported. + assert.deepEqual(order, [ + // first, we evaluate the class decorator expressions and heritage clause in document order: + "class decorator evaluation 1", + "class decorator evaluation 2", + "heritage clause evaluation", - // next, static extra initializers are applied in the order they were added (i.e., methods before fields, - // reverse order of decorator evaluation) and are applied to the replacement class. - "static method extra initializer evaluation 2a", - "static method extra initializer evaluation 2b", - "static method extra initializer evaluation 1a", - "static method extra initializer evaluation 1b", - "static auto-accessor extra initializer evaluation 2a", - "static auto-accessor extra initializer evaluation 2b", - "static auto-accessor extra initializer evaluation 1a", - "static auto-accessor extra initializer evaluation 1b", - "static field extra initializer evaluation 2a", - "static field extra initializer evaluation 2b", - "static field extra initializer evaluation 1a", - "static field extra initializer evaluation 1b", + // next, we evaluate decorators interleaved with computed property names in document order: + "static field decorator evaluation 1", + "static field decorator evaluation 2", + "static computed property name evaluation", + "instance field decorator evaluation 1", + "instance field decorator evaluation 2", + "instance computed property name evaluation", + "static method decorator evaluation 1", + "static method decorator evaluation 2", + "static auto-accessor decorator evaluation 1", + "static auto-accessor decorator evaluation 2", + "instance method decorator evaluation 1", + "instance method decorator evaluation 2", + "instance auto-accessor decorator evaluation 1", + "instance auto-accessor decorator evaluation 2", + // NOTE: at this point, all of the class elements have been collected. - // next, static initializers (i.e., fields, auto-accessors, and static blocks) are evaluated in document - // order and applied to the replacement class: - "static block evaluation", - "static field initializer evaluation", - "static field injected initializer evaluation 2", - "static field injected initializer evaluation 1", - "static auto-accessor initializer evaluation", - "static auto-accessor injected initializer evaluation 2", - "static auto-accessor injected initializer evaluation 1", - // NOTE: at this point, static private fields will be installed (TODO: on the replacement class) + // next, for each static method, in document order, we apply that method's decorators in reverse order: + "static method decorator application 2", + "static method decorator application 1", + "static auto-accessor decorator application 2", + "static auto-accessor decorator application 1", + // NOTE: at this point, all non-private static methods are defined on the class. - // finally, class extra initializers are applied in the order they were added (i.e., methods before fields, - // reverse order of decorator evaluation). - "class extra initializer evaluation 2a", - "class extra initializer evaluation 2b", - "class extra initializer evaluation 1a", - "class extra initializer evaluation 1b", - // NOTE: at this point, class definition evaluation has finished. + // next, for each instance method, in document order, we apply that method's decorators in reverse order: + "instance method decorator application 2", + "instance method decorator application 1", + "instance auto-accessor decorator application 2", + "instance auto-accessor decorator application 1", + // NOTE: at this point, all non-private instance methods are defined on the prototype. - // now we move on to construction: - "instance construction", + // next, for each static field, in document order, we apply that field's decorators in reverse order: + "static field decorator application 2", + "static field decorator application 1", + // NOTE: at this point, static fields have not yet been applied - // first, statements before `super()` are evaluated: - "pre-super constructor evaluation", - // NOTE: at this point `this` is still not yet bound. + // next, for each instance field, in document order, we apply that field's decorators in reverse order: + "instance field decorator application 2", + "instance field decorator application 1", + // NOTE: at this point, instance fields have not yet been applied - // next, statements in the superclass constructor are evaluated: - "superclass construction", - // NOTE: as we return from the `super()` call, we start instance field initialization. - // NOTE: at this point, `this` is bound. - // NOTE: at this point, instance private methods are installed. + // next, apply class decorators in reverse order: + "class decorator application 2", + "class decorator application 1", + // NOTE: at this point, any constructor replacement has occurred. + // NOTE: at this point the local class binding (i.e., the class name) has been initialized and can be + // referenced + // NOTE: at this point, static private methods will be installed (TODO: on the replacement class) - // next, instance extra initializers are applied in the order they were added (i.e., methods before fields, - // reverse order of decorator evaluation). - "instance method extra initializer evaluation 2a", - "instance method extra initializer evaluation 2b", - "instance method extra initializer evaluation 1a", - "instance method extra initializer evaluation 1b", - "instance auto-accessor extra initializer evaluation 2a", - "instance auto-accessor extra initializer evaluation 2b", - "instance auto-accessor extra initializer evaluation 1a", - "instance auto-accessor extra initializer evaluation 1b", - "instance field extra initializer evaluation 2a", - "instance field extra initializer evaluation 2b", - "instance field extra initializer evaluation 1a", - "instance field extra initializer evaluation 1b", + // next, static extra initializers are applied in the order they were added (i.e., methods before fields, + // reverse order of decorator evaluation) and are applied to the replacement class. + "static method extra initializer evaluation 2a", + "static method extra initializer evaluation 2b", + "static method extra initializer evaluation 1a", + "static method extra initializer evaluation 1b", + "static auto-accessor extra initializer evaluation 2a", + "static auto-accessor extra initializer evaluation 2b", + "static auto-accessor extra initializer evaluation 1a", + "static auto-accessor extra initializer evaluation 1b", + "static field extra initializer evaluation 2a", + "static field extra initializer evaluation 2b", + "static field extra initializer evaluation 1a", + "static field extra initializer evaluation 1b", - // next, instance initializers (i.e., fields, auto-accessors, and static blocks) are evaluated in document - // order: - "instance field initializer evaluation", - "instance field injected initializer evaluation 2", - "instance field injected initializer evaluation 1", - "instance auto-accessor initializer evaluation", - "instance auto-accessor injected initializer evaluation 2", - "instance auto-accessor injected initializer evaluation 1", - // NOTE: at this point, instance private fields will be installed. + // next, static initializers (i.e., fields, auto-accessors, and static blocks) are evaluated in document + // order and applied to the replacement class: + "static block evaluation", + "static field initializer evaluation", + "static field injected initializer evaluation 2", + "static field injected initializer evaluation 1", + "static auto-accessor initializer evaluation", + "static auto-accessor injected initializer evaluation 2", + "static auto-accessor injected initializer evaluation 1", + // NOTE: at this point, static private fields will be installed (TODO: on the replacement class) - // finally, statements in the constructor after the call to `super()` are evaluated: - "post-super constructor evaluation", + // finally, class extra initializers are applied in the order they were added (i.e., methods before fields, + // reverse order of decorator evaluation). + "class extra initializer evaluation 2a", + "class extra initializer evaluation 2b", + "class extra initializer evaluation 1a", + "class extra initializer evaluation 1b", + // NOTE: at this point, class definition evaluation has finished. - // and now evaluation has completed: - "done" - ]); - }); + // now we move on to construction: + "instance construction", + + // first, statements before `super()` are evaluated: + "pre-super constructor evaluation", + // NOTE: at this point `this` is still not yet bound. + + // next, statements in the superclass constructor are evaluated: + "superclass construction", + // NOTE: as we return from the `super()` call, we start instance field initialization. + // NOTE: at this point, `this` is bound. + // NOTE: at this point, instance private methods are installed. + + // next, instance extra initializers are applied in the order they were added (i.e., methods before fields, + // reverse order of decorator evaluation). + "instance method extra initializer evaluation 2a", + "instance method extra initializer evaluation 2b", + "instance method extra initializer evaluation 1a", + "instance method extra initializer evaluation 1b", + "instance auto-accessor extra initializer evaluation 2a", + "instance auto-accessor extra initializer evaluation 2b", + "instance auto-accessor extra initializer evaluation 1a", + "instance auto-accessor extra initializer evaluation 1b", + "instance field extra initializer evaluation 2a", + "instance field extra initializer evaluation 2b", + "instance field extra initializer evaluation 1a", + "instance field extra initializer evaluation 1b", + + // next, instance initializers (i.e., fields, auto-accessors, and static blocks) are evaluated in document + // order: + "instance field initializer evaluation", + "instance field injected initializer evaluation 2", + "instance field injected initializer evaluation 1", + "instance auto-accessor initializer evaluation", + "instance auto-accessor injected initializer evaluation 2", + "instance auto-accessor injected initializer evaluation 1", + // NOTE: at this point, instance private fields will be installed. + + // finally, statements in the constructor after the call to `super()` are evaluated: + "post-super constructor evaluation", + + // and now evaluation has completed: + "done" + ]); + }); + } }); \ No newline at end of file From b476408744a0dd2af2565dbf705f0b393d13170d Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 12 Jan 2023 18:14:58 -0500 Subject: [PATCH 45/51] Add evaluation tests for decorator examples, fix parameter-property emit --- src/compiler/transformers/classFields.ts | 113 +++++---- src/compiler/utilitiesPublic.ts | 2 +- .../unittests/evaluation/esDecorators.ts | 224 +++++++++++++++++- ...t=es2015,usedefineforclassfields=false).js | 29 +++ ...et=es2015,usedefineforclassfields=true).js | 34 +++ ...t=es2022,usedefineforclassfields=false).js | 27 +++ ...et=es2022,usedefineforclassfields=true).js | 28 +++ ...rget=es5,usedefineforclassfields=false).js | 31 +++ ...arget=es5,usedefineforclassfields=true).js | 41 ++++ ...t=esnext,usedefineforclassfields=false).js | 27 +++ ...et=esnext,usedefineforclassfields=true).js | 21 ++ ...rs-classDeclaration-parameterProperties.ts | 13 + 12 files changed, 543 insertions(+), 47 deletions(-) create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=true).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=false).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=true).js create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterProperties.ts diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index c1b54cce90363..bc3c098353b63 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -85,6 +85,7 @@ import { isClassExpression, isClassLike, isClassStaticBlockDeclaration, + isCommaExpression, isCompoundAssignment, isComputedPropertyName, isConstructorDeclaration, @@ -106,9 +107,11 @@ import { isModifierLike, isNamedEvaluation, isNonStaticMethodOrAccessorWithPrivateName, + isNumericLiteral, isObjectLiteralElementLike, isObjectLiteralExpression, isOmittedExpression, + isParameter, isParameterPropertyDeclaration, isParenthesizedExpression, isPrefixUnaryExpression, @@ -133,6 +136,7 @@ import { isSuperProperty, isTemplateLiteral, isThisProperty, + isVoidExpression, LeftHandSideExpression, LexicalEnvironment, map, @@ -163,6 +167,7 @@ import { PropertyAssignment, PropertyDeclaration, PropertyName, + removeAllComments, ScriptTarget, SetAccessorDeclaration, setCommentRange, @@ -2147,7 +2152,8 @@ export function transformClassFields(context: TransformationContext): (x: Source } function transformConstructorBody(node: ClassDeclaration | ClassExpression, constructor: ConstructorDeclaration | undefined, isDerivedClass: boolean) { - let properties = getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); + const instanceProperties = getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); + let properties = instanceProperties; if (!useDefineForClassFields) { properties = filter(properties, property => !!property.initializer || isPrivateIdentifier(property.name) || hasAccessorModifier(property)); } @@ -2216,47 +2222,38 @@ export function transformClassFields(context: TransformationContext): (x: Source // We instead *remove* them from the transformed output at this stage. let parameterPropertyDeclarationCount = 0; if (constructor?.body) { - if (useDefineForClassFields) { - statements = statements.filter(statement => !isParameterPropertyDeclaration(getOriginalNode(statement), constructor)); - } - else { - for (const statement of constructor.body.statements) { - if (isParameterPropertyDeclaration(getOriginalNode(statement), constructor)) { - parameterPropertyDeclarationCount++; - } + // parameter-property assignments should occur immediately after the prologue and `super()`, + // so only count the statements that immediately follow. + for (let i = indexOfFirstStatementAfterSuperAndPrologue; i < constructor.body.statements.length; i++) { + const statement = constructor.body.statements[i]; + if (isParameterPropertyDeclaration(getOriginalNode(statement), constructor)) { + parameterPropertyDeclarationCount++; } - if (parameterPropertyDeclarationCount > 0) { - const parameterProperties = visitNodes(constructor.body.statements, visitor, isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount); - - // If there was a super() call found, add parameter properties immediately after it - if (superStatementIndex >= 0) { - addRange(statements, parameterProperties); - } - else { - // Add add parameter properties to the top of the constructor after the prologue - let superAndPrologueStatementCount = prologueStatementCount; - // If a synthetic super() call was added, need to account for that - if (needsSyntheticConstructor) superAndPrologueStatementCount++; - statements = [ - ...statements.slice(0, superAndPrologueStatementCount), - ...parameterProperties, - ...statements.slice(superAndPrologueStatementCount), - ]; - } - - indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount; + else { + break; } } + if (parameterPropertyDeclarationCount > 0) { + indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount; + } } const receiver = factory.createThis(); // private methods can be called in property initializers, they should execute first. addInstanceMethodStatements(statements, privateMethodsAndAccessors, receiver); - addPropertyOrClassStaticBlockStatements(statements, properties, receiver); + if (constructor) { + const parameterProperties = filter(instanceProperties, prop => isParameterPropertyDeclaration(getOriginalNode(prop), constructor)); + const nonParameterProperties = filter(properties, prop => !isParameterPropertyDeclaration(getOriginalNode(prop), constructor)); + addPropertyOrClassStaticBlockStatements(statements, parameterProperties, receiver); + addPropertyOrClassStaticBlockStatements(statements, nonParameterProperties, receiver); + } + else { + addPropertyOrClassStaticBlockStatements(statements, properties, receiver); + } // Add existing statements after the initial prologues and super call if (constructor) { - addRange(statements, visitNodes(constructor.body!.statements, visitBodyStatement, isStatement, indexOfFirstStatementAfterSuperAndPrologue)); + addRange(statements, visitNodes(constructor.body!.statements, visitor, isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); @@ -2279,14 +2276,6 @@ export function transformClassFields(context: TransformationContext): (x: Source ), /*location*/ constructor ? constructor.body : undefined ); - - function visitBodyStatement(statement: Node) { - if (useDefineForClassFields && isParameterPropertyDeclaration(getOriginalNode(statement), constructor!)) { - return undefined; - } - - return visitor(statement); - } } /** @@ -2321,9 +2310,18 @@ export function transformClassFields(context: TransformationContext): (x: Source const statement = factory.createExpressionStatement(expression); setOriginalNode(statement, property); addEmitFlags(statement, getEmitFlags(property) & EmitFlags.NoComments); - setSourceMapRange(statement, moveRangePastModifiers(property)); setCommentRange(statement, property); + const propertyOriginalNode = getOriginalNode(property); + if (isParameter(propertyOriginalNode)) { + // replicate comment and source map behavior from the ts transform for parameter properties. + setSourceMapRange(statement, propertyOriginalNode); + removeAllComments(statement); + } + else { + setSourceMapRange(statement, moveRangePastModifiers(property)); + } + // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -2332,7 +2330,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // If the property was originally an auto-accessor, don't emit comments here since they will be attached to // the synthezized getter. - if (hasAccessorModifier(getOriginalNode(property))) { + if (hasAccessorModifier(propertyOriginalNode)) { addEmitFlags(statement, EmitFlags.NoComments); } @@ -2450,14 +2448,39 @@ export function transformClassFields(context: TransformationContext): (x: Source return undefined; } - const initializer = property.initializer || emitAssignment ? visitNode(property.initializer, initializerVisitor, isExpression) ?? factory.createVoidZero() - : isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && isIdentifier(propertyName) ? propertyName - : factory.createVoidZero(); + let initializer = visitNode(property.initializer, initializerVisitor, isExpression); + if (isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && isIdentifier(propertyName)) { + // A parameter-property declaration always overrides the initializer. The only time a parameter-property + // declaration *should* have an initializer is when decorators have added initializers that need to run before + // any other initializer + const localName = factory.cloneNode(propertyName); + if (initializer) { + // unwrap `(__runInitializers(this, _instanceExtraInitializers), void 0)` + if (isParenthesizedExpression(initializer) && + isCommaExpression(initializer.expression) && + isCallToHelper(initializer.expression.left, "___runInitializers" as __String) && + isVoidExpression(initializer.expression.right) && + isNumericLiteral(initializer.expression.right.expression)) { + initializer = initializer.expression.left; + } + initializer = factory.inlineExpressions([initializer, localName]); + } + else { + initializer = localName; + } + setEmitFlags(propertyName, EmitFlags.NoComments | EmitFlags.NoSourceMap); + setSourceMapRange(localName, propertyOriginalNode.name); + setEmitFlags(localName, EmitFlags.NoComments); + } + else { + initializer ??= factory.createVoidZero(); + } if (emitAssignment || isPrivateIdentifier(propertyName)) { const memberAccess = createMemberAccessForPropertyName(factory, receiver, propertyName, /*location*/ propertyName); addEmitFlags(memberAccess, EmitFlags.NoLeadingComments); - return factory.createAssignment(memberAccess, initializer); + const expression = factory.createAssignment(memberAccess, initializer); + return expression; } else { const name = isComputedPropertyName(propertyName) ? propertyName.expression diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 2f25e63696ea9..91cba091c48c7 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -530,7 +530,7 @@ export function getTypeParameterOwner(d: Declaration): Declaration | undefined { export type ParameterPropertyDeclaration = ParameterDeclaration & { parent: ConstructorDeclaration, name: Identifier }; export function isParameterPropertyDeclaration(node: Node, parent: Node): node is ParameterPropertyDeclaration { - return hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier) && parent.kind === SyntaxKind.Constructor; + return isParameter(node) && hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier) && parent.kind === SyntaxKind.Constructor; } export function isEmptyBindingPattern(node: BindingName): node is BindingPattern { diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts index 6ec9e33219cd9..08db8c6302aa6 100644 --- a/src/testRunner/unittests/evaluation/esDecorators.ts +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -1715,11 +1715,13 @@ describe("unittests:: evaluation:: esDecorators", () => { ScriptTarget.ES2021, ScriptTarget.ES2015, ]; + for (const target of targets) { + const targetName = ts.Debug.formatEnum(target, (ts as any).ScriptTarget); const options: ts.CompilerOptions = { target }; const exec = (array: TemplateStringsArray) => evaluator.evaluateTypeScript(array[0], options); - it(`class definition evaluation order (${ts.Debug.formatEnum(target, (ts as any).ScriptTarget)})`, () => { + it(`class definition evaluation order (${targetName})`, () => { const { order } = exec` export const order = []; @@ -2063,5 +2065,225 @@ describe("unittests:: evaluation:: esDecorators", () => { "done" ]); }); + + describe("examples", () => { + // see https://github.com/tc39/proposal-decorators#classes + it(`@logged (${targetName})`, () => { + const { output } = exec` + export const output: string[] = []; + + function log(s: string) { + output.push(s); + } + + function logged any>(target: T, context: ClassDecoratorContext): T | void; + function logged any>(target: T, context: ClassMethodDecoratorContext): T | void; + function logged(target: (this: This) => T, context: ClassGetterDecoratorContext): (this: This) => T; + function logged(target: (this: This, value: T) => void, context: ClassSetterDecoratorContext): (this: This, value: T) => void; + function logged(target: ClassAccessorDecoratorTarget, context: ClassAccessorDecoratorContext): ClassAccessorDecoratorResult | void; + function logged(target: any, context: DecoratorContext): any { + switch (context.kind) { + case "class": { + const name = context.name ?? "(anonymous)"; + return class extends target { + constructor(...args: any) { + log("constructor " + name + " enter"); + try { + super(...args); + } + finally { + log("constructor " + name + " exit"); + } + } + }; + } + case "method": + case "getter": + case "setter": { + const name = context.name.toString(); + const kind = context.kind; + return function (this: any, ...args: any) { + log(kind + " " + name + " enter"); + try { + return target.apply(this, args); + } + finally { + log(kind + " " + name + " exit"); + } + } + } + case "accessor": { + const name = context.name.toString(); + return { + get: function (this: any) { + log("accessor(get) " + name + " enter"); + try { + return target.get.call(this); + } + finally { + log("accessor(get) " + name + " exit"); + } + }, + set: function (this: any, value: any) { + log("accessor(set) " + name + " enter"); + try { + target.set.call(this, value); + } + finally { + log("accessor(set) " + name + " exit"); + } + } + }; + } + default: + throw new TypeError("Not supported"); + } + } + + @logged + class C { + constructor() { + log("C body"); + } + + @logged m() { + log("m body"); + } + + @logged get x() { + log("get x body"); + return 0; + } + + @logged set y(value: number) { + log("set y body"); + } + + @logged accessor z = 0; + } + + const obj = new C(); + obj.m(); + obj.x; + obj.y = 1; + obj.z = 2; + `; + + assert.deepEqual(output, [ + "constructor C enter", + "C body", + "constructor C exit", + "method m enter", + "m body", + "method m exit", + "getter x enter", + "get x body", + "getter x exit", + "setter y enter", + "set y body", + "setter y exit", + "accessor(set) z enter", + "accessor(set) z exit", + ]); + }); + + // see https://github.com/tc39/proposal-decorators#example-bound + it(`@bound (${targetName})`, () => { + const { output } = exec` + export const output: string[] = []; + + type MatchingKeys = K extends (TRecord[K] extends TMatch ? K : never) ? K : never; + type Method = (this: This, ...args: A) => T; + + function bound>>( + target: Method, + { addInitializer, name }: Omit>, "name"> & { name: K, private: false } + ): void { + addInitializer(function (this: This) { + const method = this[name] as Method; + const boundMethod = method.bind(this) as Method; + this[name] = boundMethod as typeof this[K]; + }); + } + + class C { + constructor(private message: string) {} + + @bound speak() { + output.push(this.message); + } + } + + const { speak } = new C("test"); + speak(); + `; + + assert.deepEqual(output, ["test"]); + }); + + // see https://github.com/tc39/proposal-decorators#access-and-metadata-sidechanneling + it(`dependency injection (${targetName})`, () => { + const { result } = exec` + const INJECTIONS = new WeakMap void }[]>(); + + function createInjections() { + const injections: { injectionKey: string, set: (this: any, value: any) => void }[] = []; + + function injectable any>(Class: T, context: ClassDecoratorContext) { + INJECTIONS.set(Class, injections); + } + + function inject(injectionKey: string) { + return function applyInjection(v: undefined, context: ClassFieldDecoratorContext) { + injections.push({ injectionKey, set: context.access.set }); + }; + } + + return { injectable, inject }; + } + + class Container { + registry = new Map(); + + register(injectionKey: string, value: any) { + this.registry.set(injectionKey, value); + } + + lookup(injectionKey: string) { + return this.registry.get(injectionKey); + } + + create any>(Class: T) { + let instance = new Class(); + + for (const { injectionKey, set } of INJECTIONS.get(Class) || []) { + set.call(instance, this.lookup(injectionKey)); + } + + return instance; + } + } + + class Store {} + + const { injectable, inject } = createInjections(); + + @injectable + class C { + @inject('store') store!: Store; + } + + let container = new Container(); + let store = new Store(); + + container.register('store', store); + + let c = container.create(C); + + export const result = c.store === store; + `; + assert.isTrue(result); + }); + }); } }); \ No newline at end of file diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..2baa329b86705 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=false).js @@ -0,0 +1,29 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +declare var bound: any; + +class C { + constructor(private message: string) {} + + @bound speak() { + } +} + + +//// [esDecorators-classDeclaration-parameterProperties.js] +let C = (() => { + var _a; + let _instanceExtraInitializers = []; + let _speak_decorators; + return _a = class C { + constructor(message) { + this.message = (__runInitializers(this, _instanceExtraInitializers), message); + } + speak() { + } + }, + (() => { + _speak_decorators = [bound]; + __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..bdce7d22c01cd --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=true).js @@ -0,0 +1,34 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +declare var bound: any; + +class C { + constructor(private message: string) {} + + @bound speak() { + } +} + + +//// [esDecorators-classDeclaration-parameterProperties.js] +let C = (() => { + var _a; + let _instanceExtraInitializers = []; + let _speak_decorators; + return _a = class C { + constructor(message) { + Object.defineProperty(this, "message", { + enumerable: true, + configurable: true, + writable: true, + value: (__runInitializers(this, _instanceExtraInitializers), message) + }); + } + speak() { + } + }, + (() => { + _speak_decorators = [bound]; + __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + })(), + _a; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..65fb62ca70740 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=false).js @@ -0,0 +1,27 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +declare var bound: any; + +class C { + constructor(private message: string) {} + + @bound speak() { + } +} + + +//// [esDecorators-classDeclaration-parameterProperties.js] +let C = (() => { + let _instanceExtraInitializers = []; + let _speak_decorators; + return class C { + static { + _speak_decorators = [bound]; + __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + } + constructor(message) { + this.message = (__runInitializers(this, _instanceExtraInitializers), message); + } + speak() { + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..e53eb3a6045d8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js @@ -0,0 +1,28 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +declare var bound: any; + +class C { + constructor(private message: string) {} + + @bound speak() { + } +} + + +//// [esDecorators-classDeclaration-parameterProperties.js] +let C = (() => { + let _instanceExtraInitializers = []; + let _speak_decorators; + return class C { + static { + _speak_decorators = [bound]; + __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + } + message = (__runInitializers(this, _instanceExtraInitializers), void 0); + constructor(message) { + this.message = message; + } + speak() { + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..064b48b7a1a75 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=false).js @@ -0,0 +1,31 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +declare var bound: any; + +class C { + constructor(private message: string) {} + + @bound speak() { + } +} + + +//// [esDecorators-classDeclaration-parameterProperties.js] +var _this = this; +var C = function () { + var _a; + var _instanceExtraInitializers = []; + var _speak_decorators; + return _a = /** @class */ (function () { + function C(message) { + this.message = (__runInitializers(this, _instanceExtraInitializers), message); + } + C.prototype.speak = function () { + }; + return C; + }()), + (function () { + _speak_decorators = [bound]; + __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get: function () { return this.speak; } } }, null, _instanceExtraInitializers); + })(), + _a; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..4e1d6f95f79f1 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=true).js @@ -0,0 +1,41 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +declare var bound: any; + +class C { + constructor(private message: string) {} + + @bound speak() { + } +} + + +//// [esDecorators-classDeclaration-parameterProperties.js] +var _this = this; +var C = function () { + var _a; + var _instanceExtraInitializers = []; + var _speak_decorators; + return _a = /** @class */ (function () { + function C(message) { + Object.defineProperty(this, "message", { + enumerable: true, + configurable: true, + writable: true, + value: (__runInitializers(this, _instanceExtraInitializers), message) + }); + } + Object.defineProperty(C.prototype, "speak", { + enumerable: false, + configurable: true, + writable: true, + value: function () { + } + }); + return C; + }()), + (function () { + _speak_decorators = [bound]; + __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get: function () { return this.speak; } } }, null, _instanceExtraInitializers); + })(), + _a; +}(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..65fb62ca70740 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=false).js @@ -0,0 +1,27 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +declare var bound: any; + +class C { + constructor(private message: string) {} + + @bound speak() { + } +} + + +//// [esDecorators-classDeclaration-parameterProperties.js] +let C = (() => { + let _instanceExtraInitializers = []; + let _speak_decorators; + return class C { + static { + _speak_decorators = [bound]; + __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + } + constructor(message) { + this.message = (__runInitializers(this, _instanceExtraInitializers), message); + } + speak() { + } + }; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=true).js new file mode 100644 index 0000000000000..ee5fc58c9e993 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=true).js @@ -0,0 +1,21 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +declare var bound: any; + +class C { + constructor(private message: string) {} + + @bound speak() { + } +} + + +//// [esDecorators-classDeclaration-parameterProperties.js] +class C { + message; + constructor(message) { + this.message = message; + } + @bound + speak() { + } +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterProperties.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterProperties.ts new file mode 100644 index 0000000000000..ba563c267c016 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-parameterProperties.ts @@ -0,0 +1,13 @@ +// @target: esnext, es2022, es2015, es5 +// @useDefineForClassFields: * +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare var bound: any; + +class C { + constructor(private message: string) {} + + @bound speak() { + } +} From 1e51d594756680585a937696dcc1e30423425e3b Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 13 Jan 2023 09:06:03 -0500 Subject: [PATCH 46/51] Fix lint after merge --- src/compiler/emitter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f8b6a80b8a4d1..bff588a7bc2cb 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -148,8 +148,8 @@ import { getEmitModuleKind, getExternalHelpersModuleName, getExternalModuleName, - getInternalEmitFlags, getIdentifierTypeArguments, + getInternalEmitFlags, getLeadingCommentRanges, getLineAndCharacterOfPosition, getLinesBetweenPositionAndNextNonWhitespaceCharacter, From 2c08e1550e9965bde26a791fed41f03de412e944 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 13 Jan 2023 10:39:20 -0500 Subject: [PATCH 47/51] fix 'this' references in decorator expressions --- src/compiler/transformers/esDecorators.ts | 230 +++++++++++++++--- ...ation-outerThisReference(target=es2015).js | 123 ++++++++++ ...-outerThisReference(target=es2015).symbols | 76 ++++++ ...on-outerThisReference(target=es2015).types | 90 +++++++ ...ation-outerThisReference(target=es2021).js | 123 ++++++++++ ...-outerThisReference(target=es2021).symbols | 76 ++++++ ...on-outerThisReference(target=es2021).types | 90 +++++++ ...ation-outerThisReference(target=es2022).js | 109 +++++++++ ...-outerThisReference(target=es2022).symbols | 76 ++++++ ...on-outerThisReference(target=es2022).types | 90 +++++++ ...ation-outerThisReference(target=esnext).js | 63 +++++ ...-outerThisReference(target=esnext).symbols | 76 ++++++ ...on-outerThisReference(target=esnext).types | 90 +++++++ ...assDeclaration-classThisReference copy.ts} | 0 ...ors-classDeclaration-outerThisReference.ts | 38 +++ 15 files changed, 1316 insertions(+), 34 deletions(-) create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).symbols create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).types create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).symbols create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).types create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).symbols create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).types create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).js create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).symbols create mode 100644 tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).types rename tests/cases/conformance/esDecorators/classDeclaration/classThisReference/{esDecorators-classDeclaration-classThisReference.ts => esDecorators-classDeclaration-classThisReference copy.ts} (100%) create mode 100644 tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts diff --git a/src/compiler/transformers/esDecorators.ts b/src/compiler/transformers/esDecorators.ts index a9189525a65e7..b8b1217cc1f28 100644 --- a/src/compiler/transformers/esDecorators.ts +++ b/src/compiler/transformers/esDecorators.ts @@ -1,37 +1,176 @@ import { - addEmitHelpers, addInternalEmitFlags, addRange, AllDecorators, AnonymousFunctionDefinition, append, ArrayAssignmentElement, AssignmentPattern, - AsteriskToken, BinaryExpression, BindingElement, Block, Bundle, CallExpression, chainBundle, childIsDecorated, - ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, classOrConstructorParameterIsDecorated, - ClassStaticBlockDeclaration, CommaListExpression, ComputedPropertyName, ConstructorDeclaration, - createAccessorPropertyBackingField, Debug, Decorator, ElementAccessExpression, EmitFlags, - ESDecorateClassElementContext, ESDecorateName, expandPreOrPostfixIncrementOrDecrementExpression, - ExportAssignment, Expression, ExpressionStatement, findComputedPropertyNameCacheAssignment, firstOrUndefined, - forEachEntry, ForStatement, GeneratedIdentifierFlags, GetAccessorDeclaration, getAllDecoratorsOfClass, - getAllDecoratorsOfClassElement, getCommentRange, getEffectiveBaseTypeNode, getFirstConstructorWithBody, - getHeritageClause, getNonAssignmentOperatorForCompoundAssignment, getOrCreateEmitNode, getOriginalNode, - getSourceMapRange, hasAccessorModifier, hasDecorators, hasStaticModifier, hasSyntacticModifier, HeritageClause, - Identifier, idText, InternalEmitFlags, isAmbientPropertyDeclaration, isArrayLiteralExpression, isArrowFunction, - isAssignmentExpression, isAutoAccessorPropertyDeclaration, isBindingName, isBlock, isClassElement, - isClassExpression, isClassLike, isClassStaticBlockDeclaration, isCompoundAssignment, isComputedPropertyName, - isDestructuringAssignment, isElementAccessExpression, isEmptyStringLiteral, isExpression, isForInitializer, - isFunctionExpression, isGeneratedIdentifier, isGetAccessor, isGetAccessorDeclaration, isHeritageClause, - isIdentifier, isIdentifierText, isLeftHandSideExpression, isMethodDeclaration, isMethodOrAccessor, isModifier, - isNamedClassElement, isNamedEvaluation, isObjectLiteralElementLike, isObjectLiteralExpression, isOmittedExpression, isParameter, - isParameterDeclaration, isParenthesizedExpression, isPrivateIdentifier, isPrivateIdentifierClassElementDeclaration, - isPropertyAssignment, isPropertyDeclaration, isPropertyName, isPropertyNameLiteral, isSetAccessor, - isSetAccessorDeclaration, isShorthandPropertyAssignment, isSimpleInlineableExpression, isSpreadAssignment, - isSpreadElement, isStatement, isStatic, isStaticModifier, isStringLiteral, isSuperProperty, isTemplateLiteral, - LeftHandSideExpression, map, MethodDeclaration, ModifierFlags, ModifiersArray, moveRangePastDecorators, - moveRangePastModifiers, Node, NodeArray, NodeFlags, nodeOrChildIsDecorated, ObjectAssignmentElement, - OmittedExpression, ParameterDeclaration, ParenthesizedExpression, PartiallyEmittedExpression, - PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, PrivateIdentifierGetAccessorDeclaration, - PrivateIdentifierMethodDeclaration, PrivateIdentifierPropertyDeclaration, PrivateIdentifierSetAccessorDeclaration, - PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyName, ScriptTarget, - SetAccessorDeclaration, setCommentRange, setEmitFlags, setInternalEmitFlags, setOriginalNode, setSourceMapRange, - setTextRange, ShorthandPropertyAssignment, skipOuterExpressions, skipParentheses, some, SourceFile, - SpreadAssignment, SpreadElement, Statement, SyntaxKind, TaggedTemplateExpression, ThisExpression, - TransformationContext, TransformFlags, tryCast, VariableDeclaration, visitCommaListElements, visitEachChild, - visitIterationBody, visitNode, visitNodes, Visitor, VisitResult + addEmitHelpers, + addInternalEmitFlags, + addRange, + AllDecorators, + AnonymousFunctionDefinition, + append, + ArrayAssignmentElement, + AssignmentPattern, + AsteriskToken, + BinaryExpression, + BindingElement, + Block, + Bundle, + CallExpression, + chainBundle, + childIsDecorated, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + classOrConstructorParameterIsDecorated, + ClassStaticBlockDeclaration, + CommaListExpression, + ComputedPropertyName, + ConstructorDeclaration, + createAccessorPropertyBackingField, + Debug, + Decorator, + ElementAccessExpression, + EmitFlags, + ESDecorateClassElementContext, + ESDecorateName, + expandPreOrPostfixIncrementOrDecrementExpression, + ExportAssignment, + Expression, + ExpressionStatement, + findComputedPropertyNameCacheAssignment, + firstOrUndefined, + forEachEntry, + ForStatement, + GeneratedIdentifierFlags, + GetAccessorDeclaration, + getAllDecoratorsOfClass, + getAllDecoratorsOfClassElement, + getCommentRange, + getEffectiveBaseTypeNode, + getFirstConstructorWithBody, + getHeritageClause, + getNonAssignmentOperatorForCompoundAssignment, + getOrCreateEmitNode, + getOriginalNode, + getSourceMapRange, + hasAccessorModifier, + hasDecorators, + hasStaticModifier, + hasSyntacticModifier, + HeritageClause, + Identifier, + idText, + InternalEmitFlags, + isAmbientPropertyDeclaration, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentExpression, + isAutoAccessorPropertyDeclaration, + isBindingName, + isBlock, + isClassElement, + isClassExpression, + isClassLike, + isClassStaticBlockDeclaration, + isCompoundAssignment, + isComputedPropertyName, + isDestructuringAssignment, + isElementAccessExpression, + isEmptyStringLiteral, + isExpression, + isForInitializer, + isFunctionExpression, + isGeneratedIdentifier, + isGetAccessor, + isGetAccessorDeclaration, + isHeritageClause, + isIdentifier, + isIdentifierText, + isLeftHandSideExpression, + isMethodDeclaration, + isMethodOrAccessor, + isModifier, + isNamedClassElement, + isNamedEvaluation, + isObjectLiteralElementLike, + isObjectLiteralExpression, + isOmittedExpression, + isParameter, + isParameterDeclaration, + isParenthesizedExpression, + isPrivateIdentifier, + isPrivateIdentifierClassElementDeclaration, + isPropertyAssignment, + isPropertyDeclaration, + isPropertyName, + isPropertyNameLiteral, + isSetAccessor, + isSetAccessorDeclaration, + isShorthandPropertyAssignment, + isSimpleInlineableExpression, + isSpreadAssignment, + isSpreadElement, + isStatement, + isStatic, + isStaticModifier, + isStringLiteral, + isSuperProperty, + isTemplateLiteral, + LeftHandSideExpression, + map, + MethodDeclaration, + ModifierFlags, + ModifiersArray, + moveRangePastDecorators, + moveRangePastModifiers, + Node, + NodeArray, + NodeFlags, + nodeOrChildIsDecorated, + ObjectAssignmentElement, + OmittedExpression, + ParameterDeclaration, + ParenthesizedExpression, + PartiallyEmittedExpression, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PrivateIdentifierGetAccessorDeclaration, + PrivateIdentifierMethodDeclaration, + PrivateIdentifierPropertyDeclaration, + PrivateIdentifierSetAccessorDeclaration, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + ScriptTarget, + SetAccessorDeclaration, + setCommentRange, + setEmitFlags, + setInternalEmitFlags, + setOriginalNode, + setSourceMapRange, + setTextRange, + ShorthandPropertyAssignment, + skipOuterExpressions, + skipParentheses, + some, + SourceFile, + SpreadAssignment, + SpreadElement, + Statement, + SyntaxKind, + TaggedTemplateExpression, + ThisExpression, + TransformationContext, + TransformFlags, + tryCast, + VariableDeclaration, + visitCommaListElements, + visitEachChild, + visitIterationBody, + visitNode, + visitNodes, + Visitor, + VisitResult, } from "../_namespaces/ts"; // Class/Decorator evaluation order, as it pertains to this transformer: @@ -563,7 +702,30 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc enterClass(classInfo); let members = visitNodes(node.members, classElementVisitor, isClassElement); if (pendingExpressions) { - for (const expression of pendingExpressions) { + let outerThis: Identifier | undefined; + for (let expression of pendingExpressions) { + // If a pending expression contains a lexical `this`, we'll need to capture the lexical `this` of the + // container and transform it in the expression. This ensures we use the correct `this` in the resulting + // class `static` block. We don't use substitution here because the size of the tree we are visiting + // is likely to be small and doesn't justify the complexity of introducing substitution. + expression = visitNode(expression, function thisVisitor(node) { + if (!(node.transformFlags & TransformFlags.ContainsLexicalThis)) { + return node; + } + + switch (node.kind) { + case SyntaxKind.ThisKeyword: + if (!outerThis) { + outerThis = factory.createUniqueName("_outerThis", GeneratedIdentifierFlags.Optimistic); + classDefinitionStatements.unshift(createLet(outerThis, factory.createThis())); + } + return outerThis; + + default: + return visitEachChild(node, thisVisitor, context); + } + }, isExpression); + const statement = factory.createExpressionStatement(expression); leadingBlockStatements = append(leadingBlockStatements, statement); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js new file mode 100644 index 0000000000000..498a3d84119cd --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js @@ -0,0 +1,123 @@ +//// [esDecorators-classDeclaration-outerThisReference.ts] +declare let dec: any; + +declare let f: any; + +// `this` should point to the outer `this` in both cases. +@dec(this) +class A { + @dec(this) + b = 2; +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +class B { + // @ts-ignore + [f(this)] = 1; + + @dec(this) + b = 2; + + // @ts-ignore + [f(this)] = 3; +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +class C { + #a = 1; + + @dec(this, (x: C) => x.#a) + b = 2; +} + +//// [esDecorators-classDeclaration-outerThisReference.js] +// `this` should point to the outer `this` in both cases. +let A = (() => { + let _outerThis = this; + let _classDecorators = [dec(this)]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _instanceExtraInitializers = []; + let _b_decorators; + let _b_initializers = []; + var A = _classThis = class { + constructor() { + this.b = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _b_initializers, 2)); + } + }; + __setFunctionName(_classThis, "A"); + (() => { + _b_decorators = [dec(_outerThis)]; + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + A = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); + return A = _classThis; +})(); +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. +let B = (() => { + var _a, _b; + let _classDecorators_1 = [dec(this)]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + let _instanceExtraInitializers_1 = []; + let _b_decorators; + let _b_initializers = []; + var B = _classThis_1 = class { + constructor() { + // @ts-ignore + this[_a] = (__runInitializers(this, _instanceExtraInitializers_1), 1); + this.b = __runInitializers(this, _b_initializers, 2); + // @ts-ignore + this[_b] = 3; + } + }; + _a = f(this); + _b = (_b_decorators = [dec(this)], f(this)); + __setFunctionName(_classThis_1, "B"); + (() => { + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_1); + __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); + B = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(); + return B = _classThis_1; +})(); +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +let C = (() => { + var _a; + let _outerThis_1 = this; + let _classDecorators_2 = [dec(this)]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + let _instanceExtraInitializers_2 = []; + let _b_decorators; + let _b_initializers = []; + var C = _classThis_2 = class { + constructor() { + _a.set(this, (__runInitializers(this, _instanceExtraInitializers_2), 1)); + this.b = __runInitializers(this, _b_initializers, 2); + } + }; + _a = new WeakMap(); + __setFunctionName(_classThis_2, "C"); + (() => { + _b_decorators = [dec(_outerThis_1, (x) => __classPrivateFieldGet(x, _a, "f"))]; + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_2); + __esDecorate(null, _classDescriptor_2 = { value: _classThis_2 }, _classDecorators_2, { kind: "class", name: _classThis_2.name }, null, _classExtraInitializers_2); + C = _classThis_2 = _classDescriptor_2.value; + __runInitializers(_classThis_2, _classExtraInitializers_2); + })(); + return C = _classThis_2; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).symbols b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).symbols new file mode 100644 index 0000000000000..eb559c19bc8e0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).symbols @@ -0,0 +1,76 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts === +declare let dec: any; +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) + +declare let f: any; +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) + +// `this` should point to the outer `this` in both cases. +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class A { +>A : Symbol(A, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 19)) + + @dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + + b = 2; +>b : Symbol(A.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 6, 9)) +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class B { +>B : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) + + // @ts-ignore + [f(this)] = 1; +>[f(this)] : Symbol(B[f(this)], Decl(esDecorators-classDeclaration-outerThisReference.ts, 15, 9)) +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) +>this : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) + + @dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + + b = 2; +>b : Symbol(B.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 17, 18)) + + // @ts-ignore + [f(this)] = 3; +>[f(this)] : Symbol(B[f(this)], Decl(esDecorators-classDeclaration-outerThisReference.ts, 20, 10)) +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) +>this : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class C { +>C : Symbol(C, Decl(esDecorators-classDeclaration-outerThisReference.ts, 24, 1)) + + #a = 1; +>#a : Symbol(C.#a, Decl(esDecorators-classDeclaration-outerThisReference.ts, 29, 9)) + + @dec(this, (x: C) => x.#a) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) +>x : Symbol(x, Decl(esDecorators-classDeclaration-outerThisReference.ts, 32, 16)) +>C : Symbol(C, Decl(esDecorators-classDeclaration-outerThisReference.ts, 24, 1)) +>x.#a : Symbol(C.#a, Decl(esDecorators-classDeclaration-outerThisReference.ts, 29, 9)) +>x : Symbol(x, Decl(esDecorators-classDeclaration-outerThisReference.ts, 32, 16)) + + b = 2; +>b : Symbol(C.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 30, 11)) +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).types b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).types new file mode 100644 index 0000000000000..999d15aca5483 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).types @@ -0,0 +1,90 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts === +declare let dec: any; +>dec : any + +declare let f: any; +>f : any + +// `this` should point to the outer `this` in both cases. +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class A { +>A : A + + @dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + + b = 2; +>b : number +>2 : 2 +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class B { +>B : B + + // @ts-ignore + [f(this)] = 1; +>[f(this)] : number +>f(this) : any +>f : any +>this : this +>1 : 1 + + @dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + + b = 2; +>b : number +>2 : 2 + + // @ts-ignore + [f(this)] = 3; +>[f(this)] : number +>f(this) : any +>f : any +>this : this +>3 : 3 +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class C { +>C : C + + #a = 1; +>#a : number +>1 : 1 + + @dec(this, (x: C) => x.#a) +>dec(this, (x: C) => x.#a) : any +>dec : any +>this : typeof globalThis +>(x: C) => x.#a : (x: C) => number +>x : C +>x.#a : number +>x : C + + b = 2; +>b : number +>2 : 2 +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js new file mode 100644 index 0000000000000..498a3d84119cd --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js @@ -0,0 +1,123 @@ +//// [esDecorators-classDeclaration-outerThisReference.ts] +declare let dec: any; + +declare let f: any; + +// `this` should point to the outer `this` in both cases. +@dec(this) +class A { + @dec(this) + b = 2; +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +class B { + // @ts-ignore + [f(this)] = 1; + + @dec(this) + b = 2; + + // @ts-ignore + [f(this)] = 3; +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +class C { + #a = 1; + + @dec(this, (x: C) => x.#a) + b = 2; +} + +//// [esDecorators-classDeclaration-outerThisReference.js] +// `this` should point to the outer `this` in both cases. +let A = (() => { + let _outerThis = this; + let _classDecorators = [dec(this)]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _instanceExtraInitializers = []; + let _b_decorators; + let _b_initializers = []; + var A = _classThis = class { + constructor() { + this.b = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _b_initializers, 2)); + } + }; + __setFunctionName(_classThis, "A"); + (() => { + _b_decorators = [dec(_outerThis)]; + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + A = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); + return A = _classThis; +})(); +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. +let B = (() => { + var _a, _b; + let _classDecorators_1 = [dec(this)]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + let _instanceExtraInitializers_1 = []; + let _b_decorators; + let _b_initializers = []; + var B = _classThis_1 = class { + constructor() { + // @ts-ignore + this[_a] = (__runInitializers(this, _instanceExtraInitializers_1), 1); + this.b = __runInitializers(this, _b_initializers, 2); + // @ts-ignore + this[_b] = 3; + } + }; + _a = f(this); + _b = (_b_decorators = [dec(this)], f(this)); + __setFunctionName(_classThis_1, "B"); + (() => { + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_1); + __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); + B = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(); + return B = _classThis_1; +})(); +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +let C = (() => { + var _a; + let _outerThis_1 = this; + let _classDecorators_2 = [dec(this)]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + let _instanceExtraInitializers_2 = []; + let _b_decorators; + let _b_initializers = []; + var C = _classThis_2 = class { + constructor() { + _a.set(this, (__runInitializers(this, _instanceExtraInitializers_2), 1)); + this.b = __runInitializers(this, _b_initializers, 2); + } + }; + _a = new WeakMap(); + __setFunctionName(_classThis_2, "C"); + (() => { + _b_decorators = [dec(_outerThis_1, (x) => __classPrivateFieldGet(x, _a, "f"))]; + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_2); + __esDecorate(null, _classDescriptor_2 = { value: _classThis_2 }, _classDecorators_2, { kind: "class", name: _classThis_2.name }, null, _classExtraInitializers_2); + C = _classThis_2 = _classDescriptor_2.value; + __runInitializers(_classThis_2, _classExtraInitializers_2); + })(); + return C = _classThis_2; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).symbols b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).symbols new file mode 100644 index 0000000000000..eb559c19bc8e0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).symbols @@ -0,0 +1,76 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts === +declare let dec: any; +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) + +declare let f: any; +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) + +// `this` should point to the outer `this` in both cases. +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class A { +>A : Symbol(A, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 19)) + + @dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + + b = 2; +>b : Symbol(A.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 6, 9)) +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class B { +>B : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) + + // @ts-ignore + [f(this)] = 1; +>[f(this)] : Symbol(B[f(this)], Decl(esDecorators-classDeclaration-outerThisReference.ts, 15, 9)) +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) +>this : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) + + @dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + + b = 2; +>b : Symbol(B.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 17, 18)) + + // @ts-ignore + [f(this)] = 3; +>[f(this)] : Symbol(B[f(this)], Decl(esDecorators-classDeclaration-outerThisReference.ts, 20, 10)) +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) +>this : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class C { +>C : Symbol(C, Decl(esDecorators-classDeclaration-outerThisReference.ts, 24, 1)) + + #a = 1; +>#a : Symbol(C.#a, Decl(esDecorators-classDeclaration-outerThisReference.ts, 29, 9)) + + @dec(this, (x: C) => x.#a) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) +>x : Symbol(x, Decl(esDecorators-classDeclaration-outerThisReference.ts, 32, 16)) +>C : Symbol(C, Decl(esDecorators-classDeclaration-outerThisReference.ts, 24, 1)) +>x.#a : Symbol(C.#a, Decl(esDecorators-classDeclaration-outerThisReference.ts, 29, 9)) +>x : Symbol(x, Decl(esDecorators-classDeclaration-outerThisReference.ts, 32, 16)) + + b = 2; +>b : Symbol(C.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 30, 11)) +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).types b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).types new file mode 100644 index 0000000000000..999d15aca5483 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).types @@ -0,0 +1,90 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts === +declare let dec: any; +>dec : any + +declare let f: any; +>f : any + +// `this` should point to the outer `this` in both cases. +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class A { +>A : A + + @dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + + b = 2; +>b : number +>2 : 2 +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class B { +>B : B + + // @ts-ignore + [f(this)] = 1; +>[f(this)] : number +>f(this) : any +>f : any +>this : this +>1 : 1 + + @dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + + b = 2; +>b : number +>2 : 2 + + // @ts-ignore + [f(this)] = 3; +>[f(this)] : number +>f(this) : any +>f : any +>this : this +>3 : 3 +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class C { +>C : C + + #a = 1; +>#a : number +>1 : 1 + + @dec(this, (x: C) => x.#a) +>dec(this, (x: C) => x.#a) : any +>dec : any +>this : typeof globalThis +>(x: C) => x.#a : (x: C) => number +>x : C +>x.#a : number +>x : C + + b = 2; +>b : number +>2 : 2 +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js new file mode 100644 index 0000000000000..38f88f168c6c1 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js @@ -0,0 +1,109 @@ +//// [esDecorators-classDeclaration-outerThisReference.ts] +declare let dec: any; + +declare let f: any; + +// `this` should point to the outer `this` in both cases. +@dec(this) +class A { + @dec(this) + b = 2; +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +class B { + // @ts-ignore + [f(this)] = 1; + + @dec(this) + b = 2; + + // @ts-ignore + [f(this)] = 3; +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +class C { + #a = 1; + + @dec(this, (x: C) => x.#a) + b = 2; +} + +//// [esDecorators-classDeclaration-outerThisReference.js] +// `this` should point to the outer `this` in both cases. +let A = (() => { + let _outerThis = this; + let _classDecorators = [dec(this)]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _instanceExtraInitializers = []; + let _b_decorators; + let _b_initializers = []; + var A = class { + static { + _b_decorators = [dec(_outerThis)]; + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); + A = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + } + b = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _b_initializers, 2)); + }; + return A = _classThis; +})(); +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. +let B = (() => { + let _classDecorators_1 = [dec(this)]; + let _classDescriptor_1; + let _classExtraInitializers_1 = []; + let _classThis_1; + let _instanceExtraInitializers_1 = []; + let _b_decorators; + let _b_initializers = []; + var B = class { + static { + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_1); + __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); + B = _classThis_1 = _classDescriptor_1.value; + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + // @ts-ignore + [f(this)] = (__runInitializers(this, _instanceExtraInitializers_1), 1); + b = __runInitializers(this, _b_initializers, 2); + // @ts-ignore + [(_b_decorators = [dec(this)], f(this))] = 3; + }; + return B = _classThis_1; +})(); +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +let C = (() => { + let _outerThis_1 = this; + let _classDecorators_2 = [dec(this)]; + let _classDescriptor_2; + let _classExtraInitializers_2 = []; + let _classThis_2; + let _instanceExtraInitializers_2 = []; + let _b_decorators; + let _b_initializers = []; + var C = class { + static { + _b_decorators = [dec(_outerThis_1, (x) => x.#a)]; + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_2); + __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); + C = _classThis_2 = _classDescriptor_2.value; + __runInitializers(_classThis_2, _classExtraInitializers_2); + } + #a = (__runInitializers(this, _instanceExtraInitializers_2), 1); + b = __runInitializers(this, _b_initializers, 2); + }; + return C = _classThis_2; +})(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).symbols b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).symbols new file mode 100644 index 0000000000000..eb559c19bc8e0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).symbols @@ -0,0 +1,76 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts === +declare let dec: any; +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) + +declare let f: any; +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) + +// `this` should point to the outer `this` in both cases. +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class A { +>A : Symbol(A, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 19)) + + @dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + + b = 2; +>b : Symbol(A.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 6, 9)) +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class B { +>B : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) + + // @ts-ignore + [f(this)] = 1; +>[f(this)] : Symbol(B[f(this)], Decl(esDecorators-classDeclaration-outerThisReference.ts, 15, 9)) +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) +>this : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) + + @dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + + b = 2; +>b : Symbol(B.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 17, 18)) + + // @ts-ignore + [f(this)] = 3; +>[f(this)] : Symbol(B[f(this)], Decl(esDecorators-classDeclaration-outerThisReference.ts, 20, 10)) +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) +>this : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class C { +>C : Symbol(C, Decl(esDecorators-classDeclaration-outerThisReference.ts, 24, 1)) + + #a = 1; +>#a : Symbol(C.#a, Decl(esDecorators-classDeclaration-outerThisReference.ts, 29, 9)) + + @dec(this, (x: C) => x.#a) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) +>x : Symbol(x, Decl(esDecorators-classDeclaration-outerThisReference.ts, 32, 16)) +>C : Symbol(C, Decl(esDecorators-classDeclaration-outerThisReference.ts, 24, 1)) +>x.#a : Symbol(C.#a, Decl(esDecorators-classDeclaration-outerThisReference.ts, 29, 9)) +>x : Symbol(x, Decl(esDecorators-classDeclaration-outerThisReference.ts, 32, 16)) + + b = 2; +>b : Symbol(C.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 30, 11)) +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).types b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).types new file mode 100644 index 0000000000000..999d15aca5483 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).types @@ -0,0 +1,90 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts === +declare let dec: any; +>dec : any + +declare let f: any; +>f : any + +// `this` should point to the outer `this` in both cases. +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class A { +>A : A + + @dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + + b = 2; +>b : number +>2 : 2 +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class B { +>B : B + + // @ts-ignore + [f(this)] = 1; +>[f(this)] : number +>f(this) : any +>f : any +>this : this +>1 : 1 + + @dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + + b = 2; +>b : number +>2 : 2 + + // @ts-ignore + [f(this)] = 3; +>[f(this)] : number +>f(this) : any +>f : any +>this : this +>3 : 3 +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class C { +>C : C + + #a = 1; +>#a : number +>1 : 1 + + @dec(this, (x: C) => x.#a) +>dec(this, (x: C) => x.#a) : any +>dec : any +>this : typeof globalThis +>(x: C) => x.#a : (x: C) => number +>x : C +>x.#a : number +>x : C + + b = 2; +>b : number +>2 : 2 +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).js new file mode 100644 index 0000000000000..268e20c938902 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).js @@ -0,0 +1,63 @@ +//// [esDecorators-classDeclaration-outerThisReference.ts] +declare let dec: any; + +declare let f: any; + +// `this` should point to the outer `this` in both cases. +@dec(this) +class A { + @dec(this) + b = 2; +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +class B { + // @ts-ignore + [f(this)] = 1; + + @dec(this) + b = 2; + + // @ts-ignore + [f(this)] = 3; +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +class C { + #a = 1; + + @dec(this, (x: C) => x.#a) + b = 2; +} + +//// [esDecorators-classDeclaration-outerThisReference.js] +// `this` should point to the outer `this` in both cases. +@dec(this) +class A { + @dec(this) + b = 2; +} +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. +@dec(this) +class B { + // @ts-ignore + [f(this)] = 1; + @dec(this) + b = 2; + // @ts-ignore + [f(this)] = 3; +} +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +class C { + #a = 1; + @dec(this, (x) => x.#a) + b = 2; +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).symbols b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).symbols new file mode 100644 index 0000000000000..eb559c19bc8e0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).symbols @@ -0,0 +1,76 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts === +declare let dec: any; +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) + +declare let f: any; +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) + +// `this` should point to the outer `this` in both cases. +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class A { +>A : Symbol(A, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 19)) + + @dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + + b = 2; +>b : Symbol(A.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 6, 9)) +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class B { +>B : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) + + // @ts-ignore + [f(this)] = 1; +>[f(this)] : Symbol(B[f(this)], Decl(esDecorators-classDeclaration-outerThisReference.ts, 15, 9)) +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) +>this : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) + + @dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + + b = 2; +>b : Symbol(B.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 17, 18)) + + // @ts-ignore + [f(this)] = 3; +>[f(this)] : Symbol(B[f(this)], Decl(esDecorators-classDeclaration-outerThisReference.ts, 20, 10)) +>f : Symbol(f, Decl(esDecorators-classDeclaration-outerThisReference.ts, 2, 11)) +>this : Symbol(B, Decl(esDecorators-classDeclaration-outerThisReference.ts, 9, 1)) +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) + +class C { +>C : Symbol(C, Decl(esDecorators-classDeclaration-outerThisReference.ts, 24, 1)) + + #a = 1; +>#a : Symbol(C.#a, Decl(esDecorators-classDeclaration-outerThisReference.ts, 29, 9)) + + @dec(this, (x: C) => x.#a) +>dec : Symbol(dec, Decl(esDecorators-classDeclaration-outerThisReference.ts, 0, 11)) +>this : Symbol(globalThis) +>x : Symbol(x, Decl(esDecorators-classDeclaration-outerThisReference.ts, 32, 16)) +>C : Symbol(C, Decl(esDecorators-classDeclaration-outerThisReference.ts, 24, 1)) +>x.#a : Symbol(C.#a, Decl(esDecorators-classDeclaration-outerThisReference.ts, 29, 9)) +>x : Symbol(x, Decl(esDecorators-classDeclaration-outerThisReference.ts, 32, 16)) + + b = 2; +>b : Symbol(C.b, Decl(esDecorators-classDeclaration-outerThisReference.ts, 30, 11)) +} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).types b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).types new file mode 100644 index 0000000000000..999d15aca5483 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=esnext).types @@ -0,0 +1,90 @@ +=== tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts === +declare let dec: any; +>dec : any + +declare let f: any; +>f : any + +// `this` should point to the outer `this` in both cases. +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class A { +>A : A + + @dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + + b = 2; +>b : number +>2 : 2 +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class B { +>B : B + + // @ts-ignore + [f(this)] = 1; +>[f(this)] : number +>f(this) : any +>f : any +>this : this +>1 : 1 + + @dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + + b = 2; +>b : number +>2 : 2 + + // @ts-ignore + [f(this)] = 3; +>[f(this)] : number +>f(this) : any +>f : any +>this : this +>3 : 3 +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +>dec(this) : any +>dec : any +>this : typeof globalThis + +class C { +>C : C + + #a = 1; +>#a : number +>1 : 1 + + @dec(this, (x: C) => x.#a) +>dec(this, (x: C) => x.#a) : any +>dec : any +>this : typeof globalThis +>(x: C) => x.#a : (x: C) => number +>x : C +>x.#a : number +>x : C + + b = 2; +>b : number +>2 : 2 +} diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.ts b/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference copy.ts similarity index 100% rename from tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.ts rename to tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference copy.ts diff --git a/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts new file mode 100644 index 0000000000000..458ab7be19aac --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/esDecorators-classDeclaration-outerThisReference.ts @@ -0,0 +1,38 @@ +// @target: esnext, es2022, es2021, es2015 +// @noEmitHelpers: true + +declare let dec: any; + +declare let f: any; + +// `this` should point to the outer `this` in both cases. +@dec(this) +class A { + @dec(this) + b = 2; +} + +// `this` should point to the outer `this`, and maintain the correct evaluation order with respect to computed +// property names. + +@dec(this) +class B { + // @ts-ignore + [f(this)] = 1; + + @dec(this) + b = 2; + + // @ts-ignore + [f(this)] = 3; +} + +// The `this` transformation should ensure that decorators inside the class body have privileged access to +// private names. +@dec(this) +class C { + #a = 1; + + @dec(this, (x: C) => x.#a) + b = 2; +} \ No newline at end of file From 298bce5bf9f042dcef8d02bfd527117f098f67a3 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 13 Jan 2023 10:43:18 -0500 Subject: [PATCH 48/51] Accept baseline after merge --- ...houtExportsDiagnostic1(moduleresolution=node16).trace.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/baselines/reference/resolvesWithoutExportsDiagnostic1(moduleresolution=node16).trace.json b/tests/baselines/reference/resolvesWithoutExportsDiagnostic1(moduleresolution=node16).trace.json index 6d8b992bfbc76..07fb87e30c1dc 100644 --- a/tests/baselines/reference/resolvesWithoutExportsDiagnostic1(moduleresolution=node16).trace.json +++ b/tests/baselines/reference/resolvesWithoutExportsDiagnostic1(moduleresolution=node16).trace.json @@ -92,5 +92,9 @@ "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups.", "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file From b0020f6b01e25e3f6442b82778613e4ce806e8af Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 13 Jan 2023 15:07:50 -0500 Subject: [PATCH 49/51] Fix incorrectly renamed test --- ...opy.ts => esDecorators-classDeclaration-classThisReference.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/cases/conformance/esDecorators/classDeclaration/classThisReference/{esDecorators-classDeclaration-classThisReference copy.ts => esDecorators-classDeclaration-classThisReference.ts} (100%) diff --git a/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference copy.ts b/tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.ts similarity index 100% rename from tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference copy.ts rename to tests/cases/conformance/esDecorators/classDeclaration/classThisReference/esDecorators-classDeclaration-classThisReference.ts From 673073c28f460d0d65dd4d0b2ba6ec668bd26c90 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 18 Jan 2023 17:18:49 -0500 Subject: [PATCH 50/51] Temporarily disable 'context.access' --- src/compiler/factory/emitHelpers.ts | 205 +++++++++++++----- src/compiler/transformers/classFields.ts | 6 +- src/lib/decorators.d.ts | 123 ++++++----- .../unittests/evaluation/esDecorators.ts | 6 +- ...tion-accessors-nonStatic(target=es2015).js | 12 +- ...tion-accessors-nonStatic(target=es2022).js | 12 +- ...aration-accessors-nonStatic(target=es5).js | 12 +- ...cessors-nonStaticPrivate(target=es2015).js | 4 +- ...cessors-nonStaticPrivate(target=es2022).js | 4 +- ...aration-accessors-static(target=es2015).js | 12 +- ...aration-accessors-static(target=es2022).js | 12 +- ...eclaration-accessors-static(target=es5).js | 12 +- ...-accessors-staticPrivate(target=es2015).js | 4 +- ...-accessors-staticPrivate(target=es2022).js | 4 +- ...ervation(module=commonjs,target=es2015).js | 20 +- ...ervation(module=commonjs,target=es2022).js | 20 +- ...eservation(module=esnext,target=es2015).js | 20 +- ...eservation(module=esnext,target=es2022).js | 20 +- ...t=es2015,usedefineforclassfields=false).js | 6 +- ...et=es2015,usedefineforclassfields=true).js | 6 +- ...t=es2022,usedefineforclassfields=false).js | 6 +- ...et=es2022,usedefineforclassfields=true).js | 6 +- ...rget=es5,usedefineforclassfields=false).js | 6 +- ...arget=es5,usedefineforclassfields=true).js | 6 +- ...t=esnext,usedefineforclassfields=false).js | 6 +- ...fields-nonStaticAccessor(target=es2015).js | 6 +- ...fields-nonStaticAccessor(target=es2022).js | 6 +- ...-fields-nonStaticPrivate(target=es2015).js | 2 +- ...-fields-nonStaticPrivate(target=es2022).js | 2 +- ...nonStaticPrivateAccessor(target=es2015).js | 2 +- ...nonStaticPrivateAccessor(target=es2022).js | 2 +- ...t=es2015,usedefineforclassfields=false).js | 6 +- ...et=es2015,usedefineforclassfields=true).js | 6 +- ...t=es2022,usedefineforclassfields=false).js | 6 +- ...et=es2022,usedefineforclassfields=true).js | 6 +- ...rget=es5,usedefineforclassfields=false).js | 6 +- ...arget=es5,usedefineforclassfields=true).js | 6 +- ...t=esnext,usedefineforclassfields=false).js | 6 +- ...on-fields-staticAccessor(target=es2015).js | 6 +- ...on-fields-staticAccessor(target=es2022).js | 6 +- ...ion-fields-staticPrivate(target=es2015).js | 2 +- ...ion-fields-staticPrivate(target=es2022).js | 2 +- ...ds-staticPrivateAccessor(target=es2015).js | 2 +- ...ds-staticPrivateAccessor(target=es2022).js | 2 +- ...ration-methods-nonStatic(target=es2015).js | 6 +- ...ration-methods-nonStatic(target=es2022).js | 6 +- ...claration-methods-nonStatic(target=es5).js | 6 +- ...methods-nonStaticPrivate(target=es2015).js | 2 +- ...methods-nonStaticPrivate(target=es2022).js | 2 +- ...claration-methods-static(target=es2015).js | 6 +- ...claration-methods-static(target=es2022).js | 6 +- ...sDeclaration-methods-static(target=es5).js | 6 +- ...on-methods-staticPrivate(target=es2015).js | 2 +- ...on-methods-staticPrivate(target=es2022).js | 2 +- ...mitHelpers-nonStaticPrivateAutoAccessor.js | 2 +- ...issingEmitHelpers-nonStaticPrivateField.js | 2 +- ...ssingEmitHelpers-nonStaticPrivateGetter.js | 2 +- ...ssingEmitHelpers-nonStaticPrivateMethod.js | 2 +- ...ssingEmitHelpers-nonStaticPrivateSetter.js | 2 +- ...gEmitHelpers-staticComputedAutoAccessor.js | 2 +- ...-missingEmitHelpers-staticComputedField.js | 2 +- ...missingEmitHelpers-staticComputedGetter.js | 2 +- ...missingEmitHelpers-staticComputedMethod.js | 2 +- ...missingEmitHelpers-staticComputedSetter.js | 2 +- ...ngEmitHelpers-staticPrivateAutoAccessor.js | 2 +- ...n-missingEmitHelpers-staticPrivateField.js | 2 +- ...-missingEmitHelpers-staticPrivateGetter.js | 2 +- ...-missingEmitHelpers-staticPrivateMethod.js | 2 +- ...-missingEmitHelpers-staticPrivateSetter.js | 2 +- ...ation-outerThisReference(target=es2015).js | 6 +- ...ation-outerThisReference(target=es2021).js | 6 +- ...ation-outerThisReference(target=es2022).js | 6 +- ...t=es2015,usedefineforclassfields=false).js | 2 +- ...et=es2015,usedefineforclassfields=true).js | 2 +- ...t=es2022,usedefineforclassfields=false).js | 2 +- ...et=es2022,usedefineforclassfields=true).js | 2 +- ...rget=es5,usedefineforclassfields=false).js | 2 +- ...arget=es5,usedefineforclassfields=true).js | 2 +- ...t=esnext,usedefineforclassfields=false).js | 2 +- ...assDeclaration-sourceMap(target=es2015).js | 20 +- ...eclaration-sourceMap(target=es2015).js.map | 4 +- ...ion-sourceMap(target=es2015).sourcemap.txt | 143 +++++------- ...assDeclaration-sourceMap(target=es2022).js | 20 +- ...eclaration-sourceMap(target=es2022).js.map | 4 +- ...ion-sourceMap(target=es2022).sourcemap.txt | 136 ++++-------- ...sion-commentPreservation(target=es2015).js | 20 +- ...sion-commentPreservation(target=es2022).js | 20 +- ...ators-classExpression-namedEvaluation.1.js | 8 +- ...tors-classExpression-namedEvaluation.10.js | 16 +- ...tors-classExpression-namedEvaluation.11.js | 4 +- ...ators-classExpression-namedEvaluation.2.js | 12 +- ...ators-classExpression-namedEvaluation.3.js | 6 +- ...ators-classExpression-namedEvaluation.4.js | 6 +- ...ators-classExpression-namedEvaluation.5.js | 2 +- ...ators-classExpression-namedEvaluation.6.js | 2 +- ...ators-classExpression-namedEvaluation.7.js | 2 +- ...ators-classExpression-namedEvaluation.8.js | 2 +- ...ators-classExpression-namedEvaluation.9.js | 2 +- ...rs-emitDecoratorMetadata(target=es2015).js | 24 +- ...rs-emitDecoratorMetadata(target=es2022).js | 24 +- ...ators-emitDecoratorMetadata(target=es5).js | 24 +- 101 files changed, 630 insertions(+), 609 deletions(-) diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index 848010150d082..80968a7c20568 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -25,7 +25,6 @@ import { isComputedPropertyName, isIdentifier, memoize, - ObjectLiteralElementLike, PrivateIdentifier, ScriptTarget, setEmitFlags, @@ -251,57 +250,155 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel ]); } - function createESDecorateClassElementAccessGetMethod(elementName: ESDecorateName) { - const accessor = elementName.computed ? - factory.createElementAccessExpression(factory.createThis(), elementName.name) : - factory.createPropertyAccessExpression(factory.createThis(), elementName.name); - - return factory.createMethodDeclaration( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - "get", - /*questionToken*/ undefined, - /*typeParameters*/ undefined, - [], - /*type*/ undefined, - factory.createBlock([factory.createReturnStatement(accessor)]) - ); - } - - function createESDecorateClassElementAccessSetMethod(elementName: ESDecorateName) { - const accessor = elementName.computed ? - factory.createElementAccessExpression(factory.createThis(), elementName.name) : - factory.createPropertyAccessExpression(factory.createThis(), elementName.name); - - return factory.createMethodDeclaration( - /*modifiers*/ undefined, - /*asteriskToken*/ undefined, - "set", - /*questionToken*/ undefined, - /*typeParameters*/ undefined, - [factory.createParameterDeclaration( - /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, - factory.createIdentifier("value") - )], - /*type*/ undefined, - factory.createBlock([ - factory.createExpressionStatement( - factory.createAssignment( - accessor, - factory.createIdentifier("value") - ) - ) - ]) - ); - } - - function createESDecorateClassElementAccessObject(name: ESDecorateName, access: ESDecorateClassElementAccess) { - const properties: ObjectLiteralElementLike[] = []; - if (access.get) properties.push(createESDecorateClassElementAccessGetMethod(name)); - if (access.set) properties.push(createESDecorateClassElementAccessSetMethod(name)); - return factory.createObjectLiteralExpression(properties); - } + // Per https://github.com/tc39/proposal-decorators/issues/494, we may need to change the emit for the `access` object + // so that it does not need to be used via `.call`. The following two sections represent the options presented in + // tc39/proposal-decorators#494 + // + // === Current approach (`access.get.call(obj)`, `access.set.call(obj, value)`) === + // + // function createESDecorateClassElementAccessGetMethod(elementName: ESDecorateName) { + // const accessor = elementName.computed ? + // factory.createElementAccessExpression(factory.createThis(), elementName.name) : + // factory.createPropertyAccessExpression(factory.createThis(), elementName.name); + // + // return factory.createMethodDeclaration( + // /*modifiers*/ undefined, + // /*asteriskToken*/ undefined, + // "get", + // /*questionToken*/ undefined, + // /*typeParameters*/ undefined, + // [], + // /*type*/ undefined, + // factory.createBlock([factory.createReturnStatement(accessor)]) + // ); + // } + // + // function createESDecorateClassElementAccessSetMethod(elementName: ESDecorateName) { + // const accessor = elementName.computed ? + // factory.createElementAccessExpression(factory.createThis(), elementName.name) : + // factory.createPropertyAccessExpression(factory.createThis(), elementName.name); + // + // return factory.createMethodDeclaration( + // /*modifiers*/ undefined, + // /*asteriskToken*/ undefined, + // "set", + // /*questionToken*/ undefined, + // /*typeParameters*/ undefined, + // [factory.createParameterDeclaration( + // /*modifiers*/ undefined, + // /*dotDotDotToken*/ undefined, + // factory.createIdentifier("value") + // )], + // /*type*/ undefined, + // factory.createBlock([ + // factory.createExpressionStatement( + // factory.createAssignment( + // accessor, + // factory.createIdentifier("value") + // ) + // ) + // ]) + // ); + // } + // + // function createESDecorateClassElementAccessObject(name: ESDecorateName, access: ESDecorateClassElementAccess) { + // const properties: ObjectLiteralElementLike[] = []; + // if (access.get) properties.push(createESDecorateClassElementAccessGetMethod(name)); + // if (access.set) properties.push(createESDecorateClassElementAccessSetMethod(name)); + // return factory.createObjectLiteralExpression(properties); + // } + // + // === Suggested approach (`access.get(obj)`, `access.set(obj, value)`, `access.has(obj)`) === + // + // function createESDecorateClassElementAccessGetMethod(elementName: ESDecorateName) { + // const accessor = elementName.computed ? + // factory.createElementAccessExpression(factory.createIdentifier("obj"), elementName.name) : + // factory.createPropertyAccessExpression(factory.createIdentifier("obj"), elementName.name); + // + // return factory.createMethodDeclaration( + // /*modifiers*/ undefined, + // /*asteriskToken*/ undefined, + // "get", + // /*questionToken*/ undefined, + // /*typeParameters*/ undefined, + // [factory.createParameterDeclaration( + // /*modifiers*/ undefined, + // /*dotDotDotToken*/ undefined, + // factory.createIdentifier("obj") + // )], + // /*type*/ undefined, + // factory.createBlock([factory.createReturnStatement(accessor)]) + // ); + // } + // + // function createESDecorateClassElementAccessSetMethod(elementName: ESDecorateName) { + // const accessor = elementName.computed ? + // factory.createElementAccessExpression(factory.createIdentifier("obj"), elementName.name) : + // factory.createPropertyAccessExpression(factory.createIdentifier("obj"), elementName.name); + // + // return factory.createMethodDeclaration( + // /*modifiers*/ undefined, + // /*asteriskToken*/ undefined, + // "set", + // /*questionToken*/ undefined, + // /*typeParameters*/ undefined, + // [factory.createParameterDeclaration( + // /*modifiers*/ undefined, + // /*dotDotDotToken*/ undefined, + // factory.createIdentifier("obj") + // ), + // factory.createParameterDeclaration( + // /*modifiers*/ undefined, + // /*dotDotDotToken*/ undefined, + // factory.createIdentifier("value") + // )], + // /*type*/ undefined, + // factory.createBlock([ + // factory.createExpressionStatement( + // factory.createAssignment( + // accessor, + // factory.createIdentifier("value") + // ) + // ) + // ]) + // ); + // } + // + // function createESDecorateClassElementAccessHasMethod(elementName: ESDecorateName) { + // const propertyName = + // elementName.computed ? elementName.name : + // isIdentifier(elementName.name) ? factory.createStringLiteralFromNode(elementName.name) : + // elementName.name; + // + // return factory.createMethodDeclaration( + // /*modifiers*/ undefined, + // /*asteriskToken*/ undefined, + // "has", + // /*questionToken*/ undefined, + // /*typeParameters*/ undefined, + // [factory.createParameterDeclaration( + // /*modifiers*/ undefined, + // /*dotDotDotToken*/ undefined, + // factory.createIdentifier("obj") + // )], + // /*type*/ undefined, + // factory.createBlock([factory.createReturnStatement( + // factory.createBinaryExpression( + // propertyName, + // SyntaxKind.InKeyword, + // factory.createIdentifier("obj") + // ) + // )]) + // ); + // } + // + // function createESDecorateClassElementAccessObject(name: ESDecorateName, access: ESDecorateClassElementAccess) { + // const properties: ObjectLiteralElementLike[] = []; + // if (access.get) properties.push(createESDecorateClassElementAccessGetMethod(name)); + // if (access.set) properties.push(createESDecorateClassElementAccessSetMethod(name)); + // property.push(createESDecorateClassElementAccessHasMethod(name)); + // return factory.createObjectLiteralExpression(properties); + // } function createESDecorateClassElementContextObject(contextIn: ESDecorateClassElementContext) { return factory.createObjectLiteralExpression([ @@ -309,7 +406,9 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel factory.createPropertyAssignment(factory.createIdentifier("name"), contextIn.name.computed ? contextIn.name.name : factory.createStringLiteralFromNode(contextIn.name.name)), factory.createPropertyAssignment(factory.createIdentifier("static"), contextIn.static ? factory.createTrue() : factory.createFalse()), factory.createPropertyAssignment(factory.createIdentifier("private"), contextIn.private ? factory.createTrue() : factory.createFalse()), - factory.createPropertyAssignment(factory.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access)) + + // Disabled, pending resolution of https://github.com/tc39/proposal-decorators/issues/494 + // factory.createPropertyAssignment(factory.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access)) ]); } diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 1a212b3c51d14..a75271b8b57e3 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -1052,16 +1052,14 @@ export function transformClassFields(context: TransformationContext): (x: Source return undefined; } - factory.updatePropertyDeclaration( + return factory.updatePropertyDeclaration( node, visitNodes(node.modifiers, modifierVisitor, isModifier), visitNode(node.name, propertyNameVisitor, isPropertyName), /*questionOrExclamationToken*/ undefined, /*type*/ undefined, visitNode(node.initializer, visitor, isExpression) - ) - - return visitEachChild(node, classElementVisitor, context); + ); } function transformFieldInitializer(node: PropertyDeclaration) { diff --git a/src/lib/decorators.d.ts b/src/lib/decorators.d.ts index 490e788d9391f..255f17cbed43c 100644 --- a/src/lib/decorators.d.ts +++ b/src/lib/decorators.d.ts @@ -72,16 +72,17 @@ interface ClassMethodDecoratorContext< /** A value indicating whether the class member has a private name. */ readonly private: boolean; - /** An object that can be used to access the current value of the class member at runtime. */ - readonly access: { - /** - * Gets the current value of the method from the provided receiver. - * - * @example - * let fn = context.access.get.call(instance); - */ - get(this: This): Value; - }; + // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494 + // /** An object that can be used to access the current value of the class member at runtime. */ + // readonly access: { + // /** + // * Gets the current value of the method from the provided receiver. + // * + // * @example + // * let fn = context.access.get.call(instance); + // */ + // get(this: This): Value; + // }; /** * Adds a callback to be invoked either before static initializers are run (when @@ -132,16 +133,17 @@ interface ClassGetterDecoratorContext< /** A value indicating whether the class member has a private name. */ readonly private: boolean; - /** An object that can be used to access the current value of the class member at runtime. */ - readonly access: { - /** - * Invokes the getter on the provided receiver. - * - * @example - * let value = context.access.get.call(instance); - */ - get(this: This): Value; - }; + // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494 + // /** An object that can be used to access the current value of the class member at runtime. */ + // readonly access: { + // /** + // * Invokes the getter on the provided receiver. + // * + // * @example + // * let value = context.access.get.call(instance); + // */ + // get(this: This): Value; + // }; /** * Adds a callback to be invoked either before static initializers are run (when @@ -173,16 +175,17 @@ interface ClassSetterDecoratorContext< /** A value indicating whether the class member has a private name. */ readonly private: boolean; + // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494 /** An object that can be used to access the current value of the class member at runtime. */ - readonly access: { - /** - * Invokes the setter on the provided receiver. - * - * @example - * context.access.set.call(instance, value); - */ - set(this: This, value: Value): void; - }; + // readonly access: { + // /** + // * Invokes the setter on the provided receiver. + // * + // * @example + // * context.access.set.call(instance, value); + // */ + // set(this: This, value: Value): void; + // }; /** * Adds a callback to be invoked either before static initializers are run (when @@ -214,24 +217,25 @@ interface ClassAccessorDecoratorContext< /** A value indicating whether the class member has a private name. */ readonly private: boolean; - /** An object that can be used to access the current value of the class member at runtime. */ - readonly access: { - /** - * Invokes the getter on the provided receiver. - * - * @example - * let value = context.access.get.call(instance); - */ - get(this: This): Value; - - /** - * Invokes the setter on the provided receiver. - * - * @example - * context.access.set.call(instance, value); - */ - set(this: This, value: Value): void; - }; + // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494 + // /** An object that can be used to access the current value of the class member at runtime. */ + // readonly access: { + // /** + // * Invokes the getter on the provided receiver. + // * + // * @example + // * let value = context.access.get.call(instance); + // */ + // get(this: This): Value; + + // /** + // * Invokes the setter on the provided receiver. + // * + // * @example + // * context.access.set.call(instance, value); + // */ + // set(this: This, value: Value): void; + // }; /** * Adds a callback to be invoked either before static initializers are run (when @@ -310,18 +314,19 @@ interface ClassFieldDecoratorContext< /** A value indicating whether the class member has a private name. */ readonly private: boolean; - /** An object that can be used to access the current value of the class member at runtime. */ - readonly access: { - /** - * Gets the value of the field on the provided receiver. - */ - get(this: This): Value; - - /** - * Sets the value of the field on the provided receiver. - */ - set(this: This, value: Value): void; - }; + // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494 + // /** An object that can be used to access the current value of the class member at runtime. */ + // readonly access: { + // /** + // * Gets the value of the field on the provided receiver. + // */ + // get(this: This): Value; + + // /** + // * Sets the value of the field on the provided receiver. + // */ + // set(this: This, value: Value): void; + // }; /** * Adds a callback to be invoked either before static initializers are run (when diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts index 08db8c6302aa6..1863e9426517e 100644 --- a/src/testRunner/unittests/evaluation/esDecorators.ts +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -703,7 +703,8 @@ describe("unittests:: evaluation:: esDecorators", () => { }); }); }); - describe(".access", () => { + // Disabled pending the outcome of https://github.com/tc39/proposal-decorators/issues/494 + describe.skip(".access", () => { describe("for: class", () => { it("is not set", () => { const { context } = exec` @@ -2222,7 +2223,8 @@ describe("unittests:: evaluation:: esDecorators", () => { }); // see https://github.com/tc39/proposal-decorators#access-and-metadata-sidechanneling - it(`dependency injection (${targetName})`, () => { + // Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494 + it.skip(`dependency injection (${targetName})`, () => { const { result } = exec` const INJECTIONS = new WeakMap void }[]>(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2015).js index b6cf760f47a8e..5e9c2758d53b1 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2015).js @@ -37,12 +37,12 @@ let C = (() => { } }, (() => { - __esDecorate(_a, null, _get_method1_decorators, { kind: "getter", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _set_method1_decorators, { kind: "setter", name: "method1", static: false, private: false, access: { set(value) { this.method1 = value; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _get_member_decorators, { kind: "getter", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _set_member_decorators, { kind: "setter", name: "method2", static: false, private: false, access: { set(value) { this["method2"] = value; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _get_member_decorators_1, { kind: "getter", name: _b, static: false, private: false, access: { get() { return this[_b]; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _set_member_decorators_1, { kind: "setter", name: _c, static: false, private: false, access: { set(value) { this[_c] = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_method1_decorators, { kind: "getter", name: "method1", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_method1_decorators, { kind: "setter", name: "method1", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_member_decorators, { kind: "getter", name: "method2", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_member_decorators, { kind: "setter", name: "method2", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_member_decorators_1, { kind: "getter", name: _b, static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_member_decorators_1, { kind: "setter", name: _c, static: false, private: false }, null, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2022).js index cc4f94ea5ff4c..9315c3dde5fa7 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2022).js @@ -26,12 +26,12 @@ let C = (() => { let _set_member_decorators_1; return class C { static { - __esDecorate(this, null, _get_method1_decorators, { kind: "getter", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _set_method1_decorators, { kind: "setter", name: "method1", static: false, private: false, access: { set(value) { this.method1 = value; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _get_member_decorators, { kind: "getter", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _set_member_decorators, { kind: "setter", name: "method2", static: false, private: false, access: { set(value) { this["method2"] = value; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _get_member_decorators_1, { kind: "getter", name: _a, static: false, private: false, access: { get() { return this[_a]; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _set_member_decorators_1, { kind: "setter", name: _b, static: false, private: false, access: { set(value) { this[_b] = value; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_method1_decorators, { kind: "getter", name: "method1", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_method1_decorators, { kind: "setter", name: "method1", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_member_decorators, { kind: "getter", name: "method2", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_member_decorators, { kind: "setter", name: "method2", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_member_decorators_1, { kind: "getter", name: _a, static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_member_decorators_1, { kind: "setter", name: _b, static: false, private: false }, null, _instanceExtraInitializers); } get method1() { return 0; } set method1(value) { } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es5).js index 7eca234366d4e..129044549e3b8 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es5).js @@ -55,12 +55,12 @@ var C = function () { return C; }()), (function () { - __esDecorate(_a, null, _get_method1_decorators, { kind: "getter", name: "method1", static: false, private: false, access: { get: function () { return this.method1; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _set_method1_decorators, { kind: "setter", name: "method1", static: false, private: false, access: { set: function (value) { this.method1 = value; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _get_member_decorators, { kind: "getter", name: "method2", static: false, private: false, access: { get: function () { return this["method2"]; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _set_member_decorators, { kind: "setter", name: "method2", static: false, private: false, access: { set: function (value) { this["method2"] = value; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _get_member_decorators_1, { kind: "getter", name: _b, static: false, private: false, access: { get: function () { return this[_b]; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _set_member_decorators_1, { kind: "setter", name: _c, static: false, private: false, access: { set: function (value) { this[_c] = value; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_method1_decorators, { kind: "getter", name: "method1", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_method1_decorators, { kind: "setter", name: "method1", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_member_decorators, { kind: "getter", name: "method2", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_member_decorators, { kind: "setter", name: "method2", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _get_member_decorators_1, { kind: "getter", name: _b, static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _set_member_decorators_1, { kind: "setter", name: _c, static: false, private: false }, null, _instanceExtraInitializers); })(), _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js index 19e95ff8713d4..65a6cfaaa2252 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2015).js @@ -27,8 +27,8 @@ let C = (() => { (() => { _private_get_method1_decorators = [dec(1)]; _private_set_method1_decorators = [dec(2)]; - __esDecorate(_a, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_method1_get); } } }, null, _instanceExtraInitializers); - __esDecorate(_a, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true, access: { set(value) { __classPrivateFieldSet(this, _C_instances, value, "a", _C_method1_set); } } }, null, _instanceExtraInitializers); + __esDecorate(_a, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true }, null, _instanceExtraInitializers); + __esDecorate(_a, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true }, null, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js index 828375c0796f2..e2556ba5c3e64 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=es2022).js @@ -18,8 +18,8 @@ let C = (() => { static { _private_get_method1_decorators = [dec(1)]; _private_set_method1_decorators = [dec(2)]; - __esDecorate(this, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true, access: { get() { return this.#method1; } } }, null, _instanceExtraInitializers); - __esDecorate(this, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true, access: { set(value) { this.#method1 = value; } } }, null, _instanceExtraInitializers); + __esDecorate(this, _private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _private_get_method1_decorators, { kind: "getter", name: "#method1", static: false, private: true }, null, _instanceExtraInitializers); + __esDecorate(this, _private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _private_set_method1_decorators, { kind: "setter", name: "#method1", static: false, private: true }, null, _instanceExtraInitializers); } get #method1() { return _private_get_method1_descriptor.get.call(this); } set #method1(value) { return _private_set_method1_descriptor.set.call(this, value); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2015).js index ab4333e46c377..e4b87d775a091 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2015).js @@ -34,12 +34,12 @@ let C = (() => { static set [(_static_set_member_decorators_1 = [dec(32)], _c = __propKey(method3))](value) { } }, (() => { - __esDecorate(_a, null, _static_get_method1_decorators, { kind: "getter", name: "method1", static: true, private: false, access: { get() { return this.method1; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_set_method1_decorators, { kind: "setter", name: "method1", static: true, private: false, access: { set(value) { this.method1 = value; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_get_member_decorators, { kind: "getter", name: "method2", static: true, private: false, access: { get() { return this["method2"]; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_set_member_decorators, { kind: "setter", name: "method2", static: true, private: false, access: { set(value) { this["method2"] = value; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_get_member_decorators_1, { kind: "getter", name: _b, static: true, private: false, access: { get() { return this[_b]; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_set_member_decorators_1, { kind: "setter", name: _c, static: true, private: false, access: { set(value) { this[_c] = value; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_method1_decorators, { kind: "getter", name: "method1", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_method1_decorators, { kind: "setter", name: "method1", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_member_decorators, { kind: "getter", name: "method2", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_member_decorators, { kind: "setter", name: "method2", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_member_decorators_1, { kind: "getter", name: _b, static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_member_decorators_1, { kind: "setter", name: _c, static: true, private: false }, null, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2022).js index 08ef8ac77cef7..a69d475a3952f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es2022).js @@ -26,12 +26,12 @@ let C = (() => { let _static_set_member_decorators_1; return class C { static { - __esDecorate(this, null, _static_get_method1_decorators, { kind: "getter", name: "method1", static: true, private: false, access: { get() { return this.method1; } } }, null, _staticExtraInitializers); - __esDecorate(this, null, _static_set_method1_decorators, { kind: "setter", name: "method1", static: true, private: false, access: { set(value) { this.method1 = value; } } }, null, _staticExtraInitializers); - __esDecorate(this, null, _static_get_member_decorators, { kind: "getter", name: "method2", static: true, private: false, access: { get() { return this["method2"]; } } }, null, _staticExtraInitializers); - __esDecorate(this, null, _static_set_member_decorators, { kind: "setter", name: "method2", static: true, private: false, access: { set(value) { this["method2"] = value; } } }, null, _staticExtraInitializers); - __esDecorate(this, null, _static_get_member_decorators_1, { kind: "getter", name: _a, static: true, private: false, access: { get() { return this[_a]; } } }, null, _staticExtraInitializers); - __esDecorate(this, null, _static_set_member_decorators_1, { kind: "setter", name: _b, static: true, private: false, access: { set(value) { this[_b] = value; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_get_method1_decorators, { kind: "getter", name: "method1", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_set_method1_decorators, { kind: "setter", name: "method1", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_get_member_decorators, { kind: "getter", name: "method2", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_set_member_decorators, { kind: "setter", name: "method2", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_get_member_decorators_1, { kind: "getter", name: _a, static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_set_member_decorators_1, { kind: "setter", name: _b, static: true, private: false }, null, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static get method1() { return 0; } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es5).js index 158f68a9338c5..c489fbbc63c83 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-static(target=es5).js @@ -54,12 +54,12 @@ var C = function () { return C; }()), (function () { - __esDecorate(_a, null, _static_get_method1_decorators, { kind: "getter", name: "method1", static: true, private: false, access: { get: function () { return this.method1; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_set_method1_decorators, { kind: "setter", name: "method1", static: true, private: false, access: { set: function (value) { this.method1 = value; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_get_member_decorators, { kind: "getter", name: "method2", static: true, private: false, access: { get: function () { return this["method2"]; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_set_member_decorators, { kind: "setter", name: "method2", static: true, private: false, access: { set: function (value) { this["method2"] = value; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_get_member_decorators_1, { kind: "getter", name: _b, static: true, private: false, access: { get: function () { return this[_b]; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_set_member_decorators_1, { kind: "setter", name: _c, static: true, private: false, access: { set: function (value) { this[_c] = value; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_method1_decorators, { kind: "getter", name: "method1", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_method1_decorators, { kind: "setter", name: "method1", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_member_decorators, { kind: "getter", name: "method2", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_member_decorators, { kind: "setter", name: "method2", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_get_member_decorators_1, { kind: "getter", name: _b, static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_set_member_decorators_1, { kind: "setter", name: _c, static: true, private: false }, null, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js index 4e74094766525..2c733ba8cb951 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js @@ -32,8 +32,8 @@ let C = (() => { (() => { _static_private_get_method1_decorators = [dec(1)]; _static_private_set_method1_decorators = [dec(2)]; - __esDecorate(_a, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_method1_get); } } }, null, _staticExtraInitializers); - __esDecorate(_a, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _a, value, "a", _C_method1_set); } } }, null, _staticExtraInitializers); + __esDecorate(_a, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_a, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true }, null, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js index 4433816961389..ac2fffaa2fd7e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2022).js @@ -28,8 +28,8 @@ let C = (() => { static { _static_private_get_method1_decorators = [dec(1)]; _static_private_set_method1_decorators = [dec(2)]; - __esDecorate(this, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true, access: { get() { return this.#method1; } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true, access: { set(value) { this.#method1 = value; } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_method1_descriptor = { get: __setFunctionName(function () { return 0; }, "#method1", "get") }, _static_private_get_method1_decorators, { kind: "getter", name: "#method1", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_method1_descriptor = { set: __setFunctionName(function (value) { }, "#method1", "set") }, _static_private_set_method1_decorators, { kind: "setter", name: "#method1", static: true, private: true }, null, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static get #method1() { return _static_private_get_method1_descriptor.get.call(this); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js index 6fb4fb7cba781..e3b48cc80d45d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js @@ -181,16 +181,16 @@ let C = (() => { _static_private_set_x_decorators = [dec, dec]; _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; - __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); - __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js index 195327cc07ebc..ff39528a0fd80 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js @@ -161,16 +161,16 @@ let C = (() => { _static_private_set_x_decorators = [dec, dec]; _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; - __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); - __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js index d497215f2d7dd..cd178ffe1d48b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2015).js @@ -181,16 +181,16 @@ let C = (() => { _static_private_set_x_decorators = [dec, dec]; _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; - __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); - __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js index 53cdeb1a9eff0..03a366924a373 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js @@ -161,16 +161,16 @@ let C = (() => { _static_private_set_x_decorators = [dec, dec]; _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; - __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); - __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js index 016a8bd69f29b..f22a1a91ef14e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js @@ -34,9 +34,9 @@ let C = (() => { _member_decorators_1 = [dec(3)], _b = __propKey(field3), (() => { - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false }, _member_initializers_1, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js index 0f0236495bd39..854f94797926f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js @@ -49,9 +49,9 @@ let C = (() => { _member_decorators_1 = [dec(3)], _b = __propKey(field3), (() => { - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false }, _member_initializers_1, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js index 355ce3c6396c9..b99ccc2ea9ca8 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js @@ -29,9 +29,9 @@ let C = (() => { } static { _field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false }, _member_initializers_1, _instanceExtraInitializers); } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js index 77bb180279ac6..f27d13c646f5a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=true).js @@ -23,9 +23,9 @@ let C = (() => { let _member_initializers_1 = []; return class C { static { - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false }, _member_initializers_1, _instanceExtraInitializers); } field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); ["field2"] = __runInitializers(this, _member_initializers, 2); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js index 89561163bce08..38398b531734a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js @@ -35,9 +35,9 @@ var C = function () { _member_decorators_1 = [dec(3)], _b = __propKey(field3), (function () { - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get: function () { return this[_b]; }, set: function (value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false }, _member_initializers_1, _instanceExtraInitializers); })(), _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js index e175818c2e36b..9ce6940e998ae 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js @@ -50,9 +50,9 @@ var C = function () { _member_decorators_1 = [dec(3)], _b = __propKey(field3), (function () { - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false, access: { get: function () { return this[_b]; }, set: function (value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _b, static: false, private: false }, _member_initializers_1, _instanceExtraInitializers); })(), _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js index 355ce3c6396c9..b99ccc2ea9ca8 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js @@ -29,9 +29,9 @@ let C = (() => { } static { _field1_decorators = [dec(1)], _member_decorators = [dec(2)], _member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { - __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(null, null, _field1_decorators, { kind: "field", name: "field1", static: false, private: false }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators, { kind: "field", name: "field2", static: false, private: false }, _member_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _member_decorators_1, { kind: "field", name: _a, static: false, private: false }, _member_initializers_1, _instanceExtraInitializers); } }; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js index c004d51c86084..160556550ebbf 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2015).js @@ -36,9 +36,9 @@ let C = (() => { set [_b](value) { __classPrivateFieldSet(this, _C__b_accessor_storage, value, "f"); } }, (() => { - __esDecorate(_a, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(_a, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(_a, null, _member_decorators_1, { kind: "accessor", name: _b, static: false, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(_a, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false }, _member_initializers, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators_1, { kind: "accessor", name: _b, static: false, private: false }, _member_initializers_1, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js index f6d49eb9bed93..79311b7e3b2d3 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticAccessor(target=es2022).js @@ -23,9 +23,9 @@ let C = (() => { let _member_initializers_1 = []; return class C { static { - __esDecorate(this, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _field1_initializers, _instanceExtraInitializers); - __esDecorate(this, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _member_initializers, _instanceExtraInitializers); - __esDecorate(this, null, _member_decorators_1, { kind: "accessor", name: _a, static: false, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _member_initializers_1, _instanceExtraInitializers); + __esDecorate(this, null, _field1_decorators, { kind: "accessor", name: "field1", static: false, private: false }, _field1_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators, { kind: "accessor", name: "field2", static: false, private: false }, _member_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators_1, { kind: "accessor", name: _a, static: false, private: false }, _member_initializers_1, _instanceExtraInitializers); } #field1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); get field1() { return this.#field1_accessor_storage; } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js index ecfc2cf7d04d9..bb512f1efc573 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2015).js @@ -20,7 +20,7 @@ let C = (() => { _C_field1 = new WeakMap(), (() => { _private_field1_decorators = [dec]; - __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_field1, "f"); }, set(value) { __classPrivateFieldSet(this, _C_field1, value, "f"); } } }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true }, _private_field1_initializers, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js index 0f2e296033937..493958c826520 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivate(target=es2022).js @@ -14,7 +14,7 @@ let C = (() => { return class C { static { _private_field1_decorators = [dec]; - __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _private_field1_decorators, { kind: "field", name: "#field1", static: false, private: true }, _private_field1_initializers, _instanceExtraInitializers); } #field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0)); }; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js index 17759f2a1f388..981d2c2a4766c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2015).js @@ -25,7 +25,7 @@ let C = (() => { _C_field1_set = function _C_field1_set(value) { return _private_field1_descriptor.set.call(this, value); }, (() => { _private_field1_decorators = [dec]; - __esDecorate(_a, _private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _C_instances, value, "a", _C_field1_set); } } }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(_a, _private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _C_field1_accessor_storage, "f"); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _C_field1_accessor_storage, value, "f"); }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true }, _private_field1_initializers, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js index 642d2451ada44..7ca74adec30ae 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=es2022).js @@ -15,7 +15,7 @@ let C = (() => { return class C { static { _private_field1_decorators = [dec]; - __esDecorate(this, _private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _private_field1_initializers, _instanceExtraInitializers); + __esDecorate(this, _private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _private_field1_decorators, { kind: "accessor", name: "#field1", static: false, private: true }, _private_field1_initializers, _instanceExtraInitializers); } #field1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _private_field1_initializers, 0)); get #field1() { return _private_field1_descriptor.get.call(this); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js index 8f04ac4628bb3..a0bb0d3149701 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js @@ -29,9 +29,9 @@ let C = (() => { _static_member_decorators_1 = [dec(3)], _b = __propKey(field3), (() => { - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a.field1 = __runInitializers(_a, _static_field1_initializers, 1), diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js index b010985c38374..711ed976b469c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js @@ -29,9 +29,9 @@ let C = (() => { _static_member_decorators_1 = [dec(3)], _b = __propKey(field3), (() => { - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), Object.defineProperty(_a, "field1", { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js index dcfe43d3dfc0a..9ce6c3f314551 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js @@ -24,9 +24,9 @@ let C = (() => { return class C { static { _static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static { this.field1 = __runInitializers(this, _static_field1_initializers, 1); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js index c01dec58b98b0..4ec5391109d13 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=true).js @@ -23,9 +23,9 @@ let C = (() => { let _static_member_initializers_1 = []; return class C { static { - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static field1 = __runInitializers(this, _static_field1_initializers, 1); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js index cb1c7ef0afcc5..7a258c040bd4d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js @@ -33,9 +33,9 @@ var C = function () { _static_member_decorators_1 = [dec(3)], _b = __propKey(field3), (function () { - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get: function () { return this[_b]; }, set: function (value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a.field1 = __runInitializers(_a, _static_field1_initializers, 1), diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js index 840beab156bae..737799426118d 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js @@ -33,9 +33,9 @@ var C = function () { _static_member_decorators_1 = [dec(3)], _b = __propKey(field3), (function () { - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get: function () { return this.field1; }, set: function (value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get: function () { return this["field2"]; }, set: function (value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false, access: { get: function () { return this[_b]; }, set: function (value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _b, static: true, private: false }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), Object.defineProperty(_a, "field1", { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js index dcfe43d3dfc0a..9ce6c3f314551 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js @@ -24,9 +24,9 @@ let C = (() => { return class C { static { _static_field1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _a = __propKey(field3); } static { - __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(null, null, _static_field1_decorators, { kind: "field", name: "field1", static: true, private: false }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators, { kind: "field", name: "field2", static: true, private: false }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_member_decorators_1, { kind: "field", name: _a, static: true, private: false }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static { this.field1 = __runInitializers(this, _static_field1_initializers, 1); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js index 682d2e5cb92cc..a6cf58ab3384c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js @@ -39,9 +39,9 @@ let C = (() => { static set [_b](value) { __classPrivateFieldSet(_a, _a, value, "f", _C__b_accessor_storage); } }, (() => { - __esDecorate(_a, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(_a, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(_a, null, _static_member_decorators_1, { kind: "accessor", name: _b, static: true, private: false, access: { get() { return this[_b]; }, set(value) { this[_b] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(_a, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators_1, { kind: "accessor", name: _b, static: true, private: false }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _C_field1_accessor_storage = { value: __runInitializers(_a, _static_field1_initializers, 1) }, diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js index 17c09315a7b6e..f922fb0911eb8 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js @@ -31,9 +31,9 @@ let C = (() => { let _static_member_initializers_1 = []; return class C { static { - __esDecorate(this, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false, access: { get() { return this.field1; }, set(value) { this.field1 = value; } } }, _static_field1_initializers, _staticExtraInitializers); - __esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false, access: { get() { return this["field2"]; }, set(value) { this["field2"] = value; } } }, _static_member_initializers, _staticExtraInitializers); - __esDecorate(this, null, _static_member_decorators_1, { kind: "accessor", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers_1, _staticExtraInitializers); + __esDecorate(this, null, _static_field1_decorators, { kind: "accessor", name: "field1", static: true, private: false }, _static_field1_initializers, _staticExtraInitializers); + __esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: "field2", static: true, private: false }, _static_member_initializers, _staticExtraInitializers); + __esDecorate(this, null, _static_member_decorators_1, { kind: "accessor", name: _a, static: true, private: false }, _static_member_initializers_1, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static #field1_accessor_storage = __runInitializers(this, _static_field1_initializers, 1); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js index c12992bfd34c7..253a7a5e698b8 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js @@ -25,7 +25,7 @@ let C = (() => { }, (() => { _static_private_field1_decorators = [dec]; - __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "f", _C_field1); }, set(value) { __classPrivateFieldSet(this, _a, value, "f", _C_field1); } } }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true }, _static_private_field1_initializers, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _C_field1 = { value: __runInitializers(_a, _static_private_field1_initializers, 0) }, diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js index cfc79ec2db943..d59953d89857c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js @@ -23,7 +23,7 @@ let C = (() => { return class C { static { _static_private_field1_decorators = [dec]; - __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_private_field1_decorators, { kind: "field", name: "#field1", static: true, private: true }, _static_private_field1_initializers, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static #field1 = __runInitializers(this, _static_private_field1_initializers, 0); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js index cce67479e595c..37e8d5b45d47f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js @@ -28,7 +28,7 @@ let C = (() => { _C_field1_set = function _C_field1_set(value) { return _static_private_field1_descriptor.set.call(this, value); }, (() => { _static_private_field1_decorators = [dec]; - __esDecorate(_a, _static_private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_field1_get); }, set(value) { __classPrivateFieldSet(this, _a, value, "a", _C_field1_set); } } }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(_a, _static_private_field1_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_a, _a, "f", _C_field1_accessor_storage); }, "#field1", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_a, _a, value, "f", _C_field1_accessor_storage); }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true }, _static_private_field1_initializers, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _C_field1_accessor_storage = { value: __runInitializers(this, _static_private_field1_initializers, 0) }, diff --git a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js index c00732342110c..af38ad7b02c88 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js @@ -24,7 +24,7 @@ let C = (() => { return class C { static { _static_private_field1_decorators = [dec]; - __esDecorate(this, _static_private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true, access: { get() { return this.#field1; }, set(value) { this.#field1 = value; } } }, _static_private_field1_initializers, _staticExtraInitializers); + __esDecorate(this, _static_private_field1_descriptor = { get: __setFunctionName(function () { return this.#field1_accessor_storage; }, "#field1", "get"), set: __setFunctionName(function (value) { this.#field1_accessor_storage = value; }, "#field1", "set") }, _static_private_field1_decorators, { kind: "accessor", name: "#field1", static: true, private: true }, _static_private_field1_initializers, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static #field1_accessor_storage = __runInitializers(this, _static_private_field1_initializers, 0); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2015).js index 904b891226597..b0d2cf0df399f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2015).js @@ -28,9 +28,9 @@ let C = (() => { } }, (() => { - __esDecorate(_a, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _member_decorators_1, { kind: "method", name: _b, static: false, private: false, access: { get() { return this[_b]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators_1, { kind: "method", name: _b, static: false, private: false }, null, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2022).js index fb2d3cd62780f..022592aa5b56b 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es2022).js @@ -20,9 +20,9 @@ let C = (() => { let _member_decorators_1; return class C { static { - __esDecorate(this, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false, access: { get() { return this.method1; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false, access: { get() { return this["method2"]; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _member_decorators_1, { kind: "method", name: _a, static: false, private: false, access: { get() { return this[_a]; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _member_decorators_1, { kind: "method", name: _a, static: false, private: false }, null, _instanceExtraInitializers); } method1() { } ["method2"]() { } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es5).js index 158758a269154..bd3eb8e0a7741 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStatic(target=es5).js @@ -30,9 +30,9 @@ var C = function () { return C; }()), (function () { - __esDecorate(_a, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false, access: { get: function () { return this.method1; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false, access: { get: function () { return this["method2"]; } } }, null, _instanceExtraInitializers); - __esDecorate(_a, null, _member_decorators_1, { kind: "method", name: _b, static: false, private: false, access: { get: function () { return this[_b]; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _method1_decorators, { kind: "method", name: "method1", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators, { kind: "method", name: "method2", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _member_decorators_1, { kind: "method", name: _b, static: false, private: false }, null, _instanceExtraInitializers); })(), _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2015).js index a13d61ebf7891..cf01e7489ce89 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2015).js @@ -22,7 +22,7 @@ let C = (() => { _C_method1_get = function _C_method1_get() { return _private_method1_descriptor.value; }, (() => { _private_method1_decorators = [dec]; - __esDecorate(_a, _private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _private_method1_decorators, { kind: "method", name: "#method1", static: false, private: true, access: { get() { return __classPrivateFieldGet(this, _C_instances, "a", _C_method1_get); } } }, null, _instanceExtraInitializers); + __esDecorate(_a, _private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _private_method1_decorators, { kind: "method", name: "#method1", static: false, private: true }, null, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2022).js index 138c345236288..f2fe7f5374fad 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-nonStaticPrivate(target=es2022).js @@ -14,7 +14,7 @@ let C = (() => { return class C { static { _private_method1_decorators = [dec]; - __esDecorate(this, _private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _private_method1_decorators, { kind: "method", name: "#method1", static: false, private: true, access: { get() { return this.#method1; } } }, null, _instanceExtraInitializers); + __esDecorate(this, _private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _private_method1_decorators, { kind: "method", name: "#method1", static: false, private: true }, null, _instanceExtraInitializers); } get #method1() { return _private_method1_descriptor.value; } constructor() { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2015).js index b740294efdbe8..e4a3864b3a685 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2015).js @@ -25,9 +25,9 @@ let C = (() => { static [(_static_method1_decorators = [dec(1)], _static_member_decorators = [dec(2)], _static_member_decorators_1 = [dec(3)], _b = __propKey(method3))]() { } }, (() => { - __esDecorate(_a, null, _static_method1_decorators, { kind: "method", name: "method1", static: true, private: false, access: { get() { return this.method1; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_member_decorators, { kind: "method", name: "method2", static: true, private: false, access: { get() { return this["method2"]; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_member_decorators_1, { kind: "method", name: _b, static: true, private: false, access: { get() { return this[_b]; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_method1_decorators, { kind: "method", name: "method1", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators, { kind: "method", name: "method2", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators_1, { kind: "method", name: _b, static: true, private: false }, null, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2022).js index f3d17d5e49550..619ffd32039ba 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es2022).js @@ -20,9 +20,9 @@ let C = (() => { let _static_member_decorators_1; return class C { static { - __esDecorate(this, null, _static_method1_decorators, { kind: "method", name: "method1", static: true, private: false, access: { get() { return this.method1; } } }, null, _staticExtraInitializers); - __esDecorate(this, null, _static_member_decorators, { kind: "method", name: "method2", static: true, private: false, access: { get() { return this["method2"]; } } }, null, _staticExtraInitializers); - __esDecorate(this, null, _static_member_decorators_1, { kind: "method", name: _a, static: true, private: false, access: { get() { return this[_a]; } } }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_method1_decorators, { kind: "method", name: "method1", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_member_decorators, { kind: "method", name: "method2", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_member_decorators_1, { kind: "method", name: _a, static: true, private: false }, null, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static method1() { } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es5).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es5).js index 3c770a54e39d8..9b784e8d41973 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es5).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-static(target=es5).js @@ -29,9 +29,9 @@ var C = function () { return C; }()), (function () { - __esDecorate(_a, null, _static_method1_decorators, { kind: "method", name: "method1", static: true, private: false, access: { get: function () { return this.method1; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_member_decorators, { kind: "method", name: "method2", static: true, private: false, access: { get: function () { return this["method2"]; } } }, null, _staticExtraInitializers); - __esDecorate(_a, null, _static_member_decorators_1, { kind: "method", name: _b, static: true, private: false, access: { get: function () { return this[_b]; } } }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_method1_decorators, { kind: "method", name: "method1", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators, { kind: "method", name: "method2", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_a, null, _static_member_decorators_1, { kind: "method", name: _b, static: true, private: false }, null, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js index 6e848af6b11f8..4e6137f0bbd2f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js @@ -22,7 +22,7 @@ let C = (() => { _C_method1_get = function _C_method1_get() { return _static_private_method1_descriptor.value; }, (() => { _static_private_method1_decorators = [dec]; - __esDecorate(_a, _static_private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _static_private_method1_decorators, { kind: "method", name: "#method1", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _a, "a", _C_method1_get); } } }, null, _staticExtraInitializers); + __esDecorate(_a, _static_private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _static_private_method1_decorators, { kind: "method", name: "#method1", static: true, private: true }, null, _staticExtraInitializers); __runInitializers(_a, _staticExtraInitializers); })(), _a; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js index 26a8e980cf037..ff852e59e2899 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js @@ -19,7 +19,7 @@ let C = (() => { return class C { static { _static_private_method1_decorators = [dec]; - __esDecorate(this, _static_private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _static_private_method1_decorators, { kind: "method", name: "#method1", static: true, private: true, access: { get() { return this.#method1; } } }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_method1_descriptor = { value: __setFunctionName(function () { }, "#method1") }, _static_private_method1_decorators, { kind: "method", name: "#method1", static: true, private: true }, null, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static get #method1() { return _static_private_method1_descriptor.value; } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js index a1e7b88bb4a74..fe5fbe6dab88c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateAutoAccessor.js @@ -27,7 +27,7 @@ let C = (() => { return class C { static { _private_x_decorators = [dec]; - tslib_1.__esDecorate(this, _private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _private_x_decorators, { kind: "accessor", name: "#x", static: false, private: true, access: { get() { return this.#x; }, set(value) { this.#x = value; } } }, _private_x_initializers, _instanceExtraInitializers); + tslib_1.__esDecorate(this, _private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _private_x_decorators, { kind: "accessor", name: "#x", static: false, private: true }, _private_x_initializers, _instanceExtraInitializers); } #x_accessor_storage = (tslib_1.__runInitializers(this, _instanceExtraInitializers), tslib_1.__runInitializers(this, _private_x_initializers, void 0)); get #x() { return _private_x_descriptor.get.call(this); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js index 9bc20142419c6..fffd6b94d648e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateField.js @@ -26,7 +26,7 @@ let C = (() => { return class C { static { _private_x_decorators = [dec]; - tslib_1.__esDecorate(null, null, _private_x_decorators, { kind: "field", name: "#x", static: false, private: true, access: { get() { return this.#x; }, set(value) { this.#x = value; } } }, _private_x_initializers, _instanceExtraInitializers); + tslib_1.__esDecorate(null, null, _private_x_decorators, { kind: "field", name: "#x", static: false, private: true }, _private_x_initializers, _instanceExtraInitializers); } #x = (tslib_1.__runInitializers(this, _instanceExtraInitializers), tslib_1.__runInitializers(this, _private_x_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.js index 9ed858c954f83..0d3f06e9789fd 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateGetter.js @@ -26,7 +26,7 @@ let C = (() => { return class C { static { _private_get_foo_decorators = [dec]; - tslib_1.__esDecorate(this, _private_get_foo_descriptor = { get: tslib_1.__setFunctionName(function () { return 1; }, "#foo", "get") }, _private_get_foo_decorators, { kind: "getter", name: "#foo", static: false, private: true, access: { get() { return this.#foo; } } }, null, _instanceExtraInitializers); + tslib_1.__esDecorate(this, _private_get_foo_descriptor = { get: tslib_1.__setFunctionName(function () { return 1; }, "#foo", "get") }, _private_get_foo_decorators, { kind: "getter", name: "#foo", static: false, private: true }, null, _instanceExtraInitializers); } get #foo() { return _private_get_foo_descriptor.get.call(this); } constructor() { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.js index d9b8dfbdfd8ae..0138550e4a4a1 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateMethod.js @@ -26,7 +26,7 @@ let C = (() => { return class C { static { _private_foo_decorators = [dec]; - tslib_1.__esDecorate(this, _private_foo_descriptor = { value: tslib_1.__setFunctionName(function () { }, "#foo") }, _private_foo_decorators, { kind: "method", name: "#foo", static: false, private: true, access: { get() { return this.#foo; } } }, null, _instanceExtraInitializers); + tslib_1.__esDecorate(this, _private_foo_descriptor = { value: tslib_1.__setFunctionName(function () { }, "#foo") }, _private_foo_decorators, { kind: "method", name: "#foo", static: false, private: true }, null, _instanceExtraInitializers); } get #foo() { return _private_foo_descriptor.value; } constructor() { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.js index 187f2c363711a..4b4485158a751 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-nonStaticPrivateSetter.js @@ -26,7 +26,7 @@ let C = (() => { return class C { static { _private_set_foo_decorators = [dec]; - tslib_1.__esDecorate(this, _private_set_foo_descriptor = { set: tslib_1.__setFunctionName(function (value) { }, "#foo", "set") }, _private_set_foo_decorators, { kind: "setter", name: "#foo", static: false, private: true, access: { set(value) { this.#foo = value; } } }, null, _instanceExtraInitializers); + tslib_1.__esDecorate(this, _private_set_foo_descriptor = { set: tslib_1.__setFunctionName(function (value) { }, "#foo", "set") }, _private_set_foo_decorators, { kind: "setter", name: "#foo", static: false, private: true }, null, _instanceExtraInitializers); } set #foo(value) { return _private_set_foo_descriptor.set.call(this, value); } constructor() { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js index 47a7c226c32ca..889455678e341 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedAutoAccessor.js @@ -27,7 +27,7 @@ let C = (() => { let _static_member_initializers = []; return class C { static { - tslib_1.__esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers, _staticExtraInitializers); + tslib_1.__esDecorate(this, null, _static_member_decorators, { kind: "accessor", name: _a, static: true, private: false }, _static_member_initializers, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static #_a_accessor_storage = tslib_1.__runInitializers(this, _static_member_initializers, void 0); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js index e7b54bd71e341..36d8b5e0c7c94 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedField.js @@ -27,7 +27,7 @@ let C = (() => { let _static_member_initializers = []; return class C { static { - tslib_1.__esDecorate(null, null, _static_member_decorators, { kind: "field", name: _a, static: true, private: false, access: { get() { return this[_a]; }, set(value) { this[_a] = value; } } }, _static_member_initializers, _staticExtraInitializers); + tslib_1.__esDecorate(null, null, _static_member_decorators, { kind: "field", name: _a, static: true, private: false }, _static_member_initializers, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static [(_static_member_decorators = [dec], _a = tslib_1.__propKey(x))] = tslib_1.__runInitializers(this, _static_member_initializers, void 0); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.js index 47cf10a839bac..018ed086e65a8 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedGetter.js @@ -26,7 +26,7 @@ let C = (() => { let _static_get_member_decorators; return class C { static { - tslib_1.__esDecorate(this, null, _static_get_member_decorators, { kind: "getter", name: _a, static: true, private: false, access: { get() { return this[_a]; } } }, null, _staticExtraInitializers); + tslib_1.__esDecorate(this, null, _static_get_member_decorators, { kind: "getter", name: _a, static: true, private: false }, null, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static get [(_static_get_member_decorators = [dec], _a = tslib_1.__propKey(x))]() { return 1; } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.js index 8acc54b323702..7d4f384cc6ac3 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedMethod.js @@ -26,7 +26,7 @@ let C = (() => { let _static_member_decorators; return class C { static { - tslib_1.__esDecorate(this, null, _static_member_decorators, { kind: "method", name: _a, static: true, private: false, access: { get() { return this[_a]; } } }, null, _staticExtraInitializers); + tslib_1.__esDecorate(this, null, _static_member_decorators, { kind: "method", name: _a, static: true, private: false }, null, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static [(_static_member_decorators = [dec], _a = tslib_1.__propKey(x))]() { } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.js index 5f1d7838c7ac1..e949700f51530 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticComputedSetter.js @@ -26,7 +26,7 @@ let C = (() => { let _static_set_member_decorators; return class C { static { - tslib_1.__esDecorate(this, null, _static_set_member_decorators, { kind: "setter", name: _a, static: true, private: false, access: { set(value) { this[_a] = value; } } }, null, _staticExtraInitializers); + tslib_1.__esDecorate(this, null, _static_set_member_decorators, { kind: "setter", name: _a, static: true, private: false }, null, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static set [(_static_set_member_decorators = [dec], _a = tslib_1.__propKey(x))](value) { } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js index 4d5d9628a341e..972e4f3f2061c 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateAutoAccessor.js @@ -27,7 +27,7 @@ let C = (() => { return class C { static { _static_private_x_decorators = [dec]; - tslib_1.__esDecorate(this, _static_private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _static_private_x_decorators, { kind: "accessor", name: "#x", static: true, private: true, access: { get() { return this.#x; }, set(value) { this.#x = value; } } }, _static_private_x_initializers, _staticExtraInitializers); + tslib_1.__esDecorate(this, _static_private_x_descriptor = { get: tslib_1.__setFunctionName(function () { return this.#x_accessor_storage; }, "#x", "get"), set: tslib_1.__setFunctionName(function (value) { this.#x_accessor_storage = value; }, "#x", "set") }, _static_private_x_decorators, { kind: "accessor", name: "#x", static: true, private: true }, _static_private_x_initializers, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static #x_accessor_storage = tslib_1.__runInitializers(this, _static_private_x_initializers, void 0); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js index 3aad3e1f2c419..6c4b067c87e41 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateField.js @@ -26,7 +26,7 @@ let C = (() => { return class C { static { _static_private_x_decorators = [dec]; - tslib_1.__esDecorate(null, null, _static_private_x_decorators, { kind: "field", name: "#x", static: true, private: true, access: { get() { return this.#x; }, set(value) { this.#x = value; } } }, _static_private_x_initializers, _staticExtraInitializers); + tslib_1.__esDecorate(null, null, _static_private_x_decorators, { kind: "field", name: "#x", static: true, private: true }, _static_private_x_initializers, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static #x = tslib_1.__runInitializers(this, _static_private_x_initializers, void 0); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.js index 88c17479bff7d..7630739274f7a 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateGetter.js @@ -26,7 +26,7 @@ let C = (() => { return class C { static { _static_private_get_foo_decorators = [dec]; - tslib_1.__esDecorate(this, _static_private_get_foo_descriptor = { get: tslib_1.__setFunctionName(function () { return 1; }, "#foo", "get") }, _static_private_get_foo_decorators, { kind: "getter", name: "#foo", static: true, private: true, access: { get() { return this.#foo; } } }, null, _staticExtraInitializers); + tslib_1.__esDecorate(this, _static_private_get_foo_descriptor = { get: tslib_1.__setFunctionName(function () { return 1; }, "#foo", "get") }, _static_private_get_foo_decorators, { kind: "getter", name: "#foo", static: true, private: true }, null, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static get #foo() { return _static_private_get_foo_descriptor.get.call(this); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.js index 520a21480c202..c2f0855e8fc3e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateMethod.js @@ -26,7 +26,7 @@ let C = (() => { return class C { static { _static_private_foo_decorators = [dec]; - tslib_1.__esDecorate(this, _static_private_foo_descriptor = { value: tslib_1.__setFunctionName(function () { }, "#foo") }, _static_private_foo_decorators, { kind: "method", name: "#foo", static: true, private: true, access: { get() { return this.#foo; } } }, null, _staticExtraInitializers); + tslib_1.__esDecorate(this, _static_private_foo_descriptor = { value: tslib_1.__setFunctionName(function () { }, "#foo") }, _static_private_foo_decorators, { kind: "method", name: "#foo", static: true, private: true }, null, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static get #foo() { return _static_private_foo_descriptor.value; } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.js b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.js index f01772347b935..c4304a4161bde 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.js +++ b/tests/baselines/reference/esDecorators-classDeclaration-missingEmitHelpers-staticPrivateSetter.js @@ -26,7 +26,7 @@ let C = (() => { return class C { static { _static_private_set_foo_decorators = [dec]; - tslib_1.__esDecorate(this, _static_private_set_foo_descriptor = { set: tslib_1.__setFunctionName(function (value) { }, "#foo", "set") }, _static_private_set_foo_decorators, { kind: "setter", name: "#foo", static: true, private: true, access: { set(value) { this.#foo = value; } } }, null, _staticExtraInitializers); + tslib_1.__esDecorate(this, _static_private_set_foo_descriptor = { set: tslib_1.__setFunctionName(function (value) { }, "#foo", "set") }, _static_private_set_foo_decorators, { kind: "setter", name: "#foo", static: true, private: true }, null, _staticExtraInitializers); tslib_1.__runInitializers(this, _staticExtraInitializers); } static set #foo(value) { return _static_private_set_foo_descriptor.set.call(this, value); } diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js index 498a3d84119cd..32b59b3cce617 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js @@ -54,7 +54,7 @@ let A = (() => { __setFunctionName(_classThis, "A"); (() => { _b_decorators = [dec(_outerThis)]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false }, _b_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); A = _classThis = _classDescriptor.value; __runInitializers(_classThis, _classExtraInitializers); @@ -85,7 +85,7 @@ let B = (() => { _b = (_b_decorators = [dec(this)], f(this)); __setFunctionName(_classThis_1, "B"); (() => { - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_1); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false }, _b_initializers, _instanceExtraInitializers_1); __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); B = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _classExtraInitializers_1); @@ -114,7 +114,7 @@ let C = (() => { __setFunctionName(_classThis_2, "C"); (() => { _b_decorators = [dec(_outerThis_1, (x) => __classPrivateFieldGet(x, _a, "f"))]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_2); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false }, _b_initializers, _instanceExtraInitializers_2); __esDecorate(null, _classDescriptor_2 = { value: _classThis_2 }, _classDecorators_2, { kind: "class", name: _classThis_2.name }, null, _classExtraInitializers_2); C = _classThis_2 = _classDescriptor_2.value; __runInitializers(_classThis_2, _classExtraInitializers_2); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js index 498a3d84119cd..32b59b3cce617 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2021).js @@ -54,7 +54,7 @@ let A = (() => { __setFunctionName(_classThis, "A"); (() => { _b_decorators = [dec(_outerThis)]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false }, _b_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); A = _classThis = _classDescriptor.value; __runInitializers(_classThis, _classExtraInitializers); @@ -85,7 +85,7 @@ let B = (() => { _b = (_b_decorators = [dec(this)], f(this)); __setFunctionName(_classThis_1, "B"); (() => { - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_1); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false }, _b_initializers, _instanceExtraInitializers_1); __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); B = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _classExtraInitializers_1); @@ -114,7 +114,7 @@ let C = (() => { __setFunctionName(_classThis_2, "C"); (() => { _b_decorators = [dec(_outerThis_1, (x) => __classPrivateFieldGet(x, _a, "f"))]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_2); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false }, _b_initializers, _instanceExtraInitializers_2); __esDecorate(null, _classDescriptor_2 = { value: _classThis_2 }, _classDecorators_2, { kind: "class", name: _classThis_2.name }, null, _classExtraInitializers_2); C = _classThis_2 = _classDescriptor_2.value; __runInitializers(_classThis_2, _classExtraInitializers_2); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js index 38f88f168c6c1..0908f39c28f45 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2022).js @@ -49,7 +49,7 @@ let A = (() => { var A = class { static { _b_decorators = [dec(_outerThis)]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false }, _b_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); A = _classThis = _classDescriptor.value; __runInitializers(_classThis, _classExtraInitializers); @@ -70,7 +70,7 @@ let B = (() => { let _b_initializers = []; var B = class { static { - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_1); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false }, _b_initializers, _instanceExtraInitializers_1); __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); B = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _classExtraInitializers_1); @@ -97,7 +97,7 @@ let C = (() => { var C = class { static { _b_decorators = [dec(_outerThis_1, (x) => x.#a)]; - __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false, access: { get() { return this.b; }, set(value) { this.b = value; } } }, _b_initializers, _instanceExtraInitializers_2); + __esDecorate(null, null, _b_decorators, { kind: "field", name: "b", static: false, private: false }, _b_initializers, _instanceExtraInitializers_2); __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2); C = _classThis_2 = _classDescriptor_2.value; __runInitializers(_classThis_2, _classExtraInitializers_2); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=false).js index 2baa329b86705..f84317b3778c2 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=false).js @@ -23,7 +23,7 @@ let C = (() => { }, (() => { _speak_decorators = [bound]; - __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false }, null, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=true).js index bdce7d22c01cd..c3fca6ebf00c4 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=true).js @@ -28,7 +28,7 @@ let C = (() => { }, (() => { _speak_decorators = [bound]; - __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false }, null, _instanceExtraInitializers); })(), _a; })(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=false).js index 65fb62ca70740..928864b674b14 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=false).js @@ -16,7 +16,7 @@ let C = (() => { return class C { static { _speak_decorators = [bound]; - __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false }, null, _instanceExtraInitializers); } constructor(message) { this.message = (__runInitializers(this, _instanceExtraInitializers), message); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js index e53eb3a6045d8..39679938f0997 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2022,usedefineforclassfields=true).js @@ -16,7 +16,7 @@ let C = (() => { return class C { static { _speak_decorators = [bound]; - __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false }, null, _instanceExtraInitializers); } message = (__runInitializers(this, _instanceExtraInitializers), void 0); constructor(message) { diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=false).js index 064b48b7a1a75..23a24c0eef544 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=false).js @@ -25,7 +25,7 @@ var C = function () { }()), (function () { _speak_decorators = [bound]; - __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get: function () { return this.speak; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false }, null, _instanceExtraInitializers); })(), _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=true).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=true).js index 4e1d6f95f79f1..784c8658144e5 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=true).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es5,usedefineforclassfields=true).js @@ -35,7 +35,7 @@ var C = function () { }()), (function () { _speak_decorators = [bound]; - __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get: function () { return this.speak; } } }, null, _instanceExtraInitializers); + __esDecorate(_a, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false }, null, _instanceExtraInitializers); })(), _a; }(); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=false).js index 65fb62ca70740..928864b674b14 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=false).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=esnext,usedefineforclassfields=false).js @@ -16,7 +16,7 @@ let C = (() => { return class C { static { _speak_decorators = [bound]; - __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false, access: { get() { return this.speak; } } }, null, _instanceExtraInitializers); + __esDecorate(this, null, _speak_decorators, { kind: "method", name: "speak", static: false, private: false }, null, _instanceExtraInitializers); } constructor(message) { this.message = (__runInitializers(this, _instanceExtraInitializers), message); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js index dda9b66f3cc5a..2f78b238a0782 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js @@ -151,16 +151,16 @@ let C = (() => { _static_private_set_x_decorators = [dec, dec]; _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; - __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); - __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map index e4e11c0af6b24..3bb8953653583 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;YAeH,MAAC,kGAAG,CAAC,GAAC;YAIG,yEAAI,CAAC,GAAC;QAqBnB,CAAC;QArCG,MAAM,KAAI,C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bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;YAeH,MAAC,kGAAG,CAAC,GAAC;YAIG,yEAAI,CAAC,GAAC;QAqBnB,CAAC;QArCG,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAQxB,IAAS,CAAC,uEAAK;QAAf,IAAS,CAAC,4EAAK;;;;;;;;;;8BAlBd,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;yBAGH,GAAG,EACH,GAAG;6CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;wCAGH,GAAG,EACH,GAAG;QAfJ,+DAAA,yBAAA,cAAkB,CAAC,YAAA,yIAAA;QAInB,8DAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,mIAAA;QAI7B,8DAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,mIAAA;QAQhC,0DAAA,uBAAA,gGAAuB,cAAA,EAAvB,uBAAA,qGAAuB,cAAA,2JAAA;QApCvB,wJAAW;QAIX,kJAAqB;QAIrB,kJAAwB;QAQxB,2JAAe;QAgBf,6KAAc;QApBd,kJAAM;QAfV,wJAwCC;QAxCK,CAAC;QAAD,wDAAC;;IAmCI,4EAAK,CAAC,GAAJ,CAAK;IAIE,6FAAK,CAAC,GAAJ,CAAK;;QAvCrB,uDAAC;;WAAD,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fZXNEZWNvcmF0ZSA9ICh0aGlzICYmIHRoaXMuX19lc0RlY29yYXRlKSB8fCBmdW5jdGlvbiAoY3RvciwgZGVzY3JpcHRvckluLCBkZWNvcmF0b3JzLCBjb250ZXh0SW4sIGluaXRpYWxpemVycywgZXh0cmFJbml0aWFsaXplcnMpIHsNCiAgICBmdW5jdGlvbiBhY2NlcHQoZikgeyBpZiAoZiAhPT0gdm9pZCAwICYmIHR5cGVvZiBmICE9PSAiZnVuY3Rpb24iKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJGdW5jdGlvbiBleHBlY3RlZCIpOyByZXR1cm4gZjsgfQ0KICAgIHZhciBraW5kID0gY29udGV4dEluLmtpbmQsIGtleSA9IGtpbmQgPT09ICJnZXR0ZXIiID8gImdldCIgOiBraW5kID09PSAic2V0dGVyIiA/ICJzZXQiIDogInZhbHVlIjsNCiAgICB2YXIgdGFyZ2V0ID0gIWRlc2NyaXB0b3JJbiAmJiBjdG9yID8gY29udGV4dEluWyJzdGF0aWMiXSA/IGN0b3IgOiBjdG9yLnByb3RvdHlwZSA6IG51bGw7DQogICAgdmFyIGRlc2NyaXB0b3IgPSBkZXNjcmlwdG9ySW4gfHwgKHRhcmdldCA/IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodGFyZ2V0LCBjb250ZXh0SW4ubmFtZSkgOiB7fSk7DQogICAgdmFyIF8sIGRvbmUgPSBmYWxzZTsNCiAgICBmb3IgKHZhciBpID0gZGVjb3JhdG9ycy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkgew0KICAgICAgICB2YXIgY29udGV4dCA9IHt9Ow0KICAgICAgICBmb3IgKHZhciBwIGluIGNvbnRleHRJbikgY29udGV4dFtwXSA9IHAgP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0YXRpYyAjbWV0aG9kKCkge30KCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQoKICAgIEBkZWMKICAgIEBkZWMKICAgIHN0YXRpYyBzZXQgI3godmFsdWU6IG51bWJlcikgeyB9CgogICAgQGRlYwogICAgQGRlYwogICAgc3RhdGljICN5ID0gMTsKCiAgICBAZGVjCiAgICBAZGVjCiAgICBzdGF0aWMgYWNjZXNzb3IgI3ogPSAxOwp9Cg== //// [esDecorators-classDeclaration-sourceMap.d.ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt index ee8dabe539f8d..1a6b9faa99d9e 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt @@ -493,7 +493,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > ^^^ 3 > ^^ 4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > static #y = 1; > @@ -507,14 +507,15 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 >Emitted(104, 46) Source(43, 6) + SourceIndex(0) 4 >Emitted(104, 49) Source(43, 9) + SourceIndex(0) --- ->>> __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); +>>> __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^^^^^^^^^^^^^^ 5 > ^ 6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^-> 1-> 2 > 3 > @@ -528,10 +529,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 4 >Emitted(105, 111) Source(28, 23) + SourceIndex(0) 5 >Emitted(105, 112) Source(28, 24) + SourceIndex(0) 6 >Emitted(105, 124) Source(28, 24) + SourceIndex(0) -7 >Emitted(105, 351) Source(28, 24) + SourceIndex(0) +7 >Emitted(105, 261) Source(28, 24) + SourceIndex(0) --- ->>> __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); -1 >^^^^^^^^ +>>> __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); +1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^^^^^^^^^^^^^^ @@ -541,9 +542,8 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 > ^ 9 > ^ 10> ^^^^^^^^^^^^^^ -11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -12> ^-> -1 > +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> > > @dec > @dec @@ -558,7 +558,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 9 > } 10> 11> -1 >Emitted(106, 9) Source(32, 5) + SourceIndex(0) +1->Emitted(106, 9) Source(32, 5) + SourceIndex(0) 2 >Emitted(106, 71) Source(32, 5) + SourceIndex(0) 3 >Emitted(106, 94) Source(32, 5) + SourceIndex(0) 4 >Emitted(106, 108) Source(32, 23) + SourceIndex(0) @@ -568,10 +568,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 >Emitted(106, 118) Source(32, 33) + SourceIndex(0) 9 >Emitted(106, 119) Source(32, 34) + SourceIndex(0) 10>Emitted(106, 133) Source(32, 34) + SourceIndex(0) -11>Emitted(106, 349) Source(32, 34) + SourceIndex(0) +11>Emitted(106, 264) Source(32, 34) + SourceIndex(0) --- ->>> __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); -1->^^^^^^^^ +>>> __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); +1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > > > @dec > @dec @@ -594,7 +594,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > } 8 > 9 > -1->Emitted(107, 9) Source(36, 5) + SourceIndex(0) +1 >Emitted(107, 9) Source(36, 5) + SourceIndex(0) 2 >Emitted(107, 71) Source(36, 5) + SourceIndex(0) 3 >Emitted(107, 94) Source(36, 5) + SourceIndex(0) 4 >Emitted(107, 104) Source(36, 19) + SourceIndex(0) @@ -602,9 +602,9 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 6 >Emitted(107, 113) Source(36, 36) + SourceIndex(0) 7 >Emitted(107, 114) Source(36, 37) + SourceIndex(0) 8 >Emitted(107, 128) Source(36, 37) + SourceIndex(0) -9 >Emitted(107, 349) Source(36, 37) + SourceIndex(0) +9 >Emitted(107, 259) Source(36, 37) + SourceIndex(0) --- ->>> __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); +>>> __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ @@ -614,7 +614,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^^^^^^^^^^^^^^^^^^^^^^^ 8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 > ^^^^^^^^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -642,68 +642,46 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 >Emitted(108, 225) Source(44, 5) + SourceIndex(0) 8 >Emitted(108, 326) Source(44, 28) + SourceIndex(0) 9 >Emitted(108, 340) Source(44, 28) + SourceIndex(0) -10>Emitted(108, 658) Source(44, 28) + SourceIndex(0) +10>Emitted(108, 495) Source(44, 28) + SourceIndex(0) --- ->>> __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); +>>> __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); 1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > -2 > -3 > method -4 > () {} +2 > method() {} 1 >Emitted(109, 9) Source(8, 5) + SourceIndex(0) -2 >Emitted(109, 155) Source(8, 5) + SourceIndex(0) -3 >Emitted(109, 161) Source(8, 11) + SourceIndex(0) -4 >Emitted(109, 204) Source(8, 16) + SourceIndex(0) +2 >Emitted(109, 161) Source(8, 16) + SourceIndex(0) --- ->>> __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); +>>> __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); 1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> 1 > > > @dec > @dec > -2 > get -3 > x -4 > () { return 1; } +2 > get x() { return 1; } 1 >Emitted(110, 9) Source(12, 5) + SourceIndex(0) -2 >Emitted(110, 149) Source(12, 9) + SourceIndex(0) -3 >Emitted(110, 150) Source(12, 10) + SourceIndex(0) -4 >Emitted(110, 193) Source(12, 26) + SourceIndex(0) +2 >Emitted(110, 155) Source(12, 26) + SourceIndex(0) --- ->>> __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); +>>> __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); 1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^-> 1-> > > @dec > @dec > -2 > set -3 > x -4 > (value: number) { } +2 > set x(value: number) { } 1->Emitted(111, 9) Source(16, 5) + SourceIndex(0) -2 >Emitted(111, 147) Source(16, 9) + SourceIndex(0) -3 >Emitted(111, 148) Source(16, 10) + SourceIndex(0) -4 >Emitted(111, 199) Source(16, 29) + SourceIndex(0) +2 >Emitted(111, 155) Source(16, 29) + SourceIndex(0) --- ->>> __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); +>>> __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); 1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -713,21 +691,13 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > @dec > -2 > accessor -3 > z -4 > -5 > z -6 > = 1; +2 > accessor z = 1; 1->Emitted(112, 9) Source(24, 5) + SourceIndex(0) -2 >Emitted(112, 147) Source(24, 14) + SourceIndex(0) -3 >Emitted(112, 148) Source(24, 15) + SourceIndex(0) -4 >Emitted(112, 171) Source(24, 14) + SourceIndex(0) -5 >Emitted(112, 172) Source(24, 15) + SourceIndex(0) -6 >Emitted(112, 234) Source(24, 20) + SourceIndex(0) +2 >Emitted(112, 164) Source(24, 20) + SourceIndex(0) --- ->>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); +>>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); 1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -747,32 +717,21 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > 2 > static #y = 1; 1->Emitted(113, 9) Source(40, 5) + SourceIndex(0) -2 >Emitted(113, 337) Source(40, 19) + SourceIndex(0) +2 >Emitted(113, 182) Source(40, 19) + SourceIndex(0) --- ->>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); +>>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); 1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^-> 1 > -2 > -3 > y -4 > -5 > y -6 > = 1; +2 > y = 1; 1 >Emitted(114, 9) Source(20, 5) + SourceIndex(0) -2 >Emitted(114, 138) Source(20, 5) + SourceIndex(0) -3 >Emitted(114, 139) Source(20, 6) + SourceIndex(0) -4 >Emitted(114, 162) Source(20, 5) + SourceIndex(0) -5 >Emitted(114, 163) Source(20, 6) + SourceIndex(0) -6 >Emitted(114, 225) Source(20, 11) + SourceIndex(0) +2 >Emitted(114, 155) Source(20, 11) + SourceIndex(0) --- >>> __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); -1 >^^^^^^^^ +1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > +1-> 2 > class C { > @dec > @dec @@ -814,7 +773,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > static accessor #z = 1; > } -1 >Emitted(115, 9) Source(5, 1) + SourceIndex(0) +1->Emitted(115, 9) Source(5, 1) + SourceIndex(0) 2 >Emitted(115, 161) Source(45, 2) + SourceIndex(0) --- >>> C = _classThis = _classDescriptor.value; diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js index 7bf84d19a768f..cc3a373d33e95 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js @@ -136,16 +136,16 @@ let C = (() => { _static_private_set_x_decorators = [dec, dec]; _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; - __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); - __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map index 3d865067c01f7..c6644aa75ec8f 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map @@ -1,6 +1,6 @@ //// [esDecorators-classDeclaration-sourceMap.js.map] -{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;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xOwp9Cg== +{"version":3,"file":"esDecorators-classDeclaration-sourceMap.js","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIM,CAAC;;4BAFN,GAAG,EACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;QACE,CAAC;;;;kCACF,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;iCAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;6BAGH,GAAG,EACH,GAAG;iDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;gDAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;4CAGH,GAAG,EACH,GAAG;YAfJ,yDAAA,yBAAA,cAAkB,CAAC,YAAA,yIAAA;YAInB,wDAAA,uBAAA,cAAkB,OAAO,CAAC,CAAC,CAAC,CAAC,cAAA,mIAAA;YAI7B,wDAAA,uBAAA,UAAc,KAAa,IAAI,CAAC,cAAA,mIAAA;YAQhC,oDAAA,uBAAA,0FAAuB,cAAA,EAAvB,uBAAA,+FAAuB,cAAA,2JAAA;YApCvB,kJAAW;YAIX,4IAAqB;YAIrB,4IAAwB;YAQxB,qJAAe;YAgBf,6KAAc;YApBd,kJAAM;YAfV,4IAwCC;YAxCK,CAAC;YAAD,wDAAC;;QAGH,MAAM,KAAI,CAAC;QAIX,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAIrB,IAAI,CAAC,CAAC,KAAa,IAAI,CAAC;QAIxB,CAAC,kGAAG,CAAC,GAAC;QAIN,+DAAa,CAAC,EAAC;QAAf,IAAS,CAAC,uCAAK;QAAf,IAAS,CAAC,6CAAK;;YAgBR,4EAAK,CAAC,GAAJ,CAAK;;;YAIE,6FAAK,CAAC,GAAJ,CAAK;;;YAvCrB,uDAAC;;;WAAD,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9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ts.map] {"version":3,"file":"esDecorators-classDeclaration-sourceMap.d.ts","sourceRoot":"","sources":["esDecorators-classDeclaration-sourceMap.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC;AAErB,cAEM,CAAC;;IAGH,MAAM;IAEN,IAEI,CAAC,IAIQ,MAAM,CAJE;IAErB,IAEI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAK;IAIxB,CAAC,SAAK;IAIN,QAAQ,CAAC,CAAC,SAAK;CAqBlB"} diff --git a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt index 42f14322e0221..fc615d23c3d46 100644 --- a/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt @@ -294,7 +294,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 2 > ^^^ 3 > ^^ 4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > static #y = 1; > @@ -308,14 +308,15 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 3 >Emitted(89, 50) Source(43, 6) + SourceIndex(0) 4 >Emitted(89, 53) Source(43, 9) + SourceIndex(0) --- ->>> __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); +>>> __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^^^^^^^^^^^^^^ 5 > ^ 6 > ^^^^^^^^^^^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^-> 1-> 2 > 3 > @@ -329,10 +330,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 4 >Emitted(90, 109) Source(28, 23) + SourceIndex(0) 5 >Emitted(90, 110) Source(28, 24) + SourceIndex(0) 6 >Emitted(90, 122) Source(28, 24) + SourceIndex(0) -7 >Emitted(90, 349) Source(28, 24) + SourceIndex(0) +7 >Emitted(90, 259) Source(28, 24) + SourceIndex(0) --- ->>> __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); -1 >^^^^^^^^^^^^ +>>> __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); +1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^^^^^^^^^^^^^^ @@ -342,9 +343,8 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 > ^ 9 > ^ 10> ^^^^^^^^^^^^^^ -11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -12> ^-> -1 > +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> > > @dec > @dec @@ -359,7 +359,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 9 > } 10> 11> -1 >Emitted(91, 13) Source(32, 5) + SourceIndex(0) +1->Emitted(91, 13) Source(32, 5) + SourceIndex(0) 2 >Emitted(91, 69) Source(32, 5) + SourceIndex(0) 3 >Emitted(91, 92) Source(32, 5) + SourceIndex(0) 4 >Emitted(91, 106) Source(32, 23) + SourceIndex(0) @@ -369,10 +369,10 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 8 >Emitted(91, 116) Source(32, 33) + SourceIndex(0) 9 >Emitted(91, 117) Source(32, 34) + SourceIndex(0) 10>Emitted(91, 131) Source(32, 34) + SourceIndex(0) -11>Emitted(91, 347) Source(32, 34) + SourceIndex(0) +11>Emitted(91, 262) Source(32, 34) + SourceIndex(0) --- ->>> __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); -1->^^^^^^^^^^^^ +>>> __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); +1 >^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^^^^^^^^^^ @@ -380,9 +380,9 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 6 > ^^^^ 7 > ^ 8 > ^^^^^^^^^^^^^^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > > > @dec > @dec @@ -395,7 +395,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > } 8 > 9 > -1->Emitted(92, 13) Source(36, 5) + SourceIndex(0) +1 >Emitted(92, 13) Source(36, 5) + SourceIndex(0) 2 >Emitted(92, 69) Source(36, 5) + SourceIndex(0) 3 >Emitted(92, 92) Source(36, 5) + SourceIndex(0) 4 >Emitted(92, 102) Source(36, 19) + SourceIndex(0) @@ -403,9 +403,9 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 6 >Emitted(92, 111) Source(36, 36) + SourceIndex(0) 7 >Emitted(92, 112) Source(36, 37) + SourceIndex(0) 8 >Emitted(92, 126) Source(36, 37) + SourceIndex(0) -9 >Emitted(92, 347) Source(36, 37) + SourceIndex(0) +9 >Emitted(92, 257) Source(36, 37) + SourceIndex(0) --- ->>> __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); +>>> __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^ @@ -415,7 +415,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 > ^^^^^^^^^^^^^^^^^^^^^^^ 8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 > ^^^^^^^^^^^^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -443,68 +443,46 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts 7 >Emitted(93, 217) Source(44, 5) + SourceIndex(0) 8 >Emitted(93, 312) Source(44, 28) + SourceIndex(0) 9 >Emitted(93, 326) Source(44, 28) + SourceIndex(0) -10>Emitted(93, 644) Source(44, 28) + SourceIndex(0) +10>Emitted(93, 481) Source(44, 28) + SourceIndex(0) --- ->>> __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); +>>> __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > -2 > -3 > method -4 > () {} +2 > method() {} 1 >Emitted(94, 13) Source(8, 5) + SourceIndex(0) -2 >Emitted(94, 153) Source(8, 5) + SourceIndex(0) -3 >Emitted(94, 159) Source(8, 11) + SourceIndex(0) -4 >Emitted(94, 202) Source(8, 16) + SourceIndex(0) +2 >Emitted(94, 159) Source(8, 16) + SourceIndex(0) --- ->>> __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); +>>> __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> 1 > > > @dec > @dec > -2 > get -3 > x -4 > () { return 1; } +2 > get x() { return 1; } 1 >Emitted(95, 13) Source(12, 5) + SourceIndex(0) -2 >Emitted(95, 147) Source(12, 9) + SourceIndex(0) -3 >Emitted(95, 148) Source(12, 10) + SourceIndex(0) -4 >Emitted(95, 191) Source(12, 26) + SourceIndex(0) +2 >Emitted(95, 153) Source(12, 26) + SourceIndex(0) --- ->>> __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); +>>> __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); 1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^-> 1-> > > @dec > @dec > -2 > set -3 > x -4 > (value: number) { } +2 > set x(value: number) { } 1->Emitted(96, 13) Source(16, 5) + SourceIndex(0) -2 >Emitted(96, 145) Source(16, 9) + SourceIndex(0) -3 >Emitted(96, 146) Source(16, 10) + SourceIndex(0) -4 >Emitted(96, 197) Source(16, 29) + SourceIndex(0) +2 >Emitted(96, 153) Source(16, 29) + SourceIndex(0) --- ->>> __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); +>>> __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); 1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @dec @@ -514,21 +492,13 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > @dec > @dec > -2 > accessor -3 > z -4 > -5 > z -6 > = 1; +2 > accessor z = 1; 1->Emitted(97, 13) Source(24, 5) + SourceIndex(0) -2 >Emitted(97, 145) Source(24, 14) + SourceIndex(0) -3 >Emitted(97, 146) Source(24, 15) + SourceIndex(0) -4 >Emitted(97, 169) Source(24, 14) + SourceIndex(0) -5 >Emitted(97, 170) Source(24, 15) + SourceIndex(0) -6 >Emitted(97, 232) Source(24, 20) + SourceIndex(0) +2 >Emitted(97, 162) Source(24, 20) + SourceIndex(0) --- ->>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); +>>> __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); 1->^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @dec @@ -548,27 +518,15 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts > 2 > static #y = 1; 1->Emitted(98, 13) Source(40, 5) + SourceIndex(0) -2 >Emitted(98, 341) Source(40, 19) + SourceIndex(0) +2 >Emitted(98, 186) Source(40, 19) + SourceIndex(0) --- ->>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); +>>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); 1 >^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > -2 > -3 > y -4 > -5 > y -6 > = 1; +2 > y = 1; 1 >Emitted(99, 13) Source(20, 5) + SourceIndex(0) -2 >Emitted(99, 142) Source(20, 5) + SourceIndex(0) -3 >Emitted(99, 143) Source(20, 6) + SourceIndex(0) -4 >Emitted(99, 166) Source(20, 5) + SourceIndex(0) -5 >Emitted(99, 167) Source(20, 6) + SourceIndex(0) -6 >Emitted(99, 229) Source(20, 11) + SourceIndex(0) +2 >Emitted(99, 159) Source(20, 11) + SourceIndex(0) --- >>> __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); 1 >^^^^^^^^^^^^ diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js index bbbeacc0424ba..333da95619b15 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2015).js @@ -144,16 +144,16 @@ class C { _static_private_set_x_decorators = [dec, dec]; _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; - __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); - __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(_classThis, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(_classThis, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js index f3a2a6bcf58a4..18f1285498e2a 100644 --- a/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).js @@ -123,16 +123,16 @@ class C { _static_private_set_x_decorators = [dec, dec]; _static_private_y_decorators = [dec, dec]; _static_private_z_decorators = [dec, dec]; - __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _method_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _x_get); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true, access: { set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _x_set); } } }, null, _staticExtraInitializers); - __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "a", _z_get); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "a", _z_set); } } }, _static_private_z_initializers, _staticExtraInitializers); - __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false, access: { get() { return this.x; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false, access: { get() { return this.z; }, set(value) { this.z = value; } } }, _z_initializers, _instanceExtraInitializers); - __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true, access: { get() { return __classPrivateFieldGet(this, _classThis, "f", _y); }, set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _y); } } }, _static_private_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, _static_private_method_descriptor = { value: __setFunctionName(function () { }, "#method") }, _static_private_method_decorators, { kind: "method", name: "#method", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_get_x_descriptor = { get: __setFunctionName(function () { return 1; }, "#x", "get") }, _static_private_get_x_decorators, { kind: "getter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_set_x_descriptor = { set: __setFunctionName(function (value) { }, "#x", "set") }, _static_private_set_x_decorators, { kind: "setter", name: "#x", static: true, private: true }, null, _staticExtraInitializers); + __esDecorate(this, _static_private_z_descriptor = { get: __setFunctionName(function () { return __classPrivateFieldGet(this, _classThis, "f", _z_accessor_storage); }, "#z", "get"), set: __setFunctionName(function (value) { __classPrivateFieldSet(this, _classThis, value, "f", _z_accessor_storage); }, "#z", "set") }, _static_private_z_decorators, { kind: "accessor", name: "#z", static: true, private: true }, _static_private_z_initializers, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _get_x_decorators, { kind: "getter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _static_private_y_decorators, { kind: "field", name: "#y", static: true, private: true }, _static_private_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js index ec021a9591411..dd3a023765437 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js @@ -55,7 +55,7 @@ x = (() => { static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; @@ -85,7 +85,7 @@ x &&= (() => { static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_1); } y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; @@ -115,7 +115,7 @@ x ||= (() => { static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_2); } y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; @@ -145,7 +145,7 @@ x ??= (() => { static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_3); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_3); } y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js index b1c90d0c13eb1..4791d945bd8d5 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.10.js @@ -200,7 +200,7 @@ var _a, _b; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; @@ -217,7 +217,7 @@ var _a, _b; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_1); } y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; @@ -234,7 +234,7 @@ var _a, _b; static { __setFunctionName(this, "0"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_2); } y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; @@ -251,7 +251,7 @@ var _a, _b; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_3); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_3); } y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers, void 0)); }; @@ -268,7 +268,7 @@ var _a, _b; static { __setFunctionName(this, "0"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_4); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_4); } y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers, void 0)); }; @@ -306,7 +306,7 @@ var _a, _b; static { __setFunctionName(this, "__proto__"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_5); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_5); } y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers, void 0)); }; @@ -323,7 +323,7 @@ var _a, _b; static { __setFunctionName(this, "__proto__"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_6); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_6); } y = (__runInitializers(this, _instanceExtraInitializers_6), __runInitializers(this, _y_initializers, void 0)); }; @@ -339,7 +339,7 @@ var _a, _b; return class C { static { _static_x_decorators = [dec]; - __esDecorate(null, null, _static_x_decorators, { kind: "field", name: "x", static: true, private: false, access: { get() { return this.x; }, set(value) { this.x = value; } } }, _static_x_initializers, _staticExtraInitializers); + __esDecorate(null, null, _static_x_decorators, { kind: "field", name: "x", static: true, private: false }, _static_x_initializers, _staticExtraInitializers); __runInitializers(this, _staticExtraInitializers); } static x = __runInitializers(this, _static_x_initializers, (() => { diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js index a81fd637628f8..c52affc2fd9d8 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.11.js @@ -36,7 +36,7 @@ declare let dec: any; return class { static { _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; @@ -63,7 +63,7 @@ declare let dec: any; return class C { static { _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_1); } y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js index ecda4fbed91b1..14f2f5cbb8e2b 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.2.js @@ -59,7 +59,7 @@ let x, f; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; @@ -87,7 +87,7 @@ let x, f; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_1); } y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; @@ -115,7 +115,7 @@ let x, f; static { __setFunctionName(this, "0"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_2); } y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; @@ -143,7 +143,7 @@ let x, f; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_3); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_3); } y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers, void 0)); }; @@ -171,7 +171,7 @@ let x, f; static { __setFunctionName(this, "0"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_4); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_4); } y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers, void 0)); }; @@ -199,7 +199,7 @@ let x, f; static { __setFunctionName(this, _b); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_5); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_5); } y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js index c98330fb3ee12..52df2183693a6 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.3.js @@ -46,7 +46,7 @@ declare let dec: any; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; @@ -78,7 +78,7 @@ declare let dec: any; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_1); } y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; @@ -112,7 +112,7 @@ declare let dec: any; static { __setFunctionName(this, "x1"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_2); } y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js index ecc43044211de..714b994e1c5ca 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.4.js @@ -47,7 +47,7 @@ declare let dec: any, obj: any; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; @@ -81,7 +81,7 @@ declare let dec: any, obj: any; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_1); } y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); }; @@ -113,7 +113,7 @@ declare let dec: any, obj: any; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_2); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_2); } y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js index 3adf563dc857b..06d3c745c566d 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.5.js @@ -34,7 +34,7 @@ declare let dec: any, obj: any, x: any; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js index a957a642d65e7..caf357a9a7280 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.6.js @@ -34,7 +34,7 @@ declare let dec: any, obj: any, x: any; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js index 26ec797feecc0..bd76e88acd2f6 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.7.js @@ -34,7 +34,7 @@ declare let dec: any, obj: any, x: any; static { __setFunctionName(this, "x"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js index 1c96d010c213b..cb51acdc545ee 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.8.js @@ -45,7 +45,7 @@ export default ((() => { static { __setFunctionName(this, "default"); _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js index 0f44e4a6e3432..f65818ec45578 100644 --- a/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js +++ b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.9.js @@ -36,7 +36,7 @@ module.exports = (() => { return class { static { _y_decorators = [dec]; - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); } y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); }; diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js index 1f4c456377492..63d24ad0c82da 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js @@ -79,12 +79,12 @@ let C = (() => { _static_method_decorators = [dec]; _static_set_x_decorators = [dec]; _static_y_decorators = [dec]; - __esDecorate(_classThis, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false }, _static_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); @@ -127,12 +127,12 @@ let C = (() => { _static_method_decorators = [dec]; _static_set_x_decorators = [dec]; _static_y_decorators = [dec]; - __esDecorate(_classThis_1, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers_1); - __esDecorate(_classThis_1, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers_1); - __esDecorate(_classThis_1, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers_1); - __esDecorate(_classThis_1, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers_1); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers_1); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(_classThis_1, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false }, null, _staticExtraInitializers_1); + __esDecorate(_classThis_1, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false }, null, _staticExtraInitializers_1); + __esDecorate(_classThis_1, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers_1); + __esDecorate(_classThis_1, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers_1); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false }, _static_y_initializers, _staticExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_1); __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); C = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _staticExtraInitializers_1); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js index e7d106c4d6e39..4b6c1e5cb13b7 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2022).js @@ -70,12 +70,12 @@ let C = (() => { _static_method_decorators = [dec]; _static_set_x_decorators = [dec]; _static_y_decorators = [dec]; - __esDecorate(this, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers); - __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers); - __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(this, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false }, _static_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); @@ -116,12 +116,12 @@ let C = (() => { _static_method_decorators = [dec]; _static_set_x_decorators = [dec]; _static_y_decorators = [dec]; - __esDecorate(this, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get() { return this.method; } } }, null, _staticExtraInitializers_1); - __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set(value) { this.x = value; } } }, null, _staticExtraInitializers_1); - __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get() { return this.method; } } }, null, _instanceExtraInitializers_1); - __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set(value) { this.x = value; } } }, null, _instanceExtraInitializers_1); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers_1); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get() { return this.y; }, set(value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(this, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false }, null, _staticExtraInitializers_1); + __esDecorate(this, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false }, null, _staticExtraInitializers_1); + __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers_1); + __esDecorate(this, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers_1); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false }, _static_y_initializers, _staticExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_1); __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1); C = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _staticExtraInitializers_1); diff --git a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js index dcc5090805bbf..d6f8ccddcc142 100644 --- a/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js @@ -89,12 +89,12 @@ var C = function () { _static_method_decorators = [dec]; _static_set_x_decorators = [dec]; _static_y_decorators = [dec]; - __esDecorate(_classThis, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get: function () { return this.method; } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set: function (value) { this.x = value; } } }, null, _staticExtraInitializers); - __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get: function () { return this.method; } } }, null, _instanceExtraInitializers); - __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set: function (value) { this.x = value; } } }, null, _instanceExtraInitializers); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers); + __esDecorate(_classThis, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false }, null, _staticExtraInitializers); + __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(_classThis, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false }, _static_y_initializers, _staticExtraInitializers); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); C = _classThis = _classDescriptor.value; __runInitializers(_classThis, _staticExtraInitializers); @@ -146,12 +146,12 @@ var C = function () { _static_method_decorators = [dec]; _static_set_x_decorators = [dec]; _static_y_decorators = [dec]; - __esDecorate(_classThis_1, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false, access: { get: function () { return this.method; } } }, null, _staticExtraInitializers_1); - __esDecorate(_classThis_1, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false, access: { set: function (value) { this.x = value; } } }, null, _staticExtraInitializers_1); - __esDecorate(_classThis_1, null, _method_decorators, { kind: "method", name: "method", static: false, private: false, access: { get: function () { return this.method; } } }, null, _instanceExtraInitializers_1); - __esDecorate(_classThis_1, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false, access: { set: function (value) { this.x = value; } } }, null, _instanceExtraInitializers_1); - __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _static_y_initializers, _staticExtraInitializers_1); - __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false, access: { get: function () { return this.y; }, set: function (value) { this.y = value; } } }, _y_initializers, _instanceExtraInitializers_1); + __esDecorate(_classThis_1, null, _static_method_decorators, { kind: "method", name: "method", static: true, private: false }, null, _staticExtraInitializers_1); + __esDecorate(_classThis_1, null, _static_set_x_decorators, { kind: "setter", name: "x", static: true, private: false }, null, _staticExtraInitializers_1); + __esDecorate(_classThis_1, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers_1); + __esDecorate(_classThis_1, null, _set_x_decorators, { kind: "setter", name: "x", static: false, private: false }, null, _instanceExtraInitializers_1); + __esDecorate(null, null, _static_y_decorators, { kind: "field", name: "y", static: true, private: false }, _static_y_initializers, _staticExtraInitializers_1); + __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers_1); __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1); C = _classThis_1 = _classDescriptor_1.value; __runInitializers(_classThis_1, _staticExtraInitializers_1); From 09855dcdf513fcd9dc12c51d5263b9448d12c944 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 19 Jan 2023 15:19:17 -0500 Subject: [PATCH 51/51] Documentation comment updates --- src/lib/decorators.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/decorators.d.ts b/src/lib/decorators.d.ts index 255f17cbed43c..41d4956666550 100644 --- a/src/lib/decorators.d.ts +++ b/src/lib/decorators.d.ts @@ -36,8 +36,8 @@ interface ClassDecoratorContext< * @example * ```ts * function customElement(name: string): ClassDecoratorFunction { - * return (target, { addInitializer }) => { - * addInitializer(function () { + * return (target, context) => { + * context.addInitializer(function () { * customElements.define(name, this); * }); * } @@ -91,10 +91,10 @@ interface ClassMethodDecoratorContext< * * @example * ```ts - * const bound: ClassMethodDecoratorFunction = (value, { name, private: isPrivate, addInitializer }) { - * if (isPrivate) throw new TypeError("Not supported on private methods."); - * addInitializer(function () { - * this[name] = this[name].bind(this); + * const bound: ClassMethodDecoratorFunction = (value, context) { + * if (context.private) throw new TypeError("Not supported on private methods."); + * context.addInitializer(function () { + * this[context.name] = this[context.name].bind(this); * }); * } *