diff --git a/src/compiler/_namespaces/ts.ts b/src/compiler/_namespaces/ts.ts index b31b19cae7cb5..5a01767f96d44 100644 --- a/src/compiler/_namespaces/ts.ts +++ b/src/compiler/_namespaces/ts.ts @@ -38,6 +38,7 @@ export * from "../transformers/ts"; export * from "../transformers/classFields"; export * from "../transformers/typeSerializer"; export * from "../transformers/legacyDecorators"; +export * from "../transformers/esDecorators"; export * from "../transformers/es2017"; export * from "../transformers/es2018"; export * from "../transformers/es2019"; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b9e411068d3ac..68e18e007ea12 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -69,8 +69,10 @@ import { CheckFlags, ClassDeclaration, ClassElement, + classElementOrClassElementParameterIsDecorated, ClassExpression, ClassLikeDeclaration, + classOrConstructorParameterIsDecorated, ClassStaticBlockDeclaration, clear, combinePaths, @@ -100,6 +102,7 @@ import { createDiagnosticForFileFromMessageChain, createDiagnosticForNode, createDiagnosticForNodeArray, + createDiagnosticForNodeArrayFromMessageChain, createDiagnosticForNodeFromMessageChain, createDiagnosticMessageChainFromDiagnostic, createEmptyExports, @@ -242,6 +245,7 @@ import { getDeclarationOfKind, getDeclarationsOfKind, getDeclaredExpandoInitializer, + getDecorators, getDirectoryPath, getEffectiveBaseTypeNode, getEffectiveConstraintOfTypeParameter, @@ -532,6 +536,7 @@ import { isIndexedAccessTypeNode, isInExpressionContext, isInfinityOrNaNString, + isInitializedProperty, isInJSDoc, isInJSFile, isInJsonFile, @@ -604,6 +609,7 @@ import { isModuleOrEnumDeclaration, isModuleWithStringLiteralName, isNamedDeclaration, + isNamedEvaluationSource, isNamedExports, isNamedTupleMember, isNamespaceExport, @@ -660,6 +666,7 @@ import { isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName, isSameEntityName, isSetAccessor, + isSetAccessorDeclaration, isShorthandAmbientModuleSymbol, isShorthandPropertyAssignment, isSingleOrDoubleQuote, @@ -1038,6 +1045,7 @@ import { VisitResult, VoidExpression, walkUpBindingElementsAndPatterns, + walkUpOuterExpressions, walkUpParenthesizedExpressions, walkUpParenthesizedTypes, walkUpParenthesizedTypesAndGetParentAndChild, @@ -1390,6 +1398,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<string>(); let requestedExternalEmitHelpers: ExternalEmitHelpers; let externalHelpersModule: Symbol; @@ -1412,6 +1422,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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"); @@ -1838,6 +1849,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const stringMappingTypes = new Map<string, StringMappingType>(); const substitutionTypes = new Map<string, SubstitutionType>(); const subtypeReductionCache = new Map<string, Type[]>(); + const decoratorContextOverrideTypeCache = new Map<string, Type>(); const cachedTypes = new Map<string, Type>(); const evolvingArrayTypes: EvolvingArrayType[] = []; const undefinedProperties: SymbolTable = new Map(); @@ -2067,6 +2079,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { let deferredGlobalBigIntType: ObjectType | undefined; let deferredGlobalNaNSymbol: Symbol | undefined; let deferredGlobalRecordSymbol: Symbol | undefined; + let deferredGlobalClassDecoratorContextType: GenericType | undefined; + let deferredGlobalClassMethodDecoratorContextType: GenericType | undefined; + 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<Path, PotentiallyUnusedIdentifier[]>(); // key is file name @@ -2349,6 +2369,18 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return symbol; } + function createParameter(name: __String, type: Type) { + const symbol = createSymbol(SymbolFlags.FunctionScopedVariable, name); + symbol.links.type = type; + return symbol; + } + + function createProperty(name: __String, type: Type) { + const symbol = createSymbol(SymbolFlags.Property, name); + symbol.links.type = type; + return symbol; + } + function getExcludedSymbolFlags(flags: SymbolFlags): SymbolFlags { let result: SymbolFlags = 0; if (flags & SymbolFlags.BlockScopedVariable) result |= SymbolFlags.BlockScopedVariableExcludes; @@ -14810,6 +14842,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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); @@ -15484,6 +15524,38 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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 getGlobalClassAccessorDecoratorTargetType(reportErrors: boolean) { + return (deferredGlobalClassAccessorDecoratorTargetType ??= getGlobalType("ClassAccessorDecoratorTarget" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; + } + + function getGlobalClassAccessorDecoratorResultType(reportErrors: boolean) { + return (deferredGlobalClassAccessorDecoratorResultType ??= getGlobalType("ClassAccessorDecoratorResult" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; + } + + function getGlobalClassFieldDecoratorContextType(reportErrors: boolean) { + return (deferredGlobalClassFieldDecoratorContextType ??= getGlobalType("ClassFieldDecoratorContext" as __String, /*arity*/ 2, reportErrors)) ?? emptyGenericType; + } + function getGlobalNaNSymbol(): Symbol | undefined { return (deferredGlobalNaNSymbol ||= getGlobalValueSymbol("NaN" as __String, /*reportErrors*/ false)); } @@ -27363,7 +27435,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // 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) { @@ -27672,7 +27744,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } 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); } @@ -28410,6 +28482,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { getTypeAtPosition(signature, argIndex); } + function getContextualTypeForDecorator(decorator: Decorator): Type | undefined { + const signature = getDecoratorCallSignature(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); @@ -28875,7 +28952,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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) ? getContextualType(parent as AssertionExpression, contextFlags) : getTypeFromTypeNode((parent as AssertionExpression).type); @@ -32183,38 +32262,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { * Returns the synthetic argument list for a decorator invocation. */ function getEffectiveDecoratorArguments(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(getSymbolOfDeclaration(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(getSymbolOfDeclaration(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) - ]; + const signature = getDecoratorCallSignature(node); + if (signature) { + const args: Expression[] = []; + for (const param of signature.parameters) { + const type = getTypeOfSymbol(param); + args.push(createSyntheticExpression(expr, type)); + } + return args; } return Debug.fail(); } @@ -32223,6 +32279,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { * 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: @@ -32240,6 +32305,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return Debug.fail(); } } + function getDiagnosticSpanForCallNode(node: CallExpression, doNotIncludeArguments?: boolean) { let start: number; let length: number; @@ -32257,13 +32323,20 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } 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); } } @@ -32283,7 +32356,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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); @@ -32315,18 +32388,34 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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( @@ -32349,17 +32438,27 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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<TypeNode>) { + function getTypeArgumentArityError(node: Node, signatures: readonly Signature[], typeArguments: NodeArray<TypeNode>, 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 @@ -32376,12 +32475,22 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } 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); @@ -32500,6 +32609,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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) { @@ -32539,9 +32651,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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[]]; @@ -32558,21 +32673,18 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } 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)); } } } @@ -33284,7 +33396,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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); @@ -34314,6 +34426,393 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } + function createClassDecoratorContextType(classType: Type) { + return tryCreateTypeReference(getGlobalClassDecoratorContextType(/*reportErrors*/ true), [classType]); + } + + function createClassMethodDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassMethodDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); + } + + function createClassGetterDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassGetterDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); + } + + function createClassSetterDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassSetterDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); + } + + function createClassAccessorDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassAccessorDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); + } + + function createClassFieldDecoratorContextType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassFieldDecoratorContextType(/*reportErrors*/ true), [thisType, valueType]); + } + + /** + * 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) { + 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 = getClassMemberDecoratorContextOverrideType(nameType, isPrivate, isStatic); + return getIntersectionType([contextType, overrideType]); + + } + + function createClassAccessorDecoratorTargetType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassAccessorDecoratorTargetType(/*reportError*/ true), [thisType, valueType]); + } + + function createClassAccessorDecoratorResultType(thisType: Type, valueType: Type) { + return tryCreateTypeReference(getGlobalClassAccessorDecoratorResultType(/*reportError*/ true), [thisType, valueType]); + } + + function createClassFieldDecoratorInitializerMutatorType(thisType: Type, valueType: Type) { + const thisParam = createParameter("this" as __String, thisType); + const valueParam = createParameter("value" as __String, valueType); + return createFunctionType(/*typeParameters*/ undefined, thisParam, [valueParam], valueType, /*typePredicate*/ undefined, 1); + } + + /** + * 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) { + // 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`. 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 + // 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 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 and `accessor` fields), in document order: + // a. Apply each decorator for that method, in reverse order (`B1`, `B2`). + // 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 (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`). + // + // As a result, "current" types at each decorator application are as follows: + // - 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`. + // - 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, A1, A2, B1, B2, C1, C2, D1, D2, E1, E2>( + // original: Original, + // a1: (input: Original, context: Context<E2>) => A1, + // a2: (input: A1, context: Context<E2>) => A2, + // b1: (input: A2, context: Context<E2>) => B1, + // b2: (input: B1, context: Context<E2>) => B2, + // c1: (input: B2, context: Context<E2>) => C1, + // c2: (input: C1, context: Context<E2>) => C2, + // d1: (input: C2, context: Context<E2>) => D1, + // d2: (input: D1, context: Context<E2>) => D2, + // e1: (input: D2, context: Context<E2>) => E1, + // e2: (input: E1, context: Context<E2>) => E2, + // ): E2; + + // 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); + if (!links.decoratorSignature) { + links.decoratorSignature = anySignature; + switch (parent.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: { + // Class decorators have a `context` of `ClassDecoratorContext<Class>`, where the `Class` type + // argument will be the "final type" of the class after all decorators are applied. + + const node = parent as ClassDeclaration | ClassExpression; + const targetType = getTypeOfSymbol(getSymbolOfDeclaration(node)); + const contextType = createClassDecoratorContextType(targetType); + links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, targetType); + break; + } + + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: { + const node = parent as MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration; + if (!isClassLike(node.parent)) break; + + // Method decorators have a `context` of `ClassMethodDecoratorContext<This, Value>`, where the + // `Value` type argument corresponds to the "final type" of the method. + // + // Getter decorators have a `context` of `ClassGetterDecoratorContext<This, Value>`, where the + // `Value` type argument corresponds to the "final type" of the value returned by the getter. + // + // Setter decorators have a `context` of `ClassSetterDecoratorContext<This, Value>`, 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`. + + const valueType = + isMethodDeclaration(node) ? getOrCreateTypeFromSignature(getSignatureFromDeclaration(node)) : + getTypeOfNode(node); + + const thisType = hasStaticModifier(node) ? + getTypeOfSymbol(getSymbolOfDeclaration(node.parent)) : + getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(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(valueType) : + isSetAccessorDeclaration(node) ? createSetterFunctionType(valueType) : + valueType; + + const contextType = createClassMemberDecoratorContextTypeForNode(node, thisType, valueType); + + // We also wrap the "output type", as needed. + const returnType = + isGetAccessorDeclaration(node) ? createGetterFunctionType(valueType) : + isSetAccessorDeclaration(node) ? createSetterFunctionType(valueType) : + valueType; + + links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, returnType); + break; + } + + case SyntaxKind.PropertyDeclaration: { + const node = parent as PropertyDeclaration; + if (!isClassLike(node.parent)) break; + + // Field decorators have a `context` of `ClassFieldDecoratorContext<This, Value>` and + // auto-accessor decorators have a `context` of `ClassAccessorDecoratorContext<This, Value>. 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. + + const valueType = getTypeOfNode(node); + const thisType = hasStaticModifier(node) ? + getTypeOfSymbol(getSymbolOfDeclaration(node.parent)) : + getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(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(thisType, valueType) : + undefinedType; + + 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<This, In, Out>` 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(thisType, valueType) : + createClassFieldDecoratorInitializerMutatorType(thisType, valueType); + + 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(getSymbolOfDeclaration(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; + } + + const index = getThisParameter(node.parent) ? + node.parent.parameters.indexOf(node) - 1 : + node.parent.parameters.indexOf(node); + Debug.assert(index >= 0); + + // A parameter declaration decorator will have three arguments (see `ParameterDecorator` in + // core.d.ts). + + const targetType = + isConstructorDeclaration(node.parent) ? getTypeOfSymbol(getSymbolOfDeclaration(node.parent.parent)) : + getParentTypeOfClassElement(node.parent); + + const keyType = + isConstructorDeclaration(node.parent) ? undefinedType : + getClassElementPropertyKeyType(node.parent); + + const indexType = getNumberLiteralType(index); + + 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; + } + } + } + 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<T>` type where `T` is the promisedType argument const globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); @@ -36847,7 +37346,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // 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)!; @@ -37248,7 +37747,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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); @@ -37310,7 +37809,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function checkClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration) { - checkGrammarDecoratorsAndModifiers(node); + checkGrammarModifiers(node); forEachChild(node, checkSourceElement); } @@ -38651,40 +39150,81 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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; - const classSymbol = getSymbolOfDeclaration(node.parent); - const classConstructorType = getTypeOfSymbol(classSymbol); - expectedReturnType = getUnionType([classConstructorType, voidType]); break; case SyntaxKind.PropertyDeclaration: + if (!legacyDecorators) { + headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; + 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 methodType = getTypeOfNode(node.parent); - const descriptorType = createTypedPropertyDescriptorType(methodType); - expectedReturnType = getUnionType([descriptorType, voidType]); break; default: - return Debug.fail(); + return Debug.failBadSyntaxKind(node.parent); } - checkTypeAssignableTo( - returnType, - expectedReturnType, - node, - headMessage); + checkTypeAssignableTo(returnType, expectedReturnType, node.expression, headMessage); + } + + /** + * Creates a synthetic `Signature` corresponding to a call signature. + */ + function createCallSignature( + 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)); + 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, + 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); } /** @@ -38801,23 +39341,43 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { /** 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. - if (!canHaveDecorators(node) || !hasDecorators(node) || !node.modifiers || !nodeCanBeDecorated(node, node.parent, node.parent.parent)) { + // 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.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) { @@ -39900,7 +40460,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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); } @@ -41531,9 +42091,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(getSymbolOfDeclaration(node)); } @@ -41544,7 +42154,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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)) { @@ -42219,7 +42829,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function checkInterfaceDeclaration(node: InterfaceDeclaration) { // Grammar checking - if (!checkGrammarDecoratorsAndModifiers(node)) checkGrammarInterfaceDeclaration(node); + if (!checkGrammarModifiers(node)) checkGrammarInterfaceDeclaration(node); checkTypeParameters(node.typeParameters); addLazyDiagnostic(() => { @@ -42261,7 +42871,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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); @@ -42458,7 +43068,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function checkEnumDeclarationWorker(node: EnumDeclaration) { // Grammar checking - checkGrammarDecoratorsAndModifiers(node); + checkGrammarModifiers(node); checkCollisionsForDeclarationName(node, node.name); checkExportsOnMergedDeclarations(node); @@ -42574,7 +43184,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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); } @@ -42948,7 +43558,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // 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)) { @@ -42983,7 +43593,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return; } - checkGrammarDecoratorsAndModifiers(node); + checkGrammarModifiers(node); if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); if (hasSyntacticModifier(node, ModifierFlags.Export)) { @@ -43026,7 +43636,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return; } - if (!checkGrammarDecoratorsAndModifiers(node) && hasSyntacticModifiers(node)) { + if (!checkGrammarModifiers(node) && hasSyntacticModifiers(node)) { grammarErrorOnFirstToken(node, Diagnostics.An_export_declaration_cannot_have_modifiers); } @@ -43190,7 +43800,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return; } // Grammar checking - if (!checkGrammarDecoratorsAndModifiers(node) && hasEffectiveModifiers(node)) { + if (!checkGrammarModifiers(node) && hasEffectiveModifiers(node)) { grammarErrorOnFirstToken(node, Diagnostics.An_export_assignment_cannot_have_modifiers); } @@ -45592,24 +46202,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); + } } } } @@ -45620,31 +46234,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.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"); } } @@ -45657,320 +46273,326 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } // 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(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 (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.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; 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 && modifier.kind !== SyntaxKind.ConstKeyword) { - 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 && node.kind !== SyntaxKind.TypeParameter) { - return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(SyntaxKind.ConstKeyword)); - } - const parent = node.parent; - if (node.kind === SyntaxKind.TypeParameter && !(isFunctionLikeDeclaration(parent) || isClassLike(parent) || isFunctionTypeNode(parent) || - isConstructorTypeNode(parent) || isCallSignatureDeclaration(parent) || isConstructSignatureDeclaration(parent) || isMethodSignature(parent))) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class, tokenToString(modifier.kind)); - } - 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 && modifier.kind !== SyntaxKind.ConstKeyword) { + 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 && node.kind !== SyntaxKind.TypeParameter) { + return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(SyntaxKind.ConstKeyword)); + } + const parent = node.parent; + if (node.kind === SyntaxKind.TypeParameter && !(isFunctionLikeDeclaration(parent) || isClassLike(parent) || isFunctionTypeNode(parent) || + isConstructorTypeNode(parent) || isCallSignatureDeclaration(parent) || isConstructSignatureDeclaration(parent) || isMethodSignature(parent))) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class, tokenToString(modifier.kind)); + } + 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); - } - else if (flags & ModifierFlags.Accessor) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor"); - } - 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); + } + else if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor"); + } + 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"); - } - else if (flags & ModifierFlags.Accessor) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "declare", "accessor"); - } - 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"); - } + else if (flags & ModifierFlags.Accessor) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "declare", "accessor"); + } + 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; + } } } @@ -46006,14 +46628,18 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { * 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 (!node.modifiers) return false; + + const modifier = findFirstIllegalModifier(node); + return modifier && grammarErrorOnFirstToken(modifier, Diagnostics.Modifiers_cannot_appear_here); } - function shouldReportBadModifier(node: HasModifiers | HasIllegalModifiers): boolean { + 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: @@ -46032,43 +46658,44 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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.modifiers, 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: 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 reportObviousDecoratorErrors(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators) { + const decorator = findFirstIllegalDecorator(node); + return decorator && grammarErrorOnFirstToken(decorator, Diagnostics.Decorators_are_not_valid_here); + } + + function findFirstIllegalDecorator(node: HasModifiers | HasDecorators | HasIllegalModifiers | HasIllegalDecorators): Decorator | undefined { + return canHaveIllegalDecorators(node) ? find(node.modifiers, isDecorator) : undefined; } function checkGrammarAsyncModifier(node: Node, asyncModifier: Node): boolean { @@ -46164,7 +46791,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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) || @@ -46235,7 +46862,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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<TypeNode> | undefined): boolean { @@ -46283,7 +46910,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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) { @@ -46415,7 +47042,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } else if (canHaveIllegalModifiers(prop) && prop.modifiers) { for (const mod of prop.modifiers) { - grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); + if (isModifier(mod)) { + grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); + } } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 7d30e47739f64..db2672796ecd6 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -218,7 +218,9 @@ const libEntries: [string, string][] = [ ["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"], ]; /** @@ -1157,10 +1159,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/core.ts b/src/compiler/core.ts index f8827baf4df72..636f77ff3c53a 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1553,6 +1553,22 @@ export function group<T, K>(values: readonly T[], getGroupId: (value: T) => K, r return arrayFrom(arrayToMultiMap(values, getGroupId).values(), resultSelector); } +/** @internal */ +export function groupBy<T, U extends T>(values: readonly T[] | undefined, keySelector: (value: T) => value is U): { true?: U[], false?: Exclude<T, U>[] }; +/** @internal */ +export function groupBy<T, K extends string | number | boolean | null | undefined>(values: readonly T[] | undefined, keySelector: (value: T) => K): { [P in K as `${P}`]?: T[]; }; +export function groupBy<T, K extends string | number | boolean | null | undefined>(values: readonly T[] | undefined, keySelector: (value: T) => K): { [P in K as `${P}`]?: T[]; } { + const result: Record<string, T[]> = {}; + 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[]; }; +} + /** @internal */ export function clone<T>(object: T): T { const result: any = {}; @@ -2771,13 +2787,32 @@ export function padRight(s: string, length: number, padString: " " = " ") { /** @internal */ export function takeWhile<T, U extends T>(array: readonly T[], predicate: (element: T) => element is U): U[]; /** @internal */ -export function takeWhile<T>(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<T, U extends T>(array: readonly T[] | undefined, predicate: (element: T) => element is U): U[] | undefined; +export function takeWhile<T, U extends T>(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[]; + } +} + +/** @internal */ +export function skipWhile<T, U extends T>(array: readonly T[], predicate: (element: T) => element is U): Exclude<T, U>[]; +/** @internal */ +export function skipWhile<T, U extends T>(array: readonly T[] | undefined, predicate: (element: T) => element is U): Exclude<T, U>[] | undefined; +/** @internal */ +export function skipWhile<T, U extends T>(array: readonly T[] | undefined, predicate: (element: T) => element is U): Exclude<T, U>[] | undefined { + if (array) { + const len = array.length; + let index = 0; + while (index < len && predicate(array[index])) { + index++; + } + return array.slice(index) as Exclude<T, U>[]; } - return array.slice(0, index); } /** diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f10f21178d994..c917f43521c4e 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 @@ -911,6 +907,14 @@ "category": "Error", "code": 1277 }, + "The runtime will invoke the decorator with {1} arguments, but the decorator expects {0}.": { + "category": "Error", + "code": 1278 + }, + "The runtime will invoke the decorator with {1} arguments, but the decorator expects at least {0}.": { + "category": "Error", + "code": 1279 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", @@ -1388,7 +1392,7 @@ "category": "Error", "code": 1432 }, - "Decorators may not be applied to 'this' parameters.": { + "Neither decorators nor modifiers may be applied to 'this' parameters.": { "category": "Error", "code": 1433 }, @@ -5655,7 +5659,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 }, @@ -6488,6 +6492,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/emitter.ts b/src/compiler/emitter.ts index 81b320d9ee0e6..864d679c4d51f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -149,6 +149,7 @@ import { getExternalHelpersModuleName, getExternalModuleName, getIdentifierTypeArguments, + getInternalEmitFlags, getLeadingCommentRanges, getLineAndCharacterOfPosition, getLinesBetweenPositionAndNextNonWhitespaceCharacter, @@ -199,6 +200,7 @@ import { IndexSignatureDeclaration, InferTypeNode, InterfaceDeclaration, + InternalEmitFlags, IntersectionTypeNode, isAccessExpression, isArray, @@ -314,6 +316,7 @@ import { ModuleDeclaration, ModuleKind, ModuleReference, + moveRangePastModifiers, NamedDeclaration, NamedExports, NamedImports, @@ -1361,6 +1364,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri 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<string>; // Set of names generated by the NameGenerator. let formattedNameTempFlagsStack: (Map<string, TempFlags> | undefined)[]; @@ -1655,6 +1659,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri function reset() { nodeIdToGeneratedName = []; + nodeIdToGeneratedPrivateName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new Set(); formattedNameTempFlagsStack = []; @@ -1705,7 +1710,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function beforeEmitNode(node: Node) { - if (preserveSourceNewlines && (getEmitFlags(node) & EmitFlags.IgnoreSourceNewlines)) { + if (preserveSourceNewlines && (getInternalEmitFlags(node) & InternalEmitFlags.IgnoreSourceNewlines)) { preserveSourceNewlines = false; } } @@ -2246,6 +2251,8 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri return emitMetaProperty(node as MetaProperty); case SyntaxKind.SyntheticExpression: return Debug.fail("SyntheticExpression should never be printed."); + case SyntaxKind.MissingDeclaration: + return; // JSX case SyntaxKind.JsxElement: @@ -2525,7 +2532,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(); @@ -2542,7 +2549,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); @@ -2566,7 +2573,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); @@ -2574,7 +2581,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); @@ -2585,7 +2592,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); @@ -2596,7 +2603,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); @@ -2609,14 +2616,15 @@ 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) { - emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === SyntaxKind.GetAccessor ? "get" : "set"); + const pos = emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ true); + const token = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.GetKeyword : SyntaxKind.SetKeyword; + emitTokenWithComment(token, pos, writeKeyword, node); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -2643,7 +2651,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(); @@ -2717,7 +2725,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); @@ -3042,7 +3050,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitCallExpression(node: CallExpression) { - const indirectCall = getEmitFlags(node) & EmitFlags.IndirectCall; + const indirectCall = getInternalEmitFlags(node) & InternalEmitFlags.IndirectCall; if (indirectCall) { writePunctuation("("); writeLiteral("0"); @@ -3067,7 +3075,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitTaggedTemplateExpression(node: TaggedTemplateExpression) { - const indirectCall = getEmitFlags(node) & EmitFlags.IndirectCall; + const indirectCall = getInternalEmitFlags(node) & InternalEmitFlags.IndirectCall; if (indirectCall) { writePunctuation("("); writeLiteral("0"); @@ -3105,7 +3113,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } function emitArrowFunction(node: ArrowFunction) { - emitModifiers(node, node.modifiers); + emitModifierList(node, node.modifiers); emitSignatureAndBody(node, emitArrowFunctionHead); } @@ -3380,7 +3388,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(); } @@ -3661,7 +3669,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(); @@ -3792,8 +3800,8 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri forEach(node.members, generateMemberNames); - emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword("class"); + emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ true); + emitTokenWithComment(SyntaxKind.ClassKeyword, moveRangePastModifiers(node).pos, writeKeyword, node); if (node.name) { writeSpace(); emitIdentifierName(node.name); @@ -3824,7 +3832,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); @@ -3839,7 +3847,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); @@ -3852,7 +3860,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); @@ -3864,7 +3872,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(); @@ -3897,7 +3905,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) { @@ -3922,7 +3930,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) { @@ -3984,7 +3992,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) { @@ -4714,16 +4722,19 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri write = savedWrite; } - function emitDecoratorsAndModifiers(node: Node, modifiers: NodeArray<ModifierLike> | undefined) { + function emitDecoratorsAndModifiers(node: Node, modifiers: NodeArray<ModifierLike> | 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<Modifier>); + return emitModifierList(node, modifiers as NodeArray<Modifier>); } if (every(modifiers, isDecorator)) { - // if all modifier-likes are `Decorator`, simply emit the array as decorators. - return emitDecorators(node, modifiers as NodeArray<Decorator>); + if (allowDecorators) { + // if all modifier-likes are `Decorator`, simply emit the array as decorators. + return emitDecoratorList(node, modifiers as NodeArray<Decorator>); + } + return node.pos; } onBeforeEmitNodeArray?.(modifiers); @@ -4733,10 +4744,11 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri 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; } @@ -4750,27 +4762,37 @@ 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++; } onAfterEmitNodeArray?.(modifiers); + + if (lastModifier && !positionIsSynthesized(lastModifier.end)) { + return lastModifier.end; + } } + + return node.pos; } - function emitModifiers(node: Node, modifiers: NodeArray<Modifier> | undefined): void { + function emitModifierList(node: Node, modifiers: NodeArray<Modifier> | 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) { @@ -4836,8 +4858,10 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri } } - function emitDecorators(parentNode: Node, decorators: NodeArray<Decorator> | undefined): void { + function emitDecoratorList(parentNode: Node, decorators: NodeArray<Decorator> | 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<TypeNode> | undefined) { @@ -5014,8 +5038,12 @@ 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)) { - emitLeadingCommentsOfPosition(previousSibling.end); + const previousSiblingEmitFlags = getEmitFlags(previousSibling); + if (!(previousSiblingEmitFlags & EmitFlags.NoTrailingComments)) { + emitLeadingCommentsOfPosition(previousSibling.end); + } } + writeDelimiter(format); recordBundleFileInternalSectionEnd(previousSourceFileTextKind); @@ -5701,7 +5729,8 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri 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))); } /** @@ -5944,7 +5973,14 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri 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 faa93c77be83a..80968a7c20568 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -20,13 +20,15 @@ import { getEmitScriptTarget, getPropertyNameOfBindingOrAssignmentElement, Identifier, + InternalEmitFlags, isCallExpression, isComputedPropertyName, isIdentifier, memoize, - PrivateIdentifierKind, + PrivateIdentifier, ScriptTarget, setEmitFlags, + setInternalEmitFlags, setTextRange, SyntaxKind, TextRange, @@ -34,6 +36,64 @@ import { UnscopedEmitHelper, } from "../_namespaces/ts"; +/** @internal */ +export const enum PrivateIdentifierKind { + Field = "f", + Method = "m", + Accessor = "a" +} + +/** + * Describes the decorator context object passed to a native ECMAScript decorator for a class. + * + * @internal + */ +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. + * + * @internal + */ +export interface ESDecorateClassElementContext { + /** + * The kind of the decorated element. + */ + kind: "method" | "getter" | "setter" | "accessor" | "field"; + name: ESDecorateName; + static: boolean; + private: boolean; + access: ESDecorateClassElementAccess; +} + +/** @internal */ +export interface ESDecorateClassElementAccess { + get?: boolean; + set?: boolean; +} + +/** @internal */ +export type ESDecorateName = + | { computed: true, name: Expression } + | { computed: false, name: Identifier | PrivateIdentifier } + ; + +/** @internal */ +export type ESDecorateContext = + | ESDecorateClassContext + | ESDecorateClassElementContext + ; + /** @internal */ export interface EmitHelperFactory { getUnscopedHelperName(name: string): Identifier; @@ -41,6 +101,9 @@ export interface EmitHelperFactory { 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; @@ -55,6 +118,8 @@ export interface EmitHelperFactory { 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; @@ -75,8 +140,8 @@ export interface EmitHelperFactory { /** @internal */ 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, @@ -84,6 +149,9 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel createDecorateHelper, createMetadataHelper, createParamHelper, + // ES Decorators Helpers + createESDecorateHelper, + createRunInitializersHelper, // ES2018 Helpers createAssignHelper, createAwaitHelper, @@ -98,6 +166,8 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel createExtendsHelper, createTemplateObjectHelper, createSpreadArrayHelper, + createPropKeyHelper, + createSetFunctionNameHelper, // ES2015 Destructuring Helpers createValuesHelper, createReadHelper, @@ -171,6 +241,206 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel ); } + // 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) + ]); + } + + // 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([ + 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()), + + // Disabled, pending resolution of https://github.com/tc39/proposal-decorators/issues/494 + // 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[]) { @@ -332,6 +602,24 @@ export function createEmitHelperFactory(context: TransformationContext): EmitHel ); } + function createPropKeyHelper(expr: Expression) { + context.requestEmitHelper(propKeyHelper); + return factory.createCallExpression( + getUnscopedHelperName("__propKey"), + /*typeArguments*/ undefined, + [expr] + ); + } + + function createSetFunctionNameHelper(f: Expression, name: Expression, prefix?: string): Expression { + context.requestEmitHelper(setFunctionNameHelper); + return context.factory.createCallExpression( + getUnscopedHelperName("__setFunctionName"), + /*typeArguments*/ undefined, + prefix ? [f, name, context.factory.createStringLiteral(prefix)] : [f, name] + ); + } + // ES2015 Destructuring Helpers function createValuesHelper(expression: Expression) { @@ -507,6 +795,59 @@ export const paramHelper: UnscopedEmitHelper = { };` }; +// ES Decorators Helpers +/** @internal */ +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 !== 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; + };` +}; + +/** @internal */ +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 /** @internal */ @@ -709,6 +1050,30 @@ export const spreadArrayHelper: UnscopedEmitHelper = { };` }; +/** @internal */ +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 +/** @internal */ +export const setFunctionNameHelper: UnscopedEmitHelper = { + name: "typescript:setFunctionName", + importName: "__setFunctionName", + scoped: false, + text: ` + 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 }); + };` +}; + // ES2015 Destructuring Helpers /** @internal */ @@ -1069,6 +1434,8 @@ export function getAllUnscopedEmitHelpers() { decorateHelper, metadataHelper, paramHelper, + esDecorateHelper, + runInitializersHelper, assignHelper, awaitHelper, asyncGeneratorHelper, @@ -1081,6 +1448,8 @@ export function getAllUnscopedEmitHelpers() { spreadArrayHelper, valuesHelper, readHelper, + propKeyHelper, + setFunctionNameHelper, generatorHelper, importStarHelper, importDefaultHelper, diff --git a/src/compiler/factory/emitNode.ts b/src/compiler/factory/emitNode.ts index 0a7964b1bd8ea..fba507d899ea7 100644 --- a/src/compiler/factory/emitNode.ts +++ b/src/compiler/factory/emitNode.ts @@ -11,6 +11,7 @@ import { getSourceFileOfNode, Identifier, ImportSpecifier, + InternalEmitFlags, isParseTreeNode, Node, NodeArray, @@ -49,7 +50,7 @@ export function getOrCreateEmitNode(node: Node): EmitNode { 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; } @@ -104,6 +105,27 @@ export function addEmitFlags<T extends Node>(node: T, emitFlags: EmitFlags) { return node; } +/** + * Sets flags that control emit behavior of a node. + * + * @internal + */ +export function setInternalEmitFlags<T extends Node>(node: T, emitFlags: InternalEmitFlags) { + getOrCreateEmitNode(node).internalFlags = emitFlags; + return node; +} + +/** + * Sets flags that control emit behavior of a node. + * + * @internal + */ +export function addInternalEmitFlags<T extends Node>(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. */ @@ -309,7 +331,7 @@ export function setSnippetElement<T extends Node>(node: T, snippet: SnippetEleme /** @internal */ export function ignoreSourceNewlines<T extends Node>(node: T): T { - getOrCreateEmitNode(node).flags |= EmitFlags.IgnoreSourceNewlines; + getOrCreateEmitNode(node).internalFlags |= InternalEmitFlags.IgnoreSourceNewlines; return node; } 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 ea7d745599157..ecafc7f7a098e 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -145,6 +145,7 @@ import { InferTypeNode, InputFiles, InterfaceDeclaration, + InternalEmitFlags, IntersectionTypeNode, isArray, isArrayLiteralExpression, @@ -999,6 +1000,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode createArraySliceCall, createArrayConcatCall, createObjectDefinePropertyCall, + createObjectGetOwnPropertyDescriptorCall, createReflectGetCall, createReflectSetCall, createPropertyDescriptor, @@ -1794,6 +1796,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateMethodDeclaration(updated: Mutable<MethodDeclaration>, original: MethodDeclaration) { if (updated !== original) { + // copy children used only for error reporting updated.exclamationToken = original.exclamationToken; } return update(updated, original); @@ -1807,7 +1810,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.body = body; node.transformFlags = propagateChildFlags(body) | TransformFlags.ContainsClassFields; - node.illegalDecorators = undefined; // initialized by parser for grammar errors node.modifiers = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) @@ -1829,7 +1831,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateClassStaticBlockDeclaration(updated: Mutable<ClassStaticBlockDeclaration>, original: ClassStaticBlockDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting updated.modifiers = original.modifiers; } return update(updated, original); @@ -1837,7 +1839,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function createConstructorDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, parameters: readonly ParameterDeclaration[], body: Block | undefined ) { @@ -1852,7 +1854,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode (propagateChildFlags(node.body) & ~TransformFlags.ContainsPossibleTopLevelAwait) | TransformFlags.ContainsES2015; - node.illegalDecorators = 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 @@ -1867,7 +1868,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 ) { @@ -1880,7 +1881,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateConstructorDeclaration(updated: Mutable<ConstructorDeclaration>, original: ConstructorDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -1946,6 +1946,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateGetAccessorDeclaration(updated: Mutable<GetAccessorDeclaration>, original: GetAccessorDeclaration) { if (updated !== original) { + // copy children used only for error reporting updated.typeParameters = original.typeParameters; } return finishUpdateBaseSignatureDeclaration(updated, original); @@ -2006,6 +2007,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateSetAccessorDeclaration(updated: Mutable<SetAccessorDeclaration>, original: SetAccessorDeclaration) { if (updated !== original) { + // copy children used only for error reporting updated.typeParameters = original.typeParameters; updated.type = original.type; } @@ -2080,7 +2082,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 { @@ -2090,7 +2092,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.illegalDecorators = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) node.nextContainer = undefined; // initialized by binder (LocalsContainer) @@ -2101,7 +2102,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 ) { @@ -2210,6 +2211,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateFunctionTypeNode(updated: Mutable<FunctionTypeNode>, original: FunctionTypeNode) { if (updated !== original) { + // copy children used only for error reporting updated.modifiers = original.modifiers; } return finishUpdateBaseSignatureDeclaration(updated, original); @@ -3766,7 +3768,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<VariableStatement>(SyntaxKind.VariableStatement); node.modifiers = asNodeArray(modifiers); node.declarationList = isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -3777,14 +3779,13 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.transformFlags = TransformFlags.ContainsTypeScript; } - node.illegalDecorators = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.flowNode = undefined; // initialized by binder (FlowContainer) return node; } // @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) @@ -4247,8 +4248,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode TransformFlags.ContainsHoistedDeclarationOrCompletion; } - node.illegalDecorators = undefined; // initialized by parser for grammar errors - node.typeArguments = undefined; // used in quick info node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) @@ -4283,7 +4282,9 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateFunctionDeclaration(updated: Mutable<FunctionDeclaration>, original: FunctionDeclaration) { if (updated !== original) { // copy children used only for error reporting - updated.illegalDecorators = original.illegalDecorators; + if (updated.modifiers === original.modifiers) { + updated.modifiers = original.modifiers; + } } return finishUpdateBaseSignatureDeclaration(updated, original); } @@ -4344,7 +4345,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, @@ -4358,7 +4359,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.members = createNodeArray(members); node.transformFlags = TransformFlags.ContainsTypeScript; - node.illegalDecorators = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) return node; } @@ -4366,7 +4366,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, @@ -4377,20 +4377,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<InterfaceDeclaration>, original: InterfaceDeclaration) { - if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - } - return update(updated, original); - } - // @api function createTypeAliasDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, typeParameters: readonly TypeParameterDeclaration[] | undefined, type: TypeNode @@ -4402,7 +4395,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.type = type; node.transformFlags = TransformFlags.ContainsTypeScript; - node.illegalDecorators = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) node.nextContainer = undefined; // initialized by binder (LocalsContainer) @@ -4412,7 +4404,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 @@ -4421,20 +4413,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<TypeAliasDeclaration>, original: TypeAliasDeclaration) { - if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - } - return update(updated, original); - } - // @api function createEnumDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: string | Identifier, members: readonly EnumMember[] ) { @@ -4449,7 +4434,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode TransformFlags.ContainsTypeScript; node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Enum declarations cannot contain `await` - node.illegalDecorators = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) return node; } @@ -4457,26 +4441,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<EnumDeclaration>, original: EnumDeclaration) { - if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - } - return update(updated, original); - } - // @api function createModuleDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags = NodeFlags.None @@ -4498,7 +4475,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Module declarations cannot contain `await`. - node.illegalDecorators = undefined; // initialized by parser for grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) node.locals = undefined; // initialized by binder (LocalsContainer) node.nextContainer = undefined; // initialized by binder (LocalsContainer) @@ -4508,24 +4484,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<ModuleDeclaration>, original: ModuleDeclaration) { - if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - } - return update(updated, original); - } - // @api function createModuleBlock(statements: readonly Statement[]) { const node = createBaseNode<ModuleBlock>(SyntaxKind.ModuleBlock); @@ -4569,7 +4538,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode propagateIdentifierNameFlags(node.name) | TransformFlags.ContainsTypeScript; - node.illegalDecorators = 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) return node; @@ -4584,7 +4552,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateNamespaceExportDeclaration(updated: Mutable<NamespaceExportDeclaration>, original: NamespaceExportDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting updated.modifiers = original.modifiers; } return update(updated, original); @@ -4592,7 +4560,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function createImportEqualsDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference @@ -4613,7 +4581,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // Import= declaration is always parsed in an Await context - node.illegalDecorators = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) return node; } @@ -4621,7 +4588,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 @@ -4630,20 +4597,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<ImportEqualsDeclaration>, original: ImportEqualsDeclaration) { - if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - } - return update(updated, original); - } - // @api function createImportDeclaration( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined @@ -4658,7 +4618,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context - node.illegalDecorators = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) return node; } @@ -4666,7 +4625,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 @@ -4675,17 +4634,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<ImportDeclaration>, original: ImportDeclaration) { - if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - } - return update(updated, original); - } - // @api function createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause { const node = createBaseDeclaration<ImportClause>(SyntaxKind.ImportClause); @@ -4835,7 +4787,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function createExportAssignment( - modifiers: readonly Modifier[] | undefined, + modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression ) { @@ -4848,7 +4800,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.illegalDecorators = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) return node; } @@ -4856,22 +4807,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<ExportAssignment>, original: ExportAssignment) { - if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; - } - return update(updated, original); - } - // @api function createExportDeclaration( modifiers: readonly Modifier[] | undefined, @@ -4892,7 +4836,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context - node.illegalDecorators = undefined; // initialized by parser to report grammar errors node.jsDoc = undefined; // initialized by parser (JsDocContainer) return node; } @@ -4917,7 +4860,10 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateExportDeclaration(updated: Mutable<ExportDeclaration>, original: ExportDeclaration) { if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting + if (updated.modifiers === original.modifiers) { + updated.modifiers = original.modifiers; + } } return update(updated, original); } @@ -5831,7 +5777,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode propagateNameFlags(node.name) | propagateChildFlags(node.initializer); - node.illegalDecorators = 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 @@ -5850,7 +5795,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdatePropertyAssignment(updated: Mutable<PropertyAssignment>, original: PropertyAssignment) { // copy children used only for error reporting if (updated !== original) { - updated.illegalDecorators = original.illegalDecorators; + // copy children used only for error reporting updated.modifiers = original.modifiers; updated.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; @@ -5869,7 +5814,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode TransformFlags.ContainsES2015; node.equalsToken = undefined; // initialized by parser to report grammar errors - node.illegalDecorators = 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 @@ -5888,11 +5832,10 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function finishUpdateShorthandPropertyAssignment(updated: Mutable<ShorthandPropertyAssignment>, 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.questionToken = original.questionToken; updated.exclamationToken = original.exclamationToken; + updated.equalsToken = original.equalsToken; } return update(updated, original); } @@ -6503,6 +6446,10 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode 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]); } @@ -6687,7 +6634,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode return { target, thisArg }; } - function createAssignmentTargetWrapper(paramName: Identifier, expression: Expression): LeftHandSideExpression { + function createAssignmentTargetWrapper(paramName: Identifier, expression: Expression): PropertyAccessExpression { return createPropertyAccessExpression( // Explicit parens required because of v8 regression (https://bugs.chromium.org/p/v8/issues/detail?id=9560) createParenthesizedExpression( @@ -7651,6 +7598,7 @@ export function setOriginalNode<T extends Node>(node: T, original: Node | undefi function mergeEmitNode(sourceEmitNode: EmitNode, destEmitNode: EmitNode | undefined) { const { flags, + internalFlags, leadingComments, trailingComments, commentRange, @@ -7665,7 +7613,8 @@ function mergeEmitNode(sourceEmitNode: EmitNode, destEmitNode: EmitNode | undefi // 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/nodeTests.ts b/src/compiler/factory/nodeTests.ts index 0d98989d39700..7a8405a4e9105 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, @@ -333,6 +334,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/factory/utilities.ts b/src/compiler/factory/utilities.ts index 2db193390a873..6cfb47451ac5c 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -1,9 +1,11 @@ import { AccessorDeclaration, addEmitFlags, + addInternalEmitFlags, AdditiveOperator, AdditiveOperatorOrHigher, AssertionLevel, + AssignmentExpression, AssignmentOperatorOrHigher, BinaryExpression, BinaryOperator, @@ -20,8 +22,10 @@ import { CommaListExpression, compareStringsCaseSensitive, CompilerOptions, + ComputedPropertyName, Debug, Declaration, + DefaultKeyword, EmitFlags, EmitHelperFactory, EmitHost, @@ -29,9 +33,11 @@ import { EntityName, EqualityOperator, EqualityOperatorOrHigher, + EqualsToken, ExclamationToken, ExponentiationOperator, ExportDeclaration, + ExportKeyword, Expression, ExpressionStatement, externalHelpersModuleNameText, @@ -67,9 +73,11 @@ import { ImportCall, ImportDeclaration, ImportEqualsDeclaration, + InternalEmitFlags, isAssignmentExpression, isAssignmentOperator, isBlock, + isCommaListExpression, isComputedPropertyName, isDeclarationBindingElement, isDefaultImport, @@ -84,6 +92,7 @@ import { isLiteralExpression, isMemberName, isMinusToken, + isModifierKind, isObjectLiteralElementLike, isParenthesizedExpression, isPlusToken, @@ -109,6 +118,7 @@ import { JSDocTypeAssertion, JsxOpeningFragment, JsxOpeningLikeElement, + last, LeftHandSideExpression, LiteralExpression, LogicalOperator, @@ -117,6 +127,7 @@ import { MemberExpression, MethodDeclaration, MinusToken, + Modifier, ModifiersArray, ModuleKind, ModuleName, @@ -127,6 +138,7 @@ import { Node, NodeArray, NodeFactory, + nodeIsSynthesized, NullLiteral, NumericLiteral, ObjectLiteralElementLike, @@ -135,6 +147,7 @@ import { OuterExpression, OuterExpressionKinds, outFile, + ParenthesizedExpression, parseNodeFactory, PlusToken, PostfixUnaryExpression, @@ -187,7 +200,7 @@ export function createMemberAccessForPropertyName(factory: NodeFactory, target: : factory.createElementAccessExpression(target, memberName), memberName ); - getOrCreateEmitNode(expression).flags |= EmitFlags.NoNestedSourceMaps; + addEmitFlags(expression, EmitFlags.NoNestedSourceMaps); return expression; } } @@ -598,10 +611,14 @@ export function startsWithUseStrict(statements: readonly Statement[]) { && isUseStrictPrologue(firstStatement); } +/** @internal */ +export function isCommaExpression(node: Expression): node is BinaryExpression & { operatorToken: Token<SyntaxKind.CommaToken> } { + return node.kind === SyntaxKind.BinaryExpression && (node as BinaryExpression).operatorToken.kind === SyntaxKind.CommaToken; +} + /** @internal */ export function isCommaSequence(node: Expression): node is BinaryExpression & {operatorToken: Token<SyntaxKind.CommaToken>} | CommaListExpression { - return node.kind === SyntaxKind.BinaryExpression && (node as BinaryExpression).operatorToken.kind === SyntaxKind.CommaToken || - node.kind === SyntaxKind.CommaListExpression; + return isCommaExpression(node) || isCommaListExpression(node); } /** @internal */ @@ -628,6 +645,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.SatisfiesExpression: return (kinds & OuterExpressionKinds.TypeAssertions) !== 0; case SyntaxKind.NonNullExpression: @@ -650,6 +668,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 */ @@ -726,7 +754,7 @@ export function createExternalHelpersImportDeclarationIfNeeded(nodeFactory: Node nodeFactory.createStringLiteral(externalHelpersModuleNameText), /*assertClause*/ undefined ); - addEmitFlags(externalHelpersImportDeclaration, EmitFlags.NeverApplyImportHelper); + addInternalEmitFlags(externalHelpersImportDeclaration, InternalEmitFlags.NeverApplyImportHelper); return externalHelpersImportDeclaration; } } @@ -1469,6 +1497,22 @@ export function createBinaryExpressionTrampoline<TOuterState, TState, TResult>( } } +function isExportOrDefaultKeywordKind(kind: SyntaxKind): kind is SyntaxKind.ExportKeyword | SyntaxKind.DefaultKeyword { + return kind === SyntaxKind.ExportKeyword || kind === SyntaxKind.DefaultKeyword; +} + +/** @internal */ +export function isExportOrDefaultModifier(node: Node): node is ExportKeyword | DefaultKeyword { + const kind = node.kind; + return isExportOrDefaultKeywordKind(kind); +} + +/** @internal */ +export function isNonExportDefaultModifier(node: Node): node is Exclude<Modifier, ExportKeyword | DefaultKeyword> { + 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 @@ -1573,7 +1617,6 @@ export function formatGeneratedName(privateName: boolean, prefix: string | Gener return `${privateName ? "#" : ""}${prefix}${baseName}${suffix}`; } - /** * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. * @@ -1617,7 +1660,7 @@ export function createAccessorPropertyGetRedirector(factory: NodeFactory, node: * * @internal */ -export function createAccessorPropertySetRedirector(factory: NodeFactory, node: PropertyDeclaration, modifiers: ModifiersArray | undefined, name: PropertyName): SetAccessorDeclaration { +export function createAccessorPropertySetRedirector(factory: NodeFactory, node: PropertyDeclaration, modifiers: ModifiersArray | undefined, name: PropertyName) { return factory.createSetAccessorDeclaration( modifiers, name, @@ -1639,3 +1682,62 @@ export function createAccessorPropertySetRedirector(factory: NodeFactory, node: ]) ); } + +/** @internal */ +export function findComputedPropertyNameCacheAssignment(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 as AssignmentExpression<EqualsToken> & { 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. + * + * @internal + */ +export function flattenCommaList(node: Expression) { + const expressions: Expression[] = []; + flattenCommaListWorker(node, expressions); + return expressions; +} diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index e22fe45942ad4..b448910799401 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -89,6 +89,7 @@ import { fileExtensionIs, fileExtensionIsOneOf, findIndex, + firstOrUndefined, forEach, ForEachChildNodes, ForInOrOfStatement, @@ -246,7 +247,6 @@ import { Modifier, ModifierFlags, ModifierLike, - ModifiersArray, modifiersToFlags, ModuleBlock, ModuleDeclaration, @@ -503,8 +503,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.expression); }, [SyntaxKind.ShorthandPropertyAssignment]: function forEachChildInShorthandPropertyAssignment<T>(node: ShorthandPropertyAssignment, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || @@ -538,8 +537,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.initializer); }, [SyntaxKind.PropertyAssignment]: function forEachChildInPropertyAssignment<T>(node: PropertyAssignment, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.exclamationToken) || @@ -558,8 +556,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.initializer); }, [SyntaxKind.IndexSignature]: function forEachChildInIndexSignature<T>(node: IndexSignatureDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); @@ -598,8 +595,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.type); }, [SyntaxKind.Constructor]: function forEachChildInConstructor<T>(node: ConstructorDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || @@ -623,8 +619,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.body); }, [SyntaxKind.FunctionDeclaration]: function forEachChildInFunctionDeclaration<T>(node: FunctionDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || @@ -650,8 +645,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.body); }, [SyntaxKind.ClassStaticBlockDeclaration]: function forEachChildInClassStaticBlockDeclaration<T>(node: ClassStaticBlockDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.body); }, [SyntaxKind.TypeReference]: function forEachChildInTypeReference<T>(node: TypeReferenceNode, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { @@ -809,8 +803,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.endOfFileToken); }, [SyntaxKind.VariableStatement]: function forEachChildInVariableStatement<T>(node: VariableStatement, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); }, [SyntaxKind.VariableDeclarationList]: function forEachChildInVariableDeclarationList<T>(node: VariableDeclarationList, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { @@ -894,23 +887,20 @@ const forEachChildTable: ForEachChildTable = { [SyntaxKind.ClassDeclaration]: forEachChildInClassDeclarationOrExpression, [SyntaxKind.ClassExpression]: forEachChildInClassDeclarationOrExpression, [SyntaxKind.InterfaceDeclaration]: function forEachChildInInterfaceDeclaration<T>(node: InterfaceDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, 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<T>(node: TypeAliasDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, 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<T>(node: EnumDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); }, @@ -919,20 +909,17 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.initializer); }, [SyntaxKind.ModuleDeclaration]: function forEachChildInModuleDeclaration<T>(node: ModuleDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); }, [SyntaxKind.ImportEqualsDeclaration]: function forEachChildInImportEqualsDeclaration<T>(node: ImportEqualsDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); }, [SyntaxKind.ImportDeclaration]: function forEachChildInImportDeclaration<T>(node: ImportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || visitNode(cbNode, node.assertClause); @@ -949,7 +936,7 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.value); }, [SyntaxKind.NamespaceExportDeclaration]: function forEachChildInNamespaceExportDeclaration<T>(node: NamespaceExportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name); }, [SyntaxKind.NamespaceImport]: function forEachChildInNamespaceImport<T>(node: NamespaceImport, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { @@ -961,8 +948,7 @@ const forEachChildTable: ForEachChildTable = { [SyntaxKind.NamedImports]: forEachChildInNamedImportsOrExports, [SyntaxKind.NamedExports]: forEachChildInNamedImportsOrExports, [SyntaxKind.ExportDeclaration]: function forEachChildInExportDeclaration<T>(node: ExportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || visitNode(cbNode, node.assertClause); @@ -970,8 +956,7 @@ const forEachChildTable: ForEachChildTable = { [SyntaxKind.ImportSpecifier]: forEachChildInImportOrExportSpecifier, [SyntaxKind.ExportSpecifier]: forEachChildInImportOrExportSpecifier, [SyntaxKind.ExportAssignment]: function forEachChildInExportAssignment<T>(node: ExportAssignment, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); }, [SyntaxKind.TemplateExpression]: function forEachChildInTemplateExpression<T>(node: TemplateExpression, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { @@ -1004,8 +989,7 @@ const forEachChildTable: ForEachChildTable = { return visitNode(cbNode, node.expression); }, [SyntaxKind.MissingDeclaration]: function forEachChildInMissingDeclaration<T>(node: MissingDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); + return visitNodes(cbNode, cbNodes, node.modifiers); }, [SyntaxKind.CommaListExpression]: function forEachChildInCommaListExpression<T>(node: CommaListExpression, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined { return visitNodes(cbNode, cbNodes, node.elements); @@ -2712,7 +2696,8 @@ namespace Parser { } function canFollowExportModifier(): boolean { - return token() !== SyntaxKind.AsteriskToken + return token() === SyntaxKind.AtToken + || token() !== SyntaxKind.AsteriskToken && token() !== SyntaxKind.AsKeyword && token() !== SyntaxKind.OpenBraceToken && canFollowModifier(); @@ -2737,10 +2722,12 @@ namespace Parser { 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 @@ -3819,7 +3806,7 @@ namespace Parser { function parseTypeParameter(): TypeParameterDeclaration { const pos = getNodePos(); - const modifiers = parseModifiers(/*permitConstAsModifier*/ true); + const modifiers = parseModifiers(/*allowDecorators*/ false, /*permitConstAsModifier*/ true); const name = parseIdentifier(); let constraint: TypeNode | undefined; let expression: Expression | undefined; @@ -3906,11 +3893,13 @@ namespace Parser { // 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, @@ -3918,8 +3907,9 @@ namespace Parser { /*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.Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters); } return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -3928,7 +3918,6 @@ namespace Parser { const savedTopLevel = topLevel; topLevel = false; - const modifiers = combineDecoratorsAndModifiers(decorators, parseModifiers()); const dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); if (!allowAmbiguity && !isParameterNameStart()) { @@ -4120,12 +4109,11 @@ namespace Parser { return token() === SyntaxKind.ColonToken || token() === SyntaxKind.CommaToken || token() === SyntaxKind.CloseBracketToken; } - function parseIndexSignatureDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): IndexSignatureDeclaration { + function parseIndexSignatureDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): IndexSignatureDeclaration { const parameters = parseBracketedList<ParameterDeclaration>(ParsingContext.Parameters, () => parseParameter(/*inOuterAwaitContext*/ false), SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); const type = parseTypeAnnotation(); parseTypeMemberSemicolon(); const node = factory.createIndexSignature(modifiers, parameters, type); - (node as Mutable<IndexSignatureDeclaration>).illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -4198,17 +4186,17 @@ namespace Parser { } 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); } @@ -4727,7 +4715,7 @@ namespace Parser { function skipParameterStart(): boolean { if (isModifierKind(token())) { // Skip modifiers - parseModifiers(); + parseModifiers(/*allowDecorators*/ false); } if (isIdentifier() || token() === SyntaxKind.ThisKeyword) { nextToken(); @@ -4873,6 +4861,7 @@ namespace Parser { 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. @@ -6436,6 +6425,8 @@ namespace Parser { } return parseFunctionExpression(); + case SyntaxKind.AtToken: + return parseDecoratedExpression(); case SyntaxKind.ClassKeyword: return parseClassExpression(); case SyntaxKind.FunctionKeyword: @@ -6502,14 +6493,12 @@ namespace Parser { 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); @@ -6521,7 +6510,7 @@ namespace Parser { 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 @@ -6545,7 +6534,6 @@ 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.illegalDecorators = decorators; node.modifiers = modifiers; node.questionToken = questionToken; node.exclamationToken = exclamationToken; @@ -6573,7 +6561,7 @@ namespace Parser { 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; @@ -7028,7 +7016,7 @@ namespace Parser { } 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; @@ -7125,16 +7113,16 @@ namespace Parser { 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: @@ -7191,7 +7179,7 @@ namespace Parser { return parseExpressionOrLabeledStatement(); } - function isDeclareModifier(modifier: Modifier) { + function isDeclareModifier(modifier: ModifierLike) { return modifier.kind === SyntaxKind.DeclareKeyword; } @@ -7201,8 +7189,7 @@ namespace Parser { // 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); @@ -7213,10 +7200,10 @@ namespace Parser { for (const m of modifiers!) { (m as Mutable<Node>).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); } } @@ -7229,47 +7216,46 @@ namespace Parser { }); } - function parseDeclarationWorker(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): Statement { + function parseDeclarationWorker(pos: number, hasJSDoc: boolean, modifiersIn: NodeArray<ModifierLike> | 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<MissingDeclaration>(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected); setTextRangePos(missing, pos); - missing.illegalDecorators = decorators; - missing.modifiers = modifiers; + (missing as Mutable<MissingDeclaration>).modifiers = modifiersIn; return missing; } return undefined!; // TODO: GH#18217 @@ -7427,18 +7413,15 @@ namespace Parser { return nextTokenIsIdentifier() && nextToken() === SyntaxKind.CloseParenToken; } - function parseVariableStatement(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): VariableStatement { + function parseVariableStatement(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): VariableStatement { const declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); const node = factory.createVariableStatement(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; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseFunctionDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): FunctionDeclaration { + function parseFunctionDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): FunctionDeclaration { const savedAwaitContext = inAwaitContext(); - const modifierFlags = modifiersToFlags(modifiers); parseExpected(SyntaxKind.FunctionKeyword); const asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); @@ -7453,7 +7436,6 @@ namespace Parser { const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, Diagnostics.or_expected); setAwaitContext(savedAwaitContext); const node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body); - (node as Mutable<FunctionDeclaration>).illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7469,7 +7451,7 @@ namespace Parser { } } - function tryParseConstructorDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): ConstructorDeclaration | undefined { + function tryParseConstructorDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): ConstructorDeclaration | undefined { return tryParse(() => { if (parseConstructorName()) { const typeParameters = parseTypeParameters(); @@ -7479,7 +7461,6 @@ namespace Parser { 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<ConstructorDeclaration>).illegalDecorators = decorators; (node as Mutable<ConstructorDeclaration>).typeParameters = typeParameters; (node as Mutable<ConstructorDeclaration>).type = type; return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -7490,8 +7471,7 @@ namespace Parser { function parseMethodDeclaration( pos: number, hasJSDoc: boolean, - decorators: NodeArray<Decorator> | undefined, - modifiers: NodeArray<Modifier> | undefined, + modifiers: NodeArray<ModifierLike> | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, questionToken: QuestionToken | undefined, @@ -7505,7 +7485,7 @@ namespace Parser { const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false); const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, diagnosticMessage); const node = factory.createMethodDeclaration( - combineDecoratorsAndModifiers(decorators, modifiers), + modifiers, asteriskToken, name, questionToken, @@ -7523,8 +7503,7 @@ namespace Parser { function parsePropertyDeclaration( pos: number, hasJSDoc: boolean, - decorators: NodeArray<Decorator> | undefined, - modifiers: NodeArray<Modifier> | undefined, + modifiers: NodeArray<ModifierLike> | undefined, name: PropertyName, questionToken: QuestionToken | undefined ): PropertyDeclaration { @@ -7533,7 +7512,7 @@ namespace Parser { 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, @@ -7544,8 +7523,7 @@ namespace Parser { function parsePropertyOrMethodDeclaration( pos: number, hasJSDoc: boolean, - decorators: NodeArray<Decorator> | undefined, - modifiers: NodeArray<Modifier> | undefined + modifiers: NodeArray<ModifierLike> | undefined ): PropertyDeclaration | MethodDeclaration { const asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); const name = parsePropertyName(); @@ -7553,20 +7531,20 @@ namespace Parser { // 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<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined, kind: AccessorDeclaration["kind"], flags: SignatureFlags): AccessorDeclaration { + function parseAccessorDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | 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<AccessorDeclaration>).typeParameters = typeParameters; if (isSetAccessorDeclaration(node)) (node as Mutable<SetAccessorDeclaration>).type = type; @@ -7642,11 +7620,10 @@ namespace Parser { return false; } - function parseClassStaticBlockDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: ModifiersArray | undefined): ClassStaticBlockDeclaration { + function parseClassStaticBlockDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): ClassStaticBlockDeclaration { parseExpectedToken(SyntaxKind.StaticKeyword); const body = parseClassStaticBlockBody(); const node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc); - (node as Mutable<ClassStaticBlockDeclaration>).illegalDecorators = decorators; (node as Mutable<ClassStaticBlockDeclaration>).modifiers = modifiers; return node; } @@ -7688,16 +7665,7 @@ namespace Parser { return finishNode(factory.createDecorator(expression), pos); } - function parseDecorators(): NodeArray<Decorator> | undefined { - const pos = getNodePos(); - let list, decorator; - while (decorator = tryParseDecorator()) { - list = append(list, decorator); - } - return list && createNodeArray(list, pos); - } - - function tryParseModifier(permitConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean, hasSeenStaticModifier?: boolean): Modifier | undefined { + function tryParseModifier(hasSeenStaticModifier: boolean, permitConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): Modifier | undefined { const pos = getNodePos(); const kind = token(); @@ -7723,28 +7691,38 @@ namespace Parser { return finishNode(factory.createToken(kind as Modifier["kind"]), pos); } - function combineDecoratorsAndModifiers(decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): NodeArray<ModifierLike> | undefined { - if (!decorators) return modifiers; - if (!modifiers) return decorators; - const decoratorsAndModifiers = factory.createNodeArray(concatenate<ModifierLike>(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 - * and turns it into a standalone declaration), then it is better to parse it and report an error later. - * - * In such situations, 'permitConstAsModifier' should be set to true. - */ - function parseModifiers(permitConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray<Modifier> | undefined { + * 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 + * and turns it into a standalone declaration), then it is better to parse it and report an error later. + * + * In such situations, 'permitConstAsModifier' should be set to true. + */ + function parseModifiers(allowDecorators: false, permitConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray<Modifier> | undefined; + function parseModifiers(allowDecorators: true, permitConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray<ModifierLike> | undefined; + function parseModifiers(allowDecorators: boolean, permitConstAsModifier?: boolean, stopOnStartOfClassStaticBlock?: boolean): NodeArray<ModifierLike> | undefined { const pos = getNodePos(); - let list, modifier, hasSeenStatic = false; - while (modifier = tryParseModifier(permitConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) { - if (modifier.kind === SyntaxKind.StaticKeyword) hasSeenStatic = true; + let list: ModifierLike[] | undefined; + let modifier, hasSeenStaticModifier = false; + while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, 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, permitConstAsModifier, stopOnStartOfClassStaticBlock)) { + if (modifier.kind === SyntaxKind.StaticKeyword) hasSeenStaticModifier = true; + list = append(list, modifier); + } + } + return list && createNodeArray(list, pos); } @@ -7767,29 +7745,28 @@ namespace Parser { } const hasJSDoc = hasPrecedingJSDocComment(); - const decorators = parseDecorators(); - const modifiers = parseModifiers(/*permitConstAsModifier*/ true, /*stopOnStartOfClassStaticBlock*/ true); + const modifiers = parseModifiers(/*allowDecorators*/ true, /*permitConstAsModifier*/ 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 @@ -7804,32 +7781,46 @@ namespace Parser { for (const m of modifiers!) { (m as Mutable<Node>).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<Identifier>(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. return Debug.fail("Should not have attempted to parse class member declaration."); } + function parseDecoratedExpression(): 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<MissingDeclaration>(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Expression_expected); + setTextRangePos(missing, pos); + (missing as Mutable<MissingDeclaration>).modifiers = modifiers; + return missing; + } + 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<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): ClassDeclaration { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, SyntaxKind.ClassDeclaration) as ClassDeclaration; + function parseClassDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): ClassDeclaration { + return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, SyntaxKind.ClassDeclaration) as ClassDeclaration; } - function parseClassDeclarationOrExpression(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined, kind: ClassLikeDeclaration["kind"]): ClassLikeDeclaration { + function parseClassDeclarationOrExpression(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined, kind: ClassLikeDeclaration["kind"]): ClassLikeDeclaration { const savedAwaitContext = inAwaitContext(); parseExpected(SyntaxKind.ClassKeyword); @@ -7851,8 +7842,8 @@ namespace Parser { } 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); } @@ -7914,18 +7905,17 @@ namespace Parser { return parseList(ParsingContext.ClassMembers, parseClassElement); } - function parseInterfaceDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): InterfaceDeclaration { + function parseInterfaceDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | 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<InterfaceDeclaration>).illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseTypeAliasDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): TypeAliasDeclaration { + function parseTypeAliasDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): TypeAliasDeclaration { parseExpected(SyntaxKind.TypeKeyword); const name = parseIdentifier(); const typeParameters = parseTypeParameters(); @@ -7933,7 +7923,6 @@ namespace Parser { const type = token() === SyntaxKind.IntrinsicKeyword && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); const node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); - (node as Mutable<TypeAliasDeclaration>).illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7949,7 +7938,7 @@ namespace Parser { return withJSDoc(finishNode(factory.createEnumMember(name, initializer), pos), hasJSDoc); } - function parseEnumDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): EnumDeclaration { + function parseEnumDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): EnumDeclaration { parseExpected(SyntaxKind.EnumKeyword); const name = parseIdentifier(); let members; @@ -7961,7 +7950,6 @@ namespace Parser { members = createMissingList<EnumMember>(); } const node = factory.createEnumDeclaration(modifiers, name, members); - (node as Mutable<EnumDeclaration>).illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -7978,20 +7966,19 @@ namespace Parser { return finishNode(factory.createModuleBlock(statements), pos); } - function parseModuleOrNamespaceDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined, flags: NodeFlags): ModuleDeclaration { + function parseModuleOrNamespaceDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | 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<ModuleDeclaration>).illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseAmbientExternalModuleDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): ModuleDeclaration { + function parseAmbientExternalModuleDeclaration(pos: number, hasJSDoc: boolean, modifiersIn: NodeArray<ModifierLike> | undefined): ModuleDeclaration { let flags: NodeFlags = 0; let name; if (token() === SyntaxKind.GlobalKeyword) { @@ -8010,16 +7997,15 @@ namespace Parser { else { parseSemicolon(); } - const node = factory.createModuleDeclaration(modifiers, name, body, flags); - (node as Mutable<ModuleDeclaration>).illegalDecorators = decorators; + const node = factory.createModuleDeclaration(modifiersIn, name, body, flags); return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseModuleDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): ModuleDeclaration { + function parseModuleDeclaration(pos: number, hasJSDoc: boolean, modifiersIn: NodeArray<ModifierLike> | 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; @@ -8027,10 +8013,10 @@ namespace Parser { 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() { @@ -8050,19 +8036,18 @@ namespace Parser { return nextToken() === SyntaxKind.SlashToken; } - function parseNamespaceExportDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): NamespaceExportDeclaration { + function parseNamespaceExportDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | 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<NamespaceExportDeclaration>).illegalDecorators = decorators; (node as Mutable<NamespaceExportDeclaration>).modifiers = modifiers; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseImportDeclarationOrImportEqualsDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): ImportEqualsDeclaration | ImportDeclaration { + function parseImportDeclarationOrImportEqualsDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): ImportEqualsDeclaration | ImportDeclaration { parseExpected(SyntaxKind.ImportKeyword); const afterImportPos = scanner.getStartPos(); @@ -8083,7 +8068,7 @@ namespace Parser { } if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) { - return parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly); + return parseImportEqualsDeclaration(pos, hasJSDoc, modifiers, identifier, isTypeOnly); } // ImportDeclaration: @@ -8106,7 +8091,6 @@ namespace Parser { parseSemicolon(); const node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); - (node as Mutable<ImportDeclaration>).illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -8154,12 +8138,11 @@ namespace Parser { return token() === SyntaxKind.CommaToken || token() === SyntaxKind.FromKeyword; } - function parseImportEqualsDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined, identifier: Identifier, isTypeOnly: boolean): ImportEqualsDeclaration { + function parseImportEqualsDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined, identifier: Identifier, isTypeOnly: boolean): ImportEqualsDeclaration { parseExpected(SyntaxKind.EqualsToken); const moduleReference = parseModuleReference(); parseSemicolon(); const node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); - (node as Mutable<ImportEqualsDeclaration>).illegalDecorators = decorators; const finished = withJSDoc(finishNode(node, pos), hasJSDoc); return finished; } @@ -8337,7 +8320,7 @@ namespace Parser { return finishNode(factory.createNamespaceExport(parseIdentifierName()), pos); } - function parseExportDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): ExportDeclaration { + function parseExportDeclaration(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): ExportDeclaration { const savedAwaitContext = inAwaitContext(); setAwaitContext(/*value*/ true); let exportClause: NamedExportBindings | undefined; @@ -8368,11 +8351,10 @@ namespace Parser { parseSemicolon(); setAwaitContext(savedAwaitContext); const node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); - (node as Mutable<ExportDeclaration>).illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseExportAssignment(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: NodeArray<Modifier> | undefined): ExportAssignment { + function parseExportAssignment(pos: number, hasJSDoc: boolean, modifiers: NodeArray<ModifierLike> | undefined): ExportAssignment { const savedAwaitContext = inAwaitContext(); setAwaitContext(/*value*/ true); let isExportEquals: boolean | undefined; @@ -8386,7 +8368,6 @@ namespace Parser { parseSemicolon(); setAwaitContext(savedAwaitContext); const node = factory.createExportAssignment(modifiers, isExportEquals, expression); - (node as Mutable<ExportAssignment>).illegalDecorators = decorators; return withJSDoc(finishNode(node, pos), hasJSDoc); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 4bbe445845f80..f6876e221d17c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1,7 +1,7 @@ import * as ts from "./_namespaces/ts"; import { __String, - addEmitFlags, + addInternalEmitFlags, addRange, append, arrayFrom, @@ -10,7 +10,8 @@ import { AssertClause, BuilderProgram, CancellationToken, - canHaveModifiers, + canHaveDecorators, + canHaveIllegalDecorators, chainDiagnosticMessages, changeExtension, changesAffectingProgramStructure, @@ -65,7 +66,6 @@ import { directorySeparator, DirectoryStructureHost, emitFiles, - EmitFlags, EmitHost, EmitOnly, EmitResult, @@ -90,6 +90,7 @@ import { FileReference, filter, find, + findIndex, firstDefined, firstDefinedIterator, flatMap, @@ -164,6 +165,7 @@ import { ImportDeclaration, ImportOrExportSpecifier, InputFiles, + InternalEmitFlags, inverseJsxOptionMap, isAmbientModule, isAnyImportOrReExport, @@ -171,9 +173,12 @@ import { isArrayLiteralExpression, isBuildInfoFile, isCheckJsEnabledForFile, + isClassDeclaration, isDeclarationFileName, isDecorator, + isDefaultModifier, isExportDeclaration, + isExportModifier, isExternalModule, isExternalModuleNameRelative, isIdentifierText, @@ -188,6 +193,7 @@ import { isModifier, isModuleDeclaration, isObjectLiteralExpression, + isParameter, isPlainJsFile, isRequireCall, isRootedDiskPath, @@ -2935,8 +2941,33 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } function walkArray(nodes: NodeArray<Node>, 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.modifiers, 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) { @@ -3122,7 +3153,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg 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/transformer.ts b/src/compiler/transformer.ts index 456a23a065577..a5b250f40ab4f 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -27,6 +27,7 @@ import { getJSXTransformEnabled, getParseTreeNode, getSourceFileOfNode, + getUseDefineForClassFields, Identifier, isBundle, isSourceFile, @@ -62,6 +63,7 @@ import { transformES2020, transformES2021, transformES5, + transformESDecorators, transformESNext, transformGenerators, transformJsx, @@ -119,12 +121,20 @@ function getScriptTransformers(compilerOptions: CompilerOptions, customTransform const languageVersion = getEmitScriptTarget(compilerOptions); const moduleKind = getEmitModuleKind(compilerOptions); + const useDefineForClassFields = getUseDefineForClassFields(compilerOptions); const transformers: TransformerFactory<SourceFile | Bundle>[] = []; 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)) { diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 6a5a1a6aa52fc..a75271b8b57e3 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -1,14 +1,19 @@ import { __String, AccessorDeclaration, + accessPrivateIdentifier as accessPrivateIdentifierCommon, addEmitFlags, addEmitHelpers, addRange, + AnonymousFunctionDefinition, append, + ArrayAssignmentElement, + AssignmentExpression, AssignmentOperator, AssignmentPattern, AutoAccessorPropertyDeclaration, BinaryExpression, + BindingElement, Bundle, CallExpression, chainBundle, @@ -18,6 +23,7 @@ import { ClassLikeDeclaration, classOrConstructorParameterIsDecorated, ClassStaticBlockDeclaration, + CommaListExpression, compact, ComputedPropertyName, ConstructorDeclaration, @@ -29,33 +35,36 @@ import { ElementAccessExpression, EmitFlags, EmitHint, + EqualsToken, expandPreOrPostfixIncrementOrDecrementExpression, + ExportAssignment, Expression, ExpressionStatement, ExpressionWithTypeArguments, factory, filter, + find, + findComputedPropertyNameCacheAssignment, findSuperStatementIndex, + flattenCommaList, ForStatement, GeneratedIdentifier, GeneratedIdentifierFlags, GeneratedNamePart, - GeneratedPrivateIdentifier, GetAccessorDeclaration, getCommentRange, getEffectiveBaseTypeNode, getEmitFlags, getEmitScriptTarget, - getInitializerOfBindingOrAssignmentElement, + getInternalEmitFlags, getNameOfDeclaration, - getNodeForGeneratedName, getNonAssignmentOperatorForCompoundAssignment, getOriginalNode, getOriginalNodeId, + getPrivateIdentifier, getProperties, getSourceMapRange, getStaticPropertiesAndClassStaticBlock, - getTargetOfBindingOrAssignmentElement, getUseDefineForClassFields, hasAbstractModifier, hasAccessorModifier, @@ -64,22 +73,29 @@ import { hasSyntacticModifier, Identifier, InKeyword, + InternalEmitFlags, isAccessorModifier, + isArrayBindingOrAssignmentElement, isArrayLiteralExpression, isArrowFunction, isAssignmentExpression, isAutoAccessorPropertyDeclaration, - isBindingOrAssignmentElement, + isBindingName, isCallChain, + isCallToHelper, isClassDeclaration, isClassElement, + isClassExpression, + isClassLike, isClassStaticBlockDeclaration, + isCommaExpression, isCompoundAssignment, isComputedPropertyName, isConstructorDeclaration, isDestructuringAssignment, isElementAccessExpression, isExpression, + isExpressionStatement, isForInitializer, isGeneratedIdentifier, isGeneratedPrivateIdentifier, @@ -88,12 +104,18 @@ import { isHeritageClause, isIdentifier, isInitializedProperty, + isLeftHandSideExpression, isMethodDeclaration, isModifier, isModifierLike, + isNamedEvaluation, isNonStaticMethodOrAccessorWithPrivateName, + isNumericLiteral, isObjectBindingOrAssignmentElement, isObjectLiteralElementLike, + isObjectLiteralExpression, + isOmittedExpression, + isParameter, isParameterPropertyDeclaration, isParenthesizedExpression, isPrefixUnaryExpression, @@ -104,6 +126,7 @@ import { isPropertyAssignment, isPropertyDeclaration, isPropertyName, + isPropertyNameLiteral, isSetAccessor, isSetAccessorDeclaration, isShorthandPropertyAssignment, @@ -117,39 +140,57 @@ import { isSuperProperty, isTemplateLiteral, isThisProperty, + isVoidExpression, LeftHandSideExpression, + LexicalEnvironment, map, MethodDeclaration, Modifier, ModifierFlags, + ModifierLike, moveRangePastModifiers, moveRangePos, + newPrivateEnvironment, Node, NodeCheckFlags, nodeIsSynthesized, - ObjectLiteralElementLike, + ObjectLiteralElement, + OmittedExpression, + ParameterDeclaration, + ParenthesizedExpression, + PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, + PrivateEnvironment, PrivateIdentifier, + PrivateIdentifierAccessorDeclaration, + PrivateIdentifierKind, + PrivateIdentifierMethodDeclaration, PrivateIdentifierPropertyAccessExpression, PrivateIdentifierPropertyDeclaration, PropertyAccessExpression, + PropertyAssignment, PropertyDeclaration, PropertyName, + removeAllComments, ScriptTarget, SetAccessorDeclaration, setCommentRange, setEmitFlags, setOriginalNode, + setPrivateIdentifier, setSourceMapRange, setSyntheticLeadingComments, setSyntheticTrailingComments, setTextRange, + ShorthandPropertyAssignment, skipOuterExpressions, skipParentheses, skipPartiallyEmittedExpressions, some, SourceFile, + SpreadAssignment, + SpreadElement, startOnNewLine, Statement, SuperProperty, @@ -159,16 +200,19 @@ import { ThisExpression, TransformationContext, TransformFlags, + tryCast, tryGetTextOfPropertyName, - UnderscoreEscapedMap, unescapeLeadingUnderscores, + VariableDeclaration, VariableStatement, visitArray, + visitCommaListElements, visitEachChild, visitFunctionBody, visitIterationBody, visitNode, visitNodes, + Visitor, visitParameterList, VisitResult, } from "../_namespaces/ts"; @@ -186,13 +230,6 @@ const enum ClassPropertySubstitutionFlags { ClassStaticThisOrSuperReference = 1 << 1, } -/** @internal */ -export const enum PrivateIdentifierKind { - Field = "f", - Method = "m", - Accessor = "a" -} - interface PrivateIdentifierInfoBase { /** * brandCheckIdentifier can contain: @@ -235,10 +272,6 @@ interface PrivateIdentifierMethodInfo extends PrivateIdentifierInfoBase { 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 { @@ -250,42 +283,40 @@ interface PrivateIdentifierStaticFieldInfo extends PrivateIdentifierInfoBase { 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<PrivateIdentifierInfo>; - /** - * A mapping of generated private names to information needed for transformation. - */ - generatedIdentifiers?: Map<Node, PrivateIdentifierInfo>; } +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 { @@ -297,6 +328,9 @@ const enum ClassFacts { WillHoistInitializersToConstructor = 1 << 4, } +type LexicalEnv = LexicalEnvironment<ClassLexicalEnvironment | undefined, PrivateEnvironmentData, PrivateIdentifierInfo>; +type PrivateEnv = PrivateEnvironment<PrivateEnvironmentData, PrivateIdentifierInfo>; + /** * Transforms ECMAScript Class Syntax. * TypeScript parameter property syntax is transformed in the TypeScript transformer. @@ -309,6 +343,7 @@ const enum ClassFacts { export function transformClassFields(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle { const { factory, + getEmitHelperFactory: emitHelpers, hoistVariableDeclaration, endLexicalEnvironment, startLexicalEnvironment, @@ -319,6 +354,7 @@ export function transformClassFields(context: TransformationContext): (x: Source 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; @@ -356,6 +392,7 @@ export function transformClassFields(context: TransformationContext): (x: Source const previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; + let shouldTransformPrivateStaticElementsInFile = false; let enabledSubstitutions: ClassPropertySubstitutionFlags; let classAliases: Identifier[]; @@ -372,18 +409,24 @@ export function transformClassFields(context: TransformationContext): (x: Source */ let pendingStatements: Statement[] | undefined; - const classLexicalEnvironmentStack: (ClassLexicalEnvironment | undefined)[] = []; - const classLexicalEnvironmentMap = new Map<number, ClassLexicalEnvironment>(); + let lexicalEnvironment: LexicalEnv | undefined; + const lexicalEnvironmentMap = new Map<Node, LexicalEnv>(); - 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; } @@ -392,7 +435,16 @@ export function transformClassFields(context: TransformationContext): (x: Source return visited; } - function visitor(node: Node): VisitResult<Node | undefined> { + function modifierVisitor(node: ModifierLike): VisitResult<Modifier | undefined> { + switch (node.kind) { + case SyntaxKind.AccessorKeyword: + return shouldTransformAutoAccessorsInCurrentClass() ? undefined : node; + default: + return tryCast(node, isModifier); + } + } + + function visitor(node: Node): VisitResult<Node> { if (!(node.transformFlags & TransformFlags.ContainsClassFields) && !(node.transformFlags & TransformFlags.ContainsLexicalThisOrSuper)) { return node; @@ -400,17 +452,26 @@ export function transformClassFields(context: TransformationContext): (x: Source switch (node.kind) { case SyntaxKind.AccessorKeyword: - return shouldTransformAutoAccessorsInCurrentClass() ? undefined : node; + return Debug.fail("Use `modifierVisitor` instead."); 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); + return Debug.fail("Use `classElementVisitor` instead."); + 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.Parameter: + return visitParameterDeclaration(node as ParameterDeclaration); + 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: @@ -419,9 +480,11 @@ export function transformClassFields(context: TransformationContext): (x: Source 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: @@ -452,16 +515,33 @@ export function transformClassFields(context: TransformationContext): (x: Source return visitEachChild(node, visitor, context); } + function namedEvaluationVisitor(node: Node, referencedName: Expression): VisitResult<Node> { + 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. */ - function discardedValueVisitor(node: Node): VisitResult<Node | undefined> { + function discardedValueVisitor(node: Node): VisitResult<Node> { 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); } @@ -470,7 +550,7 @@ export function transformClassFields(context: TransformationContext): (x: Source /** * Visits a node in a {@link HeritageClause}. */ - function heritageClauseVisitor(node: Node): VisitResult<Node | undefined> { + function heritageClauseVisitor(node: Node): VisitResult<Node> { switch (node.kind) { case SyntaxKind.HeritageClause: return visitEachChild(node, heritageClauseVisitor, context); @@ -484,7 +564,7 @@ export function transformClassFields(context: TransformationContext): (x: Source /** * Visits the assignment target of a destructuring assignment. */ - function assignmentTargetVisitor(node: Node): VisitResult<Node | undefined> { + function assignmentTargetVisitor(node: Node): VisitResult<Node> { switch (node.kind) { case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.ArrayLiteralExpression: @@ -513,10 +593,24 @@ export function transformClassFields(context: TransformationContext): (x: Source /*current*/ undefined, visitPropertyDeclaration, node as PropertyDeclaration); + case SyntaxKind.ClassStaticBlockDeclaration: + return visitClassStaticBlockDeclaration(node as ClassStaticBlockDeclaration); case SyntaxKind.ComputedPropertyName: return visitComputedPropertyName(node as ComputedPropertyName); case SyntaxKind.SemicolonClassElement: return node; + default: + return isModifierLike(node) ? modifierVisitor(node) : visitor(node); + } + } + + /** + * Visits a property name of a class member. + */ + function propertyNameVisitor(node: Node): VisitResult<Node> { + switch (node.kind) { + case SyntaxKind.ComputedPropertyName: + return visitComputedPropertyName(node as ComputedPropertyName); default: return visitor(node); } @@ -554,13 +648,6 @@ export function transformClassFields(context: TransformationContext): (x: Source 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` */ @@ -568,10 +655,8 @@ export function transformClassFields(context: TransformationContext): (x: Source const info = accessPrivateIdentifier(node.left); if (info) { const receiver = visitNode(node.right, visitor, isExpression); - Debug.assert(receiver); - return setOriginalNode( - context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), + emitHelpers().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node ); } @@ -580,6 +665,23 @@ export function transformClassFields(context: TransformationContext): (x: Source 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 (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); + } + + return visitEachChild(node, visitor, context); + } + function visitVariableStatement(node: VariableStatement) { const savedPendingStatements = pendingStatements; pendingStatements = []; @@ -593,19 +695,139 @@ export function transformClassFields(context: TransformationContext): (x: Source return statement; } - function visitComputedPropertyName(node: ComputedPropertyName) { - let expression = visitNode(node.expression, visitor, isExpression); - Debug.assert(expression); + 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 + // ... + // 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 (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.updateVariableDeclaration(node, name, /*exclamationToken*/ undefined, /*type*/ undefined, initializer); + } + + 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? + // ... + // 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 propertyName = visitNode(node.propertyName, visitor, isPropertyName); + const name = visitNode(node.name, visitor, isBindingName); + const initializer = visitNode(node.initializer, node => namedEvaluationVisitor(node, assignedName), 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 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 (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + const assignedName = factory.createStringLiteral(node.isExportEquals ? "" : "default"); + const modifiers = visitNodes(node.modifiers, modifierVisitor, isModifier); + const expression = visitNode(node.expression, node => namedEvaluationVisitor(node, assignedName), 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])); + 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; } - 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) { @@ -615,10 +837,16 @@ export function transformClassFields(context: TransformationContext): (x: Source 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); } @@ -690,8 +918,6 @@ export function transformClassFields(context: TransformationContext): (x: Source // get x() { return this.#x; } // set x(value) { this.#x = value; } - Debug.assertEachNode(node.modifiers, isModifier); - const commentRange = getCommentRange(node); const sourceMapRange = getSourceMapRange(node); @@ -701,27 +927,34 @@ export function transformClassFields(context: TransformationContext): (x: Source 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); - Debug.assert(expression); - const assignment = factory.createAssignment(temp, expression); - setSourceMapRange(assignment, name.expression); - getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); - setterName = factory.updateComputedPropertyName(name, temp); + 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 backingField = createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + const modifiers = visitNodes(node.modifiers, modifierVisitor, isModifier); + const backingField = createAccessorPropertyBackingField(factory, 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); @@ -730,16 +963,30 @@ export function transformClassFields(context: TransformationContext): (x: Source } 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."); - // 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) && currentClassLexicalEnvironment && currentClassLexicalEnvironment.facts & ClassFacts.WillHoistInitializersToConstructor) { + if (shouldTransformInitializersUsingSet && !isStatic(node) && lexicalEnvironment?.data && lexicalEnvironment.data.facts & ClassFacts.WillHoistInitializersToConstructor) { // 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 @@ -754,6 +1001,18 @@ export function transformClassFields(context: TransformationContext): (x: Source ); } + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + const { referencedName, name } = visitReferencedPropertyName(node.name); + return factory.updatePropertyDeclaration( + node, + visitNodes(node.modifiers, modifierVisitor, isModifier), + name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + visitNode(node.initializer, child => namedEvaluationVisitor(child, referencedName), isExpression) + ); + } + return visitEachChild(node, visitor, context); } @@ -763,9 +1022,12 @@ export function transformClassFields(context: TransformationContext): (x: Source // 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*/ isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)); if (expr) { - getPendingExpressions().push(expr); + getPendingExpressions().push(...flattenCommaList(expr)); } if (isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { @@ -790,7 +1052,14 @@ export function transformClassFields(context: TransformationContext): (x: Source return undefined; } - return visitEachChild(node, classElementVisitor, context); + return factory.updatePropertyDeclaration( + node, + visitNodes(node.modifiers, modifierVisitor, isModifier), + visitNode(node.name, propertyNameVisitor, isPropertyName), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + visitNode(node.initializer, visitor, isExpression) + ); } function transformFieldInitializer(node: PropertyDeclaration) { @@ -803,13 +1072,14 @@ export function transformClassFields(context: TransformationContext): (x: Source function shouldTransformAutoAccessorsInCurrentClass() { return shouldTransformAutoAccessors === Ternary.True || shouldTransformAutoAccessors === Ternary.Maybe && - !!currentClassLexicalEnvironment && !!(currentClassLexicalEnvironment.facts & ClassFacts.WillHoistInitializersToConstructor); + !!lexicalEnvironment?.data && !!(lexicalEnvironment.data.facts & ClassFacts.WillHoistInitializersToConstructor); } function visitPropertyDeclaration(node: PropertyDeclaration) { // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function // will in turn call `transformFieldInitializer` as needed. - if (shouldTransformAutoAccessorsInCurrentClass() && isAutoAccessorPropertyDeclaration(node)) { + if (isAutoAccessorPropertyDeclaration(node) && (shouldTransformAutoAccessorsInCurrentClass() || + hasStaticModifier(node) && getInternalEmitFlags(node) & InternalEmitFlags.TransformPrivateStaticElements)) { return transformAutoAccessor(node); } @@ -817,41 +1087,44 @@ export function transformClassFields(context: TransformationContext): (x: Source } function createPrivateIdentifierAccess(info: PrivateIdentifierInfo, receiver: Expression): Expression { - return createPrivateIdentifierAccessHelper(info, Debug.checkDefined(visitNode(receiver, visitor, isExpression))); + return createPrivateIdentifierAccessHelper(info, visitNode(receiver, visitor, isExpression)); } 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( + 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, - 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( @@ -867,8 +1140,8 @@ export function transformClassFields(context: TransformationContext): (x: Source 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); } @@ -891,8 +1164,8 @@ export function transformClassFields(context: TransformationContext): (x: Source 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); } @@ -901,7 +1174,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // converts `super[x]` into `Reflect.get(_baseTemp, x, _classTemp)` const superProperty = factory.createReflectGetCall( superClassReference, - Debug.checkDefined(visitNode(node.argumentExpression, visitor, isExpression)), + visitNode(node.argumentExpression, visitor, isExpression), classConstructor ); setOriginalNode(superProperty, node.expression); @@ -912,20 +1185,19 @@ export function transformClassFields(context: TransformationContext): (x: Source 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); - if (shouldTransformPrivateElementsOrClassStaticBlocks && - isPrivateIdentifierPropertyAccessExpression(operand)) { + + if (isPrivateIdentifierPropertyAccessExpression(operand)) { let info: PrivateIdentifierInfo | undefined; if (info = accessPrivateIdentifier(operand.name)) { const receiver = visitNode(operand.expression, visitor, isExpression); - Debug.assert(receiver); 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, @@ -945,7 +1217,7 @@ export function transformClassFields(context: TransformationContext): (x: Source 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)` @@ -954,7 +1226,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // 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) ? @@ -975,14 +1247,14 @@ export function transformClassFields(context: TransformationContext): (x: Source } else { getterName = factory.createTempVariable(hoistVariableDeclaration); - setterName = factory.createAssignment(getterName, Debug.checkDefined(visitNode(operand.argumentExpression, visitor, isExpression))); + setterName = factory.createAssignment(getterName, visitNode(operand.argumentExpression, visitor, isExpression)); } } if (setterName && getterName) { 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); @@ -1012,7 +1284,7 @@ export function transformClassFields(context: TransformationContext): (x: Source function visitExpressionStatement(node: ExpressionStatement) { return factory.updateExpressionStatement( node, - Debug.checkDefined(visitNode(node.expression, discardedValueVisitor, isExpression)) + visitNode(node.expression, discardedValueVisitor, isExpression) ); } @@ -1027,8 +1299,8 @@ export function transformClassFields(context: TransformationContext): (x: Source } 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. @@ -1036,31 +1308,31 @@ export function transformClassFields(context: TransformationContext): (x: Source if (isCallChain(node)) { return factory.updateCallChain( node, - factory.createPropertyAccessChain(Debug.checkDefined(visitNode(target, visitor, isExpression)), node.questionDotToken, "call"), + factory.createPropertyAccessChain(visitNode(target, visitor, isExpression), node.questionDotToken, "call"), /*questionDotToken*/ undefined, /*typeArguments*/ undefined, - [Debug.checkDefined(visitNode(thisArg, visitor, isExpression)), ...visitNodes(node.arguments, visitor, isExpression)] + [visitNode(thisArg, visitor, isExpression), ...visitNodes(node.arguments, visitor, isExpression)] ); } return factory.updateCallExpression( node, - factory.createPropertyAccessExpression(Debug.checkDefined(visitNode(target, visitor, isExpression)), "call"), + factory.createPropertyAccessExpression(visitNode(target, visitor, isExpression), "call"), /*typeArguments*/ undefined, - [Debug.checkDefined(visitNode(thisArg, visitor, isExpression)), ...visitNodes(node.arguments, visitor, isExpression)] + [visitNode(thisArg, visitor, isExpression), ...visitNodes(node.arguments, visitor, isExpression)] ); } 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( - Debug.checkDefined(visitNode(node.expression, visitor, isExpression)), - currentClassLexicalEnvironment.classConstructor, + visitNode(node.expression, visitor, isExpression), + lexicalEnvironment.data.classConstructor, visitNodes(node.arguments, visitor, isExpression) ); setOriginalNode(invocation, node); @@ -1072,30 +1344,30 @@ export function transformClassFields(context: TransformationContext): (x: Source } 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( node, factory.createCallExpression( - factory.createPropertyAccessExpression(Debug.checkDefined(visitNode(target, visitor, isExpression)), "bind"), + factory.createPropertyAccessExpression(visitNode(target, visitor, isExpression), "bind"), /*typeArguments*/ undefined, - [Debug.checkDefined(visitNode(thisArg, visitor, isExpression))] + [visitNode(thisArg, visitor, isExpression)] ), /*typeArguments*/ undefined, - Debug.checkDefined(visitNode(node.template, visitor, isTemplateLiteral)) + visitNode(node.template, visitor, isTemplateLiteral) ); } 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( - Debug.checkDefined(visitNode(node.tag, visitor, isExpression)), - currentClassLexicalEnvironment.classConstructor, + visitNode(node.tag, visitor, isExpression), + lexicalEnvironment.data.classConstructor, [] ); setOriginalNode(invocation, node); @@ -1104,18 +1376,18 @@ export function transformClassFields(context: TransformationContext): (x: Source node, invocation, /*typeArguments*/ undefined, - Debug.checkDefined(visitNode(node.template, visitor, isTemplateLiteral)) + visitNode(node.template, visitor, isTemplateLiteral) ); } return visitEachChild(node, visitor, context); } 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, @@ -1132,7 +1404,32 @@ export function transformClassFields(context: TransformationContext): (x: Source } } - function visitBinaryExpression(node: BinaryExpression, valueIsDiscarded: boolean) { + function isAnonymousClassNeedingAssignedName(node: AnonymousFunctionDefinition) { + 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 || + !!(getInternalEmitFlags(node) && InternalEmitFlags.TransformPrivateStaticElements)) && + 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 } = ...) @@ -1141,9 +1438,9 @@ export function transformClassFields(context: TransformationContext): (x: Source pendingExpressions = undefined; node = factory.updateBinaryExpression( node, - Debug.checkDefined(visitNode(node.left, assignmentTargetVisitor, isExpression)), + visitNode(node.left, assignmentTargetVisitor, isExpression), node.operatorToken, - Debug.checkDefined(visitNode(node.right, visitor, isExpression)) + visitNode(node.right, visitor, isExpression) ); const expr = some(pendingExpressions) ? factory.inlineExpressions(compact([...pendingExpressions, node])) : @@ -1152,8 +1449,40 @@ export function transformClassFields(context: TransformationContext): (x: Source return expr; } if (isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && - isPrivateIdentifierPropertyAccessExpression(node.left)) { + // 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]]. + // ... + + 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)) { // obj.#x = ... const info = accessPrivateIdentifier(node.left.name); if (info) { @@ -1169,18 +1498,18 @@ export function transformClassFields(context: TransformationContext): (x: Source 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, visitInvalidSuperProperty(node.left), node.operatorToken, - Debug.checkDefined(visitNode(node.right, visitor, isExpression))); + visitNode(node.right, visitor, isExpression)); } if (classConstructor && superClassReference) { let setterName = @@ -1207,8 +1536,6 @@ export function transformClassFields(context: TransformationContext): (x: Source ); setOriginalNode(superPropertyGet, node.left); setTextRange(superPropertyGet, node.left); - - Debug.assert(expression); expression = factory.createBinaryExpression( superPropertyGet, getNonAssignmentOperatorForCompoundAssignment(node.operatorToken.kind), @@ -1217,14 +1544,12 @@ export function transformClassFields(context: TransformationContext): (x: Source setTextRange(expression, node); } - const temp = valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); + const temp = discarded ? undefined : factory.createTempVariable(hoistVariableDeclaration); if (temp) { - Debug.assert(expression); expression = factory.createAssignment(temp, expression); setTextRange(temp, node); } - Debug.assert(expression); expression = factory.createReflectSetCall( superClassReference, setterName, @@ -1244,17 +1569,68 @@ export function transformClassFields(context: TransformationContext): (x: Source } } } - if (shouldTransformPrivateElementsOrClassStaticBlocks && - isPrivateIdentifierInExpression(node)) { + if (isPrivateIdentifierInExpression(node)) { // #x in obj return transformPrivateIdentifierInInExpression(node); } 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<Node, Node> = + 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<Node, Node> = + 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 = Debug.checkDefined(visitNode(receiver, visitor, isExpression)); - right = Debug.checkDefined(visitNode(right, visitor, isExpression)); + receiver = visitNode(receiver, visitor, isExpression); + right = visitNode(right, visitor, isExpression); if (isCompoundAssignment(operator)) { const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver); @@ -1270,7 +1646,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, @@ -1278,7 +1654,7 @@ export function transformClassFields(context: TransformationContext): (x: Source info.setterName ); case PrivateIdentifierKind.Method: - return context.getEmitHelperFactory().createClassPrivateFieldSetHelper( + return emitHelpers().createClassPrivateFieldSetHelper( receiver, info.brandCheckIdentifier, right, @@ -1286,13 +1662,16 @@ export function transformClassFields(context: TransformationContext): (x: Source /* f */ undefined ); case PrivateIdentifierKind.Field: - return context.getEmitHelperFactory().createClassPrivateFieldSetHelper( + return emitHelpers().createClassPrivateFieldSetHelper( receiver, 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"); } @@ -1305,7 +1684,7 @@ export function transformClassFields(context: TransformationContext): (x: Source 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; } let containsPublicInstanceFields = false; @@ -1314,7 +1693,9 @@ export function transformClassFields(context: TransformationContext): (x: Source let containsInstanceAutoAccessors = false; for (const member of node.members) { if (isStatic(member)) { - 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)) { @@ -1360,7 +1741,7 @@ export function transformClassFields(context: TransformationContext): (x: Source } 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; @@ -1368,7 +1749,7 @@ export function transformClassFields(context: TransformationContext): (x: Source node, factory.createAssignment( temp, - Debug.checkDefined(visitNode(node.expression, visitor, isExpression)) + visitNode(node.expression, visitor, isExpression) ), /*typeArguments*/ undefined ); @@ -1376,22 +1757,26 @@ export function transformClassFields(context: TransformationContext): (x: Source return visitEachChild(node, visitor, context); } - function visitInNewClassLexicalEnvironment<T extends ClassLikeDeclaration, U>(node: T, visitor: (node: T, facts: ClassFacts) => U) { + function visitInNewClassLexicalEnvironment<T extends ClassLikeDeclaration, U>(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 ); @@ -1407,8 +1792,9 @@ export function transformClassFields(context: TransformationContext): (x: Source enableSubstitutionForClassStaticThisOrSuperReference(); } - const result = visitor(node, facts); + const result = visitor(node, facts, referencedName); endClassLexicalEnvironment(); + Debug.assert(lexicalEnvironment === savedLexicalEnvironment); currentClassContainer = savedCurrentClassContainer; pendingExpressions = savedPendingExpressions; return result; @@ -1416,7 +1802,7 @@ export function transformClassFields(context: TransformationContext): (x: Source } function visitClassDeclaration(node: ClassDeclaration) { - return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + return visitInNewClassLexicalEnvironment(node, /*referencedName*/ undefined, visitClassDeclarationInNewClassLexicalEnvironment); } function visitClassDeclarationInNewClassLexicalEnvironment(node: ClassDeclaration, facts: ClassFacts) { @@ -1424,12 +1810,31 @@ export function transformClassFields(context: TransformationContext): (x: Source // 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); + const modifiers = visitNodes(node.modifiers, modifierVisitor, isModifier); const heritageClauses = visitNodes(node.heritageClauses, heritageClauseVisitor, isHeritageClause); const { members, prologue } = transformClassMembers(node); const classDecl = factory.updateClassDeclaration( @@ -1457,7 +1862,7 @@ export function transformClassFields(context: TransformationContext): (x: Source 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: @@ -1473,11 +1878,11 @@ export function transformClassFields(context: TransformationContext): (x: Source 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. @@ -1486,27 +1891,44 @@ export function transformClassFields(context: TransformationContext): (x: Source // 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 modifiers = visitNodes(node.modifiers, modifierVisitor, isModifier); const heritageClauses = visitNodes(node.heritageClauses, heritageClauseVisitor, isHeritageClause); const { members, prologue } = transformClassMembers(node); - const classExpression = factory.updateClassExpression( + let classExpression = factory.updateClassExpression( node, modifiers, node.name, @@ -1523,39 +1945,61 @@ export function transformClassFields(context: TransformationContext): (x: Source // 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) || 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."); // 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 (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 (pendingStatements && some(staticPropertiesOrClassStaticBlocks)) { - addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); + if (some(staticPropertiesOrClassStaticBlocks)) { + addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, node.emitNode?.classThis ?? factory.getInternalName(node)); } if (temp) { - expressions.push( - startOnNewLine(factory.createAssignment(temp, classExpression)), - 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(); @@ -1564,21 +2008,26 @@ export function transformClassFields(context: TransformationContext): (x: Source 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(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); @@ -1593,21 +2042,40 @@ export function transformClassFields(context: TransformationContext): (x: Source } 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 (shouldTransformAutoAccessorsInCurrentClass()) { for (const member of node.members) { if (isAutoAccessorPropertyDeclaration(member)) { const storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); - addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + if (shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformPrivateStaticElementsInClass && hasStaticModifier(member)) { + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + else { + const privateEnv = getPrivateIdentifierEnvironment(); + setPrivateIdentifier(privateEnv, storageName, { kind: "untransformed" }); + } } } } @@ -1665,7 +2133,7 @@ export function transformClassFields(context: TransformationContext): (x: Source } function createBrandCheckWeakSetForPrivateMethods() { - const { weakSetName } = getPrivateIdentifierEnvironment(); + const { weakSetName } = getPrivateIdentifierEnvironment().data; Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); getPendingExpressions().push( @@ -1682,7 +2150,7 @@ export function transformClassFields(context: TransformationContext): (x: Source function transformConstructor(constructor: ConstructorDeclaration | undefined, container: ClassDeclaration | ClassExpression) { constructor = visitNode(constructor, visitor, isConstructorDeclaration); - if (!currentClassLexicalEnvironment || !(currentClassLexicalEnvironment.facts & ClassFacts.WillHoistInitializersToConstructor)) { + if (!lexicalEnvironment?.data || !(lexicalEnvironment.data.facts & ClassFacts.WillHoistInitializersToConstructor)) { return constructor; } @@ -1715,7 +2183,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)); } @@ -1784,47 +2253,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. - addMethodStatements(statements, privateMethodsAndAccessors, receiver); - addPropertyOrClassStaticBlockStatements(statements, properties, receiver); + addInstanceMethodStatements(statements, privateMethodsAndAccessors, 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()); @@ -1847,14 +2307,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); - } } /** @@ -1865,7 +2317,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) { + if (isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks) { continue; } @@ -1889,15 +2341,30 @@ 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. 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(propertyOriginalNode)) { + addEmitFlags(statement, EmitFlags.NoComments); + } + return statement; } @@ -1934,11 +2401,12 @@ export function transformClassFields(context: TransformationContext): (x: Source 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); + setSourceMapRange(transformed, getSourceMapRange(property.name)); + lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment); } currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; return transformed; @@ -1948,6 +2416,19 @@ export function transformClassFields(context: TransformationContext): (x: Source // 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 (isNamedEvaluation(property, isAnonymousClassNeedingAssignedName)) { + 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) : @@ -1959,21 +2440,25 @@ export function transformClassFields(context: TransformationContext): (x: Source currentStaticPropertyDeclarationOrStaticBlock = property; } - if (shouldTransformPrivateElementsOrClassStaticBlocks && isPrivateIdentifier(propertyName)) { + const initializerVisitor: Visitor = + referencedName ? child => namedEvaluationVisitor(child, referencedName!) : + visitor; + + if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property as PrivateIdentifierPropertyDeclaration)) { const privateIdentifierInfo = accessPrivateIdentifier(propertyName); if (privateIdentifierInfo) { if (privateIdentifierInfo.kind === PrivateIdentifierKind.Field) { 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) ); } } @@ -1994,13 +2479,39 @@ export function transformClassFields(context: TransformationContext): (x: Source return undefined; } - const initializer = property.initializer || emitAssignment ? visitNode(property.initializer, visitor, 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); - return factory.createAssignment(memberAccess, initializer); + addEmitFlags(memberAccess, EmitFlags.NoLeadingComments); + const expression = factory.createAssignment(memberAccess, initializer); + return expression; } else { const name = isComputedPropertyName(propertyName) ? propertyName.expression @@ -2030,20 +2541,13 @@ export function transformClassFields(context: TransformationContext): (x: Source // 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); } } @@ -2055,12 +2559,12 @@ export function transformClassFields(context: TransformationContext): (x: Source * @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( @@ -2078,140 +2582,7 @@ export function transformClassFields(context: TransformationContext): (x: Source factory.updateElementAccessExpression( node, factory.createVoidZero(), - Debug.checkDefined(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; + visitNode(node.argumentExpression, visitor, isExpression)); } /** @@ -2219,13 +2590,13 @@ export function transformClassFields(context: TransformationContext): (x: Source * 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); - Debug.assert(expression); + 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) { @@ -2234,6 +2605,9 @@ export function transformClassFields(context: TransformationContext): (x: Source else { hoistVariableDeclaration(generatedName); } + if (captureReferencedName) { + expression = emitHelpers().createPropKeyHelper(expression); + } return factory.createAssignment(generatedName, expression); } return (inlinable || isIdentifier(innerExpression)) ? undefined : expression; @@ -2241,32 +2615,30 @@ export function transformClassFields(context: TransformationContext): (x: Source } 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() { @@ -2277,7 +2649,7 @@ export function transformClassFields(context: TransformationContext): (x: Source node: PropertyDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined @@ -2303,20 +2675,21 @@ export function transformClassFields(context: TransformationContext): (x: Source _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, }); } @@ -2325,9 +2698,8 @@ export function transformClassFields(context: TransformationContext): (x: Source setPrivateIdentifier(privateEnv, name, { kind: PrivateIdentifierKind.Field, - brandCheckIdentifier: weakMapName, - variableName: undefined, isStatic: false, + brandCheckIdentifier: weakMapName, isValid, }); @@ -2346,15 +2718,15 @@ export function transformClassFields(context: TransformationContext): (x: Source _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, @@ -2369,15 +2741,15 @@ export function transformClassFields(context: TransformationContext): (x: Source _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; @@ -2398,17 +2770,18 @@ export function transformClassFields(context: TransformationContext): (x: Source _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 { @@ -2427,7 +2800,7 @@ export function transformClassFields(context: TransformationContext): (x: Source _node: AutoAccessorPropertyDeclaration, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, _previousInfo: PrivateIdentifierInfo | undefined @@ -2435,8 +2808,8 @@ export function transformClassFields(context: TransformationContext): (x: Source 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, @@ -2455,7 +2828,7 @@ export function transformClassFields(context: TransformationContext): (x: Source node: T, name: PrivateIdentifier, lex: ClassLexicalEnvironment, - privateEnv: PrivateIdentifierEnvironment, + privateEnv: PrivateEnv, isStatic: boolean, isValid: boolean, previousInfo: PrivateIdentifierInfo | undefined @@ -2470,7 +2843,7 @@ export function transformClassFields(context: TransformationContext): (x: Source } 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) : @@ -2498,45 +2871,8 @@ export function transformClassFields(context: TransformationContext): (x: Source * @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<K extends __String | Node>( - 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 = accessPrivateIdentifierCommon(lexicalEnvironment, name); + return info?.kind === "untransformed" ? undefined : info; } function wrapPrivateIdentifierForDestructuringTarget(node: PrivateIdentifierPropertyAccessExpression) { @@ -2550,7 +2886,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // differently inside the function. if (isThisProperty(node) || isSuperProperty(node) || !isSimpleCopiableExpression(node.expression)) { receiver = factory.createTempVariable(hoistVariableDeclaration, /*reservedInNestedScopes*/ true); - getPendingExpressions().push(factory.createBinaryExpression(receiver, SyntaxKind.EqualsToken, Debug.checkDefined(visitNode(node.expression, visitor, isExpression)))); + getPendingExpressions().push(factory.createBinaryExpression(receiver, SyntaxKind.EqualsToken, visitNode(node.expression, visitor, isExpression))); } return factory.createAssignmentTargetWrapper( parameter, @@ -2563,116 +2899,145 @@ export function transformClassFields(context: TransformationContext): (x: Source ); } - function visitArrayAssignmentTarget(node: Node) { - Debug.assertNode(node, isBindingOrAssignmentElement); - const target = getTargetOfBindingOrAssignmentElement(node); - if (target) { - let wrapped: LeftHandSideExpression | undefined; - if (isPrivateIdentifierPropertyAccessExpression(target)) { - wrapped = wrapPrivateIdentifierForDestructuringTarget(target); + function visitDestructuringAssignmentTarget(node: LeftHandSideExpression): LeftHandSideExpression { + if (isObjectLiteralExpression(node) || isArrayLiteralExpression(node)) { + return visitAssignmentPattern(node); + } + + if (isPrivateIdentifierPropertyAccessExpression(node)) { + return wrapPrivateIdentifierForDestructuringTarget(node); + } + else if (shouldTransformSuperInStaticInitializers && + isSuperProperty(node) && + currentStaticPropertyDeclarationOrStaticBlock && + lexicalEnvironment?.data) { + const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; + 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, - Debug.checkDefined(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, - ) - ); - } - } - } - } - if (isPropertyAssignment(node)) { - const initializer = getInitializerOfBindingOrAssignmentElement(node); - return factory.updatePropertyAssignment( - node, - Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)), - wrapped ? - initializer ? factory.createAssignment(wrapped, Debug.checkDefined(visitNode(initializer, visitor, isExpression))) : wrapped : - Debug.checkDefined(visitNode(node.initializer, assignmentTargetVisitor, isExpression)) - ); - } - if (isSpreadAssignment(node)) { - return factory.updateSpreadAssignment( - node, - wrapped || Debug.checkDefined(visitNode(node.expression, assignmentTargetVisitor, isExpression)) - ); - } - Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); + function visitAssignmentElement(node: Exclude<ArrayAssignmentElement, SpreadElement | OmittedExpression>): ArrayAssignmentElement { + // 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 (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) as AssignmentExpression<EqualsToken>; + } + 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) as AssignmentExpression<EqualsToken>; } - return visitNode(node, visitor); + return visitDestructuringAssignmentTarget(node) as ArrayAssignmentElement; + } + + 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: Expression): Expression { + Debug.assertNode(node, isArrayBindingOrAssignmentElement); + 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 (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); + } + + 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: ObjectLiteralElement) { + Debug.assertNode(node, isObjectBindingOrAssignmentElement); + 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) { @@ -2687,7 +3052,7 @@ export function transformClassFields(context: TransformationContext): (x: Source // [ { set value(x) { this.#myProp = x; } }.value ] = [ "hello" ]; return factory.updateArrayLiteralExpression( node, - visitNodes(node.elements, visitArrayAssignmentTarget, isExpression) + visitNodes(node.elements, visitArrayAssignmentElement, isExpression) ); } else { @@ -2701,10 +3066,144 @@ export function transformClassFields(context: TransformationContext): (x: Source // ({ stringProperty: { set value(x) { this.#myProp = x; } }.value }) = { stringProperty: "hello" }; return factory.updateObjectLiteralExpression( node, - visitNodes(node.properties, visitObjectAssignmentTarget, isObjectLiteralElementLike) + visitNodes(node.properties, visitObjectAssignmentElement, isObjectLiteralElementLike) ); } } + + 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) { @@ -2736,27 +3235,9 @@ function isReservedPrivateName(node: PrivateIdentifier) { 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/declarations.ts b/src/compiler/transformers/declarations.ts index e14bd6d5fe250..c9c8fb39df353 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -857,13 +857,13 @@ export function transformDeclarations(context: TransformationContext) { } } - function updateParamsList(node: Node, params: NodeArray<ParameterDeclaration>, modifierMask?: ModifierFlags) { + function updateParamsList(node: Node, params: NodeArray<ParameterDeclaration>, modifierMask?: ModifierFlags): NodeArray<ParameterDeclaration> { 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/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index c2e9bdaf2b79a..bf5cc72878a76 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -65,6 +65,7 @@ import { getEmitFlags, getEnclosingBlockScopeContainer, getFirstConstructorWithBody, + getInternalEmitFlags, getNameOfDeclaration, getOriginalNode, getParseTreeNode, @@ -79,6 +80,7 @@ import { insertStatementAfterCustomPrologue, insertStatementsAfterCustomPrologue, insertStatementsAfterStandardPrologue, + InternalEmitFlags, isArrayLiteralExpression, isArrowFunction, isAssignmentExpression, @@ -579,7 +581,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile || 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<Node | undefined> { @@ -2351,7 +2353,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile 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 { @@ -3923,7 +3925,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile * @param node a CallExpression. */ function visitCallExpression(node: CallExpression) { - if (getEmitFlags(node) & EmitFlags.TypeScriptClassWrapper) { + if (getInternalEmitFlags(node) & InternalEmitFlags.TypeScriptClassWrapper) { return visitTypeScriptClassWrapper(node); } @@ -4065,8 +4067,21 @@ export function transformES2015(context: TransformationContext): (x: SourceFile 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..d0614bf9f907d --- /dev/null +++ b/src/compiler/transformers/esDecorators.ts @@ -0,0 +1,2315 @@ +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, + isArrayBindingOrAssignmentElement, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentExpression, + isAsyncModifier, + 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, + isObjectBindingOrAssignmentElement, + isObjectLiteralElementLike, + isObjectLiteralExpression, + isOmittedExpression, + isParameter, + isParenthesizedExpression, + isPrivateIdentifier, + isPrivateIdentifierClassElementDeclaration, + isPropertyAssignment, + isPropertyDeclaration, + isPropertyName, + isPropertyNameLiteral, + isSetAccessor, + isSetAccessorDeclaration, + isShorthandPropertyAssignment, + isSimpleInlineableExpression, + isSpreadAssignment, + isSpreadElement, + isStatement, + isStatic, + isStaticModifier, + isStringLiteral, + isSuperProperty, + isTemplateLiteral, + LeftHandSideExpression, + map, + MethodDeclaration, + Modifier, + ModifierFlags, + ModifierLike, + ModifiersArray, + moveRangePastDecorators, + moveRangePastModifiers, + Node, + NodeArray, + NodeFlags, + nodeOrChildIsDecorated, + ObjectLiteralElement, + 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: +// +// 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 (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 +// 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?: Map<ClassElement, MemberInfo>; // 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; + hasStaticPrivateClassElements: 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 + ; + +/** @internal */ +export function transformESDecorators(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle { + 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; + 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; + } + + 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", "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", "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; + top.classSuper = top.next.classInfo?.classSuper; + } + updateState(); + } + + function exitClassElement() { + 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", "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", "Incorrect value for top.kind.", () => `Expected top.kind to be 'name' but got '${top?.kind}' instead.`); + 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", "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--; + } + 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<Node> { + if (!shouldVisitNode(node)) { + return node; + } + + switch (node.kind) { + case SyntaxKind.Decorator: // elided, will be emitted as part of `visitClassDeclaration` + return Debug.fail("Use `modifierVisitor` instead."); + 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, fallbackVisitor, context); + exitOther(); + return result; + } + + default: + return visitEachChild(node, fallbackVisitor, context); + } + } + + function fallbackVisitor(node: Node): VisitResult<Node | undefined> { + switch (node.kind) { + case SyntaxKind.Decorator: + return undefined; + default: + return visitor(node); + } + } + + function modifierVisitor(node: ModifierLike): VisitResult<Modifier | undefined> { + switch (node.kind) { + case SyntaxKind.Decorator: // elided, will be emitted as part of `visitClassDeclaration` + return undefined; + default: + return node; + } + } + + 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<Node> { + 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<Node> { + 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 createClassInfo(node: ClassLikeDeclaration): ClassInfo { + let instanceExtraInitializersName: Identifier | undefined; + 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. + + 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); + } + } + + if ((isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member)) { + hasStaticPrivateClassElements = true; + } + + // exit early if possible + if (staticExtraInitializersName && + instanceExtraInitializersName && + hasStaticInitializers && + hasNonAmbientInstanceFields && + hasStaticPrivateClassElements) { + break; + } + } + + return { + class: node, + instanceExtraInitializersName, + staticExtraInitializersName, + hasStaticInitializers, + hasNonAmbientInstanceFields, + hasStaticPrivateClassElements, + }; + } + + 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<HeritageClause> | undefined; + let shouldTransformPrivateStaticElementsInClass = false; + + // 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), + ); + + if (classInfo.hasStaticPrivateClassElements) { + shouldTransformPrivateStaticElementsInClass = true; + shouldTransformPrivateStaticElementsInFile = true; + } + } + + // 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 renamedClassThis = classInfo.classThis ?? factory.createThis(); + + // 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(factory.createThis(), 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) { + 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: Node): 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); + } + 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: this.name }, _classExtraInitializers); + const valueProperty = factory.createPropertyAssignment("value", factory.createThis()); + const classDescriptor = factory.createObjectLiteralExpression([valueProperty]); + const classDescriptorAssignment = factory.createAssignment(classInfo.classDescriptorName, classDescriptor); + const classNameReference = factory.createPropertyAccessExpression(factory.createThis(), "name"); + const esDecorateHelper = emitHelpers().createESDecorateHelper( + factory.createNull(), + classDescriptorAssignment, + classInfo.classDecoratorsName, + { kind: "class", name: classNameReference }, + factory.createNull(), + classInfo.classExtraInitializersName + ); + const esDecorateStatement = factory.createExpressionStatement(esDecorateHelper); + setSourceMapRange(esDecorateStatement, moveRangePastDecorators(node)); + leadingBlockStatements.push(esDecorateStatement); + + // 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); + 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 + + // 13. Class extra initializers are evaluated + if (classInfo.classExtraInitializersName) { + const runClassInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo.classExtraInitializersName); + 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 + 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); + 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]; + } + + // 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(); + 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 {}`. + + // (() => { + // 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; + // })(); + + 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(returnExpr), + ); + } + else { + // return <classExpression>; + 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)); + } + + function isDecoratedClassLike(node: ClassLikeDeclaration) { + return classOrConstructorParameterIsDecorated(/*legacyDecorators*/ false, node) || + childIsDecorated(/*legacyDecorators*/ false, node); + } + + function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement> { + if (isDecoratedClassLike(node)) { + if (hasSyntacticModifier(node, ModifierFlags.Export) && + hasSyntacticModifier(node, ModifierFlags.Default)) { + // export default (() => { ... })(); + 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 { + // 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, modifierVisitor, 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); + setCommentRange(statement, getCommentRange(node)); + return statement; + } + } + else { + const modifiers = visitNodes(node.modifiers, modifierVisitor, 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, modifierVisitor, 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) { + // 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 + const statements: Statement[] = []; + + statements.push( + factory.createExpressionStatement( + emitHelpers().createRunInitializersHelper( + factory.createThis(), + classInfo.instanceExtraInitializersName + ) + ) + ); + + return statements; + } + } + + function visitConstructorDeclaration(node: ConstructorDeclaration) { + enterClassElement(node); + const modifiers = visitNodes(node.modifiers, modifierVisitor, isModifier); + const parameters = visitNodes(node.parameters, visitor, isParameter); + let body: Block | undefined; + 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); + 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< + TNode extends MethodDeclaration | PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration, + >( + member: TNode, + useNamedEvaluation: boolean, + classInfo: ClassInfo | undefined, + createDescriptor?: (node: TNode & { readonly name: PrivateIdentifier }, 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, modifierVisitor, isModifier); + enterName(); + if (useNamedEvaluation) { + ({ referencedName, name } = visitReferencedPropertyName(member.name)); + } + else { + name = visitPropertyName(member.name); + } + exitName(); + return { modifiers, referencedName, name, initializersName, descriptorName, thisArg }; + } + + // 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, modifierVisitor, isModifier); + + 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(memberDecoratorsAssignment); + + // 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) || isAutoAccessorPropertyDeclaration(member) ? + isStatic(member) ? + classInfo.staticNonFieldDecorationStatements ??= [] : + classInfo.nonStaticNonFieldDecorationStatements ??= [] : + isPropertyDeclaration(member) && !isAutoAccessorPropertyDeclaration(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: factory.createStringLiteralFromNode(member.name) }; + } + else { + const expression = member.name.expression; + if (isPropertyNameLiteral(expression) && !isIdentifier(expression)) { + propertyName = { computed: true, name: factory.createStringLiteralFromNode(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 (isPrivateIdentifierClassElementDeclaration(member) && createDescriptor) { + descriptor = createDescriptor(member, visitNodes(modifiers, node => tryCast(node, isAsyncModifier), isModifier)); + memberInfo.memberDescriptorName = descriptorName = createHelperVariable(member, "descriptor"); + descriptor = factory.createAssignment(descriptorName, descriptor); + } + + 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"); + + if (isStatic(member)) { + thisArg = classInfo.classThis; + } + + let descriptor: Expression | undefined; + if (isPrivateIdentifierClassElementDeclaration(member) && hasAccessorModifier(member) && createDescriptor) { + descriptor = createDescriptor(member, /*modifiers*/ undefined); + 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); + 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); + } + } + + if (name === undefined) { + enterName(); + if (useNamedEvaluation) { + ({ referencedName, name } = visitReferencedPropertyName(member.name)); + } + else { + name = visitPropertyName(member.name); + } + exitName(); + } + + 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); + } + + 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, isParameter); + 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, isParameter); + 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, isParameter); + 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): 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.assert(!isAmbientPropertyDeclaration(node), "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 = isNamedEvaluation(node, isAnonymousClassNeedingAssignedName); + 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 ?? factory.createVoidZero()); + } + + 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; + } + + const declarations = endLexicalEnvironment(); + if (some(declarations)) { + initializer = factory.createImmediatelyInvokedArrowFunction([ + ...declarations, + factory.createReturnStatement(initializer) + ]); + } + + exitClassElement(); + + 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, isModifier); + + 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 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); + } + + 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) { + // 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. + setCommentRange(updated, node); + setTextRange(updated, moveRangePastModifiers(node)); + setSourceMapRange(updated, moveRangePastModifiers(node)); + setEmitFlags(updated.name, EmitFlags.NoTrailingSourceMap); + } + return updated; + } + + function isAnonymousClassNeedingAssignedName(node: AnonymousFunctionDefinition) { + 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]]. + // ... + + 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) { + 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); + + // 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); + 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.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)); + 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 (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); + } + + 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 (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.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 (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + 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, assignedName), 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<ArrayAssignmentElement, SpreadElement | OmittedExpression>): ArrayAssignmentElement { + // 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 (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + 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) as ArrayAssignmentElement; + } + else { + return visitDestructuringAssignmentTarget(node) as ArrayAssignmentElement; + } + } + + 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: Expression): Expression { + Debug.assertNode(node, isArrayBindingOrAssignmentElement); + 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 (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); + 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: ObjectLiteralElement) { + Debug.assertNode(node, isObjectBindingOrAssignmentElement); + 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 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 (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + const referencedName = factory.createStringLiteral(node.isExportEquals ? "" : "default"); + const modifiers = visitNodes(node.modifiers, modifierVisitor, 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<Node, Node> = + 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<Node, Node> = + 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)) { + pendingExpressions.push(expression.expression); + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(pendingExpressions)); + } + else { + pendingExpressions.push(expression); + expression = factory.inlineExpressions(pendingExpressions); + } + 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)); + return decoratorExpressions; + } + + /** + * Transforms a decorator into an expression. + * + * @param decorator The decorator node. + */ + function transformDecorator(decorator: Decorator) { + const expression = visitNode(decorator.expression, visitor, isExpression); + setEmitFlags(expression, EmitFlags.NoComments); + return expression; + } + + /** + * Creates a `value`, `get`, or `set` method for a pseudo-{@link PropertyDescriptor} object created for a private element. + */ + 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, + /*name*/ undefined, + /*typeParameters*/ undefined, + parameters, + /*type*/ undefined, + body ?? factory.createBlock([]) + ); + setOriginalNode(func, original); + setSourceMapRange(func, moveRangePastDecorators(original)); + setEmitFlags(func, EmitFlags.NoComments); + + 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); + 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: PrivateIdentifierMethodDeclaration, 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: PrivateIdentifierGetAccessorDeclaration, 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: PrivateIdentifierSetAccessorDeclaration, 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: PrivateIdentifierPropertyDeclaration, 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")] + ) + ) + ]) + ); + } + + 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); + } +} diff --git a/src/compiler/transformers/legacyDecorators.ts b/src/compiler/transformers/legacyDecorators.ts index 86d2d0ea10cd9..f3f19a528aceb 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -1,4 +1,5 @@ import { + __String, addEmitHelpers, addRange, AllDecorators, @@ -28,13 +29,14 @@ import { getEmitFlags, getEmitScriptTarget, getOriginalNodeId, + groupBy, hasAccessorModifier, - hasDecorators, hasSyntacticModifier, Identifier, idText, isBindingName, isBlock, + isCallToHelper, isClassElement, isComputedPropertyName, isDecorator, @@ -147,9 +149,11 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S } function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement> { - 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) ? + const statements = classOrConstructorParameterIsDecorated(/*useLegacyDecorators*/ true, node) ? transformClassDeclarationWithClassDecorators(node, node.name) : transformClassDeclarationWithoutClassDecorators(node, node.name); @@ -173,7 +177,7 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S 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; } @@ -337,7 +341,7 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S const classExpression = factory.createClassExpression( /*modifiers*/ undefined, - name, + name && isGeneratedIdentifier(name) ? undefined : name, /*typeParameters*/ undefined, heritageClauses, members); @@ -469,6 +473,10 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S 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. * @@ -479,9 +487,12 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S 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; } @@ -504,7 +515,7 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S * @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); } @@ -544,7 +555,7 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S * @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/module/module.ts b/src/compiler/transformers/module/module.ts index cdcb78401c126..311dcfe85a574 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1,7 +1,7 @@ import { - addEmitFlags, addEmitHelper, addEmitHelpers, + addInternalEmitFlags, addRange, append, ArrowFunction, @@ -41,6 +41,7 @@ import { getExternalModuleNameLiteral, getImportNeedsImportDefaultHelper, getImportNeedsImportStarHelper, + getInternalEmitFlags, getLocalNameForExternalImport, getNamespaceDeclarationNode, getNodeId, @@ -56,6 +57,7 @@ import { ImportEqualsDeclaration, InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, + InternalEmitFlags, isArrayLiteralExpression, isArrowFunction, isAssignmentOperator, @@ -1034,7 +1036,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile } 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)) { @@ -1044,7 +1046,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile } 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)) { @@ -1305,7 +1307,7 @@ export function transformModule(context: TransformationContext): (x: SourceFile 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, @@ -1485,11 +1487,30 @@ export function transformModule(context: TransformationContext): (x: SourceFile // 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))) { @@ -2022,13 +2043,13 @@ export function transformModule(context: TransformationContext): (x: SourceFile 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 ); } @@ -2041,13 +2062,13 @@ export function transformModule(context: TransformationContext): (x: SourceFile 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 d47ada78383fb..e00a3187b66c7 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -5,7 +5,6 @@ import { addEmitHelpers, addRange, addSyntheticTrailingComment, - AllDecorators, append, ArrowFunction, AssertionExpression, @@ -16,6 +15,7 @@ import { childIsDecorated, ClassDeclaration, ClassElement, + classElementOrClassElementParameterIsDecorated, ClassExpression, ClassLikeDeclaration, classOrConstructorParameterIsDecorated, @@ -30,7 +30,6 @@ import { Declaration, Decorator, ElementAccessExpression, - elideNodes, EmitFlags, EmitHint, EntityName, @@ -43,16 +42,12 @@ import { ExpressionWithTypeArguments, filter, findSuperStatementIndex, - firstOrUndefined, - flatMap, flattenDestructuringAssignment, FlattenLevel, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, GetAccessorDeclaration, - getAllDecoratorsOfClass, - getAllDecoratorsOfClassElement, getEffectiveBaseTypeNode, getEmitFlags, getEmitModuleKind, @@ -77,6 +72,7 @@ import { ImportSpecifier, InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, + InternalEmitFlags, isAccessExpression, isArray, isAssertionExpression, @@ -88,6 +84,7 @@ import { isDecorator, isElementAccessExpression, isEnumConst, + isExportOrDefaultModifier, isExportSpecifier, isExpression, isExternalModule, @@ -122,7 +119,6 @@ import { isTemplateLiteral, JsxOpeningElement, JsxSelfClosingElement, - lastOrUndefined, LeftHandSideExpression, map, mapDefined, @@ -142,6 +138,7 @@ import { NamespaceExport, NewExpression, Node, + NodeArray, NodeFlags, nodeIsMissing, NonNullExpression, @@ -162,6 +159,7 @@ import { setCommentRange, setConstantValue, setEmitFlags, + setInternalEmitFlags, setOriginalNode, setParent, setSourceMapRange, @@ -170,27 +168,26 @@ import { setTextRange, setTextRangeEnd, setTextRangePos, - setTextRangePosEnd, setTypeNode, ShorthandPropertyAssignment, shouldPreserveConstEnums, - singleOrMany, skipOuterExpressions, skipPartiallyEmittedExpressions, skipTrivia, + skipWhile, some, SourceFile, startOnNewLine, Statement, SyntaxKind, TaggedTemplateExpression, + takeWhile, TextRange, TransformationContext, TransformFlags, UnderscoreEscapedMap, VariableDeclaration, VariableStatement, - visitArray, visitEachChild, visitFunctionBody, visitLexicalEnvironment, @@ -215,16 +212,14 @@ const enum TypeScriptSubstitutionFlags { 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, } @@ -244,6 +239,7 @@ export function transformTypeScript(context: TransformationContext) { 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. @@ -563,6 +559,14 @@ export function transformTypeScript(context: TransformationContext) { } } + function decoratorElidingVisitor(node: Node): VisitResult<Node | undefined> { + return isDecorator(node) ? undefined : visitor(node); + } + + function modifierElidingVisitor(node: Node): VisitResult<Node | undefined> { + return isModifier(node) ? undefined : visitor(node); + } + function modifierVisitor(node: Node): VisitResult<Node | undefined> { if (isDecorator(node)) return undefined; if (modifierToFlag(node.kind) & ModifierFlags.TypeScriptModifier) { @@ -794,17 +798,16 @@ export function transformTypeScript(context: TransformationContext) { ); } - 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(node)) facts |= ClassFacts.HasConstructorDecorators; - if (childIsDecorated(node)) facts |= ClassFacts.HasMemberDecorators; + 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; } @@ -820,7 +823,13 @@ export function transformTypeScript(context: TransformationContext) { } function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement> { - 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), @@ -831,28 +840,42 @@ export function transformTypeScript(context: TransformationContext) { ); } - 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 && legacyDecorators || + 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 = + moveModifiers && !node.name || + 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<ModifierLike>(decorators, modifiers), + modifiers, name, /*typeParameters*/ undefined, visitNodes(node.heritageClauses, visitor, isHeritageClause), @@ -866,11 +889,10 @@ export function transformTypeScript(context: TransformationContext) { 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: @@ -882,6 +904,7 @@ export function transformTypeScript(context: TransformationContext) { // return C; // }(); // + const statements: Statement[] = [classDeclaration]; const closingBraceLocation = createTokenRange(skipTrivia(currentSourceFile.text, node.members.end), SyntaxKind.CloseBraceToken); const localName = factory.getInternalName(node); @@ -891,18 +914,24 @@ export function transformTypeScript(context: TransformationContext) { 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); + setInternalEmitFlags(iife, InternalEmitFlags.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), @@ -910,52 +939,62 @@ export function transformTypeScript(context: TransformationContext) { /*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) ); } @@ -965,73 +1004,60 @@ export function transformTypeScript(context: TransformationContext) { * @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<ModifierLike> | 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: readonly Decorator[] | undefined, parameterOffset: number) { - if (parameterDecorators) { - const decorators: Decorator[] = []; - for (const parameterDecorator of parameterDecorators) { - const expression = visitNode(parameterDecorator.expression, visitor, isExpression); - Debug.assert(expression); - 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<ModifierLike> | 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; } /** @@ -1040,6 +1066,8 @@ export function transformTypeScript(context: TransformationContext) { * @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); @@ -1169,7 +1197,7 @@ export function transformTypeScript(context: TransformationContext) { // 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); Debug.assert(expression); const innerExpression = skipPartiallyEmittedExpressions(expression); @@ -1227,18 +1255,22 @@ export function transformTypeScript(context: TransformationContext) { 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; } - 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<ModifierLike>(decorators, factory.createModifiersFromModifierFlags(ModifierFlags.Ambient)), + concatenate<ModifierLike>(modifiers, factory.createModifiersFromModifierFlags(ModifierFlags.Ambient)), Debug.checkDefined(visitNode(node.name, visitor, isPropertyName)), /*questionOrExclamationToken*/ undefined, /*type*/ undefined, @@ -1248,7 +1280,7 @@ export function transformTypeScript(context: TransformationContext) { return factory.updatePropertyDeclaration( node, - concatenate(decorators, visitNodes(node.modifiers, modifierVisitor, isModifierLike)), + modifiers, visitPropertyNameOfClassElement(node), /*questionOrExclamationToken*/ undefined, /*type*/ undefined, @@ -1382,11 +1414,15 @@ export function transformTypeScript(context: TransformationContext) { 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, @@ -1416,13 +1452,15 @@ export function transformTypeScript(context: TransformationContext) { 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, @@ -1439,13 +1477,15 @@ export function transformTypeScript(context: TransformationContext) { 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([]) @@ -1511,7 +1551,7 @@ export function transformTypeScript(context: TransformationContext) { 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, Debug.checkDefined(visitNode(node.name, visitor, isBindingName)), /*questionToken*/ undefined, @@ -2449,7 +2489,7 @@ export function transformTypeScript(context: TransformationContext) { && 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) @@ -2458,7 +2498,11 @@ export function transformTypeScript(context: TransformationContext) { 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/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index 90ef9bffb7f9d..e6fd5c2346b02 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -29,6 +29,7 @@ import { getDecorators, getFirstConstructorWithBody, getNamespaceDeclarationNode, + getNodeForGeneratedName, getNodeId, getOriginalNode, hasDecorators, @@ -47,6 +48,7 @@ import { isDefaultImport, isExpressionStatement, isGeneratedIdentifier, + isGeneratedPrivateIdentifier, isIdentifier, isKeyword, isMethodOrAccessor, @@ -67,6 +69,7 @@ import { Node, NodeArray, parameterIsThisKeyword, + PrivateIdentifier, PrivateIdentifierAccessorDeclaration, PrivateIdentifierAutoAccessorPropertyDeclaration, PrivateIdentifierMethodDeclaration, @@ -78,6 +81,7 @@ import { SuperCall, SyntaxKind, TransformationContext, + UnderscoreEscapedMap, VariableDeclaration, VariableStatement, } from "../_namespaces/ts"; @@ -552,10 +556,13 @@ export function getAllDecoratorsOfClass(node: ClassLikeDeclaration): AllDecorato * * @internal */ -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: @@ -609,7 +616,7 @@ function getAllDecoratorsOfAccessors(accessor: AccessorDeclaration, parent: Clas * * @param method The class method member. */ -function getAllDecoratorsOfMethod(method: MethodDeclaration): AllDecorators | undefined { +function getAllDecoratorsOfMethod(method: MethodDeclaration | AccessorDeclaration): AllDecorators | undefined { if (!method.body) { return undefined; } @@ -637,3 +644,80 @@ function getAllDecoratorsOfProperty(property: PropertyDeclaration): AllDecorator return { decorators }; } + +/** @internal */ +export interface PrivateEnvironment<TData, TEntry> { + readonly data: TData; + + /** + * A mapping of private names to information needed for transformation. + */ + identifiers?: UnderscoreEscapedMap<TEntry>; + + /** + * A mapping of generated private names to information needed for transformation. + */ + generatedIdentifiers?: Map<Node, TEntry>; +} + +/** @internal */ +export interface LexicalEnvironment<in out TEnvData, TPrivateEnvData, TPrivateEntry> { + data: TEnvData; + privateEnv?: PrivateEnvironment<TPrivateEnvData, TPrivateEntry>; + readonly previous: LexicalEnvironment<TEnvData, TPrivateEnvData, TPrivateEntry> | undefined; +} + +/** @internal */ +export function walkUpLexicalEnvironments<TEnvData, TPrivateEnvData, TPrivateEntry, U>( + env: LexicalEnvironment<TEnvData, TPrivateEnvData, TPrivateEntry> | undefined, + cb: (env: LexicalEnvironment<TEnvData, TPrivateEnvData, TPrivateEntry>) => U +): U | undefined { + while (env) { + const result = cb(env); + if (result !== undefined) return result; + env = env.previous; + } +} + +/** @internal */ +export function newPrivateEnvironment<TData, TEntry>(data: TData): PrivateEnvironment<TData, TEntry> { + return { data }; +} + +/** @internal */ +export function getPrivateIdentifier<TData, TEntry>( + privateEnv: PrivateEnvironment<TData, TEntry> | undefined, + name: PrivateIdentifier +) { + return isGeneratedPrivateIdentifier(name) ? + privateEnv?.generatedIdentifiers?.get(getNodeForGeneratedName(name)) : + privateEnv?.identifiers?.get(name.escapedText); +} + +/** @internal */ +export function setPrivateIdentifier<TData, TEntry>( + privateEnv: PrivateEnvironment<TData, TEntry>, + 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); + } +} + +/** @internal */ +export function accessPrivateIdentifier< + TEnvData, + TPrivateEnvData, + TPrivateEntry, +>( + env: LexicalEnvironment<TEnvData, TPrivateEnvData, TPrivateEntry> | undefined, + name: PrivateIdentifier, +) { + return walkUpLexicalEnvironments(env, env => getPrivateIdentifier(env.privateEnv, name)); +} diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 760c2a97170e7..4a8ba0bf0b21e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -550,8 +550,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 @@ -1576,6 +1579,9 @@ export type QuestionToken = PunctuationToken<SyntaxKind.QuestionToken>; export type ExclamationToken = PunctuationToken<SyntaxKind.ExclamationToken>; export type ColonToken = PunctuationToken<SyntaxKind.ColonToken>; export type EqualsToken = PunctuationToken<SyntaxKind.EqualsToken>; +export type AmpersandAmpersandEqualsToken = PunctuationToken<SyntaxKind.AmpersandAmpersandEqualsToken>; +export type BarBarEqualsToken = PunctuationToken<SyntaxKind.BarBarEqualsToken>; +export type QuestionQuestionEqualsToken = PunctuationToken<SyntaxKind.QuestionQuestionEqualsToken>; export type AsteriskToken = PunctuationToken<SyntaxKind.AsteriskToken>; export type EqualsGreaterThanToken = PunctuationToken<SyntaxKind.EqualsGreaterThanToken>; export type PlusToken = PunctuationToken<SyntaxKind.PlusToken>; @@ -1964,8 +1970,7 @@ export interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer readonly initializer: Expression; // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // property assignment cannot have decorators - /** @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; // property assignment cannot have modifiers + /** @internal */ readonly modifiers?: NodeArray<ModifierLike> | 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 } @@ -1980,8 +1985,7 @@ export interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDoc readonly objectAssignmentInitializer?: Expression; // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // shorthand property assignment cannot have decorators - /** @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; // shorthand property assignment cannot have modifiers + /** @internal */ readonly modifiers?: NodeArray<ModifierLike> | 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 } @@ -2053,12 +2057,9 @@ export type FunctionLike = SignatureDeclaration; export interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement, LocalsContainer { readonly kind: SyntaxKind.FunctionDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name?: Identifier; readonly body?: FunctionBody; - - // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // functions cannot have decorators } export interface MethodSignature extends SignatureDeclarationBase, TypeElement, LocalsContainer { @@ -2091,11 +2092,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<Modifier> | undefined; + readonly modifiers?: NodeArray<ModifierLike> | undefined; readonly body?: FunctionBody | undefined; // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; // A constructor cannot have decorators /** @internal */ readonly typeParameters?: NodeArray<TypeParameterDeclaration>; // A constructor cannot have type parameters /** @internal */ readonly type?: TypeNode; // A constructor cannot have a return type annotation } @@ -2138,11 +2138,8 @@ export type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaratio export interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement, LocalsContainer { readonly kind: SyntaxKind.IndexSignature; readonly parent: ObjectTypeDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly type: TypeNode; - - // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; } export interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer, LocalsContainer { @@ -2154,8 +2151,7 @@ export interface ClassStaticBlockDeclaration extends ClassElement, JSDocContaine /** @internal */ returnFlowNode?: FlowNode; // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; - /** @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; + /** @internal */ readonly modifiers?: NodeArray<ModifierLike> | undefined; } export interface TypeNode extends Node { @@ -2677,12 +2673,13 @@ export type BindingOrAssignmentElement = export type ObjectBindingOrAssignmentElement = | BindingElement | PropertyAssignment // AssignmentProperty - // AssignmentProperty | ShorthandPropertyAssignment // AssignmentProperty - // AssignmentProperty | SpreadAssignment // AssignmentRestProperty ; +/** @internal */ +export type ObjectAssignmentElement = Exclude<ObjectBindingOrAssignmentElement, BindingElement>; + export type ArrayBindingOrAssignmentElement = | BindingElement | OmittedExpression // Elision @@ -2691,11 +2688,13 @@ export type ArrayBindingOrAssignmentElement = | ObjectLiteralExpression // ObjectAssignmentPattern | AssignmentExpression<EqualsToken> // AssignmentElement | Identifier // DestructuringAssignmentTarget - // DestructuringAssignmentTarget | PropertyAccessExpression // DestructuringAssignmentTarget | ElementAccessExpression // DestructuringAssignmentTarget ; +/** @internal */ +export type ArrayAssignmentElement = Exclude<ArrayBindingOrAssignmentElement, BindingElement>; + export type BindingOrAssignmentElementRestIndicator = | DotDotDotToken // from BindingElement | SpreadElement // AssignmentRestElement @@ -2709,6 +2708,9 @@ export type BindingOrAssignmentElementTarget = | ElementAccessExpression | OmittedExpression; +/** @internal */ +export type AssignmentElementTarget = Exclude<BindingOrAssignmentElementTarget, BindingPattern>; + export type ObjectBindingOrAssignmentPattern = | ObjectBindingPattern | ObjectLiteralExpression // ObjectAssignmentPattern @@ -3314,13 +3316,12 @@ export interface DebuggerStatement extends Statement, FlowContainer { readonly kind: SyntaxKind.DebuggerStatement; } -export interface MissingDeclaration extends DeclarationStatement { +export interface MissingDeclaration extends DeclarationStatement, PrimaryExpression { readonly kind: SyntaxKind.MissingDeclaration; readonly name?: Identifier; // The following properties are used only to report grammar errors - /** @internal */ illegalDecorators?: NodeArray<Decorator> | undefined; - /** @internal */ modifiers?: NodeArray<Modifier> | undefined; + /** @internal */ readonly modifiers?: NodeArray<ModifierLike> | undefined; } export type BlockLike = @@ -3338,11 +3339,8 @@ export interface Block extends Statement, LocalsContainer { export interface VariableStatement extends Statement, FlowContainer { readonly kind: SyntaxKind.VariableStatement; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly declarationList: VariableDeclarationList; - - // The following properties are used only to report grammar errors - /** @internal */ illegalDecorators?: NodeArray<Decorator> | undefined; } export interface ExpressionStatement extends Statement, FlowContainer { @@ -3549,14 +3547,11 @@ export interface TypeElement extends NamedDeclaration { export interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.InterfaceDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly typeParameters?: NodeArray<TypeParameterDeclaration>; readonly heritageClauses?: NodeArray<HeritageClause>; readonly members: NodeArray<TypeElement>; - - // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; } export interface HeritageClause extends Node { @@ -3568,13 +3563,10 @@ export interface HeritageClause extends Node { export interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.TypeAliasDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly typeParameters?: NodeArray<TypeParameterDeclaration>; readonly type: TypeNode; - - // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; } export interface EnumMember extends NamedDeclaration, JSDocContainer { @@ -3588,12 +3580,9 @@ export interface EnumMember extends NamedDeclaration, JSDocContainer { export interface EnumDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.EnumDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly members: NodeArray<EnumMember>; - - // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; } export type ModuleName = @@ -3614,12 +3603,9 @@ export interface AmbientModuleDeclaration extends ModuleDeclaration { export interface ModuleDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.ModuleDeclaration; readonly parent: ModuleBody | SourceFile; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: ModuleName; readonly body?: ModuleBody | JSDocNamespaceDeclaration; - - // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; } export type NamespaceBody = @@ -3661,16 +3647,13 @@ export type ModuleReference = export interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ImportEqualsDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; 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 illegalDecorators?: NodeArray<Decorator> | undefined; } export interface ExternalModuleReference extends Node { @@ -3686,14 +3669,11 @@ export interface ExternalModuleReference extends Node { export interface ImportDeclaration extends Statement { readonly kind: SyntaxKind.ImportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; 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 illegalDecorators?: NodeArray<Decorator> | undefined; } export type NamedImportBindings = @@ -3753,23 +3733,19 @@ export interface NamespaceExportDeclaration extends DeclarationStatement, JSDocC readonly name: Identifier; // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; - /** @internal */ readonly modifiers?: NodeArray<Modifier> | undefined; + /** @internal */ readonly modifiers?: NodeArray<ModifierLike> | undefined; } export interface ExportDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; 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 illegalDecorators?: NodeArray<Decorator> | undefined; } export interface NamedImports extends Node { @@ -3829,12 +3805,9 @@ export type TypeOnlyAliasDeclaration = export interface ExportAssignment extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportAssignment; readonly parent: SourceFile; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly isExportEquals?: boolean; readonly expression: Expression; - - // The following properties are used only to report grammar errors - /** @internal */ readonly illegalDecorators?: NodeArray<Decorator> | undefined; } export interface FileReference extends TextRange { @@ -5990,6 +5963,7 @@ export interface NodeLinks { 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?: Map<string, SerializedTypeEntry>; // Collection of types serialized at this location + decoratorSignature?: Signature; // Signature for decorator as if invoked by the runtime. } /** @internal */ @@ -7828,6 +7802,7 @@ export interface SourceMapSource { 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 @@ -7840,6 +7815,7 @@ export interface EmitNode { startsOnNewLine?: boolean; // If the node should begin on a new line snippetElement?: SnippetElement; // Snippet element of the node typeNode?: TypeNode; // VariableDeclaration type + classThis?: Identifier; // Identifier that points to the final class constructor after decorators are applied identifierTypeArguments?: NodeArray<TypeNode | TypeParameterDeclaration>; // Only defined on synthesized identifiers. Though not syntactically valid, used in emitting diagnostics, quickinfo, and signature help. autoGenerate: AutoGenerateInfo | undefined; // Used for auto-generated identifiers and private identifiers. generatedImportReference?: ImportSpecifier; // Reference to the generated import specifier this identifier refers to @@ -7900,11 +7876,17 @@ export const enum EmitFlags { HasEndOfDeclarationMarker = 1 << 23, // Declaration has an associated NotEmittedStatement to mark the end of the declaration Iterator = 1 << 24, // The expression to a `yield*` should be treated as an Iterator when down-leveling, not an Iterable. NoAsciiEscaping = 1 << 25, // 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 << 26, // The node is an IIFE class wrapper created by the ts transform. - /** @internal */ NeverApplyImportHelper = 1 << 27, // Indicates the node should never be wrapped with an import star helper (because, for example, it imports tslib itself) - /** @internal */ IgnoreSourceNewlines = 1 << 28, // Overrides `printerOptions.preserveSourceNewlines` to print this node (and all descendants) with default whitespace. - /** @internal */ Immutable = 1 << 29, // 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 << 30, // 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 { @@ -7944,6 +7926,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) @@ -7963,8 +7946,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) + 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 = CreateBinding, + LastEmitHelper = PropKey, // Helpers included by ES2015 for..of ForOfIncludes = Values, @@ -8054,6 +8040,12 @@ export type OuterExpression = | NonNullExpression | PartiallyEmittedExpression; +/** @internal */ +export type WrappedExpression<T extends Expression> = + | OuterExpression & { readonly expression: WrappedExpression<T> } + | T + ; + export type TypeOfTag = "undefined" | "number" | "bigint" | "boolean" | "string" | "symbol" | "object" | "function"; /** @internal */ @@ -8243,8 +8235,8 @@ export interface NodeFactory { updateMethodSignature(node: MethodSignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, 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; @@ -8253,9 +8245,9 @@ export interface NodeFactory { updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): CallSignatureDeclaration; createConstructSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, 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; @@ -8419,8 +8411,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; @@ -8461,24 +8453,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<AssertEntry>, multiLine?: boolean): AssertClause; @@ -8495,10 +8487,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; @@ -8754,6 +8746,7 @@ export interface NodeFactory { /** @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; @@ -8777,7 +8770,7 @@ export interface NodeFactory { * * @internal */ - createAssignmentTargetWrapper(paramName: Identifier, expression: Expression): LeftHandSideExpression; + createAssignmentTargetWrapper(paramName: Identifier, expression: Expression): PropertyAccessExpression; /** @internal */ inlineExpressions(expressions: readonly Expression[]): Expression; /** * Gets the internal name of a declaration. This is primarily used for declarations that can be diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index dd6376699cb2f..033a0f7b41938 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7,6 +7,7 @@ import { affectsEmitOptionDeclarations, AllAccessorDeclarations, AmbientModuleDeclaration, + AmpersandAmpersandEqualsToken, AnyImportOrBareOrAccessedRequire, AnyImportOrReExport, AnyImportSyntax, @@ -22,6 +23,7 @@ import { AssignmentDeclarationKind, AssignmentExpression, AssignmentOperatorToken, + BarBarEqualsToken, BinaryExpression, binarySearch, BindableObjectDefinePropertyCall, @@ -37,7 +39,6 @@ import { CallLikeExpression, CallSignatureDeclaration, canHaveDecorators, - canHaveIllegalDecorators, canHaveModifiers, CaseBlock, CaseClause, @@ -48,6 +49,7 @@ import { CheckFlags, ClassDeclaration, ClassElement, + ClassExpression, ClassLikeDeclaration, ClassStaticBlockDeclaration, combinePaths, @@ -224,6 +226,7 @@ import { InitializedVariableDeclaration, insertSorted, InterfaceDeclaration, + InternalEmitFlags, isAccessor, isAnyDirectorySeparator, isArray, @@ -292,6 +295,7 @@ import { isLiteralTypeNode, isMemberName, isMetaProperty, + isMethodDeclaration, isMethodOrAccessor, isModuleDeclaration, isNamedDeclaration, @@ -431,6 +435,7 @@ import { PropertySignature, PseudoBigInt, QualifiedName, + QuestionQuestionEqualsToken, ReadonlyCollection, ReadonlyTextRange, removeTrailingDirectorySeparator, @@ -532,6 +537,7 @@ import { version, WhileStatement, WithStatement, + WrappedExpression, WriteFileCallback, WriteFileCallbackData, YieldExpression, @@ -1175,6 +1181,16 @@ export function getEmitFlags(node: Node): EmitFlags { return emitNode && emitNode.flags || 0; } +/** + * Gets flags that control emit behavior of a node. + * + * @internal + */ +export function getInternalEmitFlags(node: Node): InternalEmitFlags { + const emitNode = node.emitNode; + return emitNode && emitNode.internalFlags || 0; +} + /** @internal */ export interface ScriptTargetFeatures { [key: string]: { [key: string]: string[] | undefined }; @@ -1721,6 +1737,12 @@ export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain return createFileDiagnosticFromMessageChain(sourceFile, span.start, span.length, messageChain, relatedInformation); } +/** @internal */ +export function createDiagnosticForNodeArrayFromMessageChain(sourceFile: SourceFile, nodes: NodeArray<Node>, 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); @@ -2690,91 +2712,151 @@ export function getInvokedExpression(node: CallLikeExpression): Expression { } /** @internal */ -export function nodeCanBeDecorated(node: ClassDeclaration): true; +export function nodeCanBeDecorated(useLegacyDecorators: boolean, node: ClassDeclaration): true; +/** @internal */ +export function nodeCanBeDecorated(useLegacyDecorators: boolean, node: ClassExpression): boolean; /** @internal */ -export function nodeCanBeDecorated(node: ClassElement, parent: Node): boolean; +export function nodeCanBeDecorated(useLegacyDecorators: boolean, node: ClassElement, parent: Node): boolean; /** @internal */ -export function nodeCanBeDecorated(node: Node, parent: Node, grandparent: Node): boolean; +export function nodeCanBeDecorated(useLegacyDecorators: boolean, node: Node, parent: Node, grandparent: Node): boolean; /** @internal */ -export function nodeCanBeDecorated(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) && !hasAbstractModifier(node) && !hasAmbientModifier(node)); 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; - return (parent as FunctionLikeDeclaration).body !== undefined - && (parent!.kind === SyntaxKind.Constructor - || parent!.kind === SyntaxKind.MethodDeclaration - || parent!.kind === SyntaxKind.SetAccessor) - && grandparent!.kind === SyntaxKind.ClassDeclaration; + // TODO(rbuckton): Parameter decorator support for ES decorators must 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 !== 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; } return false; } /** @internal */ -export function nodeIsDecorated(node: ClassDeclaration): boolean; +export function nodeIsDecorated(useLegacyDecorators: boolean, node: ClassDeclaration | ClassExpression): boolean; /** @internal */ -export function nodeIsDecorated(node: ClassElement, parent: Node): boolean; +export function nodeIsDecorated(useLegacyDecorators: boolean, node: ClassElement, parent: Node): boolean; /** @internal */ -export function nodeIsDecorated(node: Node, parent: Node, grandparent: Node): boolean; +export function nodeIsDecorated(useLegacyDecorators: boolean, node: Node, parent: Node, grandparent: Node): boolean; /** @internal */ -export function nodeIsDecorated(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!); } /** @internal */ -export function nodeOrChildIsDecorated(node: ClassDeclaration): boolean; +export function nodeOrChildIsDecorated(useLegacyDecorators: boolean, node: ClassDeclaration | ClassExpression): boolean; /** @internal */ -export function nodeOrChildIsDecorated(node: ClassElement, parent: Node): boolean; +export function nodeOrChildIsDecorated(useLegacyDecorators: boolean, node: ClassElement, parent: Node): boolean; /** @internal */ -export function nodeOrChildIsDecorated(node: Node, parent: Node, grandparent: Node): boolean; +export function nodeOrChildIsDecorated(useLegacyDecorators: boolean, node: Node, parent: Node, grandparent: Node): boolean; /** @internal */ -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: Node, parent?: Node, grandparent?: Node): boolean { + return nodeIsDecorated(useLegacyDecorators, node, parent!, grandparent!) + || childIsDecorated(useLegacyDecorators, node, parent!); } /** @internal */ -export function childIsDecorated(node: ClassDeclaration): boolean; +export function childIsDecorated(useLegacyDecorators: boolean, node: ClassDeclaration | ClassExpression): boolean; /** @internal */ -export function childIsDecorated(node: Node, parent: Node): boolean; +export function childIsDecorated(useLegacyDecorators: boolean, node: Node, parent: Node): boolean; /** @internal */ -export function childIsDecorated(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; } } /** @internal */ -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); +} + +/** @internal */ +export function classElementOrClassElementParameterIsDecorated(useLegacyDecorators: boolean, node: ClassElement, parent: ClassDeclaration | ClassExpression): boolean { + let parameters: NodeArray<ParameterDeclaration> | 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; +} + +/** @internal */ +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 === ""; } /** @internal */ @@ -4526,6 +4608,127 @@ export function isESSymbolIdentifier(node: Node): boolean { 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. + * + * @internal + */ +export function isProtoSetter(node: PropertyName) { + return isIdentifier(node) ? idText(node) === "__proto__" : + 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<AnonymousFunctionDefinition> { + 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<EqualsToken | AmpersandAmpersandEqualsToken | BarBarEqualsToken | QuestionQuestionEqualsToken> & { 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<AnonymousFunctionDefinition> } + | ShorthandPropertyAssignment & { readonly objectAssignmentInitializer: WrappedExpression<AnonymousFunctionDefinition> } + | VariableDeclaration & { readonly name: Identifier, readonly initializer: WrappedExpression<AnonymousFunctionDefinition> } + | ParameterDeclaration & { readonly name: Identifier, readonly dotDotDotToken: undefined, readonly initializer: WrappedExpression<AnonymousFunctionDefinition> } + | BindingElement & { readonly name: Identifier, readonly dotDotDotToken: undefined, readonly initializer: WrappedExpression<AnonymousFunctionDefinition> } + | PropertyDeclaration & { readonly initializer: WrappedExpression<AnonymousFunctionDefinition> } + | AssignmentExpression<EqualsToken | AmpersandAmpersandEqualsToken | BarBarEqualsToken | QuestionQuestionEqualsToken> & { readonly left: Identifier, readonly right: WrappedExpression<AnonymousFunctionDefinition> } + | ExportAssignment & { readonly expression: WrappedExpression<AnonymousFunctionDefinition> } + ; + +/** @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"; @@ -6716,6 +6919,10 @@ export function moveRangePastDecorators(node: Node): TextRange { * @internal */ 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) @@ -9241,7 +9448,6 @@ export function getContainingNodeArray(node: Node): NodeArray<Node> | undefined case SyntaxKind.Decorator: { const { parent } = node as Decorator; return canHaveDecorators(parent) ? parent.modifiers : - canHaveIllegalDecorators(parent) ? parent.illegalDecorators : undefined; } case SyntaxKind.HeritageClause: diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index da47384f21edd..0aeccfe090146 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -537,8 +537,9 @@ 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 { @@ -1947,6 +1948,7 @@ function isLeftHandSideExpressionKind(kind: SyntaxKind): boolean { 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 67e9dc5965954..9e3dee9440586 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -563,6 +563,25 @@ export function visitIterationBody(body: Statement, visitor: Visitor, context: T 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<Expression>, visitor: Visitor, discardVisitor = visitor): NodeArray<Expression> { + 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. * @@ -687,7 +706,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)); }, @@ -732,7 +751,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, isParameter), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))); }, @@ -1118,7 +1137,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), Debug.checkDefined(nodeVisitor(node.declarationList, visitor, isVariableDeclarationList))); }, @@ -1249,7 +1268,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), Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, isHeritageClause), @@ -1258,7 +1277,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), Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)), nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))); @@ -1266,14 +1285,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), Debug.checkDefined(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), Debug.checkDefined(nodeVisitor(node.name, visitor, isModuleName)), nodeVisitor(node.body, visitor, isModuleBody)); }, @@ -1295,7 +1314,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, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)), Debug.checkDefined(nodeVisitor(node.moduleReference, visitor, isModuleReference))); @@ -1303,7 +1322,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), Debug.checkDefined(nodeVisitor(node.moduleSpecifier, visitor, isExpression)), nodeVisitor(node.assertClause, visitor, isAssertClause)); @@ -1352,13 +1371,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), Debug.checkDefined(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<Modifier> | undefined; + readonly modifiers?: NodeArray<ModifierLike> | 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/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 15d42ad6b960f..2ad9711d2a148 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1174,6 +1174,16 @@ export namespace Completion { typeEntry("PropertyDecorator"), typeEntry("MethodDecorator"), typeEntry("ParameterDecorator"), + typeEntry("ClassMemberDecoratorContext"), + typeEntry("DecoratorContext"), + interfaceEntry("ClassDecoratorContext"), + interfaceEntry("ClassMethodDecoratorContext"), + interfaceEntry("ClassGetterDecoratorContext"), + interfaceEntry("ClassSetterDecoratorContext"), + interfaceEntry("ClassAccessorDecoratorContext"), + interfaceEntry("ClassAccessorDecoratorTarget"), + interfaceEntry("ClassAccessorDecoratorResult"), + interfaceEntry("ClassFieldDecoratorContext"), 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..41d4956666550 --- /dev/null +++ b/src/lib/decorators.d.ts @@ -0,0 +1,337 @@ +/** + * The decorator context types provided to class member decorators. + */ +type ClassMemberDecoratorContext = + | ClassMethodDecoratorContext + | ClassGetterDecoratorContext + | ClassSetterDecoratorContext + | ClassFieldDecoratorContext + | ClassAccessorDecoratorContext + ; + +/** + * The decorator context types provided to any decorator. + */ +type DecoratorContext = + | ClassDecoratorContext + | ClassMemberDecoratorContext + ; + +/** + * 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, +> { + /** The kind of element that was decorated. */ + readonly kind: "class"; + + /** The name of the decorated 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, context) => { + * context.addInitializer(function () { + * customElements.define(name, this); + * }); + * } + * } + * + * @customElement("my-element") + * class MyElement {} + * ``` + */ + addInitializer(initializer: (this: Class) => void): 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, + 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; + + // 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 + * decorating a `static` member), or before instance initializers are run (when + * decorating a non-`static` member). + * + * @example + * ```ts + * 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); + * }); + * } + * + * class C { + * message = "Hello"; + * + * @bound + * m() { + * console.log(this.message); + * } + * } + * ``` + */ + addInitializer(initializer: (this: This) => void): 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 + * 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, + 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; + + // 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 + * decorating a `static` member), or before instance initializers are run (when + * decorating a non-`static` member). + */ + addInitializer(initializer: (this: This) => void): 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 + * 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, + 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; + + // 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; + // }; + + /** + * 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; +} + +/** + * 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, + 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; + + // 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 + * decorating a `static` member), or before instance initializers are run (when + * decorating a non-`static` member). + */ + addInitializer(initializer: (this: This) => void): void; +} + +/** + * 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<This, Value> { + /** + * 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; +} + +/** + * 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<This, Value> { + /** + * 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; +} + +/** + * 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, + 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; + + // 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 + * decorating a `static` member), or before instance initializers are run (when + * decorating a non-`static` member). + */ + addInitializer(initializer: (this: This) => void): 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 = <TFunction extends Function>(target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 9ed6d1c8a0c56..a74b3cb4c2111 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1,3 +1,6 @@ +/// <reference lib="decorators" /> +/// <reference lib="decorators.legacy" /> + ///////////////////////////// /// ECMAScript APIs ///////////////////////////// @@ -1483,11 +1486,6 @@ interface TypedPropertyDescriptor<T> { set?: (value: T) => void; } -declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - declare type PromiseConstructorLike = new <T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) => PromiseLike<T>; interface PromiseLike<T> { diff --git a/src/lib/libs.json b/src/lib/libs.json index 0780efe237d71..82ba97aa35fb8 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -66,6 +66,8 @@ "es2022.regexp", "es2023.array", "esnext.intl", + "decorators", + "decorators.legacy", // Default libraries "es5.full", "es2015.full", 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/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/tests.ts b/src/testRunner/tests.ts index aa8817e7cd049..f014bae90da21 100644 --- a/src/testRunner/tests.ts +++ b/src/testRunner/tests.ts @@ -36,6 +36,7 @@ import "./unittests/evaluation/autoAccessors"; import "./unittests/evaluation/awaiter"; import "./unittests/evaluation/destructuring"; import "./unittests/evaluation/externalModules"; +import "./unittests/evaluation/esDecorators"; import "./unittests/evaluation/forAwaitOf"; import "./unittests/evaluation/forOf"; import "./unittests/evaluation/generator"; diff --git a/src/testRunner/unittests/evaluation/esDecorators.ts b/src/testRunner/unittests/evaluation/esDecorators.ts new file mode 100644 index 0000000000000..1863e9426517e --- /dev/null +++ b/src/testRunner/unittests/evaluation/esDecorators.ts @@ -0,0 +1,2291 @@ +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 }; + 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); + }); + }); + }); + // 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` + 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("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", () => { + 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("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; } + 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")); + }); + }); + }); + + const nodeVersion = ts.Version.tryParse(process.version); + const supportsClassStaticBlock = nodeVersion && nodeVersion.major >= 16; + + 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 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 (${targetName})`, () => { + 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 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"); + + [(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 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"); + 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 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"); + 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", + "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: + "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 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, 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, 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 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" + ]); + }); + + 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<T extends abstract new (...args: any) => any>(target: T, context: ClassDecoratorContext<T>): T | void; + function logged<This, T extends (this: This, ...args: any) => any>(target: T, context: ClassMethodDecoratorContext<This, T>): T | void; + function logged<This, T>(target: (this: This) => T, context: ClassGetterDecoratorContext<This, T>): (this: This) => T; + function logged<This, T>(target: (this: This, value: T) => void, context: ClassSetterDecoratorContext<This, T>): (this: This, value: T) => void; + function logged<This, T>(target: ClassAccessorDecoratorTarget<This, T>, context: ClassAccessorDecoratorContext<This, T>): ClassAccessorDecoratorResult<This, T> | 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<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never; + type Method<This, A extends any[], T> = (this: This, ...args: A) => T; + + function bound<This, A extends any[], T, K extends MatchingKeys<This, Method<This, A, T>>>( + target: Method<This, A, T>, + { addInitializer, name }: Omit<ClassMethodDecoratorContext<This, Method<This, A, T>>, "name"> & { name: K, private: false } + ): void { + addInitializer(function (this: This) { + const method = this[name] as Method<This, A, T>; + const boundMethod = method.bind(this) as Method<undefined, A, T>; + 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 + // 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<object, { injectionKey: string, set: (this: any, value: any) => void }[]>(); + + function createInjections() { + const injections: { injectionKey: string, set: (this: any, value: any) => void }[] = []; + + function injectable<T extends new (...args: any) => any>(Class: T, context: ClassDecoratorContext<T>) { + INJECTIONS.set(Class, injections); + } + + function inject(injectionKey: string) { + return function applyInjection(v: undefined, context: ClassFieldDecoratorContext<any, any>) { + 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<T extends new (...args: any) => 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/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/src/testRunner/unittests/transform.ts b/src/testRunner/unittests/transform.ts index 4087553e46900..89331f93c4242 100644 --- a/src/testRunner/unittests/transform.ts +++ b/src/testRunner/unittests/transform.ts @@ -4,6 +4,7 @@ import * as evaluator from "../_namespaces/evaluator"; import * as vfs from "../_namespaces/vfs"; import * as documents from "../_namespaces/documents"; import * as fakes from "../_namespaces/fakes"; +import { NewLineKind, ScriptTarget, transpileModule } from "../_namespaces/ts"; describe("unittests:: TransformAPI", () => { function replaceUndefinedWithVoid0(context: ts.TransformationContext) { @@ -328,13 +329,14 @@ describe("unittests:: TransformAPI", () => { // https://github.com/Microsoft/TypeScript/issues/17384 testBaseline("transformAddDecoratedNode", () => { - return ts.transpileModule("", { + return transpileModule("", { transformers: { before: [transformAddDecoratedNode], }, compilerOptions: { - target: ts.ScriptTarget.ES5, - newLine: ts.NewLineKind.CarriageReturnLineFeed, + target: ScriptTarget.ES5, + experimentalDecorators: true, + newLine: NewLineKind.CarriageReturnLineFeed, } }).outputText; @@ -366,13 +368,14 @@ describe("unittests:: TransformAPI", () => { // https://github.com/microsoft/TypeScript/issues/33295 testBaseline("transformParameterProperty", () => { - return ts.transpileModule("", { + return transpileModule("", { transformers: { before: [transformAddParameterProperty], }, compilerOptions: { - target: ts.ScriptTarget.ES5, - newLine: ts.NewLineKind.CarriageReturnLineFeed, + target: ScriptTarget.ES5, + newLine: NewLineKind.CarriageReturnLineFeed, + experimentalDecorators: true, } }).outputText; @@ -643,8 +646,9 @@ class MyClass { before: [addStaticFieldWithComment], }, compilerOptions: { - target: ts.ScriptTarget.ES2015, - newLine: ts.NewLineKind.CarriageReturnLineFeed, + target: ScriptTarget.ES2015, + experimentalDecorators: true, + newLine: NewLineKind.CarriageReturnLineFeed, } }).outputText; }); @@ -658,8 +662,9 @@ const MyClass = class { before: [addStaticFieldWithComment], }, compilerOptions: { - target: ts.ScriptTarget.ES2015, - newLine: ts.NewLineKind.CarriageReturnLineFeed, + target: ScriptTarget.ES2015, + experimentalDecorators: true, + newLine: NewLineKind.CarriageReturnLineFeed, } }).outputText; }); diff --git a/tests/baselines/reference/amdImportNotAsPrimaryExpression.js b/tests/baselines/reference/amdImportNotAsPrimaryExpression.js index 43c36d331d292..a559a89d7da73 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"; Object.defineProperty(exports, "__esModule", { value: 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/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 35d7f3eab8a10..ca7b3306f5f44 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4385,7 +4385,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; @@ -4537,6 +4537,9 @@ declare namespace ts { type ExclamationToken = PunctuationToken<SyntaxKind.ExclamationToken>; type ColonToken = PunctuationToken<SyntaxKind.ColonToken>; type EqualsToken = PunctuationToken<SyntaxKind.EqualsToken>; + type AmpersandAmpersandEqualsToken = PunctuationToken<SyntaxKind.AmpersandAmpersandEqualsToken>; + type BarBarEqualsToken = PunctuationToken<SyntaxKind.BarBarEqualsToken>; + type QuestionQuestionEqualsToken = PunctuationToken<SyntaxKind.QuestionQuestionEqualsToken>; type AsteriskToken = PunctuationToken<SyntaxKind.AsteriskToken>; type EqualsGreaterThanToken = PunctuationToken<SyntaxKind.EqualsGreaterThanToken>; type PlusToken = PunctuationToken<SyntaxKind.PlusToken>; @@ -4747,7 +4750,7 @@ declare namespace ts { } interface ShorthandPropertyAssignment { /** @deprecated A shorthand property assignment cannot have modifiers */ - readonly modifiers?: NodeArray<Modifier> | undefined; + readonly modifiers?: NodeArray<ModifierLike> | 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 */ @@ -4791,7 +4794,7 @@ declare namespace ts { type FunctionLike = SignatureDeclaration; interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement, LocalsContainer { readonly kind: SyntaxKind.FunctionDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name?: Identifier; readonly body?: FunctionBody; } @@ -4811,7 +4814,7 @@ declare namespace ts { interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.Constructor; readonly parent: ClassLikeDeclaration; - readonly modifiers?: NodeArray<Modifier> | undefined; + readonly modifiers?: NodeArray<ModifierLike> | undefined; readonly body?: FunctionBody | undefined; } /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ @@ -4837,7 +4840,7 @@ declare namespace ts { interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement, LocalsContainer { readonly kind: SyntaxKind.IndexSignature; readonly parent: ObjectTypeDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly type: TypeNode; } interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer, LocalsContainer { @@ -5420,7 +5423,7 @@ declare namespace ts { interface DebuggerStatement extends Statement, FlowContainer { readonly kind: SyntaxKind.DebuggerStatement; } - interface MissingDeclaration extends DeclarationStatement { + interface MissingDeclaration extends DeclarationStatement, PrimaryExpression { readonly kind: SyntaxKind.MissingDeclaration; readonly name?: Identifier; } @@ -5431,7 +5434,7 @@ declare namespace ts { } interface VariableStatement extends Statement, FlowContainer { readonly kind: SyntaxKind.VariableStatement; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly declarationList: VariableDeclarationList; } interface ExpressionStatement extends Statement, FlowContainer { @@ -5568,7 +5571,7 @@ declare namespace ts { } interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.InterfaceDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly typeParameters?: NodeArray<TypeParameterDeclaration>; readonly heritageClauses?: NodeArray<HeritageClause>; @@ -5582,7 +5585,7 @@ declare namespace ts { } interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.TypeAliasDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly typeParameters?: NodeArray<TypeParameterDeclaration>; readonly type: TypeNode; @@ -5595,7 +5598,7 @@ declare namespace ts { } interface EnumDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.EnumDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly members: NodeArray<EnumMember>; } @@ -5604,7 +5607,7 @@ declare namespace ts { interface ModuleDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.ModuleDeclaration; readonly parent: ModuleBody | SourceFile; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: ModuleName; readonly body?: ModuleBody | JSDocNamespaceDeclaration; } @@ -5632,7 +5635,7 @@ declare namespace ts { interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ImportEqualsDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly isTypeOnly: boolean; readonly moduleReference: ModuleReference; @@ -5645,7 +5648,7 @@ declare namespace ts { interface ImportDeclaration extends Statement { readonly kind: SyntaxKind.ImportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly importClause?: ImportClause; /** If this is not a StringLiteral it will be a grammar error. */ readonly moduleSpecifier: Expression; @@ -5690,7 +5693,7 @@ declare namespace ts { interface ExportDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly isTypeOnly: boolean; /** Will not be assigned in the case of `export * from "foo";` */ readonly exportClause?: NamedExportBindings; @@ -5758,7 +5761,7 @@ declare namespace ts { interface ExportAssignment extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportAssignment; readonly parent: SourceFile; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly isExportEquals?: boolean; readonly expression: Expression; } @@ -7525,8 +7528,8 @@ declare namespace ts { updateMethodSignature(node: MethodSignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, 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; @@ -7535,8 +7538,8 @@ declare namespace ts { updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): CallSignatureDeclaration; createConstructSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, 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; @@ -7672,8 +7675,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; @@ -7714,24 +7717,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<AssertEntry>, multiLine?: boolean): AssertClause; @@ -7748,10 +7751,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; @@ -9407,6 +9410,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<Expression>, visitor: Visitor, discardVisitor?: Visitor): NodeArray<Expression>; /** * 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 6c4dd8cf96b43..d7f5fac47b782 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -444,7 +444,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; @@ -596,6 +596,9 @@ declare namespace ts { type ExclamationToken = PunctuationToken<SyntaxKind.ExclamationToken>; type ColonToken = PunctuationToken<SyntaxKind.ColonToken>; type EqualsToken = PunctuationToken<SyntaxKind.EqualsToken>; + type AmpersandAmpersandEqualsToken = PunctuationToken<SyntaxKind.AmpersandAmpersandEqualsToken>; + type BarBarEqualsToken = PunctuationToken<SyntaxKind.BarBarEqualsToken>; + type QuestionQuestionEqualsToken = PunctuationToken<SyntaxKind.QuestionQuestionEqualsToken>; type AsteriskToken = PunctuationToken<SyntaxKind.AsteriskToken>; type EqualsGreaterThanToken = PunctuationToken<SyntaxKind.EqualsGreaterThanToken>; type PlusToken = PunctuationToken<SyntaxKind.PlusToken>; @@ -806,7 +809,7 @@ declare namespace ts { } interface ShorthandPropertyAssignment { /** @deprecated A shorthand property assignment cannot have modifiers */ - readonly modifiers?: NodeArray<Modifier> | undefined; + readonly modifiers?: NodeArray<ModifierLike> | 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 */ @@ -850,7 +853,7 @@ declare namespace ts { type FunctionLike = SignatureDeclaration; interface FunctionDeclaration extends FunctionLikeDeclarationBase, DeclarationStatement, LocalsContainer { readonly kind: SyntaxKind.FunctionDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name?: Identifier; readonly body?: FunctionBody; } @@ -870,7 +873,7 @@ declare namespace ts { interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.Constructor; readonly parent: ClassLikeDeclaration; - readonly modifiers?: NodeArray<Modifier> | undefined; + readonly modifiers?: NodeArray<ModifierLike> | undefined; readonly body?: FunctionBody | undefined; } /** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */ @@ -896,7 +899,7 @@ declare namespace ts { interface IndexSignatureDeclaration extends SignatureDeclarationBase, ClassElement, TypeElement, LocalsContainer { readonly kind: SyntaxKind.IndexSignature; readonly parent: ObjectTypeDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly type: TypeNode; } interface ClassStaticBlockDeclaration extends ClassElement, JSDocContainer, LocalsContainer { @@ -1479,7 +1482,7 @@ declare namespace ts { interface DebuggerStatement extends Statement, FlowContainer { readonly kind: SyntaxKind.DebuggerStatement; } - interface MissingDeclaration extends DeclarationStatement { + interface MissingDeclaration extends DeclarationStatement, PrimaryExpression { readonly kind: SyntaxKind.MissingDeclaration; readonly name?: Identifier; } @@ -1490,7 +1493,7 @@ declare namespace ts { } interface VariableStatement extends Statement, FlowContainer { readonly kind: SyntaxKind.VariableStatement; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly declarationList: VariableDeclarationList; } interface ExpressionStatement extends Statement, FlowContainer { @@ -1627,7 +1630,7 @@ declare namespace ts { } interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.InterfaceDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly typeParameters?: NodeArray<TypeParameterDeclaration>; readonly heritageClauses?: NodeArray<HeritageClause>; @@ -1641,7 +1644,7 @@ declare namespace ts { } interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.TypeAliasDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly typeParameters?: NodeArray<TypeParameterDeclaration>; readonly type: TypeNode; @@ -1654,7 +1657,7 @@ declare namespace ts { } interface EnumDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.EnumDeclaration; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly members: NodeArray<EnumMember>; } @@ -1663,7 +1666,7 @@ declare namespace ts { interface ModuleDeclaration extends DeclarationStatement, JSDocContainer, LocalsContainer { readonly kind: SyntaxKind.ModuleDeclaration; readonly parent: ModuleBody | SourceFile; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: ModuleName; readonly body?: ModuleBody | JSDocNamespaceDeclaration; } @@ -1691,7 +1694,7 @@ declare namespace ts { interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ImportEqualsDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly name: Identifier; readonly isTypeOnly: boolean; readonly moduleReference: ModuleReference; @@ -1704,7 +1707,7 @@ declare namespace ts { interface ImportDeclaration extends Statement { readonly kind: SyntaxKind.ImportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly importClause?: ImportClause; /** If this is not a StringLiteral it will be a grammar error. */ readonly moduleSpecifier: Expression; @@ -1749,7 +1752,7 @@ declare namespace ts { interface ExportDeclaration extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportDeclaration; readonly parent: SourceFile | ModuleBlock; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly isTypeOnly: boolean; /** Will not be assigned in the case of `export * from "foo";` */ readonly exportClause?: NamedExportBindings; @@ -1817,7 +1820,7 @@ declare namespace ts { interface ExportAssignment extends DeclarationStatement, JSDocContainer { readonly kind: SyntaxKind.ExportAssignment; readonly parent: SourceFile; - readonly modifiers?: NodeArray<Modifier>; + readonly modifiers?: NodeArray<ModifierLike>; readonly isExportEquals?: boolean; readonly expression: Expression; } @@ -3584,8 +3587,8 @@ declare namespace ts { updateMethodSignature(node: MethodSignature, modifiers: readonly Modifier[] | undefined, name: PropertyName, questionToken: QuestionToken | undefined, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, 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; @@ -3594,8 +3597,8 @@ declare namespace ts { updateCallSignature(node: CallSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, type: TypeNode | undefined): CallSignatureDeclaration; createConstructSignature(typeParameters: readonly TypeParameterDeclaration[] | undefined, parameters: readonly ParameterDeclaration[], type: TypeNode | undefined): ConstructSignatureDeclaration; updateConstructSignature(node: ConstructSignatureDeclaration, typeParameters: NodeArray<TypeParameterDeclaration> | undefined, parameters: NodeArray<ParameterDeclaration>, 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; @@ -3731,8 +3734,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; @@ -3773,24 +3776,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<AssertEntry>, multiLine?: boolean): AssertClause; @@ -3807,10 +3810,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; @@ -5466,6 +5469,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<Expression>, visitor: Visitor, discardVisitor?: Visitor): NodeArray<Expression>; /** * 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/autoAccessor5(target=es2015).js b/tests/baselines/reference/autoAccessor5(target=es2015).js index a7394e4d18c8a..6f204b8217dcf 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2015).js +++ b/tests/baselines/reference/autoAccessor5(target=es2015).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 f5022161cea00..f79577e076791 100644 --- a/tests/baselines/reference/autoAccessor5(target=es2022).js +++ b/tests/baselines/reference/autoAccessor5(target=es2022).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/blockScopedVariablesUseBeforeDef.js b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js index 8ddcf18df29ac..0190553561270 100644 --- a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js @@ -173,6 +173,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; +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 foo0() { var a = x; var x; @@ -238,6 +242,7 @@ function foo9() { } return class_2; }()), + __setFunctionName(_a, "y"), _a.a = x, _a); var x; @@ -259,6 +264,7 @@ function foo11() { } return class_3; }()), + __setFunctionName(_a, "y"), _a.a = x, _a); } 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/checkIndexConstraintOfJavascriptClassExpression.errors.txt b/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt index 2a99b34bf064e..a8067965c68f0 100644 --- a/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt +++ b/tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.errors.txt @@ -9,7 +9,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/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..f9ea77a2e9702 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, 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() { 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..5367bf93d89cc 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, 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() { 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/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/commonJSImportAsPrimaryExpression.js b/tests/baselines/reference/commonJSImportAsPrimaryExpression.js index a02e7388fbfa8..566de077611a7 100644 --- a/tests/baselines/reference/commonJSImportAsPrimaryExpression.js +++ b/tests/baselines/reference/commonJSImportAsPrimaryExpression.js @@ -17,14 +17,13 @@ if(foo.C1.s1){ "use strict"; Object.defineProperty(exports, "__esModule", { value: 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"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js index 7ef8a6e2e8858..defd792f3947a 100644 --- a/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js +++ b/tests/baselines/reference/commonJSImportNotAsPrimaryExpression.js @@ -35,14 +35,13 @@ var e: number = <foo.E1>0; "use strict"; Object.defineProperty(exports, "__esModule", { value: 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/completionsStringMethods.baseline b/tests/baselines/reference/completionsStringMethods.baseline index d40c12a3539b0..1bea1679c2efa 100644 --- a/tests/baselines/reference/completionsStringMethods.baseline +++ b/tests/baselines/reference/completionsStringMethods.baseline @@ -1078,7 +1078,7 @@ "target": { "fileName": "lib.d.ts", "textSpan": { - "start": 18451, + "start": 18529, "length": 28 } } @@ -1101,7 +1101,7 @@ "target": { "fileName": "lib.d.ts", "textSpan": { - "start": 18451, + "start": 18529, "length": 28 } } 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 6829ad887310c..1ceb78426146d 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', 'es2023', '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', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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', 'es2022.regexp', 'es2023.array', '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 6c5918632f8f5..a0d83c38d378d 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', 'es2023', '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', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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', 'es2022.regexp', 'es2023.array', '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 8d0b48aca3004..3309e00f86fcf 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', 'es2023', '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', 'es2022.regexp', 'es2023.array', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', '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', 'es2022.regexp', 'es2023.array', '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/initTSConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json index 44f0d12a60dce..3d657071fcc69 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 44f0d12a60dce..3d657071fcc69 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 44f0d12a60dce..3d657071fcc69 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 ec9755595785c..8c04d74cb873a 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 dc1cbd0260ee9..c846ee106d5ff 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 0c2b3cef5e01b..3c2bbae0f8d0f 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 924da33ea0c00..d0d41011037ce 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 4a82bf2b3c90c..a9cfa7ac7b4da 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 44f0d12a60dce..3d657071fcc69 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 6e11011c888e7..f0c0827039874 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 9e7148c874a29..bf3f08ec05292 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/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 c83e9c7377605..2b44e0e9f1ea2 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/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/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<C>'. - 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<C>'. + 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<C>'. -!!! 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<C>'. +!!! 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/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/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/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<T> { >BaseEntity : Symbol(BaseEntity, Decl(decoratorMetadataConditionalType.ts, 0, 40)) diff --git a/tests/baselines/reference/decoratorMetadataGenericTypeVariable.js b/tests/baselines/reference/decoratorMetadataGenericTypeVariable.js index bf890a8860c23..21d2003f066fa 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) { }; Object.defineProperty(exports, "__esModule", { value: 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", void 0); return C; }()); -exports.C = C; diff --git a/tests/baselines/reference/decoratorMetadataGenericTypeVariableDefault.js b/tests/baselines/reference/decoratorMetadataGenericTypeVariableDefault.js index 2bddc48ae878f..619b822955570 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) { }; Object.defineProperty(exports, "__esModule", { value: 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", void 0); return C; }()); -exports.C = C; diff --git a/tests/baselines/reference/decoratorMetadataGenericTypeVariableInScope.js b/tests/baselines/reference/decoratorMetadataGenericTypeVariableInScope.js index be3b0d3dd18db..cf863b36f5a38 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", void 0); return C; }()); -exports.C = C; diff --git a/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.js b/tests/baselines/reference/decoratorMetadataNoLibIsolatedModulesTypes.js index ca40daf943a52..6c6c57d19c8ec 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) { }; Object.defineProperty(exports, "__esModule", { value: 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", void 0); 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/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.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/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/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 bf1e1c2279c1a..f83e55a9fe239 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) { }; Object.defineProperty(exports, "__esModule", { value: 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", void 0); return Main; }()); -exports.Main = Main; 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<T>(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<T>(target: T): T; var F = @dec () => { >F : any -> : any >dec () : unknown >dec : <T>(target: T) => T } 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.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<T>(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..5edb1c7cfa4ad 100644 --- a/tests/baselines/reference/decoratorOnClass3.js +++ b/tests/baselines/reference/decoratorOnClass3.js @@ -7,13 +7,16 @@ 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; }; -var C = /** @class */ (function () { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.C = void 0; +var C = exports.C = /** @class */ (function () { function C() { } C = __decorate([ 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/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 88dd41e7b6065..7e8761f4052cb 100644 --- a/tests/baselines/reference/decoratorOnClass8.es6.js +++ b/tests/baselines/reference/decoratorOnClass8.es6.js @@ -13,8 +13,13 @@ 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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; +let default_1 = class { +}; +__setFunctionName(default_1, "default"); default_1.y = 1; default_1 = __decorate([ dec 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/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/decoratorOnClassMethodThisParameter.errors.txt b/tests/baselines/reference/decoratorOnClassMethodThisParameter.errors.txt index 02fb67534e881..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 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: 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 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 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/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/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/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<T>(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<T>(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<T>(target: T): T; var F = @dec function () { >F : any -> : any >dec : <T>(target: T) => T > : () => void } diff --git a/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt b/tests/baselines/reference/decoratorOnFunctionParameter.errors.txt index a2259e0666a12..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 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: 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 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 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/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 c8f9fd6b305e7..d6c101ccd028f 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:1495:13: 'Array' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1498: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 20d9a290c04c9..b0fa1bd259fe2 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:1460:24: The expected type comes from the return type of this signature. -!!! related TS6502 /.ts/lib.es5.d.ts:1466:27: The expected type comes from the return type of this signature. +!!! related TS6502 /.ts/lib.es5.d.ts:1463:24: The expected type comes from the return type of this signature. +!!! related TS6502 /.ts/lib.es5.d.ts:1469: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>[]): never[]', gave the following error. diff --git a/tests/baselines/reference/duplicateNumericIndexers.errors.txt b/tests/baselines/reference/duplicateNumericIndexers.errors.txt index c34d35766c139..826a48d1c815b 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(1481,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(1484,5): error TS2374: Duplicate index signature for type 'number'. ==== tests/cases/conformance/types/members/duplicateNumericIndexers.ts (12 errors) ==== diff --git a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js index 9c84249d36e53..ee447f2a4bde7 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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; var _a; Object.defineProperty(exports, "__esModule", { value: 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/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/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/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-nonStatic(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-accessors-nonStatic(target=es2015).js new file mode 100644 index 0000000000000..5e9c2758d53b1 --- /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 }, 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 new file mode 100644 index 0000000000000..9315c3dde5fa7 --- /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 }, 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) { } + 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..129044549e3b8 --- /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 }, 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=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..65a6cfaaa2252 --- /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", "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 new file mode 100644 index 0000000000000..e2556ba5c3e64 --- /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", "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); } + 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..e4b87d775a091 --- /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 }, 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 new file mode 100644 index 0000000000000..a69d475a3952f --- /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 }, 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; } + 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..c489fbbc63c83 --- /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 }, 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=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..2c733ba8cb951 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=es2015).js @@ -0,0 +1,64 @@ +//// [esDecorators-classDeclaration-accessors-staticPrivate.ts] +declare let dec: any; + +class C { + @dec(1) static get #method1() { return 0; } + @dec(2) static set #method1(value) {} +} + +@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", "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; +})(); +let D = (() => { + var _method1_get, _method1_set; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + 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 new file mode 100644 index 0000000000000..ac2fffaa2fd7e --- /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) {} +} + +@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", "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); } + static set #method1(value) { return _static_private_set_method1_descriptor.set.call(this, value); } + }; +})(); +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 { + __classPrivateFieldGet(_classThis, _classThis, "a", _method1_get); + __classPrivateFieldSet(_classThis, _classThis, 1, "a", _method1_set); + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return D = _classThis; +})(); 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..7db3406603928 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).js @@ -0,0 +1,35 @@ +//// [esDecorators-classDeclaration-accessors-staticPrivate.ts] +declare let dec: any; + +class C { + @dec(1) static get #method1() { return 0; } + @dec(2) static set #method1(value) {} +} + +@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) { } +} +@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..1fc2933e85b42 --- /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 = _classThis; +})(); 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..a8ac1577f4231 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.2.js @@ -0,0 +1,93 @@ +//// [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] +// class expression in extends should not get an assigned name +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 = _classThis; +})(); +// function expression in extends should not get an assigned name +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 = _classThis_1; +})(); +// arrow function in extends should not get an assigned name +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 = _classThis_2; +})(); 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..d970c0bf48412 --- /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 = _classThis; +})(); 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..33451269c0573 --- /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 = _classThis; +})(); 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..f2085eac5ee9c --- /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 = _classThis; +})(); +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 = _classThis_1; +})(); +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 = _classThis_2; +})(); 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..61caf27db40e2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classSuper.6.js @@ -0,0 +1,54 @@ +//// [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] +// none of the following should result in caching `super` +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 = _classThis; +})(); 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..086bc280bb02e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2015).js @@ -0,0 +1,41 @@ +//// [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_accessor_storage; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + 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 new file mode 100644 index 0000000000000..384f95606c9c6 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference(target=es2022).js @@ -0,0 +1,41 @@ +//// [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_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 = { 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; } + static get g() { return this; } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C = _classThis; +})(); 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..218d40b4c367d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-classThisReference.es5.js @@ -0,0 +1,44 @@ +//// [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 _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + 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-commentPreservation(module=commonjs,target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2015).js new file mode 100644 index 0000000000000..e3b48cc80d45d --- /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 }, 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); + })(); + /*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..ff39528a0fd80 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=es2022).js @@ -0,0 +1,268 @@ +//// [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; + 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 { _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 }, 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); + } + /*4*/ + method() { } + /*7*/ + get x() { return 1; } + /*10*/ + set x(value) { } + /*13*/ + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + #z_accessor_storage = __runInitializers(this, _z_initializers, 1); + /*16*/ + 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) }; + } + static { + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + } + static { + __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 = 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..cd178ffe1d48b --- /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 }, 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); + })(); + /*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..03a366924a373 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-commentPreservation(module=esnext,target=es2022).js @@ -0,0 +1,265 @@ +//// [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; + 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 { _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 }, 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); + } + /*4*/ + method() { } + /*7*/ + get x() { return 1; } + /*10*/ + set x(value) { } + /*13*/ + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + #z_accessor_storage = __runInitializers(this, _z_initializers, 1); + /*16*/ + 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) }; + } + static { + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + } + static { + __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 = 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-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/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..f22a1a91ef14e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=false).js @@ -0,0 +1,42 @@ +//// [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 _a = class C { + constructor() { + this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); + this["field2"] = __runInitializers(this, _member_initializers, 2); + this[_b] = __runInitializers(this, _member_initializers_1, 3); + } + }, + _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 }, _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 new file mode 100644 index 0000000000000..854f94797926f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2015,usedefineforclassfields=true).js @@ -0,0 +1,57 @@ +//// [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 _a = 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, _b, { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(this, _member_initializers_1, 3) + }); + } + }, + _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 }, _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 new file mode 100644 index 0000000000000..b99ccc2ea9ca8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es2022,usedefineforclassfields=false).js @@ -0,0 +1,37 @@ +//// [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 { + 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 { _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 }, _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 new file mode 100644 index 0000000000000..f27d13c646f5a --- /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 }, _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); + [(_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..38398b531734a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=false).js @@ -0,0 +1,43 @@ +//// [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; + var _b; + var _instanceExtraInitializers = []; + var _field1_decorators; + var _field1_initializers = []; + var _member_decorators; + var _member_initializers = []; + var _member_decorators_1; + var _member_initializers_1 = []; + return _a = /** @class */ (function () { + function C() { + this.field1 = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _field1_initializers, 1)); + this["field2"] = __runInitializers(this, _member_initializers, 2); + this[_b] = __runInitializers(this, _member_initializers_1, 3); + } + return C; + }()), + _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 }, _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 new file mode 100644 index 0000000000000..9ce6940e998ae --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=es5,usedefineforclassfields=true).js @@ -0,0 +1,58 @@ +//// [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; + var _b; + var _instanceExtraInitializers = []; + var _field1_decorators; + var _field1_initializers = []; + var _member_decorators; + var _member_initializers = []; + var _member_decorators_1; + var _member_initializers_1 = []; + return _a = /** @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, _b, { + enumerable: true, + configurable: true, + writable: true, + value: __runInitializers(this, _member_initializers_1, 3) + }); + } + return C; + }()), + _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 }, _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 new file mode 100644 index 0000000000000..b99ccc2ea9ca8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-nonStatic(target=esnext,usedefineforclassfields=false).js @@ -0,0 +1,37 @@ +//// [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 { + 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 { _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 }, _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=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..160556550ebbf --- /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 }, _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 new file mode 100644 index 0000000000000..79311b7e3b2d3 --- /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 }, _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; } + 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..bb512f1efc573 --- /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 }, _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..493958c826520 --- /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 }, _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..981d2c2a4766c --- /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_accessor_storage, _C_field1_get, _C_field1_set; + 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_field1_accessor_storage = new WeakMap(), + _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", "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 new file mode 100644 index 0000000000000..7ca74adec30ae --- /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", "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); } + set #field1(value) { return _private_field1_descriptor.set.call(this, 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..a0bb0d3149701 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=false).js @@ -0,0 +1,41 @@ +//// [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 _a = class C { + }, + _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 }, _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), + _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..711ed976b469c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2015,usedefineforclassfields=true).js @@ -0,0 +1,56 @@ +//// [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 _a = class C { + }, + _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 }, _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", { + 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..9ce6c3f314551 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es2022,usedefineforclassfields=false).js @@ -0,0 +1,36 @@ +//// [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 { _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 }, _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); } + 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..4ec5391109d13 --- /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 }, _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); + 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..7a258c040bd4d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=false).js @@ -0,0 +1,45 @@ +//// [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; + var _b; + 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; + }()), + _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 }, _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), + _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..737799426118d --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=es5,usedefineforclassfields=true).js @@ -0,0 +1,60 @@ +//// [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; + var _b; + 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; + }()), + _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 }, _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", { + 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..9ce6c3f314551 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-static(target=esnext,usedefineforclassfields=false).js @@ -0,0 +1,36 @@ +//// [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 { _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 }, _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); } + 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..a6cf58ab3384c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2015).js @@ -0,0 +1,76 @@ +//// [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; +} + +@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 }, _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) }, + _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 _field1_accessor_storage; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = _classThis = class { + static get field1() { return __classPrivateFieldGet(_classThis, _classThis, "f", _field1_accessor_storage); } + static set field1(value) { __classPrivateFieldSet(_classThis, _classThis, value, "f", _field1_accessor_storage); } + }; + __setFunctionName(_classThis, "D"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(); + _field1_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 new file mode 100644 index 0000000000000..f922fb0911eb8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=es2022).js @@ -0,0 +1,76 @@ +//// [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; +} + +@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 }, _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); + 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 = (() => { + var _field1_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_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 { + _classThis.field1; + _classThis.field1 = 1; + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + 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 new file mode 100644 index 0000000000000..d4c76162f914f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).js @@ -0,0 +1,38 @@ +//// [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; +} + +@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; +} +@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..253a7a5e698b8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2015).js @@ -0,0 +1,56 @@ +//// [esDecorators-classDeclaration-fields-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #field1 = 0; +} + +@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 }, _static_private_field1_initializers, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _C_field1 = { value: __runInitializers(_a, _static_private_field1_initializers, 0) }, + _a; +})(); +let D = (() => { + var _field1; + let _classDecorators = [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; + })(); + _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 new file mode 100644 index 0000000000000..d59953d89857c --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=es2022).js @@ -0,0 +1,56 @@ +//// [esDecorators-classDeclaration-fields-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #field1 = 0; +} + +@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 }, _static_private_field1_initializers, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static #field1 = __runInitializers(this, _static_private_field1_initializers, 0); + }; +})(); +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 = { value: 0 }; + } + static { + __classPrivateFieldGet(_classThis, _classThis, "f", _field1); + __classPrivateFieldSet(_classThis, _classThis, 1, "f", _field1); + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + 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 new file mode 100644 index 0000000000000..4f7ea0b8285f8 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).js @@ -0,0 +1,30 @@ +//// [esDecorators-classDeclaration-fields-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #field1 = 0; +} + +@dec +class D { + static #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} + + +//// [esDecorators-classDeclaration-fields-staticPrivate.js] +class C { + @dec + static #field1 = 0; +} +@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..37e8d5b45d47f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2015).js @@ -0,0 +1,61 @@ +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.ts] +declare let dec: any; + +class C { + @dec static accessor #field1 = 0; +} + +@dec +class D { + static accessor #field1 = 0; + static { + this.#field1; + this.#field1 = 1; + } +} + + +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.js] +let C = (() => { + 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 _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", "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) }, + _a; +})(); +let D = (() => { + var _field1_get, _field1_set, _field1_accessor_storage; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var D = _classThis = class { + }; + _field1_get = function _field1_get() { return __classPrivateFieldGet(this, _classThis, "f", _field1_accessor_storage); }; + _field1_set = function _field1_set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _field1_accessor_storage); }; + __setFunctionName(_classThis, "D"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + D = _classThis = _classDescriptor.value; + })(); + _field1_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 new file mode 100644 index 0000000000000..af38ad7b02c88 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=es2022).js @@ -0,0 +1,60 @@ +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.ts] +declare let dec: any; + +class C { + @dec static accessor #field1 = 0; +} + +@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", "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); + 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_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_accessor_storage); }, _field1_set = function _field1_set(value) { __classPrivateFieldSet(this, _classThis, value, "f", _field1_accessor_storage); }; } + static { + __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); + } + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + 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 new file mode 100644 index 0000000000000..34957f5c432fe --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).js @@ -0,0 +1,30 @@ +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.ts] +declare let dec: any; + +class C { + @dec static accessor #field1 = 0; +} + +@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; +} +@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..b0d2cf0df399f --- /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 }, 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 new file mode 100644 index 0000000000000..022592aa5b56b --- /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 }, 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"]() { } + [(_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..bd3eb8e0a7741 --- /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 }, 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=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..cf01e7489ce89 --- /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 }, 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..f2fe7f5374fad --- /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 }, 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..e4a3864b3a685 --- /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 }, 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 new file mode 100644 index 0000000000000..619ffd32039ba --- /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 }, 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() { } + 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..9b784e8d41973 --- /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 }, 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=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..4e6137f0bbd2f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2015).js @@ -0,0 +1,46 @@ +//// [esDecorators-classDeclaration-methods-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #method1() {} +} + +@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 }, null, _staticExtraInitializers); + __runInitializers(_a, _staticExtraInitializers); + })(), + _a; +})(); +let D = (() => { + var _method1; + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + 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 new file mode 100644 index 0000000000000..ff852e59e2899 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=es2022).js @@ -0,0 +1,44 @@ +//// [esDecorators-classDeclaration-methods-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #method1() {} +} + +@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 }, null, _staticExtraInitializers); + __runInitializers(this, _staticExtraInitializers); + } + static get #method1() { return _static_private_method1_descriptor.value; } + }; +})(); +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); + } + }; + 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 new file mode 100644 index 0000000000000..77bf2e0573206 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).js @@ -0,0 +1,22 @@ +//// [esDecorators-classDeclaration-methods-staticPrivate.ts] +declare let dec: any; + +class C { + @dec static #method1() {} +} + +@dec +class D { + static #method1() {} +} + + +//// [esDecorators-classDeclaration-methods-staticPrivate.js] +class C { + @dec + static #method1() { } +} +@dec +class D { + static #method1() { } +} 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..fe5fbe6dab88c --- /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 }, _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..fffd6b94d648e --- /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 }, _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..0d3f06e9789fd --- /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 }, 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..0138550e4a4a1 --- /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 }, 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..4b4485158a751 --- /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 }, 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..889455678e341 --- /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 }, _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..36d8b5e0c7c94 --- /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 }, _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..018ed086e65a8 --- /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 }, 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..7d4f384cc6ac3 --- /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 }, 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..e949700f51530 --- /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 }, 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..972e4f3f2061c --- /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 }, _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..6c4b067c87e41 --- /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 }, _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..7630739274f7a --- /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 }, 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..c2f0855e8fc3e --- /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 }, 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..c4304a4161bde --- /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 }, 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-multipleDecorators(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js new file mode 100644 index 0000000000000..fac9d3cbc855b --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2015).js @@ -0,0 +1,25 @@ +//// [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 = _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=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es2022).js new file mode 100644 index 0000000000000..df55f69d019fd --- /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 = _classThis; +})(); 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..8946e029ab70e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-multipleDecorators(target=es5).js @@ -0,0 +1,29 @@ +//// [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 _classDecorators = [dec1, dec2]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + 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-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-outerThisReference(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-outerThisReference(target=es2015).js new file mode 100644 index 0000000000000..32b59b3cce617 --- /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 }, _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 }, _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 }, _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..32b59b3cce617 --- /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 }, _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 }, _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 }, _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..0908f39c28f45 --- /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 }, _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 }, _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 }, _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/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-parameterProperties(target=es2015,usedefineforclassfields=false).js b/tests/baselines/reference/esDecorators-classDeclaration-parameterProperties(target=es2015,usedefineforclassfields=false).js new file mode 100644 index 0000000000000..f84317b3778c2 --- /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 }, 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..c3fca6ebf00c4 --- /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 }, 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..928864b674b14 --- /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 }, 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..39679938f0997 --- /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 }, 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..23a24c0eef544 --- /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 }, 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..784c8658144e5 --- /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 }, 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..928864b674b14 --- /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 }, 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/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js new file mode 100644 index 0000000000000..7702afec3b08f --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2015).js @@ -0,0 +1,74 @@ +//// [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 = _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 = (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + 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 (() => { + let _classDecorators = [dec]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + 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=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es2022).js new file mode 100644 index 0000000000000..09eac0a5b6171 --- /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 = _classThis; +})(); +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 = _classThis; +})(); +//// [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 = _classThis; +})(); 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..b574caffd3bbf --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-setFunctionName(target=es5).js @@ -0,0 +1,93 @@ +//// [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 _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + 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] +"use strict"; +var _this = this; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.C = void 0; +var C = exports.C = function () { + var _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + 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] +"use strict"; +var _this = this; +Object.defineProperty(exports, "__esModule", { value: true }); +var default_1 = function () { + var _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + 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-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..aaf0a0957d941 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2015).js @@ -0,0 +1,24 @@ +//// [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 = _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=es2022).js b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es2022).js new file mode 100644 index 0000000000000..898d229014ae0 --- /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 = _classThis; +})(); 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..82754d7ead7e2 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-simpleTransformation(target=es5).js @@ -0,0 +1,28 @@ +//// [esDecorators-classDeclaration-simpleTransformation.ts] +declare let dec: any; + +@dec +class C { +} + + +//// [esDecorators-classDeclaration-simpleTransformation.js] +var _this = this; +var C = function () { + var _classDecorators = [dec]; + var _classDescriptor; + var _classExtraInitializers = []; + var _classThis; + 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-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-classDeclaration-sourceMap(target=es2015).js b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).js new file mode 100644 index 0000000000000..2f78b238a0782 --- /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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + 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"); + 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 }, 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); + })(); + _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..3bb8953653583 --- /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,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/IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodGFyZ2V0LCBjb250ZXh0SW4ubmFtZSkgOiB7fSk7DQogICAgdmFyIF8sIGRvbmUgPSBmYWxzZTsNCiAgICBmb3IgKHZhciBpID0gZGVjb3JhdG9ycy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkgew0KICAgICAgICB2YXIgY29udGV4dCA9IHt9Ow0KICAgICAgICBmb3IgKHZhciBwIGluIGNvbnRleHRJbikgY29udGV4dFtwXSA9IHAgPT09ICJhY2Nlc3MiID8ge30gOiBjb250ZXh0SW5bcF07DQogICAgICAgIGZvciAodmFyIHAgaW4gY29udGV4dEluLmFjY2VzcykgY29udGV4dC5hY2Nlc3NbcF0gPSBjb250ZXh0SW4uYWNjZXNzW3BdOw0KICAgICAgICBjb250ZXh0LmFkZEluaXRpYWxpemVyID0gZnVuY3Rpb24gKGYpIHsgaWYgKGRvbmUpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCBhZGQgaW5pdGlhbGl6ZXJzIGFmdGVyIGRlY29yYXRpb24gaGFzIGNvbXBsZXRlZCIpOyBleHRyYUluaXRpYWxpemVycy5wdXNoKGFjY2VwdChmIHx8IG51bGwpKTsgfTsNCiAgICAgICAgdmFyIHJlc3VsdCA9ICgwLCBkZWNvcmF0b3JzW2ldKShraW5kID09PSAiYWNjZXNzb3IiID8geyBnZXQ6IGRlc2NyaXB0b3IuZ2V0LCBzZXQ6IGRlc2NyaXB0b3Iuc2V0IH0gOiBkZXNjcmlwdG9yW2tleV0sIGNvbnRleHQpOw0KICAgICAgICBpZiAoa2luZCA9PT0gImFjY2Vzc29yIikgew0KICAgICAgICAgICAgaWYgKHJlc3VsdCA9PT0gdm9pZCAwKSBjb250aW51ZTsNCiAgICAgICAgICAgIGlmIChyZXN1bHQgPT09IG51bGwgfHwgdHlwZW9mIHJlc3VsdCAhPT0gIm9iamVjdCIpIHRocm93IG5ldyBUeXBlRXJyb3IoIk9iamVjdCBleHBlY3RlZCIpOw0KICAgICAgICAgICAgaWYgKF8gPSBhY2NlcHQocmVzdWx0LmdldCkpIGRlc2NyaXB0b3IuZ2V0ID0gXzsNCiAgICAgICAgICAgIGlmIChfID0gYWNjZXB0KHJlc3VsdC5zZXQpKSBkZXNjcmlwdG9yLnNldCA9IF87DQogICAgICAgICAgICBpZiAoXyA9IGFjY2VwdChyZXN1bHQuaW5pdCkpIGluaXRpYWxpemVycy5wdXNoKF8pOw0KICAgICAgICB9DQogICAgICAgIGVsc2UgaWYgKF8gPSBhY2NlcHQocmVzdWx0KSkgew0KICAgICAgICAgICAgaWYgKGtpbmQgPT09ICJmaWVsZCIpIGluaXRpYWxpemVycy5wdXNoKF8pOw0KICAgICAgICAgICAgZWxzZSBkZXNjcmlwdG9yW2tleV0gPSBfOw0KICAgICAgICB9DQogICAgfQ0KICAgIGlmICh0YXJnZXQpIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0YXJnZXQsIGNvbnRleHRJbi5uYW1lLCBkZXNjcmlwdG9yKTsNCiAgICBkb25lID0gdHJ1ZTsNCn07DQp2YXIgX19ydW5Jbml0aWFsaXplcnMgPSAodGhpcyAmJiB0aGlzLl9fcnVuSW5pdGlhbGl6ZXJzKSB8fCBmdW5jdGlvbiAodGhpc0FyZywgaW5pdGlhbGl6ZXJzLCB2YWx1ZSkgew0KICAgIHZhciB1c2VWYWx1ZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAyOw0KICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaW5pdGlhbGl6ZXJzLmxlbmd0aDsgaSsrKSB7DQogICAgICAgIHZhbHVlID0gdXNlVmFsdWUgPyBpbml0aWFsaXplcnNbaV0uY2FsbCh0aGlzQXJnLCB2YWx1ZSkgOiBpbml0aWFsaXplcnNbaV0uY2FsbCh0aGlzQXJnKTsNCiAgICB9DQogICAgcmV0dXJuIHVzZVZhbHVlID8gdmFsdWUgOiB2b2lkIDA7DQp9Ow0KdmFyIF9fc2V0RnVuY3Rpb25OYW1lID0gKHRoaXMgJiYgdGhpcy5fX3NldEZ1bmN0aW9uTmFtZSkgfHwgZnVuY3Rpb24gKGYsIG5hbWUsIHByZWZpeCkgew0KICAgIGlmICh0eXBlb2YgbmFtZSA9PT0gInN5bWJvbCIpIG5hbWUgPSBuYW1lLmRlc2NyaXB0aW9uID8gIlsiLmNvbmNhdChuYW1lLmRlc2NyaXB0aW9uLCAiXSIpIDogIiI7DQogICAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShmLCAibmFtZSIsIHsgY29uZmlndXJhYmxlOiB0cnVlLCB2YWx1ZTogcHJlZml4ID8gIiIuY29uY2F0KHByZWZpeCwgIiAiLCBuYW1lKSA6IG5hbWUgfSk7DQp9Ow0KdmFyIF9fY2xhc3NQcml2YXRlRmllbGRHZXQgPSAodGhpcyAmJiB0aGlzLl9fY2xhc3NQcml2YXRlRmllbGRHZXQpIHx8IGZ1bmN0aW9uIChyZWNlaXZlciwgc3RhdGUsIGtpbmQsIGYpIHsNCiAgICBpZiAoa2luZCA9PT0gImEiICYmICFmKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIGFjY2Vzc29yIHdhcyBkZWZpbmVkIHdpdGhvdXQgYSBnZXR0ZXIiKTsNCiAgICBpZiAodHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgIT09IHN0YXRlIHx8ICFmIDogIXN0YXRlLmhhcyhyZWNlaXZlcikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCByZWFkIHByaXZhdGUgbWVtYmVyIGZyb20gYW4gb2JqZWN0IHdob3NlIGNsYXNzIGRpZCBub3QgZGVjbGFyZSBpdCIpOw0KICAgIHJldHVybiBraW5kID09PSAibSIgPyBmIDoga2luZCA9PT0gImEiID8gZi5jYWxsKHJlY2VpdmVyKSA6IGYgPyBmLnZhbHVlIDogc3RhdGUuZ2V0KHJlY2VpdmVyKTsNCn07DQp2YXIgX19jbGFzc1ByaXZhdGVGaWVsZFNldCA9ICh0aGlzICYmIHRoaXMuX19jbGFzc1ByaXZhdGVGaWVsZFNldCkgfHwgZnVuY3Rpb24gKHJlY2VpdmVyLCBzdGF0ZSwgdmFsdWUsIGtpbmQsIGYpIHsNCiAgICBpZiAoa2luZCA9PT0gIm0iKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIG1ldGhvZCBpcyBub3Qgd3JpdGFibGUiKTsNCiAgICBpZiAoa2luZCA9PT0gImEiICYmICFmKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIGFjY2Vzc29yIHdhcyBkZWZpbmVkIHdpdGhvdXQgYSBzZXR0ZXIiKTsNCiAgICBpZiAodHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgIT09IHN0YXRlIHx8ICFmIDogIXN0YXRlLmhhcyhyZWNlaXZlcikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCB3cml0ZSBwcml2YXRlIG1lbWJlciB0byBhbiBvYmplY3Qgd2hvc2UgY2xhc3MgZGlkIG5vdCBkZWNsYXJlIGl0Iik7DQogICAgcmV0dXJuIChraW5kID09PSAiYSIgPyBmLmNhbGwocmVjZWl2ZXIsIHZhbHVlKSA6IGYgPyBmLnZhbHVlID0gdmFsdWUgOiBzdGF0ZS5zZXQocmVjZWl2ZXIsIHZhbHVlKSksIHZhbHVlOw0KfTsNCmxldCBDID0gKCgpID0+IHsNCiAgICB2YXIgX21ldGhvZF9nZXQsIF94X2dldCwgX3hfc2V0LCBfeSwgX3pfYWNjZXNzb3Jfc3RvcmFnZSwgX3pfZ2V0LCBfel9zZXQsIF96XzFfYWNjZXNzb3Jfc3RvcmFnZTsNCiAgICBsZXQgX2NsYXNzRGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgbGV0IF9jbGFzc0Rlc2NyaXB0b3I7DQogICAgbGV0IF9jbGFzc0V4dHJhSW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9jbGFzc1RoaXM7DQogICAgbGV0IF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVzY3JpcHRvcjsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX2dldF94X2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZXNjcmlwdG9yOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3NldF94X2Rlc2NyaXB0b3I7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV95X2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV95X2luaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfel9kZWNvcmF0b3JzOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfel9pbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3pfZGVzY3JpcHRvcjsNCiAgICBsZXQgX21ldGhvZF9kZWNvcmF0b3JzOw0KICAgIGxldCBfZ2V0X3hfZGVjb3JhdG9yczsNCiAgICBsZXQgX3NldF94X2RlY29yYXRvcnM7DQogICAgbGV0IF95X2RlY29yYXRvcnM7DQogICAgbGV0IF95X2luaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfel9kZWNvcmF0b3JzOw0KICAgIGxldCBfel9pbml0aWFsaXplcnMgPSBbXTsNCiAgICB2YXIgQyA9IF9jbGFzc1RoaXMgPSBjbGFzcyB7DQogICAgICAgIGNvbnN0cnVjdG9yKCkgew0KICAgICAgICAgICAgdGhpcy55ID0gKF9fcnVuSW5pdGlhbGl6ZXJzKHRoaXMsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKSwgX19ydW5Jbml0aWFsaXplcnModGhpcywgX3lfaW5pdGlhbGl6ZXJzLCAxKSk7DQogICAgICAgICAgICBfel8xX2FjY2Vzc29yX3N0b3JhZ2Uuc2V0KHRoaXMsIF9fcnVuSW5pdGlhbGl6ZXJzKHRoaXMsIF96X2luaXRpYWxpemVycywgMSkpOw0KICAgICAgICB9DQogICAgICAgIG1ldGhvZCgpIHsgfQ0KICAgICAgICBnZXQgeCgpIHsgcmV0dXJuIDE7IH0NCiAgICAgICAgc2V0IHgodmFsdWUpIHsgfQ0KICAgICAgICBnZXQgeigpIHsgcmV0dXJuIF9fY2xhc3NQcml2YXRlRmllbGRHZXQodGhpcywgX3pfMV9hY2Nlc3Nvcl9zdG9yYWdlLCAiZiIpOyB9DQogICAgICAgIHNldCB6KHZhbHVlKSB7IF9fY2xhc3NQcml2YXRlRmllbGRTZXQodGhpcywgX3pfMV9hY2Nlc3Nvcl9zdG9yYWdlLCB2YWx1ZSwgImYiKTsgfQ0KICAgIH07DQogICAgX3pfMV9hY2Nlc3Nvcl9zdG9yYWdlID0gbmV3IFdlYWtNYXAoKTsNCiAgICBfbWV0aG9kX2dldCA9IGZ1bmN0aW9uIF9tZXRob2RfZ2V0KCkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZXNjcmlwdG9yLnZhbHVlOyB9Ow0KICAgIF94X2dldCA9IGZ1bmN0aW9uIF94X2dldCgpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZXNjcmlwdG9yLmdldC5jYWxsKHRoaXMpOyB9Ow0KICAgIF94X3NldCA9IGZ1bmN0aW9uIF94X3NldCh2YWx1ZSkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX3NldF94X2Rlc2NyaXB0b3Iuc2V0LmNhbGwodGhpcywgdmFsdWUpOyB9Ow0KICAgIF96X2dldCA9IGZ1bmN0aW9uIF96X2dldCgpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3IuZ2V0LmNhbGwodGhpcyk7IH07DQogICAgX3pfc2V0ID0gZnVuY3Rpb24gX3pfc2V0KHZhbHVlKSB7IHJldHVybiBfc3RhdGljX3ByaXZhdGVfel9kZXNjcmlwdG9yLnNldC5jYWxsKHRoaXMsIHZhbHVlKTsgfTsNCiAgICBfX3NldEZ1bmN0aW9uTmFtZShfY2xhc3NUaGlzLCAiQyIpOw0KICAgICgoKSA9PiB7DQogICAgICAgIF9tZXRob2RfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9nZXRfeF9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3NldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICBfeV9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3pfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3N0YXRpY19wcml2YXRlX3NldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgX3N0YXRpY19wcml2YXRlX3pfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgIF9fZXNEZWNvcmF0ZShfY2xhc3NUaGlzLCBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2Rlc2NyaXB0b3IgPSB7IHZhbHVlOiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAoKSB7IH0sICIjbWV0aG9kIikgfSwgX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJtZXRob2QiLCBuYW1lOiAiI21ldGhvZCIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSB9LCBudWxsLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX2dldF94X2Rlc2NyaXB0b3IgPSB7IGdldDogX19zZXRGdW5jdGlvbk5hbWUoZnVuY3Rpb24gKCkgeyByZXR1cm4gMTsgfSwgIiN4IiwgImdldCIpIH0sIF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJnZXR0ZXIiLCBuYW1lOiAiI3giLCBzdGF0aWM6IHRydWUsIHByaXZhdGU6IHRydWUgfSwgbnVsbCwgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZXNjcmlwdG9yID0geyBzZXQ6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICh2YWx1ZSkgeyB9LCAiI3giLCAic2V0IikgfSwgX3N0YXRpY19wcml2YXRlX3NldF94X2RlY29yYXRvcnMsIHsga2luZDogInNldHRlciIsIG5hbWU6ICIjeCIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSB9LCBudWxsLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICBfX2VzRGVjb3JhdGUoX2NsYXNzVGhpcywgX3N0YXRpY19wcml2YXRlX3pfZGVzY3JpcHRvciA9IHsgZ2V0OiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAoKSB7IHJldHVybiBfX2NsYXNzUHJpdmF0ZUZpZWxkR2V0KF9jbGFzc1RoaXMsIF9jbGFzc1RoaXMsICJmIiwgX3pfYWNjZXNzb3Jfc3RvcmFnZSk7IH0sICIjeiIsICJnZXQiKSwgc2V0OiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAodmFsdWUpIHsgX19jbGFzc1ByaXZhdGVGaWVsZFNldChfY2xhc3NUaGlzLCBfY2xhc3NUaGlzLCB2YWx1ZSwgImYiLCBfel9hY2Nlc3Nvcl9zdG9yYWdlKTsgfSwgIiN6IiwgInNldCIpIH0sIF9zdGF0aWNfcHJpdmF0ZV96X2RlY29yYXRvcnMsIHsga2luZDogImFjY2Vzc29yIiwgbmFtZTogIiN6Iiwgc3RhdGljOiB0cnVlLCBwcml2YXRlOiB0cnVlIH0sIF9zdGF0aWNfcHJpdmF0ZV96X2luaXRpYWxpemVycywgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKF9jbGFzc1RoaXMsIG51bGwsIF9tZXRob2RfZGVjb3JhdG9ycywgeyBraW5kOiAibWV0aG9kIiwgbmFtZTogIm1ldGhvZCIsIHN0YXRpYzogZmFsc2UsIHByaXZhdGU6IGZhbHNlIH0sIG51bGwsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKF9jbGFzc1RoaXMsIG51bGwsIF9nZXRfeF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJnZXR0ZXIiLCBuYW1lOiAieCIsIHN0YXRpYzogZmFsc2UsIHByaXZhdGU6IGZhbHNlIH0sIG51bGwsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKF9jbGFzc1RoaXMsIG51bGwsIF9zZXRfeF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJzZXR0ZXIiLCBuYW1lOiAieCIsIHN0YXRpYzogZmFsc2UsIHByaXZhdGU6IGZhbHNlIH0sIG51bGwsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKF9jbGFzc1RoaXMsIG51bGwsIF96X2RlY29yYXRvcnMsIHsga2luZDogImFjY2Vzc29yIiwgbmFtZTogInoiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSB9LCBfel9pbml0aWFsaXplcnMsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKG51bGwsIG51bGwsIF9zdGF0aWNfcHJpdmF0ZV95X2RlY29yYXRvcnMsIHsga2luZDogImZpZWxkIiwgbmFtZTogIiN5Iiwgc3RhdGljOiB0cnVlLCBwcml2YXRlOiB0cnVlIH0sIF9zdGF0aWNfcHJpdmF0ZV95X2luaXRpYWxpemVycywgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKG51bGwsIG51bGwsIF95X2RlY29yYXRvcnMsIHsga2luZDogImZpZWxkIiwgbmFtZTogInkiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSB9LCBfeV9pbml0aWFsaXplcnMsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgX19lc0RlY29yYXRlKG51bGwsIF9jbGFzc0Rlc2NyaXB0b3IgPSB7IHZhbHVlOiBfY2xhc3NUaGlzIH0sIF9jbGFzc0RlY29yYXRvcnMsIHsga2luZDogImNsYXNzIiwgbmFtZTogX2NsYXNzVGhpcy5uYW1lIH0sIG51bGwsIF9jbGFzc0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgQyA9IF9jbGFzc1RoaXMgPSBfY2xhc3NEZXNjcmlwdG9yLnZhbHVlOw0KICAgICAgICBfX3J1bkluaXRpYWxpemVycyhfY2xhc3NUaGlzLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgIH0pKCk7DQogICAgX3kgPSB7IHZhbHVlOiBfX3J1bkluaXRpYWxpemVycyhfY2xhc3NUaGlzLCBfc3RhdGljX3ByaXZhdGVfeV9pbml0aWFsaXplcnMsIDEpIH07DQogICAgX3pfYWNjZXNzb3Jfc3RvcmFnZSA9IHsgdmFsdWU6IF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV96X2luaXRpYWxpemVycywgMSkgfTsNCiAgICAoKCkgPT4gew0KICAgICAgICBfX3J1bkluaXRpYWxpemVycyhfY2xhc3NUaGlzLCBfY2xhc3NFeHRyYUluaXRpYWxpemVycyk7DQogICAgfSkoKTsNCiAgICByZXR1cm4gQyA9IF9jbGFzc1RoaXM7DQp9KSgpOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7SUFJTSxDQUFDOzs0QkFGTixHQUFHLEVBQ0gsR0FBRzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O1FBQ0UsQ0FBQzs7WUFlSCxNQUFDLGtHQUFHLENBQUMsR0FBQztZQUlHLHlFQUFJLENBQUMsR0FBQztRQXFCbkIsQ0FBQztRQXJDRyxNQUFNLEtBQUksQ0FBQztRQUlYLElBQUksQ0FBQyxLQUFLLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUlyQixJQUFJLENBQUMsQ0FBQyxLQUFhLElBQUksQ0FBQztRQVF4QixJQUFTLENBQUMsdUVBQUs7UUFBZixJQUFTLENBQUMsNEVBQUs7Ozs7Ozs7Ozs7OEJBbEJkLEdBQUcsRUFDSCxHQUFHOzZCQUdILEdBQUcsRUFDSCxHQUFHOzZCQUdILEdBQUcsRUFDSCxHQUFHO3lCQUdILEdBQUcsRUFDSCxHQUFHO3lCQUdILEdBQUcsRUFDSCxHQUFHOzZDQUdILEdBQUcsRUFDSCxHQUFHOzRDQUdILEdBQUcsRUFDSCxHQUFHOzRDQUdILEdBQUcsRUFDSCxHQUFHO3dDQUdILEdBQUcsRUFDSCxHQUFHO3dDQUdILEdBQUcsRUFDSCxHQUFHO1FBZkosK0RBQUEseUJBQUEsY0FBa0IsQ0FBQyxZQUFBLHlJQUFBO1FBSW5CLDhEQUFBLHVCQUFBLGNBQWtCLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxjQUFBLG1JQUFBO1FBSTdCLDhEQUFBLHVCQUFBLFVBQWMsS0FBYSxJQUFJLENBQUMsY0FBQSxtSUFBQTtRQVFoQywwREFBQSx1QkFBQSxnR0FBdUIsY0FBQSxFQUF2Qix1QkFBQSxxR0FBdUIsY0FBQSwySkFBQTtRQXBDdkIsd0pBQVc7UUFJWCxrSkFBcUI7UUFJckIsa0pBQXdCO1FBUXhCLDJKQUFlO1FBZ0JmLDZLQUFjO1FBcEJkLGtKQUFNO1FBZlYsd0pBd0NDO1FBeENLLENBQUM7UUFBRCx3REFBQzs7SUFtQ0ksNEVBQUssQ0FBQyxHQUFKLENBQUs7SUFJRSw2RkFBSyxDQUFDLEdBQUosQ0FBSzs7UUF2Q3JCLHVEQUFDOztXQUFELENBQUMifQ==,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=es2015).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt new file mode 100644 index 0000000000000..1a6b9faa99d9e --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2015).sourcemap.txt @@ -0,0 +1,1077 @@ +=================================================================== +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, prefix) { +>>> if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; +>>> 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"); +>>> 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 }, null, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^-> +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, 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 }, null, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^^^^^^^^^^^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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, 133) 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 }, null, _staticExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^ +5 > ^^^^^ +6 > ^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +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, 128) 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 }, _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, 495) Source(44, 28) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > method() {} +1 >Emitted(109, 9) Source(8, 5) + 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 }, null, _instanceExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > + > + > @dec + > @dec + > +2 > get x() { return 1; } +1 >Emitted(110, 9) Source(12, 5) + 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 }, null, _instanceExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^-> +1-> + > + > @dec + > @dec + > +2 > set x(value: number) { } +1->Emitted(111, 9) Source(16, 5) + SourceIndex(0) +2 >Emitted(111, 155) Source(16, 29) + SourceIndex(0) +--- +>>> __esDecorate(_classThis, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^-> +1-> + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > +2 > accessor z = 1; +1->Emitted(112, 9) Source(24, 5) + 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 }, _static_private_y_initializers, _staticExtraInitializers); +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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(113, 9) Source(40, 5) + SourceIndex(0) +2 >Emitted(113, 182) Source(40, 19) + SourceIndex(0) +--- +>>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^-> +1 > +2 > y = 1; +1 >Emitted(114, 9) Source(20, 5) + 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->^^^^^^^^ +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..cc3a373d33e95 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js @@ -0,0 +1,184 @@ +//// [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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + 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"); + 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; + 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 { _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 }, 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); + } + method() { } + get x() { return 1; } + set x(value) { } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + #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) }; + } + static { + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + } + static { + __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=es2022).js.map b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).js.map new file mode 100644 index 0000000000000..c6644aa75ec8f --- /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;;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,dmFyIF9fZXNEZWNvcmF0ZSA9ICh0aGlzICYmIHRoaXMuX19lc0RlY29yYXRlKSB8fCBmdW5jdGlvbiAoY3RvciwgZGVzY3JpcHRvckluLCBkZWNvcmF0b3JzLCBjb250ZXh0SW4sIGluaXRpYWxpemVycywgZXh0cmFJbml0aWFsaXplcnMpIHsNCiAgICBmdW5jdGlvbiBhY2NlcHQoZikgeyBpZiAoZiAhPT0gdm9pZCAwICYmIHR5cGVvZiBmICE9PSAiZnVuY3Rpb24iKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJGdW5jdGlvbiBleHBlY3RlZCIpOyByZXR1cm4gZjsgfQ0KICAgIHZhciBraW5kID0gY29udGV4dEluLmtpbmQsIGtleSA9IGtpbmQgPT09ICJnZXR0ZXIiID8gImdldCIgOiBraW5kID09PSAic2V0dGVyIiA/ICJzZXQiIDogInZhbHVlIjsNCiAgICB2YXIgdGFyZ2V0ID0gIWRlc2NyaXB0b3JJbiAmJiBjdG9yID8gY29udGV4dEluWyJzdGF0aWMiXSA/IGN0b3IgOiBjdG9yLnByb3RvdHlwZSA6IG51bGw7DQogICAgdmFyIGRlc2NyaXB0b3IgPSBkZXNjcmlwdG9ySW4gfHwgKHRhcmdldCA/IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodGFyZ2V0LCBjb250ZXh0SW4ubmFtZSkgOiB7fSk7DQogICAgdmFyIF8sIGRvbmUgPSBmYWxzZTsNCiAgICBmb3IgKHZhciBpID0gZGVjb3JhdG9ycy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkgew0KICAgICAgICB2YXIgY29udGV4dCA9IHt9Ow0KICAgICAgICBmb3IgKHZhciBwIGluIGNvbnRleHRJbikgY29udGV4dFtwXSA9IHAgPT09ICJhY2Nlc3MiID8ge30gOiBjb250ZXh0SW5bcF07DQogICAgICAgIGZvciAodmFyIHAgaW4gY29udGV4dEluLmFjY2VzcykgY29udGV4dC5hY2Nlc3NbcF0gPSBjb250ZXh0SW4uYWNjZXNzW3BdOw0KICAgICAgICBjb250ZXh0LmFkZEluaXRpYWxpemVyID0gZnVuY3Rpb24gKGYpIHsgaWYgKGRvbmUpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCBhZGQgaW5pdGlhbGl6ZXJzIGFmdGVyIGRlY29yYXRpb24gaGFzIGNvbXBsZXRlZCIpOyBleHRyYUluaXRpYWxpemVycy5wdXNoKGFjY2VwdChmIHx8IG51bGwpKTsgfTsNCiAgICAgICAgdmFyIHJlc3VsdCA9ICgwLCBkZWNvcmF0b3JzW2ldKShraW5kID09PSAiYWNjZXNzb3IiID8geyBnZXQ6IGRlc2NyaXB0b3IuZ2V0LCBzZXQ6IGRlc2NyaXB0b3Iuc2V0IH0gOiBkZXNjcmlwdG9yW2tleV0sIGNvbnRleHQpOw0KICAgICAgICBpZiAoa2luZCA9PT0gImFjY2Vzc29yIikgew0KICAgICAgICAgICAgaWYgKHJlc3VsdCA9PT0gdm9pZCAwKSBjb250aW51ZTsNCiAgICAgICAgICAgIGlmIChyZXN1bHQgPT09IG51bGwgfHwgdHlwZW9mIHJlc3VsdCAhPT0gIm9iamVjdCIpIHRocm93IG5ldyBUeXBlRXJyb3IoIk9iamVjdCBleHBlY3RlZCIpOw0KICAgICAgICAgICAgaWYgKF8gPSBhY2NlcHQocmVzdWx0LmdldCkpIGRlc2NyaXB0b3IuZ2V0ID0gXzsNCiAgICAgICAgICAgIGlmIChfID0gYWNjZXB0KHJlc3VsdC5zZXQpKSBkZXNjcmlwdG9yLnNldCA9IF87DQogICAgICAgICAgICBpZiAoXyA9IGFjY2VwdChyZXN1bHQuaW5pdCkpIGluaXRpYWxpemVycy5wdXNoKF8pOw0KICAgICAgICB9DQogICAgICAgIGVsc2UgaWYgKF8gPSBhY2NlcHQocmVzdWx0KSkgew0KICAgICAgICAgICAgaWYgKGtpbmQgPT09ICJmaWVsZCIpIGluaXRpYWxpemVycy5wdXNoKF8pOw0KICAgICAgICAgICAgZWxzZSBkZXNjcmlwdG9yW2tleV0gPSBfOw0KICAgICAgICB9DQogICAgfQ0KICAgIGlmICh0YXJnZXQpIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0YXJnZXQsIGNvbnRleHRJbi5uYW1lLCBkZXNjcmlwdG9yKTsNCiAgICBkb25lID0gdHJ1ZTsNCn07DQp2YXIgX19ydW5Jbml0aWFsaXplcnMgPSAodGhpcyAmJiB0aGlzLl9fcnVuSW5pdGlhbGl6ZXJzKSB8fCBmdW5jdGlvbiAodGhpc0FyZywgaW5pdGlhbGl6ZXJzLCB2YWx1ZSkgew0KICAgIHZhciB1c2VWYWx1ZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAyOw0KICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaW5pdGlhbGl6ZXJzLmxlbmd0aDsgaSsrKSB7DQogICAgICAgIHZhbHVlID0gdXNlVmFsdWUgPyBpbml0aWFsaXplcnNbaV0uY2FsbCh0aGlzQXJnLCB2YWx1ZSkgOiBpbml0aWFsaXplcnNbaV0uY2FsbCh0aGlzQXJnKTsNCiAgICB9DQogICAgcmV0dXJuIHVzZVZhbHVlID8gdmFsdWUgOiB2b2lkIDA7DQp9Ow0KdmFyIF9fc2V0RnVuY3Rpb25OYW1lID0gKHRoaXMgJiYgdGhpcy5fX3NldEZ1bmN0aW9uTmFtZSkgfHwgZnVuY3Rpb24gKGYsIG5hbWUsIHByZWZpeCkgew0KICAgIGlmICh0eXBlb2YgbmFtZSA9PT0gInN5bWJvbCIpIG5hbWUgPSBuYW1lLmRlc2NyaXB0aW9uID8gIlsiLmNvbmNhdChuYW1lLmRlc2NyaXB0aW9uLCAiXSIpIDogIiI7DQogICAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShmLCAibmFtZSIsIHsgY29uZmlndXJhYmxlOiB0cnVlLCB2YWx1ZTogcHJlZml4ID8gIiIuY29uY2F0KHByZWZpeCwgIiAiLCBuYW1lKSA6IG5hbWUgfSk7DQp9Ow0KdmFyIF9fY2xhc3NQcml2YXRlRmllbGRHZXQgPSAodGhpcyAmJiB0aGlzLl9fY2xhc3NQcml2YXRlRmllbGRHZXQpIHx8IGZ1bmN0aW9uIChyZWNlaXZlciwgc3RhdGUsIGtpbmQsIGYpIHsNCiAgICBpZiAoa2luZCA9PT0gImEiICYmICFmKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIGFjY2Vzc29yIHdhcyBkZWZpbmVkIHdpdGhvdXQgYSBnZXR0ZXIiKTsNCiAgICBpZiAodHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgIT09IHN0YXRlIHx8ICFmIDogIXN0YXRlLmhhcyhyZWNlaXZlcikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCByZWFkIHByaXZhdGUgbWVtYmVyIGZyb20gYW4gb2JqZWN0IHdob3NlIGNsYXNzIGRpZCBub3QgZGVjbGFyZSBpdCIpOw0KICAgIHJldHVybiBraW5kID09PSAibSIgPyBmIDoga2luZCA9PT0gImEiID8gZi5jYWxsKHJlY2VpdmVyKSA6IGYgPyBmLnZhbHVlIDogc3RhdGUuZ2V0KHJlY2VpdmVyKTsNCn07DQp2YXIgX19jbGFzc1ByaXZhdGVGaWVsZFNldCA9ICh0aGlzICYmIHRoaXMuX19jbGFzc1ByaXZhdGVGaWVsZFNldCkgfHwgZnVuY3Rpb24gKHJlY2VpdmVyLCBzdGF0ZSwgdmFsdWUsIGtpbmQsIGYpIHsNCiAgICBpZiAoa2luZCA9PT0gIm0iKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIG1ldGhvZCBpcyBub3Qgd3JpdGFibGUiKTsNCiAgICBpZiAoa2luZCA9PT0gImEiICYmICFmKSB0aHJvdyBuZXcgVHlwZUVycm9yKCJQcml2YXRlIGFjY2Vzc29yIHdhcyBkZWZpbmVkIHdpdGhvdXQgYSBzZXR0ZXIiKTsNCiAgICBpZiAodHlwZW9mIHN0YXRlID09PSAiZnVuY3Rpb24iID8gcmVjZWl2ZXIgIT09IHN0YXRlIHx8ICFmIDogIXN0YXRlLmhhcyhyZWNlaXZlcikpIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCB3cml0ZSBwcml2YXRlIG1lbWJlciB0byBhbiBvYmplY3Qgd2hvc2UgY2xhc3MgZGlkIG5vdCBkZWNsYXJlIGl0Iik7DQogICAgcmV0dXJuIChraW5kID09PSAiYSIgPyBmLmNhbGwocmVjZWl2ZXIsIHZhbHVlKSA6IGYgPyBmLnZhbHVlID0gdmFsdWUgOiBzdGF0ZS5zZXQocmVjZWl2ZXIsIHZhbHVlKSksIHZhbHVlOw0KfTsNCmxldCBDID0gKCgpID0+IHsNCiAgICB2YXIgX21ldGhvZF9nZXQsIF94X2dldCwgX3hfc2V0LCBfeSwgX3pfYWNjZXNzb3Jfc3RvcmFnZSwgX3pfZ2V0LCBfel9zZXQ7DQogICAgbGV0IF9jbGFzc0RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgIGxldCBfY2xhc3NEZXNjcmlwdG9yOw0KICAgIGxldCBfY2xhc3NFeHRyYUluaXRpYWxpemVycyA9IFtdOw0KICAgIGxldCBfY2xhc3NUaGlzOw0KICAgIGxldCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX2luc3RhbmNlRXh0cmFJbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX21ldGhvZF9kZWNvcmF0b3JzOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2Rlc2NyaXB0b3I7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZWNvcmF0b3JzOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVzY3JpcHRvcjsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3NldF94X2RlY29yYXRvcnM7DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZXNjcmlwdG9yOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzOw0KICAgIGxldCBfc3RhdGljX3ByaXZhdGVfeV9pbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3pfZGVjb3JhdG9yczsNCiAgICBsZXQgX3N0YXRpY19wcml2YXRlX3pfaW5pdGlhbGl6ZXJzID0gW107DQogICAgbGV0IF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3I7DQogICAgbGV0IF9tZXRob2RfZGVjb3JhdG9yczsNCiAgICBsZXQgX2dldF94X2RlY29yYXRvcnM7DQogICAgbGV0IF9zZXRfeF9kZWNvcmF0b3JzOw0KICAgIGxldCBfeV9kZWNvcmF0b3JzOw0KICAgIGxldCBfeV9pbml0aWFsaXplcnMgPSBbXTsNCiAgICBsZXQgX3pfZGVjb3JhdG9yczsNCiAgICBsZXQgX3pfaW5pdGlhbGl6ZXJzID0gW107DQogICAgdmFyIEMgPSBjbGFzcyB7DQogICAgICAgIHN0YXRpYyB7IF9fc2V0RnVuY3Rpb25OYW1lKHRoaXMsICJDIik7IH0NCiAgICAgICAgc3RhdGljIHsgX21ldGhvZF9nZXQgPSBmdW5jdGlvbiBfbWV0aG9kX2dldCgpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVzY3JpcHRvci52YWx1ZTsgfSwgX3hfZ2V0ID0gZnVuY3Rpb24gX3hfZ2V0KCkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX2dldF94X2Rlc2NyaXB0b3IuZ2V0LmNhbGwodGhpcyk7IH0sIF94X3NldCA9IGZ1bmN0aW9uIF94X3NldCh2YWx1ZSkgeyByZXR1cm4gX3N0YXRpY19wcml2YXRlX3NldF94X2Rlc2NyaXB0b3Iuc2V0LmNhbGwodGhpcywgdmFsdWUpOyB9LCBfel9nZXQgPSBmdW5jdGlvbiBfel9nZXQoKSB7IHJldHVybiBfc3RhdGljX3ByaXZhdGVfel9kZXNjcmlwdG9yLmdldC5jYWxsKHRoaXMpOyB9LCBfel9zZXQgPSBmdW5jdGlvbiBfel9zZXQodmFsdWUpIHsgcmV0dXJuIF9zdGF0aWNfcHJpdmF0ZV96X2Rlc2NyaXB0b3Iuc2V0LmNhbGwodGhpcywgdmFsdWUpOyB9OyB9DQogICAgICAgIHN0YXRpYyB7DQogICAgICAgICAgICBfbWV0aG9kX2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX2dldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX3NldF94X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX3lfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfel9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgICAgIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfc3RhdGljX3ByaXZhdGVfZ2V0X3hfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVjb3JhdG9ycyA9IFtkZWMsIGRlY107DQogICAgICAgICAgICBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzID0gW2RlYywgZGVjXTsNCiAgICAgICAgICAgIF9zdGF0aWNfcHJpdmF0ZV96X2RlY29yYXRvcnMgPSBbZGVjLCBkZWNdOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIF9zdGF0aWNfcHJpdmF0ZV9tZXRob2RfZGVzY3JpcHRvciA9IHsgdmFsdWU6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICgpIHsgfSwgIiNtZXRob2QiKSB9LCBfc3RhdGljX3ByaXZhdGVfbWV0aG9kX2RlY29yYXRvcnMsIHsga2luZDogIm1ldGhvZCIsIG5hbWU6ICIjbWV0aG9kIiwgc3RhdGljOiB0cnVlLCBwcml2YXRlOiB0cnVlIH0sIG51bGwsIF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgICAgICBfX2VzRGVjb3JhdGUodGhpcywgX3N0YXRpY19wcml2YXRlX2dldF94X2Rlc2NyaXB0b3IgPSB7IGdldDogX19zZXRGdW5jdGlvbk5hbWUoZnVuY3Rpb24gKCkgeyByZXR1cm4gMTsgfSwgIiN4IiwgImdldCIpIH0sIF9zdGF0aWNfcHJpdmF0ZV9nZXRfeF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJnZXR0ZXIiLCBuYW1lOiAiI3giLCBzdGF0aWM6IHRydWUsIHByaXZhdGU6IHRydWUgfSwgbnVsbCwgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZSh0aGlzLCBfc3RhdGljX3ByaXZhdGVfc2V0X3hfZGVzY3JpcHRvciA9IHsgc2V0OiBfX3NldEZ1bmN0aW9uTmFtZShmdW5jdGlvbiAodmFsdWUpIHsgfSwgIiN4IiwgInNldCIpIH0sIF9zdGF0aWNfcHJpdmF0ZV9zZXRfeF9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJzZXR0ZXIiLCBuYW1lOiAiI3giLCBzdGF0aWM6IHRydWUsIHByaXZhdGU6IHRydWUgfSwgbnVsbCwgX3N0YXRpY0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZSh0aGlzLCBfc3RhdGljX3ByaXZhdGVfel9kZXNjcmlwdG9yID0geyBnZXQ6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICgpIHsgcmV0dXJuIF9fY2xhc3NQcml2YXRlRmllbGRHZXQodGhpcywgX2NsYXNzVGhpcywgImYiLCBfel9hY2Nlc3Nvcl9zdG9yYWdlKTsgfSwgIiN6IiwgImdldCIpLCBzZXQ6IF9fc2V0RnVuY3Rpb25OYW1lKGZ1bmN0aW9uICh2YWx1ZSkgeyBfX2NsYXNzUHJpdmF0ZUZpZWxkU2V0KHRoaXMsIF9jbGFzc1RoaXMsIHZhbHVlLCAiZiIsIF96X2FjY2Vzc29yX3N0b3JhZ2UpOyB9LCAiI3oiLCAic2V0IikgfSwgX3N0YXRpY19wcml2YXRlX3pfZGVjb3JhdG9ycywgeyBraW5kOiAiYWNjZXNzb3IiLCBuYW1lOiAiI3oiLCBzdGF0aWM6IHRydWUsIHByaXZhdGU6IHRydWUgfSwgX3N0YXRpY19wcml2YXRlX3pfaW5pdGlhbGl6ZXJzLCBfc3RhdGljRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIG51bGwsIF9tZXRob2RfZGVjb3JhdG9ycywgeyBraW5kOiAibWV0aG9kIiwgbmFtZTogIm1ldGhvZCIsIHN0YXRpYzogZmFsc2UsIHByaXZhdGU6IGZhbHNlIH0sIG51bGwsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZSh0aGlzLCBudWxsLCBfZ2V0X3hfZGVjb3JhdG9ycywgeyBraW5kOiAiZ2V0dGVyIiwgbmFtZTogIngiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSB9LCBudWxsLCBfaW5zdGFuY2VFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgICAgICBfX2VzRGVjb3JhdGUodGhpcywgbnVsbCwgX3NldF94X2RlY29yYXRvcnMsIHsga2luZDogInNldHRlciIsIG5hbWU6ICJ4Iiwgc3RhdGljOiBmYWxzZSwgcHJpdmF0ZTogZmFsc2UgfSwgbnVsbCwgX2luc3RhbmNlRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKHRoaXMsIG51bGwsIF96X2RlY29yYXRvcnMsIHsga2luZDogImFjY2Vzc29yIiwgbmFtZTogInoiLCBzdGF0aWM6IGZhbHNlLCBwcml2YXRlOiBmYWxzZSB9LCBfel9pbml0aWFsaXplcnMsIF9pbnN0YW5jZUV4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIF9fZXNEZWNvcmF0ZShudWxsLCBudWxsLCBfc3RhdGljX3ByaXZhdGVfeV9kZWNvcmF0b3JzLCB7IGtpbmQ6ICJmaWVsZCIsIG5hbWU6ICIjeSIsIHN0YXRpYzogdHJ1ZSwgcHJpdmF0ZTogdHJ1ZSB9LCBfc3RhdGljX3ByaXZhdGVfeV9pbml0aWFsaXplcnMsIF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgICAgICBfX2VzRGVjb3JhdGUobnVsbCwgbnVsbCwgX3lfZGVjb3JhdG9ycywgeyBraW5kOiAiZmllbGQiLCBuYW1lOiAieSIsIHN0YXRpYzogZmFsc2UsIHByaXZhdGU6IGZhbHNlIH0sIF95X2luaXRpYWxpemVycywgX2luc3RhbmNlRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICAgICAgX19lc0RlY29yYXRlKG51bGwsIF9jbGFzc0Rlc2NyaXB0b3IgPSB7IHZhbHVlOiB0aGlzIH0sIF9jbGFzc0RlY29yYXRvcnMsIHsga2luZDogImNsYXNzIiwgbmFtZTogdGhpcy5uYW1lIH0sIG51bGwsIF9jbGFzc0V4dHJhSW5pdGlhbGl6ZXJzKTsNCiAgICAgICAgICAgIEMgPSBfY2xhc3NUaGlzID0gX2NsYXNzRGVzY3JpcHRvci52YWx1ZTsNCiAgICAgICAgICAgIF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNFeHRyYUluaXRpYWxpemVycyk7DQogICAgICAgIH0NCiAgICAgICAgbWV0aG9kKCkgeyB9DQogICAgICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQ0KICAgICAgICBzZXQgeCh2YWx1ZSkgeyB9DQogICAgICAgIHkgPSAoX19ydW5Jbml0aWFsaXplcnModGhpcywgX2luc3RhbmNlRXh0cmFJbml0aWFsaXplcnMpLCBfX3J1bkluaXRpYWxpemVycyh0aGlzLCBfeV9pbml0aWFsaXplcnMsIDEpKTsNCiAgICAgICAgI3pfYWNjZXNzb3Jfc3RvcmFnZSA9IF9fcnVuSW5pdGlhbGl6ZXJzKHRoaXMsIF96X2luaXRpYWxpemVycywgMSk7DQogICAgICAgIGdldCB6KCkgeyByZXR1cm4gdGhpcy4jel9hY2Nlc3Nvcl9zdG9yYWdlOyB9DQogICAgICAgIHNldCB6KHZhbHVlKSB7IHRoaXMuI3pfYWNjZXNzb3Jfc3RvcmFnZSA9IHZhbHVlOyB9DQogICAgICAgIHN0YXRpYyB7DQogICAgICAgICAgICBfeSA9IHsgdmFsdWU6IF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV95X2luaXRpYWxpemVycywgMSkgfTsNCiAgICAgICAgfQ0KICAgICAgICBzdGF0aWMgew0KICAgICAgICAgICAgX3pfYWNjZXNzb3Jfc3RvcmFnZSA9IHsgdmFsdWU6IF9fcnVuSW5pdGlhbGl6ZXJzKF9jbGFzc1RoaXMsIF9zdGF0aWNfcHJpdmF0ZV96X2luaXRpYWxpemVycywgMSkgfTsNCiAgICAgICAgfQ0KICAgICAgICBzdGF0aWMgew0KICAgICAgICAgICAgX19ydW5Jbml0aWFsaXplcnMoX2NsYXNzVGhpcywgX2NsYXNzRXh0cmFJbml0aWFsaXplcnMpOw0KICAgICAgICB9DQogICAgfTsNCiAgICByZXR1cm4gQyA9IF9jbGFzc1RoaXM7DQp9KSgpOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7SUFJTSxDQUFDOzs0QkFGTixHQUFHLEVBQ0gsR0FBRzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O1FBQ0UsQ0FBQzs7OztrQ0FDRixHQUFHLEVBQ0gsR0FBRztpQ0FHSCxHQUFHLEVBQ0gsR0FBRztpQ0FHSCxHQUFHLEVBQ0gsR0FBRzs2QkFHSCxHQUFHLEVBQ0gsR0FBRzs2QkFHSCxHQUFHLEVBQ0gsR0FBRztpREFHSCxHQUFHLEVBQ0gsR0FBRztnREFHSCxHQUFHLEVBQ0gsR0FBRztnREFHSCxHQUFHLEVBQ0gsR0FBRzs0Q0FHSCxHQUFHLEVBQ0gsR0FBRzs0Q0FHSCxHQUFHLEVBQ0gsR0FBRztZQWZKLHlEQUFBLHlCQUFBLGNBQWtCLENBQUMsWUFBQSx5SUFBQTtZQUluQix3REFBQSx1QkFBQSxjQUFrQixPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsY0FBQSxtSUFBQTtZQUk3Qix3REFBQSx1QkFBQSxVQUFjLEtBQWEsSUFBSSxDQUFDLGNBQUEsbUlBQUE7WUFRaEMsb0RBQUEsdUJBQUEsMEZBQXVCLGNBQUEsRUFBdkIsdUJBQUEsK0ZBQXVCLGNBQUEsMkpBQUE7WUFwQ3ZCLGtKQUFXO1lBSVgsNElBQXFCO1lBSXJCLDRJQUF3QjtZQVF4QixxSkFBZTtZQWdCZiw2S0FBYztZQXBCZCxrSkFBTTtZQWZWLDRJQXdDQztZQXhDSyxDQUFDO1lBQUQsd0RBQUM7O1FBR0gsTUFBTSxLQUFJLENBQUM7UUFJWCxJQUFJLENBQUMsS0FBSyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFJckIsSUFBSSxDQUFDLENBQUMsS0FBYSxJQUFJLENBQUM7UUFJeEIsQ0FBQyxrR0FBRyxDQUFDLEdBQUM7UUFJTiwrREFBYSxDQUFDLEVBQUM7UUFBZixJQUFTLENBQUMsdUNBQUs7UUFBZixJQUFTLENBQUMsNkNBQUs7O1lBZ0JSLDRFQUFLLENBQUMsR0FBSixDQUFLOzs7WUFJRSw2RkFBSyxDQUFDLEdBQUosQ0FBSzs7O1lBdkNyQix1REFBQzs7O1dBQUQsQ0FBQyJ9,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=es2022).sourcemap.txt b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt new file mode 100644 index 0000000000000..fc615d23c3d46 --- /dev/null +++ b/tests/baselines/reference/esDecorators-classDeclaration-sourceMap(target=es2022).sourcemap.txt @@ -0,0 +1,1009 @@ +=================================================================== +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, prefix) { +>>> if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; +>>> 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"); +>>> 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; +>>> 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 { _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 }, null, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^^^-> +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, 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 }, null, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^^^^^^^^^^^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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, 131) 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 }, null, _staticExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^ +5 > ^^^^^ +6 > ^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +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, 126) 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 }, _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, 481) Source(44, 28) + SourceIndex(0) +--- +>>> __esDecorate(this, null, _method_decorators, { kind: "method", name: "method", static: false, private: false }, null, _instanceExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > method() {} +1 >Emitted(94, 13) Source(8, 5) + 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 }, null, _instanceExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > + > + > @dec + > @dec + > +2 > get x() { return 1; } +1 >Emitted(95, 13) Source(12, 5) + 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 }, null, _instanceExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^-> +1-> + > + > @dec + > @dec + > +2 > set x(value: number) { } +1->Emitted(96, 13) Source(16, 5) + SourceIndex(0) +2 >Emitted(96, 153) Source(16, 29) + SourceIndex(0) +--- +>>> __esDecorate(this, null, _z_decorators, { kind: "accessor", name: "z", static: false, private: false }, _z_initializers, _instanceExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > @dec + > @dec + > y = 1; + > + > @dec + > @dec + > +2 > accessor z = 1; +1->Emitted(97, 13) Source(24, 5) + 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 }, _static_private_y_initializers, _staticExtraInitializers); +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +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(98, 13) Source(40, 5) + SourceIndex(0) +2 >Emitted(98, 186) Source(40, 19) + SourceIndex(0) +--- +>>> __esDecorate(null, null, _y_decorators, { kind: "field", name: "y", static: false, private: false }, _y_initializers, _instanceExtraInitializers); +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 > y = 1; +1 >Emitted(99, 13) Source(20, 5) + 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 >^^^^^^^^^^^^ +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_accessor_storage = __runInitializers(this, _z_initializers, 1); +1 >^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +1 > + > + > @dec + > @dec + > +2 > accessor z = +3 > 1 +4 > ; +1 >Emitted(108, 9) Source(24, 5) + 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 this.#z_accessor_storage; } +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, 53) Source(24, 20) + SourceIndex(0) +--- +>>> set z(value) { this.#z_accessor_storage = value; } +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, 59) Source(24, 20) + SourceIndex(0) +--- +>>> static { +>>> _y = { value: __runInitializers(_classThis, _static_private_y_initializers, 1) }; +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +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(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) +--- +>>> } +>>> 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(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(121, 12) Source(5, 7) + SourceIndex(0) +2 >Emitted(121, 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;IACJ,MAAM,KAAI,CAAC;IAEX,CAAC,GAAG;IACJ,CAAC,GAAG;QACA,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAErB,CAAC,GAAG;IACJ,CAAC,GAAG;QACA,CAAC,CAAC,KAAa,IAAI,CAAC;IAExB,CAAC,GAAG;IACJ,CAAC,GAAG;IACJ,CAAC,GAAG,CAAC,CAAC;IAEN,CAAC,GAAG;IACJ,CAAC,GAAG;IACJ,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;IAEf,CAAC,GAAG;IACJ,CAAC,GAAG;IACJ,MAAM,CAAC,OAAO,KAAI,CAAC;IAEnB,CAAC,GAAG;IACJ,CAAC,GAAG;IACJ,MAAM,KAAK,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAE7B,CAAC,GAAG;IACJ,CAAC,GAAG;IACJ,MAAM,KAAK,EAAE,CAAC,KAAa,IAAI,CAAC;IAEhC,CAAC,GAAG;IACJ,CAAC,GAAG;IACJ,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;IAEd,CAAC,GAAG;IACJ,CAAC,GAAG;IACJ,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC"} +//// https://sokra.github.io/source-map-visualization#base64,QGRlYw0KQGRlYw0KY2xhc3MgQyB7DQogICAgQGRlYw0KICAgIEBkZWMNCiAgICBtZXRob2QoKSB7IH0NCiAgICBAZGVjDQogICAgQGRlYw0KICAgIGdldCB4KCkgeyByZXR1cm4gMTsgfQ0KICAgIEBkZWMNCiAgICBAZGVjDQogICAgc2V0IHgodmFsdWUpIHsgfQ0KICAgIEBkZWMNCiAgICBAZGVjDQogICAgeSA9IDE7DQogICAgQGRlYw0KICAgIEBkZWMNCiAgICBhY2Nlc3NvciB6ID0gMTsNCiAgICBAZGVjDQogICAgQGRlYw0KICAgIHN0YXRpYyAjbWV0aG9kKCkgeyB9DQogICAgQGRlYw0KICAgIEBkZWMNCiAgICBzdGF0aWMgZ2V0ICN4KCkgeyByZXR1cm4gMTsgfQ0KICAgIEBkZWMNCiAgICBAZGVjDQogICAgc3RhdGljIHNldCAjeCh2YWx1ZSkgeyB9DQogICAgQGRlYw0KICAgIEBkZWMNCiAgICBzdGF0aWMgI3kgPSAxOw0KICAgIEBkZWMNCiAgICBAZGVjDQogICAgc3RhdGljIGFjY2Vzc29yICN6ID0gMTsNCn0NCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWVzRGVjb3JhdG9ycy1jbGFzc0RlY2xhcmF0aW9uLXNvdXJjZU1hcC5qcy5tYXA=,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXNEZWNvcmF0b3JzLWNsYXNzRGVjbGFyYXRpb24tc291cmNlTWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLENBQUMsR0FBRztBQUNKLENBQUMsR0FBRztNQUNFLENBQUM7SUFDSCxDQUFDLEdBQUc7SUFDSixDQUFDLEdBQUc7SUFDSixNQUFNLEtBQUksQ0FBQztJQUVYLENBQUMsR0FBRztJQUNKLENBQUMsR0FBRztRQUNBLENBQUMsS0FBSyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFFckIsQ0FBQyxHQUFHO0lBQ0osQ0FBQyxHQUFHO1FBQ0EsQ0FBQyxDQUFDLEtBQWEsSUFBSSxDQUFDO0lBRXhCLENBQUMsR0FBRztJQUNKLENBQUMsR0FBRztJQUNKLENBQUMsR0FBRyxDQUFDLENBQUM7SUFFTixDQUFDLEdBQUc7SUFDSixDQUFDLEdBQUc7SUFDSixRQUFRLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUVmLENBQUMsR0FBRztJQUNKLENBQUMsR0FBRztJQUNKLE1BQU0sQ0FBQyxPQUFPLEtBQUksQ0FBQztJQUVuQixDQUFDLEdBQUc7SUFDSixDQUFDLEdBQUc7SUFDSixNQUFNLEtBQUssRUFBRSxLQUFLLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUU3QixDQUFDLEdBQUc7SUFDSixDQUFDLEdBQUc7SUFDSixNQUFNLEtBQUssRUFBRSxDQUFDLEtBQWEsSUFBSSxDQUFDO0lBRWhDLENBQUMsR0FBRztJQUNKLENBQUMsR0FBRztJQUNKLE1BQU0sQ0FBQyxFQUFFLEdBQUcsQ0FBQyxDQUFDO0lBRWQsQ0FBQyxHQUFHO0lBQ0osQ0FBQyxHQUFHO0lBQ0osTUFBTSxDQUFDLFFBQVEsQ0FBQyxFQUFFLEdBQUcsQ0FBQyxDQUFDIn0=,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/esDecorators-classExpression-classSuper.1.js b/tests/baselines/reference/esDecorators-classExpression-classSuper.1.js new file mode 100644 index 0000000000000..55a3de265b4e2 --- /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 = _classThis; +})()); 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..8ffd58e86ffc8 --- /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 = _classThis; +})()); +// 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 = _classThis_1; +})()); +// 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 = _classThis_2; +})()); 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..ac9ea3a19cbbb --- /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 = _classThis; +})()); 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..2b901f0137f24 --- /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 = _classThis; +})()); 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..41327501b796a --- /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 = _classThis; +})()); +((() => { + 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 = _classThis_1; +})()); +((() => { + 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 = _classThis_2; +})()); 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..d40daa28ff70e --- /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 = _classThis; +})()); 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..333da95619b15 --- /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 }, 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); + })(), + /*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..18f1285498e2a --- /dev/null +++ b/tests/baselines/reference/esDecorators-classExpression-commentPreservation(target=es2022).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, _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 { _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 }, 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); + } + /*5*/ + method() { } + /*8*/ + get x() { return 1; } + /*11*/ + set x(value) { } + /*14*/ + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1)); + #z_accessor_storage = __runInitializers(this, _z_initializers, 1); + /*17*/ + 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) }; + } + static { + _z_accessor_storage = { value: __runInitializers(_classThis, _static_private_z_initializers, 1) }; + } + 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/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/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js b/tests/baselines/reference/esDecorators-classExpression-namedEvaluation.1.js new file mode 100644 index 0000000000000..dd3a023765437 --- /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 = _classThis; +})(); +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 }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + }; +})(); +// 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 = _classThis_1; +})(); +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 }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); + }; +})(); +// 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 = _classThis_2; +})(); +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 }, _y_initializers, _instanceExtraInitializers_2); + } + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); + }; +})(); +// 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 = _classThis_3; +})(); +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 }, _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 new file mode 100644 index 0000000000000..4791d945bd8d5 --- /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 = _classThis; + })(); + } +} +{ + 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 = _classThis_1; + })(); + } +} +{ + 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 = _classThis_2; + })(); + } +} +{ + 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 = _classThis_3; + })(); + } +} +{ + 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 = _classThis_4; + })(); + } +} +// @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 = _classThis_5; + })(); + } +} +// __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 = _classThis_6; + })(); + } +} +{ + 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 = _classThis_7; + })(); + } +} +{ + 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 }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + }; + })(); + } +} +{ + 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 }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); + }; + })(); + } +} +{ + 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 }, _y_initializers, _instanceExtraInitializers_2); + } + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); + }; + })(); + } +} +{ + 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 }, _y_initializers, _instanceExtraInitializers_3); + } + y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers, void 0)); + }; + })(); + } +} +{ + 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 }, _y_initializers, _instanceExtraInitializers_4); + } + y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers, void 0)); + }; + })(); + } +} +// @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 = _classThis_8; + })(); + } +} +// __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 }, _y_initializers, _instanceExtraInitializers_5); + } + y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers, void 0)); + }; + })(); + } +} +{ + 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 }, _y_initializers, _instanceExtraInitializers_6); + } + y = (__runInitializers(this, _instanceExtraInitializers_6), __runInitializers(this, _y_initializers, void 0)); + }; + })(); + } +} +// 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 }, _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 = _classThis_9; + })()); + }; + })(); +} 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..c52affc2fd9d8 --- /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 = _classThis; +})()); +((() => { + 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 }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + }; +})()); +// 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 = _classThis_1; +})()); +((() => { + 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 }, _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 new file mode 100644 index 0000000000000..14f2f5cbb8e2b --- /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 = _classThis; + })() }); +({ 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 }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + }; + })() }); +({ "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 = _classThis_1; + })() }); +({ "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 }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); + }; + })() }); +({ 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 = _classThis_2; + })() }); +({ 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 }, _y_initializers, _instanceExtraInitializers_2); + } + y = (__runInitializers(this, _instanceExtraInitializers_2), __runInitializers(this, _y_initializers, void 0)); + }; + })() }); +({ ["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 = _classThis_3; + })() }); +({ ["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 }, _y_initializers, _instanceExtraInitializers_3); + } + y = (__runInitializers(this, _instanceExtraInitializers_3), __runInitializers(this, _y_initializers, void 0)); + }; + })() }); +({ [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 = _classThis_4; + })() }); +({ [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 }, _y_initializers, _instanceExtraInitializers_4); + } + y = (__runInitializers(this, _instanceExtraInitializers_4), __runInitializers(this, _y_initializers, void 0)); + }; + })() }); +({ [_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 = _classThis_5; + })() }); +({ [_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 }, _y_initializers, _instanceExtraInitializers_5); + } + y = (__runInitializers(this, _instanceExtraInitializers_5), __runInitializers(this, _y_initializers, void 0)); + }; + })() }); +// __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 = _classThis_6; + })() }); +({ "__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 = _classThis_7; + })() }); +// "__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 = _classThis_8; + })() }); 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..52df2183693a6 --- /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 = _classThis; + })(); +} +{ + 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 }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + }; + })(); +} +{ + 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 = _classThis_1; + })(); +} +{ + 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 }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); + }; + })(); +} +// 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 = _classThis_2; + })(); +} +{ + 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 }, _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 new file mode 100644 index 0000000000000..714b994e1c5ca --- /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 = _classThis; + })()] = 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 }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + }; + })()] = 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 = _classThis_1; + })() } = 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 }, _y_initializers, _instanceExtraInitializers_1); + } + y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); + }; + })() } = 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 = _classThis_2; + })() } = 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 }, _y_initializers, _instanceExtraInitializers_2); + } + 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 new file mode 100644 index 0000000000000..06d3c745c566d --- /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 = _classThis; + })() } = 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 }, _y_initializers, _instanceExtraInitializers); + } + 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 new file mode 100644 index 0000000000000..caf357a9a7280 --- /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 = _classThis; + })() } = 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 }, _y_initializers, _instanceExtraInitializers); + } + 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 new file mode 100644 index 0000000000000..bd76e88acd2f6 --- /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 = _classThis; + })()] = 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 }, _y_initializers, _instanceExtraInitializers); + } + 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 new file mode 100644 index 0000000000000..cb51acdc545ee --- /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 = _classThis; +})()); +//// [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 }, _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 new file mode 100644 index 0000000000000..f65818ec45578 --- /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 = _classThis; +})(); +//// [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 }, _y_initializers, _instanceExtraInitializers); + } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + }; +})(); 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<This, Args extends any[], Return>(source: string, bound = true) { + return function loggedDecorator( + target: (this: This, ...args: Args) => Return, + context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => 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<This, Args extends any[], Return>(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<This, (this: This, ...args: Args) => 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<C, (this: C) => void>) => (this: C) => void +>boundMethodLogger : <This, Args extends any[], Return>(source: string, bound?: boolean) => (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => 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<This, Args extends any[], Return>(source: string, bound = true) { +>boundMethodLogger : <This, Args extends any[], Return>(source: string, bound?: boolean) => (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => 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<This, (this: This, ...args: Args) => 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<This, (this: This, ...args: Args) => Return>) => (this: This, ...args: Args) => Return +>loggedDecorator : (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>) => (this: This, ...args: Args) => Return + + target: (this: This, ...args: Args) => Return, +>target : (this: This, ...args: Args) => Return +>this : This +>args : Args + + context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return> +>context : ClassMethodDecoratorContext<This, (this: This, ...args: Args) => 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<This, (this: This, ...args: Args) => 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<This, (this: This, ...args: Args) => 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<This, (this: This, ...args: Args) => 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<This, (this: This, ...args: Args) => 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/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..0e2539de5e446 --- /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<typeof C>) => void +>(t, c) => { } : (t: typeof C, c: ClassDecoratorContext<typeof C>) => void +>t : typeof C +>c : ClassDecoratorContext<typeof C> + +class C { +>C : C + + @((t, c) => { }) +>((t, c) => { }) : (t: () => void, c: ClassMethodDecoratorContext<typeof C, () => void> & { name: "f"; private: false; static: true; }) => void +>(t, c) => { } : (t: () => void, c: ClassMethodDecoratorContext<typeof C, () => void> & { name: "f"; private: false; static: true; }) => void +>t : () => void +>c : ClassMethodDecoratorContext<typeof C, () => void> & { name: "f"; private: false; static: true; } + + static f() {} +>f : () => void + + @((t, c) => { }) +>((t, c) => { }) : (t: () => void, c: ClassMethodDecoratorContext<typeof C, () => void> & { name: "#f"; private: true; static: true; }) => void +>(t, c) => { } : (t: () => void, c: ClassMethodDecoratorContext<typeof C, () => void> & { name: "#f"; private: true; static: true; }) => void +>t : () => void +>c : ClassMethodDecoratorContext<typeof C, () => void> & { name: "#f"; private: true; static: true; } + + static #f() {} +>#f : () => void + + @((t, c) => { }) +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext<typeof C, number> & { name: "x"; private: false; static: true; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext<typeof C, number> & { name: "x"; private: false; static: true; }) => void +>t : () => number +>c : ClassGetterDecoratorContext<typeof C, 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<typeof C, number> & { name: "x"; private: false; static: true; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext<typeof C, number> & { name: "x"; private: false; static: true; }) => void +>t : (value: number) => void +>c : ClassSetterDecoratorContext<typeof C, number> & { name: "x"; private: false; static: true; } + + static set x(value) { } +>x : number +>value : number + + @((t, c) => { }) +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext<typeof C, number> & { name: "#x"; private: true; static: true; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext<typeof C, number> & { name: "#x"; private: true; static: true; }) => void +>t : () => number +>c : ClassGetterDecoratorContext<typeof C, 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<typeof C, number> & { name: "#x"; private: true; static: true; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext<typeof C, number> & { name: "#x"; private: true; static: true; }) => void +>t : (value: number) => void +>c : ClassSetterDecoratorContext<typeof C, number> & { name: "#x"; private: true; static: true; } + + static set #x(value) { } +>#x : number +>value : number + + @((t, c) => { }) +>((t, c) => { }) : (t: ClassAccessorDecoratorTarget<typeof C, number>, c: ClassAccessorDecoratorContext<typeof C, number> & { name: "y"; private: false; static: true; }) => void +>(t, c) => { } : (t: ClassAccessorDecoratorTarget<typeof C, number>, c: ClassAccessorDecoratorContext<typeof C, number> & { name: "y"; private: false; static: true; }) => void +>t : ClassAccessorDecoratorTarget<typeof C, number> +>c : ClassAccessorDecoratorContext<typeof C, number> & { name: "y"; private: false; static: true; } + + static accessor y = 1; +>y : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: ClassAccessorDecoratorTarget<typeof C, number>, c: ClassAccessorDecoratorContext<typeof C, number> & { name: "#y"; private: true; static: true; }) => void +>(t, c) => { } : (t: ClassAccessorDecoratorTarget<typeof C, number>, c: ClassAccessorDecoratorContext<typeof C, number> & { name: "#y"; private: true; static: true; }) => void +>t : ClassAccessorDecoratorTarget<typeof C, number> +>c : ClassAccessorDecoratorContext<typeof C, number> & { name: "#y"; private: true; static: true; } + + static accessor #y = 1; +>#y : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: undefined, c: ClassFieldDecoratorContext<typeof C, number> & { name: "z"; private: false; static: true; }) => void +>(t, c) => { } : (t: undefined, c: ClassFieldDecoratorContext<typeof C, number> & { name: "z"; private: false; static: true; }) => void +>t : undefined +>c : ClassFieldDecoratorContext<typeof C, number> & { name: "z"; private: false; static: true; } + + static z = 1; +>z : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: undefined, c: ClassFieldDecoratorContext<typeof C, number> & { name: "#z"; private: true; static: true; }) => void +>(t, c) => { } : (t: undefined, c: ClassFieldDecoratorContext<typeof C, number> & { name: "#z"; private: true; static: true; }) => void +>t : undefined +>c : ClassFieldDecoratorContext<typeof C, number> & { name: "#z"; private: true; static: true; } + + static #z = 1; +>#z : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: () => void, c: ClassMethodDecoratorContext<C, () => void> & { name: "g"; private: false; static: false; }) => void +>(t, c) => { } : (t: () => void, c: ClassMethodDecoratorContext<C, () => void> & { name: "g"; private: false; static: false; }) => void +>t : () => void +>c : ClassMethodDecoratorContext<C, () => void> & { name: "g"; private: false; static: false; } + + g() {} +>g : () => void + + @((t, c) => { }) +>((t, c) => { }) : (t: () => void, c: ClassMethodDecoratorContext<C, () => void> & { name: "#g"; private: true; static: false; }) => void +>(t, c) => { } : (t: () => void, c: ClassMethodDecoratorContext<C, () => void> & { name: "#g"; private: true; static: false; }) => void +>t : () => void +>c : ClassMethodDecoratorContext<C, () => void> & { name: "#g"; private: true; static: false; } + + #g() {} +>#g : () => void + + @((t, c) => { }) +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext<C, number> & { name: "a"; private: false; static: false; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext<C, number> & { name: "a"; private: false; static: false; }) => void +>t : () => number +>c : ClassGetterDecoratorContext<C, 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<C, number> & { name: "a"; private: false; static: false; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext<C, number> & { name: "a"; private: false; static: false; }) => void +>t : (value: number) => void +>c : ClassSetterDecoratorContext<C, number> & { name: "a"; private: false; static: false; } + + set a(value) { } +>a : number +>value : number + + @((t, c) => { }) +>((t, c) => { }) : (t: () => number, c: ClassGetterDecoratorContext<C, number> & { name: "#a"; private: true; static: false; }) => void +>(t, c) => { } : (t: () => number, c: ClassGetterDecoratorContext<C, number> & { name: "#a"; private: true; static: false; }) => void +>t : () => number +>c : ClassGetterDecoratorContext<C, 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<C, number> & { name: "#a"; private: true; static: false; }) => void +>(t, c) => { } : (t: (value: number) => void, c: ClassSetterDecoratorContext<C, number> & { name: "#a"; private: true; static: false; }) => void +>t : (value: number) => void +>c : ClassSetterDecoratorContext<C, number> & { name: "#a"; private: true; static: false; } + + set #a(value) { } +>#a : number +>value : number + + @((t, c) => { }) +>((t, c) => { }) : (t: ClassAccessorDecoratorTarget<C, number>, c: ClassAccessorDecoratorContext<C, number> & { name: "b"; private: false; static: false; }) => void +>(t, c) => { } : (t: ClassAccessorDecoratorTarget<C, number>, c: ClassAccessorDecoratorContext<C, number> & { name: "b"; private: false; static: false; }) => void +>t : ClassAccessorDecoratorTarget<C, number> +>c : ClassAccessorDecoratorContext<C, number> & { name: "b"; private: false; static: false; } + + accessor b = 1; +>b : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: ClassAccessorDecoratorTarget<C, number>, c: ClassAccessorDecoratorContext<C, number> & { name: "#b"; private: true; static: false; }) => void +>(t, c) => { } : (t: ClassAccessorDecoratorTarget<C, number>, c: ClassAccessorDecoratorContext<C, number> & { name: "#b"; private: true; static: false; }) => void +>t : ClassAccessorDecoratorTarget<C, number> +>c : ClassAccessorDecoratorContext<C, number> & { name: "#b"; private: true; static: false; } + + accessor #b = 1; +>#b : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: undefined, c: ClassFieldDecoratorContext<C, number> & { name: "c"; private: false; static: false; }) => void +>(t, c) => { } : (t: undefined, c: ClassFieldDecoratorContext<C, number> & { name: "c"; private: false; static: false; }) => void +>t : undefined +>c : ClassFieldDecoratorContext<C, number> & { name: "c"; private: false; static: false; } + + c = 1; +>c : number +>1 : 1 + + @((t, c) => { }) +>((t, c) => { }) : (t: undefined, c: ClassFieldDecoratorContext<C, number> & { name: "#c"; private: true; static: false; }) => void +>(t, c) => { } : (t: undefined, c: ClassFieldDecoratorContext<C, number> & { name: "#c"; private: true; static: false; }) => void +>t : undefined +>c : ClassFieldDecoratorContext<C, number> & { name: "#c"; private: true; static: false; } + + #c = 1; +>#c : number +>1 : 1 +} 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..63d24ad0c82da --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es2015).js @@ -0,0 +1,146 @@ +//// [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]; + 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 = _classThis = class { + constructor(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + } + 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 }, 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); + })(); + _classThis.y = __runInitializers(_classThis, _static_y_initializers, void 0); + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); + return C = _classThis; +})(); +((() => { + let _classDecorators_1 = [dec]; + 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 = (_classThis_1 = class { + constructor(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); + } + method(x) { } + set x(x) { } + static method(x) { } + static set x(x) { } + }, + __setFunctionName(_classThis_1, "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_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); + })(), + _classThis_1.y = __runInitializers(_classThis_1, _static_y_initializers, void 0), + (() => { + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(), + _classThis_1); + return C = _classThis_1; +})()); 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..4b6c1e5cb13b7 --- /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]; + 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]; + _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 }, 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); + } + constructor(x) { } + method(x) { } + set x(x) { } + y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + static method(x) { } + static set x(x) { } + static y = __runInitializers(_classThis, _static_y_initializers, void 0); + static { + __runInitializers(_classThis, _classExtraInitializers); + } + }; + return C = _classThis; +})(); +((() => { + let _classDecorators_1 = [dec]; + 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]; + _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 }, 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); + } + constructor(x) { } + method(x) { } + set x(x) { } + 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, void 0); + static { + __runInitializers(_classThis_1, _classExtraInitializers_1); + } + }; + return C = _classThis_1; +})()); 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..d6f8ccddcc142 --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=es5).js @@ -0,0 +1,165 @@ +//// [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 _classDecorators = [dec]; + 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 = _classThis = /** @class */ (function () { + function C_1(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, void 0)); + } + 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 }, 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); + })(); + _classThis.y = __runInitializers(_classThis, _static_y_initializers, void 0); + (function () { + __runInitializers(_classThis, _classExtraInitializers); + })(); + return C = _classThis; +}(); +((function () { + var _classDecorators_1 = [dec]; + 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 = (_classThis_1 = /** @class */ (function () { + function class_1(x) { + this.y = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _y_initializers, void 0)); + } + 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(_classThis_1, "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_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); + })(), + _classThis_1.y = __runInitializers(_classThis_1, _static_y_initializers, void 0), + (function () { + __runInitializers(_classThis_1, _classExtraInitializers_1); + })(), + _classThis_1); + return C = _classThis_1; +})()); 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..f8bed6444b6c0 --- /dev/null +++ b/tests/baselines/reference/esDecorators-emitDecoratorMetadata(target=esnext).js @@ -0,0 +1,82 @@ +//// [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 +class C { + constructor(x) { } + @dec + method(x) { } + @dec + set x(x) { } + @dec + y; + @dec + static method(x) { } + @dec + static set x(x) { } + @dec + static y; +} +( +@dec +class C { + constructor(x) { } + @dec + method(x) { } + @dec + set x(x) { } + @dec + y; + @dec + static method(x) { } + @dec + static set x(x) { } + @dec + static y; +}); 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/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index 2edbcc5ad6078..c3e3352d75be4 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:938:13: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:941: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:938:13: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:941: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:938:13: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:941: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:938:13: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:941:13: 'Date' is declared here. \ No newline at end of file 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/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<number, void, unknown> +>g : () => Generator<number, void, (target: typeof C) => void | typeof C> @(yield 0) >(yield 0) : any diff --git a/tests/baselines/reference/importImportOnlyModule.js b/tests/baselines/reference/importImportOnlyModule.js index b770810648b5b..d60eaa7206aa6 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"; Object.defineProperty(exports, "__esModule", { value: 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/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/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/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<number>) => void +>(t, k, d) => { } : (t: typeof C, k: "x", d: TypedPropertyDescriptor<number>) => void +>t : typeof C +>k : "x" +>d : TypedPropertyDescriptor<number> + + 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<number>) => void +>(t, k, d) => { } : (t: typeof C, k: "y", d: TypedPropertyDescriptor<number>) => void +>t : typeof C +>k : "y" +>d : TypedPropertyDescriptor<number> + + 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<number>) => void +>(t, k, d) => { } : (t: C, k: "a", d: TypedPropertyDescriptor<number>) => void +>t : C +>k : "a" +>d : TypedPropertyDescriptor<number> + + 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<number>) => void +>(t, k, d) => { } : (t: C, k: "b", d: TypedPropertyDescriptor<number>) => void +>t : C +>k : "b" +>d : TypedPropertyDescriptor<number> + + 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/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 @@ -[96mtests/cases/compiler/a.ts[0m:[93m1[0m:[93m11[0m - [91merror[0m[90m TS1109: [0mExpression expected. - -[7m1[0m const a =!@#!@$ -[7m [0m [91m ~[0m [96mtests/cases/compiler/a.ts[0m:[93m1[0m:[93m12[0m - [91merror[0m[90m TS18026: [0m'#!' can only be used at the start of a file. [7m1[0m const a =!@#!@$ [7m [0m [91m [0m -[96mtests/cases/compiler/a.ts[0m:[93m1[0m:[93m14[0m - [91merror[0m[90m TS1109: [0mExpression expected. +[96mtests/cases/compiler/a.ts[0m:[93m1[0m:[93m13[0m - [91merror[0m[90m TS1134: [0mVariable declaration expected. [7m1[0m const a =!@#!@$ -[7m [0m [91m ~[0m -[96mtests/cases/compiler/a.ts[0m:[93m2[0m:[93m12[0m - [91merror[0m[90m TS1109: [0mExpression expected. +[7m [0m [91m ~[0m +[96mtests/cases/compiler/a.ts[0m:[93m1[0m:[93m16[0m - [91merror[0m[90m TS1109: [0mExpression expected. -[7m2[0m const b = !@#!@#!@#! -[7m [0m [91m ~[0m +[7m1[0m const a =!@#!@$ +[7m [0m [91m [0m [96mtests/cases/compiler/a.ts[0m:[93m2[0m:[93m13[0m - [91merror[0m[90m TS18026: [0m'#!' can only be used at the start of a file. [7m2[0m const b = !@#!@#!@#! [7m [0m [91m [0m -[96mtests/cases/compiler/a.ts[0m:[93m2[0m:[93m15[0m - [91merror[0m[90m TS1109: [0mExpression expected. +[96mtests/cases/compiler/a.ts[0m:[93m2[0m:[93m14[0m - [91merror[0m[90m TS1134: [0mVariable declaration expected. [7m2[0m const b = !@#!@#!@#! -[7m [0m [91m ~[0m +[7m [0m [91m ~[0m [96mtests/cases/compiler/a.ts[0m:[93m2[0m:[93m16[0m - [91merror[0m[90m TS18026: [0m'#!' can only be used at the start of a file. [7m2[0m const b = !@#!@#!@#! [7m [0m [91m [0m -[96mtests/cases/compiler/a.ts[0m:[93m2[0m:[93m18[0m - [91merror[0m[90m TS1109: [0mExpression expected. - -[7m2[0m const b = !@#!@#!@#! -[7m [0m [91m ~[0m [96mtests/cases/compiler/a.ts[0m:[93m2[0m:[93m19[0m - [91merror[0m[90m TS18026: [0m'#!' can only be used at the start of a file. [7m2[0m const b = !@#!@#!@#! @@ -84,25 +76,21 @@ [7m [0m [91m~~~~~[0m -==== 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[90m:1[0m + 16 tests/cases/compiler/a.ts[90m:1[0m 3 tests/cases/compiler/b.ts[90m:1[0m 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/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt index 4ce90177920e9..aa57a8ac9035e 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>[]): number[]; (...items: (number | ConcatArray<number>)[]): 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: { <S extends number>(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: <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { <S extends number>(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; <U>(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; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { <S extends number>(predicate: (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<number>; values: () => IterableIterator<number>; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: <A, D extends number = 1>(this: A, depth?: D) => FlatArray<A, D>[]; [iterator]: () => IterableIterator<number>; [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:1304:5: 'length' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1307:5: 'length' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/metadataImportType.js b/tests/baselines/reference/metadataImportType.js index e104a7a721e62..ca7d138e2541e 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) { }; Object.defineProperty(exports, "__esModule", { value: 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", void 0); 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/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.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/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/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/narrowExceptionVariableInCatchClause.errors.txt b/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt index 6eeddecfb1b68..b07c2eb109593 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:1054:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1057:5: 'message' is declared here. } else { diff --git a/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt b/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt index 5e5918b323351..0292b260eac4b 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:1054:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1057: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 bf105754b9d86..0e5168963afc6 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:1054:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1057: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/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 diff --git a/tests/baselines/reference/nodeModulesAtTypesPriority.trace.json b/tests/baselines/reference/nodeModulesAtTypesPriority.trace.json index 2fb49cc45b7a1..a57c094e0df37 100644 --- a/tests/baselines/reference/nodeModulesAtTypesPriority.trace.json +++ b/tests/baselines/reference/nodeModulesAtTypesPriority.trace.json @@ -76,5 +76,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=node16).trace.json b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node16).trace.json index d0aae2ef9523b..85626d1375d94 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node16).trace.json +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node16).trace.json @@ -177,5 +177,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 de93053530308..d87b67457f168 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=nodenext).trace.json +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=nodenext).trace.json @@ -177,5 +177,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/nodeModulesPackageImports(module=node16).trace.json b/tests/baselines/reference/nodeModulesPackageImports(module=node16).trace.json index 8396c26c2c24e..2bc0174a861f3 100644 --- a/tests/baselines/reference/nodeModulesPackageImports(module=node16).trace.json +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node16).trace.json @@ -90,5 +90,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/nodeModulesPackageImports(module=nodenext).trace.json b/tests/baselines/reference/nodeModulesPackageImports(module=nodenext).trace.json index c41f412d789fc..fe767320bdde3 100644 --- a/tests/baselines/reference/nodeModulesPackageImports(module=nodenext).trace.json +++ b/tests/baselines/reference/nodeModulesPackageImports(module=nodenext).trace.json @@ -90,5 +90,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/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json index f2612545b7532..2e8e583407907 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json @@ -191,5 +191,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/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json index b8c7bc83a1807..939099488d397 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json @@ -191,5 +191,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/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 2d94ae168c2f6..c808903b073a6 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:1050:13: 'RegExp' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1053: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 589152746a27e..0f8129fff7f04 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:1050:13: 'RegExp' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1053: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 462082d4e4bd6..21f0375cfb473 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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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 26fe88430f8ab..26d6645fef9cb 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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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 6b6cc78cfa1a5..82d6f4a9ccf9f 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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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 0f224db25e319..3bf3ec8da574f 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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067:13: 'Error' is declared here. } \ No newline at end of file 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/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/privacyCannotNameVarTypeDeclFile.js b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js index 25b0719e889d4..c58862a4f19ff 100644 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js @@ -156,7 +156,7 @@ exports.createExportedWidget4 = createExportedWidget4; Object.defineProperty(exports, "__esModule", { value: 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/privateNameFieldClassExpression.js b/tests/baselines/reference/privateNameFieldClassExpression.js index b62835d6fe036..94720459d5d7c 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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : 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/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/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<T extends object, V>(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/privateNameStaticFieldClassExpression.js b/tests/baselines/reference/privateNameStaticFieldClassExpression.js index 7b159cdaebed2..69d37160d618b 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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : 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..74aec7b6c4e97 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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : 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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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 7bc65540d1aa4..069760228de90 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<string>' is not assignable to parameter of type '(error: any) => Promise<number>'. !!! error TS2769: Property 'catch' is missing in type 'IPromise<string>' but required in type 'Promise<number>'. -!!! related TS2728 /.ts/lib.es5.d.ts:1540:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1538: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 000994163afbb..570f1911c9e4c 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<string>' is not assignable to parameter of type '(error: any) => Promise<number>'. !!! error TS2345: Property 'catch' is missing in type 'IPromise<string>' but required in type 'Promise<number>'. -!!! related TS2728 /.ts/lib.es5.d.ts:1540:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1538:5: 'catch' is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise<number>; diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index e0c7a897ed481..ad198fb310013 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<string>' is not assignable to parameter of type '(error: any) => Promise<number>'. !!! error TS2769: Property 'catch' is missing in type 'IPromise<string>' but required in type 'Promise<number>'. -!!! related TS2728 /.ts/lib.es5.d.ts:1540:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1538: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 '{ <T>(x: T): IPromise<T>; <T>(x: T, y: T): Promise<T>; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise<unknown>'. !!! error TS2345: Property 'catch' is missing in type 'IPromise<any>' but required in type 'Promise<unknown>'. -!!! related TS2728 /.ts/lib.es5.d.ts:1540:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1538: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 b82c1948d272b..1df1348cd42ce 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json @@ -45,5 +45,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 cbd4fcb8704ed..8e96e0cc2a33e 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json @@ -39,5 +39,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 468b3e9e823c2..24f7d9a356eb8 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 '<T>(n: number, s: string) => number' but required in type 'ArrayConstructor'. -!!! related TS2728 /.ts/lib.es5.d.ts:1491:5: 'isArray' is declared here. \ No newline at end of file +!!! related TS2728 /.ts/lib.es5.d.ts:1494:5: 'isArray' is declared here. \ No newline at end of file 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 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 35fa62b19fdd6..45e3b25526bcd 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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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 24fcaa0338f92..0e33986fca7bc 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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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 e27597c7c66a8..3ca2bfc9437ed 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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067: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:1064:13: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1067:13: 'Error' is declared here. } var \u041A = 1; if (К !== 1) { diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js.map b/tests/baselines/reference/sourceMapValidationDecorators.js.map index c980e54efb237..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;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,CAAC,CAAA;QAGvB,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;OAPxB,OAAO,CA4CZ;IAAD,cAAC;CAAA,AA9CD,IA8CC"} -//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fZGVjb3JhdGUgPSAodGhpcyAmJiB0aGlzLl9fZGVjb3JhdGUpIHx8IGZ1bmN0aW9uIChkZWNvcmF0b3JzLCB0YXJnZXQsIGtleSwgZGVzYykgew0KICAgIHZhciBjID0gYXJndW1lbnRzLmxlbmd0aCwgciA9IGMgPCAzID8gdGFyZ2V0IDogZGVzYyA9PT0gbnVsbCA/IGRlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHRhcmdldCwga2V5KSA6IGRlc2MsIGQ7DQogICAgaWYgKHR5cGVvZiBSZWZsZWN0ID09PSAib2JqZWN0IiAmJiB0eXBlb2YgUmVmbGVjdC5kZWNvcmF0ZSA9PT0gImZ1bmN0aW9uIikgciA9IFJlZmxlY3QuZGVjb3JhdGUoZGVjb3JhdG9ycywgdGFyZ2V0LCBrZXksIGRlc2MpOw0KICAgIGVsc2UgZm9yICh2YXIgaSA9IGRlY29yYXRvcnMubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIGlmIChkID0gZGVjb3JhdG9yc1tpXSkgciA9IChjIDwgMyA/IGQocikgOiBjID4gMyA/IGQodGFyZ2V0LCBrZXksIHIpIDogZCh0YXJnZXQsIGtleSkpIHx8IHI7DQogICAgcmV0dXJuIGMgPiAzICYmIHIgJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRhcmdldCwga2V5LCByKSwgcjsNCn07DQp2YXIgX19wYXJhbSA9ICh0aGlzICYmIHRoaXMuX19wYXJhbSkgfHwgZnVuY3Rpb24gKHBhcmFtSW5kZXgsIGRlY29yYXRvcikgew0KICAgIHJldHVybiBmdW5jdGlvbiAodGFyZ2V0LCBrZXkpIHsgZGVjb3JhdG9yKHRhcmdldCwga2V5LCBwYXJhbUluZGV4KTsgfQ0KfTsNCnZhciBHcmVldGVyID0gLyoqIEBjbGFzcyAqLyAoZnVuY3Rpb24gKCkgew0KICAgIGZ1bmN0aW9uIEdyZWV0ZXIoZ3JlZXRpbmcpIHsNCiAgICAgICAgdmFyIGIgPSBbXTsNCiAgICAgICAgZm9yICh2YXIgX2kgPSAxOyBfaSA8IGFyZ3VtZW50cy5sZW5ndGg7IF9pKyspIHsNCiAgICAgICAgICAgIGJbX2kgLSAxXSA9IGFyZ3VtZW50c1tfaV07DQogICAgICAgIH0NCiAgICAgICAgdGhpcy5ncmVldGluZyA9IGdyZWV0aW5nOw0KICAgIH0NCiAgICBHcmVldGVyLnByb3RvdHlwZS5ncmVldCA9IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgcmV0dXJuICI8aDE+IiArIHRoaXMuZ3JlZXRpbmcgKyAiPC9oMT4iOw0KICAgIH07DQogICAgR3JlZXRlci5wcm90b3R5cGUuZm4gPSBmdW5jdGlvbiAoeCkgew0KICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsNCiAgICB9Ow0KICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShHcmVldGVyLnByb3RvdHlwZSwgImdyZWV0aW5ncyIsIHsNCiAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7DQogICAgICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsNCiAgICAgICAgfSwNCiAgICAgICAgc2V0OiBmdW5jdGlvbiAoZ3JlZXRpbmdzKSB7DQogICAgICAgICAgICB0aGlzLmdyZWV0aW5nID0gZ3JlZXRpbmdzOw0KICAgICAgICB9LA0KICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwNCiAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlDQogICAgfSk7DQogICAgR3JlZXRlci54MSA9IDEwOw0KICAgIF9fZGVjb3JhdGUoWw0KICAgICAgICBQcm9wZXJ0eURlY29yYXRvcjEsDQogICAgICAgIFByb3BlcnR5RGVjb3JhdG9yMig0MCkNCiAgICBdLCBHcmVldGVyLnByb3RvdHlwZSwgImdyZWV0IiwgbnVsbCk7DQogICAgX19kZWNvcmF0ZShbDQogICAgICAgIFByb3BlcnR5RGVjb3JhdG9yMSwNCiAgICAgICAgUHJvcGVydHlEZWNvcmF0b3IyKDUwKQ0KICAgIF0sIEdyZWV0ZXIucHJvdG90eXBlLCAieCIsIHZvaWQgMCk7DQogICAgX19kZWNvcmF0ZShbDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMSksDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMig3MCkpDQogICAgXSwgR3JlZXRlci5wcm90b3R5cGUsICJmbiIsIG51bGwpOw0KICAgIF9fZGVjb3JhdGUoWw0KICAgICAgICBQcm9wZXJ0eURlY29yYXRvcjEsDQogICAgICAgIFByb3BlcnR5RGVjb3JhdG9yMig4MCksDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMSksDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMig5MCkpDQogICAgXSwgR3JlZXRlci5wcm90b3R5cGUsICJncmVldGluZ3MiLCBudWxsKTsNCiAgICBfX2RlY29yYXRlKFsNCiAgICAgICAgUHJvcGVydHlEZWNvcmF0b3IxLA0KICAgICAgICBQcm9wZXJ0eURlY29yYXRvcjIoNjApDQogICAgXSwgR3JlZXRlciwgIngxIiwgdm9pZCAwKTsNCiAgICBHcmVldGVyID0gX19kZWNvcmF0ZShbDQogICAgICAgIENsYXNzRGVjb3JhdG9yMSwNCiAgICAgICAgQ2xhc3NEZWNvcmF0b3IyKDEwKSwNCiAgICAgICAgX19wYXJhbSgwLCBQYXJhbWV0ZXJEZWNvcmF0b3IxKSwNCiAgICAgICAgX19wYXJhbSgwLCBQYXJhbWV0ZXJEZWNvcmF0b3IyKDIwKSksDQogICAgICAgIF9fcGFyYW0oMSwgUGFyYW1ldGVyRGVjb3JhdG9yMSksDQogICAgICAgIF9fcGFyYW0oMSwgUGFyYW1ldGVyRGVjb3JhdG9yMigzMCkpDQogICAgXSwgR3JlZXRlcik7DQogICAgcmV0dXJuIEdyZWV0ZXI7DQp9KCkpOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9c291cmNlTWFwVmFsaWRhdGlvbkRlY29yYXRvcnMuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlTWFwVmFsaWRhdGlvbkRlY29yYXRvcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2VNYXBWYWxpZGF0aW9uRGVjb3JhdG9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFTQTtJQUNJLGlCQUdTLFFBQWdCO1FBSXZCLFdBQWM7YUFBZCxVQUFjLEVBQWQscUJBQWMsRUFBZCxJQUFjO1lBQWQsMEJBQWM7O1FBSlAsYUFBUSxHQUFSLFFBQVEsQ0FBUTtJQUt6QixDQUFDO0lBSUQsdUJBQUssR0FBTDtRQUNJLE9BQU8sTUFBTSxHQUFHLElBQUksQ0FBQyxRQUFRLEdBQUcsT0FBTyxDQUFDO0lBQzVDLENBQUM7SUFVTyxvQkFBRSxHQUFWLFVBR0UsQ0FBUztRQUNQLE9BQU8sSUFBSSxDQUFDLFFBQVEsQ0FBQztJQUN6QixDQUFDO0lBRUQsc0JBRUksOEJBQVM7YUFGYjtZQUdJLE9BQU8sSUFBSSxDQUFDLFFBQVEsQ0FBQztRQUN6QixDQUFDO2FBRUQsVUFHRSxTQUFpQjtZQUNmLElBQUksQ0FBQyxRQUFRLEdBQUcsU0FBUyxDQUFDO1FBQzlCLENBQUM7OztPQVBBO0lBYmMsVUFBRSxHQUFXLEVBQUcsQ0FBQTtJQVYvQjtRQUZDLGtCQUFrQjtRQUNsQixrQkFBa0IsQ0FBQyxFQUFFLENBQUM7d0NBR3RCO0lBSUQ7UUFGQyxrQkFBa0I7UUFDbEIsa0JBQWtCLENBQUMsRUFBRSxDQUFDO3NDQUNMO0lBTWxCO1FBQ0csV0FBQSxtQkFBbUIsQ0FBQTtRQUNuQixXQUFBLG1CQUFtQixDQUFDLEVBQUUsQ0FBQyxDQUFBO3FDQUd6QjtJQUVEO1FBQUMsa0JBQWtCO1FBQ2xCLGtCQUFrQixDQUFDLEVBQUUsQ0FBQztRQU1wQixXQUFBLG1CQUFtQixDQUFBO1FBQ25CLFdBQUEsbUJBQW1CLENBQUMsRUFBRSxDQUFDLENBQUE7NENBSnpCO0lBYmM7UUFGZCxrQkFBa0I7UUFDbEIsa0JBQWtCLENBQUMsRUFBRSxDQUFDOzZCQUNRO0lBdkI3QixPQUFPO1FBRlosZUFBZTtRQUNmLGVBQWUsQ0FBQyxFQUFFLENBQUM7UUFHYixXQUFBLG1CQUFtQixDQUFBO1FBQ25CLFdBQUEsbUJBQW1CLENBQUMsRUFBRSxDQUFDLENBQUE7UUFHdkIsV0FBQSxtQkFBbUIsQ0FBQTtRQUNuQixXQUFBLG1CQUFtQixDQUFDLEVBQUUsQ0FBQyxDQUFBO09BUHhCLE9BQU8sQ0E0Q1o7SUFBRCxjQUFDO0NBQUEsQUE5Q0QsSUE4Q0MifQ==,ZGVjbGFyZSBmdW5jdGlvbiBDbGFzc0RlY29yYXRvcjEodGFyZ2V0OiBGdW5jdGlvbik6IHZvaWQ7CmRlY2xhcmUgZnVuY3Rpb24gQ2xhc3NEZWNvcmF0b3IyKHg6IG51bWJlcik6ICh0YXJnZXQ6IEZ1bmN0aW9uKSA9PiB2b2lkOwpkZWNsYXJlIGZ1bmN0aW9uIFByb3BlcnR5RGVjb3JhdG9yMSh0YXJnZXQ6IE9iamVjdCwga2V5OiBzdHJpbmcgfCBzeW1ib2wsIGRlc2NyaXB0b3I/OiBQcm9wZXJ0eURlc2NyaXB0b3IpOiB2b2lkOwpkZWNsYXJlIGZ1bmN0aW9uIFByb3BlcnR5RGVjb3JhdG9yMih4OiBudW1iZXIpOiAodGFyZ2V0OiBPYmplY3QsIGtleTogc3RyaW5nIHwgc3ltYm9sLCBkZXNjcmlwdG9yPzogUHJvcGVydHlEZXNjcmlwdG9yKSA9PiB2b2lkOwpkZWNsYXJlIGZ1bmN0aW9uIFBhcmFtZXRlckRlY29yYXRvcjEodGFyZ2V0OiBPYmplY3QsIGtleTogc3RyaW5nIHwgc3ltYm9sLCBwYXJhbUluZGV4OiBudW1iZXIpOiB2b2lkOwpkZWNsYXJlIGZ1bmN0aW9uIFBhcmFtZXRlckRlY29yYXRvcjIoeDogbnVtYmVyKTogKHRhcmdldDogT2JqZWN0LCBrZXk6IHN0cmluZyB8IHN5bWJvbCwgcGFyYW1JbmRleDogbnVtYmVyKSA9PiB2b2lkOwoKQENsYXNzRGVjb3JhdG9yMQpAQ2xhc3NEZWNvcmF0b3IyKDEwKQpjbGFzcyBHcmVldGVyIHsKICAgIGNvbnN0cnVjdG9yKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoMjApIAogICAgICBwdWJsaWMgZ3JlZXRpbmc6IHN0cmluZywgCiAgICAgIAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoMzApIAogICAgICAuLi5iOiBzdHJpbmdbXSkgewogICAgfQogICAgCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDQwKQogICAgZ3JlZXQoKSB7CiAgICAgICAgcmV0dXJuICI8aDE+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,oBAAE,GAAF,UAGN,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,EAAE,AAAb,CAAc;IAV/B;QAFC,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;wCAGtB;IAIO;QAFP,kBAAkB;QAClB,kBAAkB,CAAC,EAAE,CAAC;sCACL;IAMV;QACL,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;qCAGzB;IAID;QAFC,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,CAAC,CAAA;QAGvB,WAAA,mBAAmB,CAAA;QACnB,WAAA,mBAAmB,CAAC,EAAE,CAAC,CAAA;OAPxB,OAAO,CA4CZ;IAAD,cAAC;CAAA,AA5CD,IA4CC"} +//// https://sokra.github.io/source-map-visualization#base64,dmFyIF9fZGVjb3JhdGUgPSAodGhpcyAmJiB0aGlzLl9fZGVjb3JhdGUpIHx8IGZ1bmN0aW9uIChkZWNvcmF0b3JzLCB0YXJnZXQsIGtleSwgZGVzYykgew0KICAgIHZhciBjID0gYXJndW1lbnRzLmxlbmd0aCwgciA9IGMgPCAzID8gdGFyZ2V0IDogZGVzYyA9PT0gbnVsbCA/IGRlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHRhcmdldCwga2V5KSA6IGRlc2MsIGQ7DQogICAgaWYgKHR5cGVvZiBSZWZsZWN0ID09PSAib2JqZWN0IiAmJiB0eXBlb2YgUmVmbGVjdC5kZWNvcmF0ZSA9PT0gImZ1bmN0aW9uIikgciA9IFJlZmxlY3QuZGVjb3JhdGUoZGVjb3JhdG9ycywgdGFyZ2V0LCBrZXksIGRlc2MpOw0KICAgIGVsc2UgZm9yICh2YXIgaSA9IGRlY29yYXRvcnMubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIGlmIChkID0gZGVjb3JhdG9yc1tpXSkgciA9IChjIDwgMyA/IGQocikgOiBjID4gMyA/IGQodGFyZ2V0LCBrZXksIHIpIDogZCh0YXJnZXQsIGtleSkpIHx8IHI7DQogICAgcmV0dXJuIGMgPiAzICYmIHIgJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRhcmdldCwga2V5LCByKSwgcjsNCn07DQp2YXIgX19wYXJhbSA9ICh0aGlzICYmIHRoaXMuX19wYXJhbSkgfHwgZnVuY3Rpb24gKHBhcmFtSW5kZXgsIGRlY29yYXRvcikgew0KICAgIHJldHVybiBmdW5jdGlvbiAodGFyZ2V0LCBrZXkpIHsgZGVjb3JhdG9yKHRhcmdldCwga2V5LCBwYXJhbUluZGV4KTsgfQ0KfTsNCnZhciBHcmVldGVyID0gLyoqIEBjbGFzcyAqLyAoZnVuY3Rpb24gKCkgew0KICAgIGZ1bmN0aW9uIEdyZWV0ZXIoZ3JlZXRpbmcpIHsNCiAgICAgICAgdmFyIGIgPSBbXTsNCiAgICAgICAgZm9yICh2YXIgX2kgPSAxOyBfaSA8IGFyZ3VtZW50cy5sZW5ndGg7IF9pKyspIHsNCiAgICAgICAgICAgIGJbX2kgLSAxXSA9IGFyZ3VtZW50c1tfaV07DQogICAgICAgIH0NCiAgICAgICAgdGhpcy5ncmVldGluZyA9IGdyZWV0aW5nOw0KICAgIH0NCiAgICBHcmVldGVyLnByb3RvdHlwZS5ncmVldCA9IGZ1bmN0aW9uICgpIHsNCiAgICAgICAgcmV0dXJuICI8aDE+IiArIHRoaXMuZ3JlZXRpbmcgKyAiPC9oMT4iOw0KICAgIH07DQogICAgR3JlZXRlci5wcm90b3R5cGUuZm4gPSBmdW5jdGlvbiAoeCkgew0KICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsNCiAgICB9Ow0KICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShHcmVldGVyLnByb3RvdHlwZSwgImdyZWV0aW5ncyIsIHsNCiAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7DQogICAgICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsNCiAgICAgICAgfSwNCiAgICAgICAgc2V0OiBmdW5jdGlvbiAoZ3JlZXRpbmdzKSB7DQogICAgICAgICAgICB0aGlzLmdyZWV0aW5nID0gZ3JlZXRpbmdzOw0KICAgICAgICB9LA0KICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwNCiAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlDQogICAgfSk7DQogICAgR3JlZXRlci54MSA9IDEwOw0KICAgIF9fZGVjb3JhdGUoWw0KICAgICAgICBQcm9wZXJ0eURlY29yYXRvcjEsDQogICAgICAgIFByb3BlcnR5RGVjb3JhdG9yMig0MCkNCiAgICBdLCBHcmVldGVyLnByb3RvdHlwZSwgImdyZWV0IiwgbnVsbCk7DQogICAgX19kZWNvcmF0ZShbDQogICAgICAgIFByb3BlcnR5RGVjb3JhdG9yMSwNCiAgICAgICAgUHJvcGVydHlEZWNvcmF0b3IyKDUwKQ0KICAgIF0sIEdyZWV0ZXIucHJvdG90eXBlLCAieCIsIHZvaWQgMCk7DQogICAgX19kZWNvcmF0ZShbDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMSksDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMig3MCkpDQogICAgXSwgR3JlZXRlci5wcm90b3R5cGUsICJmbiIsIG51bGwpOw0KICAgIF9fZGVjb3JhdGUoWw0KICAgICAgICBQcm9wZXJ0eURlY29yYXRvcjEsDQogICAgICAgIFByb3BlcnR5RGVjb3JhdG9yMig4MCksDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMSksDQogICAgICAgIF9fcGFyYW0oMCwgUGFyYW1ldGVyRGVjb3JhdG9yMig5MCkpDQogICAgXSwgR3JlZXRlci5wcm90b3R5cGUsICJncmVldGluZ3MiLCBudWxsKTsNCiAgICBfX2RlY29yYXRlKFsNCiAgICAgICAgUHJvcGVydHlEZWNvcmF0b3IxLA0KICAgICAgICBQcm9wZXJ0eURlY29yYXRvcjIoNjApDQogICAgXSwgR3JlZXRlciwgIngxIiwgdm9pZCAwKTsNCiAgICBHcmVldGVyID0gX19kZWNvcmF0ZShbDQogICAgICAgIENsYXNzRGVjb3JhdG9yMSwNCiAgICAgICAgQ2xhc3NEZWNvcmF0b3IyKDEwKSwNCiAgICAgICAgX19wYXJhbSgwLCBQYXJhbWV0ZXJEZWNvcmF0b3IxKSwNCiAgICAgICAgX19wYXJhbSgwLCBQYXJhbWV0ZXJEZWNvcmF0b3IyKDIwKSksDQogICAgICAgIF9fcGFyYW0oMSwgUGFyYW1ldGVyRGVjb3JhdG9yMSksDQogICAgICAgIF9fcGFyYW0oMSwgUGFyYW1ldGVyRGVjb3JhdG9yMigzMCkpDQogICAgXSwgR3JlZXRlcik7DQogICAgcmV0dXJuIEdyZWV0ZXI7DQp9KCkpOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9c291cmNlTWFwVmFsaWRhdGlvbkRlY29yYXRvcnMuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlTWFwVmFsaWRhdGlvbkRlY29yYXRvcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2VNYXBWYWxpZGF0aW9uRGVjb3JhdG9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFTQTtJQUNJLGlCQUdTLFFBQWdCO1FBSXZCLFdBQWM7YUFBZCxVQUFjLEVBQWQscUJBQWMsRUFBZCxJQUFjO1lBQWQsMEJBQWM7O1FBSlAsYUFBUSxHQUFSLFFBQVEsQ0FBUTtJQUt6QixDQUFDO0lBSUQsdUJBQUssR0FBTDtRQUNJLE9BQU8sTUFBTSxHQUFHLElBQUksQ0FBQyxRQUFRLEdBQUcsT0FBTyxDQUFDO0lBQzVDLENBQUM7SUFVTyxvQkFBRSxHQUFGLFVBR04sQ0FBUztRQUNQLE9BQU8sSUFBSSxDQUFDLFFBQVEsQ0FBQztJQUN6QixDQUFDO0lBSUQsc0JBQUksOEJBQVM7YUFBYjtZQUNJLE9BQU8sSUFBSSxDQUFDLFFBQVEsQ0FBQztRQUN6QixDQUFDO2FBRUQsVUFHRSxTQUFpQjtZQUNmLElBQUksQ0FBQyxRQUFRLEdBQUcsU0FBUyxDQUFDO1FBQzlCLENBQUM7OztPQVBBO0lBYmMsVUFBRSxHQUFXLEVBQUUsQUFBYixDQUFjO0lBVi9CO1FBRkMsa0JBQWtCO1FBQ2xCLGtCQUFrQixDQUFDLEVBQUUsQ0FBQzt3Q0FHdEI7SUFJTztRQUZQLGtCQUFrQjtRQUNsQixrQkFBa0IsQ0FBQyxFQUFFLENBQUM7c0NBQ0w7SUFNVjtRQUNMLFdBQUEsbUJBQW1CLENBQUE7UUFDbkIsV0FBQSxtQkFBbUIsQ0FBQyxFQUFFLENBQUMsQ0FBQTtxQ0FHekI7SUFJRDtRQUZDLGtCQUFrQjtRQUNsQixrQkFBa0IsQ0FBQyxFQUFFLENBQUM7UUFNcEIsV0FBQSxtQkFBbUIsQ0FBQTtRQUNuQixXQUFBLG1CQUFtQixDQUFDLEVBQUUsQ0FBQyxDQUFBOzRDQUp6QjtJQWJjO1FBRmQsa0JBQWtCO1FBQ2xCLGtCQUFrQixDQUFDLEVBQUUsQ0FBQzs2QkFDUTtJQXZCN0IsT0FBTztRQUZaLGVBQWU7UUFDZixlQUFlLENBQUMsRUFBRSxDQUFDO1FBR2IsV0FBQSxtQkFBbUIsQ0FBQTtRQUNuQixXQUFBLG1CQUFtQixDQUFDLEVBQUUsQ0FBQyxDQUFBO1FBR3ZCLFdBQUEsbUJBQW1CLENBQUE7UUFDbkIsV0FBQSxtQkFBbUIsQ0FBQyxFQUFFLENBQUMsQ0FBQTtPQVB4QixPQUFPLENBNENaO0lBQUQsY0FBQztDQUFBLEFBNUNELElBNENDIn0=,ZGVjbGFyZSBmdW5jdGlvbiBDbGFzc0RlY29yYXRvcjEodGFyZ2V0OiBGdW5jdGlvbik6IHZvaWQ7CmRlY2xhcmUgZnVuY3Rpb24gQ2xhc3NEZWNvcmF0b3IyKHg6IG51bWJlcik6ICh0YXJnZXQ6IEZ1bmN0aW9uKSA9PiB2b2lkOwpkZWNsYXJlIGZ1bmN0aW9uIFByb3BlcnR5RGVjb3JhdG9yMSh0YXJnZXQ6IE9iamVjdCwga2V5OiBzdHJpbmcgfCBzeW1ib2wsIGRlc2NyaXB0b3I/OiBQcm9wZXJ0eURlc2NyaXB0b3IpOiB2b2lkOwpkZWNsYXJlIGZ1bmN0aW9uIFByb3BlcnR5RGVjb3JhdG9yMih4OiBudW1iZXIpOiAodGFyZ2V0OiBPYmplY3QsIGtleTogc3RyaW5nIHwgc3ltYm9sLCBkZXNjcmlwdG9yPzogUHJvcGVydHlEZXNjcmlwdG9yKSA9PiB2b2lkOwpkZWNsYXJlIGZ1bmN0aW9uIFBhcmFtZXRlckRlY29yYXRvcjEodGFyZ2V0OiBPYmplY3QsIGtleTogc3RyaW5nIHwgc3ltYm9sLCBwYXJhbUluZGV4OiBudW1iZXIpOiB2b2lkOwpkZWNsYXJlIGZ1bmN0aW9uIFBhcmFtZXRlckRlY29yYXRvcjIoeDogbnVtYmVyKTogKHRhcmdldDogT2JqZWN0LCBrZXk6IHN0cmluZyB8IHN5bWJvbCwgcGFyYW1JbmRleDogbnVtYmVyKSA9PiB2b2lkOwoKQENsYXNzRGVjb3JhdG9yMQpAQ2xhc3NEZWNvcmF0b3IyKDEwKQpjbGFzcyBHcmVldGVyIHsKICAgIGNvbnN0cnVjdG9yKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoMjApIAogICAgICBwdWJsaWMgZ3JlZXRpbmc6IHN0cmluZywgCiAgICAgIAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoMzApIAogICAgICAuLi5iOiBzdHJpbmdbXSkgewogICAgfQogICAgCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDQwKQogICAgZ3JlZXQoKSB7CiAgICAgICAgcmV0dXJuICI8aDE+IiArIHRoaXMuZ3JlZXRpbmcgKyAiPC9oMT4iOwogICAgfQoKICAgIEBQcm9wZXJ0eURlY29yYXRvcjEKICAgIEBQcm9wZXJ0eURlY29yYXRvcjIoNTApCiAgICBwcml2YXRlIHg6IHN0cmluZzsKCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDYwKQogICAgcHJpdmF0ZSBzdGF0aWMgeDE6IG51bWJlciA9IDEwOwogICAgCiAgICBwcml2YXRlIGZuKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoNzApIAogICAgICB4OiBudW1iZXIpIHsKICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsKICAgIH0KCiAgICBAUHJvcGVydHlEZWNvcmF0b3IxCiAgICBAUHJvcGVydHlEZWNvcmF0b3IyKDgwKQogICAgZ2V0IGdyZWV0aW5ncygpIHsKICAgICAgICByZXR1cm4gdGhpcy5ncmVldGluZzsKICAgIH0KCiAgICBzZXQgZ3JlZXRpbmdzKAogICAgICBAUGFyYW1ldGVyRGVjb3JhdG9yMSAKICAgICAgQFBhcmFtZXRlckRlY29yYXRvcjIoOTApIAogICAgICBncmVldGluZ3M6IHN0cmluZykgewogICAgICAgIHRoaXMuZ3JlZXRpbmcgPSBncmVldGluZ3M7CiAgICB9ICAgIAp9 diff --git a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt index 45c46f1eb1552..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) --- @@ -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 @@ -358,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 >^^^^ @@ -419,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->^^^^^^^^ @@ -465,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->^^^^^^^^ @@ -474,7 +475,7 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ^^^^^^^^^^^^^^^^^^^ 4 > ^ 5 > ^^^^^-> -1->private fn( +1->fn( > @ 2 > 3 > ParameterDecorator1 @@ -521,14 +522,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 +838,7 @@ sourceFile:sourceMapValidationDecorators.ts 4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 > -3 > @ClassDecorator1 - > @ClassDecorator2(10) - > class Greeter { +3 > class Greeter { > constructor( > @ParameterDecorator1 > @ParameterDecorator2(20) @@ -883,7 +884,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/staticFieldWithInterfaceContext.js b/tests/baselines/reference/staticFieldWithInterfaceContext.js index f8886b4812e00..eb51f8dad1a6f 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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + 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 () { 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" }; @@ -54,6 +60,7 @@ function f(c) { } return class_3; }()), + __setFunctionName(_a, "c"), _a.x = { a: "a" }, _a); } } @@ -62,6 +69,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 +77,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 +85,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 +114,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 +122,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 +136,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 +150,6 @@ var _w = [(_q = /** @class */ (function () { } return class_15; }()), + __setFunctionName(_p, "c11"), _p.x = { a: "a" }, _p) : _w; 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/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/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 59d7140ab6ddf..ee5315028f5ab 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) { }; Object.defineProperty(exports, "__esModule", { value: 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", void 0); return Greeter; }()); -exports.Greeter = Greeter; diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt index 0c9dd0264d248..707e534988d01 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: 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 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. @@ -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: 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. @@ -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: 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/baselines/reference/thisTypeInFunctionsNegative.symbols b/tests/baselines/reference/thisTypeInFunctionsNegative.symbols index d275ba895574b..6a2d15565d148 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 6a3d134f34772..d828be4b3e849 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 diff --git a/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js b/tests/baselines/reference/transformApi/transformsCorrectly.transformSyntheticCommentOnStaticFieldInClassExpression.js index e6ca9fc6ac387..47c851a2a8ecb 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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; var _a; const MyClass = (_a = class { }, + __setFunctionName(_a, "MyClass"), /*comment*/ _a.newField = "x", _a); 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 736c36e2ae00d..781a2731d46bb 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] 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 80f252a5df1a3..cbee6ce837d1d 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, es2023, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, esnext.intl +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, 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 e463e5a5d12e8..37c7be1aeed5e 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 [94m--lib[39m 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, es2023, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, esnext.intl +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, esnext.intl, decorators, decorators.legacy default: undefined [94m--allowJs[39m 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 e463e5a5d12e8..37c7be1aeed5e 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 [94m--lib[39m 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, es2023, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, esnext.intl +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, 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, es2022.error, es2022.intl, es2022.object, es2022.sharedmemory, es2022.string/esnext.string, es2022.regexp, es2023.array/esnext.array, esnext.intl, decorators, decorators.legacy default: undefined [94m--allowJs[39m 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 fb86001568eaa..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 @@ -31,17 +31,20 @@ Output:: >> Screen clear [[90m12:00:15 AM[0m] Starting compilation in watch mode... +[91merror[0m[90m TS2318: [0mCannot find global type 'ClassDecoratorContext'. + [96ma.ts[0m:[93m1[0m:[93m1[0m - [91merror[0m[90m TS1371: [0mThis import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'. [7m1[0m import {B} from './b' [7m [0m [91m~~~~~~~~~~~~~~~~~~~~~[0m -[96ma.ts[0m:[93m3[0m:[93m14[0m - [91merror[0m[90m TS1219: [0mExperimental 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. +[96ma.ts[0m:[93m2[0m:[93m2[0m - [91merror[0m[90m TS1238: [0mUnable 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. -[7m3[0m export class A { -[7m [0m [91m ~[0m +[7m2[0m @((_) => {}) +[7m [0m [91m ~~~~~~~~~~~[0m -[[90m12:00:20 AM[0m] Found 2 errors. Watching for file changes. +[[90m12:00:20 AM[0m] Found 3 errors. Watching for file changes. @@ -87,20 +90,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 !== 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; }; -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, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; +import './b'; +export let A = (() => { + let _classDecorators = [((_) => { })]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + 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; +})(); @@ -120,7 +164,7 @@ Output:: [7m1[0m import {B} from './b' [7m [0m [91m~~~~~~~~~~~~~~~~~~~~~[0m -[[90m12:00:24 AM[0m] Found 1 error. Watching for file changes. +[[90m12:00:30 AM[0m] Found 1 error. Watching for file changes. @@ -157,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 @@ -167,9 +229,9 @@ Input:: Output:: >> Screen clear -[[90m12:00:27 AM[0m] File change detected. Starting incremental compilation... +[[90m12:00:33 AM[0m] File change detected. Starting incremental compilation... -[[90m12:00:34 AM[0m] Found 0 errors. Watching for file changes. +[[90m12:00:40 AM[0m] 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 855976efc5b99..69f23c8730014 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", @@ -626,6 +625,8 @@ Info 32 [00:01:13.000] response: "1275", "1276", "1277", + "1278", + "1279", "1300", "1309", "1313", @@ -1413,6 +1414,7 @@ Info 32 [00:01:13.000] response: "8035", "8036", "8037", + "8038", "9005", "9006", "17000", @@ -1691,7 +1693,6 @@ Info 38 [00:01:19.000] response: "2653", "17009", "2377", - "1219", "17004", "2845", "1378", @@ -1961,6 +1962,8 @@ Info 38 [00:01:19.000] response: "1275", "1276", "1277", + "1278", + "1279", "1300", "1309", "1313", @@ -2748,6 +2751,7 @@ Info 38 [00:01:19.000] response: "8035", "8036", "8037", + "8038", "9005", "9006", "17000", @@ -2938,7 +2942,6 @@ Info 40 [00:01:21.000] response: "2653", "17009", "2377", - "1219", "17004", "2845", "1378", @@ -3208,6 +3211,8 @@ Info 40 [00:01:21.000] response: "1275", "1276", "1277", + "1278", + "1279", "1300", "1309", "1313", @@ -3995,6 +4000,7 @@ Info 40 [00:01:21.000] response: "8035", "8036", "8037", + "8038", "9005", "9006", "17000", 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/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/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<T>(target: T): T; class A { 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 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..821521bd2b3be --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/accessors/esDecorators-classDeclaration-accessors-staticPrivate.ts @@ -0,0 +1,20 @@ +// @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) {} +} + +@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-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/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 {} 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/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-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 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-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() { + } +} 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/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; +} 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..118ad1a5e827b --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticAccessor.ts @@ -0,0 +1,22 @@ +// @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; +} + +@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..c42095ebfca20 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivate.ts @@ -0,0 +1,18 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec static #field1 = 0; +} + +@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..215b0cca67c29 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/fields/esDecorators-classDeclaration-fields-staticPrivateAccessor.ts @@ -0,0 +1,18 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec static accessor #field1 = 0; +} + +@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..89954a68bcc87 --- /dev/null +++ b/tests/cases/conformance/esDecorators/classDeclaration/methods/esDecorators-classDeclaration-methods-staticPrivate.ts @@ -0,0 +1,14 @@ +// @target: esnext, es2022, es2015 +// @noEmitHelpers: true +// @noTypesAndSymbols: true + +declare let dec: any; + +class C { + @dec static #method1() {} +} + +@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/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; +} +); 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 {} 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-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 {} 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<This, Args extends any[], Return>(source: string, bound = true) { + return function loggedDecorator( + target: (this: This, ...args: Args) => Return, + context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => 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 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 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 @@ -/// <reference path='fourslash.ts' /> - -// @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 @@ -/// <reference path='fourslash.ts' /> - -// @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 @@ -/// <reference path='fourslash.ts' /> - -// @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 @@ -/// <reference path='fourslash.ts' /> - -// @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 @@ -/// <reference path='fourslash.ts' /> - -// @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 @@ -/// <reference path='fourslash.ts' /> - -// @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 @@ -/// <reference path='fourslash.ts' /> - -// @Filename: /dir/a.ts -////declare const decorator: any; -////class A { -//// @decorator method() {}; -////}; - -goTo.file("/dir/a.ts"); -verify.not.codeFixAvailable(); 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"])