diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 58e3a71a68052..54d722f53b0f7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -126,6 +126,7 @@ module ts { let stringLiteralTypes: Map = {}; let emitExtends = false; let emitDecorate = false; + let emitParam = false; let mergedSymbols: Symbol[] = []; let symbolLinks: SymbolLinks[] = []; @@ -3000,6 +3001,16 @@ module ts { return getSignaturesOfObjectOrUnionType(getApparentType(type), kind); } + function typeHasCallOrConstructSignatures(type: Type): boolean { + let apparentType = getApparentType(type); + if (apparentType.flags & (TypeFlags.ObjectType | TypeFlags.Union)) { + let resolved = resolveObjectOrUnionTypeMembers(type); + return resolved.callSignatures.length > 0 + || resolved.constructSignatures.length > 0; + } + return false; + } + function getIndexTypeOfObjectOrUnionType(type: Type, kind: IndexKind): Type { if (type.flags & (TypeFlags.ObjectType | TypeFlags.Union)) { let resolved = resolveObjectOrUnionTypeMembers(type); @@ -8727,24 +8738,92 @@ module ts { } } - /** Check the decorators of a node */ - function checkDecorators(node: Node): void { - if (!node.decorators) { - return; - } + /** Checks a type reference node as an expression. */ + function checkTypeNodeAsExpression(node: TypeNode | LiteralExpression) { + // When we are emitting type metadata for decorators, we need to try to check the type + // as if it were an expression so that we can emit the type in a value position when we + // serialize the type metadata. + if (node && node.kind === SyntaxKind.TypeReference) { + let type = getTypeFromTypeNodeOrHeritageClauseElement(node); + let shouldCheckIfUnknownType = type === unknownType && compilerOptions.separateCompilation; + if (!type || (!shouldCheckIfUnknownType && type.flags & (TypeFlags.Intrinsic | TypeFlags.NumberLike | TypeFlags.StringLike))) { + return; + } + if (shouldCheckIfUnknownType || type.symbol.valueDeclaration) { + checkExpressionOrQualifiedName((node).typeName); + } + } + } + /** + * Checks the type annotation of an accessor declaration or property declaration as + * an expression if it is a type reference to a type with a value declaration. + */ + function checkTypeAnnotationAsExpression(node: AccessorDeclaration | PropertyDeclaration | ParameterDeclaration | MethodDeclaration) { switch (node.kind) { - case SyntaxKind.ClassDeclaration: + case SyntaxKind.PropertyDeclaration: + checkTypeNodeAsExpression((node).type); + break; + case SyntaxKind.Parameter: checkTypeNodeAsExpression((node).type); + break; case SyntaxKind.MethodDeclaration: + checkTypeNodeAsExpression((node).type); + break; case SyntaxKind.GetAccessor: + checkTypeNodeAsExpression((node).type); + break; case SyntaxKind.SetAccessor: - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.Parameter: - emitDecorate = true; + checkTypeNodeAsExpression(getSetAccessorTypeAnnotationNode(node)); break; + } + } + + /** Checks the type annotation of the parameters of a function/method or the constructor of a class as expressions */ + function checkParameterTypeAnnotationsAsExpressions(node: FunctionLikeDeclaration) { + // ensure all type annotations with a value declaration are checked as an expression + for (let parameter of node.parameters) { + checkTypeAnnotationAsExpression(parameter); + } + } - default: - return; + /** Check the decorators of a node */ + function checkDecorators(node: Node): void { + if (!node.decorators) { + return; + } + + // skip this check for nodes that cannot have decorators. These should have already had an error reported by + // checkGrammarDecorators. + if (!nodeCanBeDecorated(node)) { + return; + } + + if (compilerOptions.emitDecoratorMetadata) { + // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + var constructor = getFirstConstructorWithBody(node); + if (constructor) { + checkParameterTypeAnnotationsAsExpressions(constructor); + } + break; + + case SyntaxKind.MethodDeclaration: + checkParameterTypeAnnotationsAsExpressions(node); + // fall-through + + case SyntaxKind.SetAccessor: + case SyntaxKind.GetAccessor: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.Parameter: + checkTypeAnnotationAsExpression(node); + break; + } + } + + emitDecorate = true; + if (node.kind === SyntaxKind.Parameter) { + emitParam = true; } forEach(node.decorators, checkDecorator); @@ -10764,6 +10843,10 @@ module ts { links.flags |= NodeCheckFlags.EmitDecorate; } + if (emitParam) { + links.flags |= NodeCheckFlags.EmitParam; + } + links.flags |= NodeCheckFlags.TypeChecked; } } @@ -11442,6 +11525,201 @@ module ts { return undefined; } + /** Serializes an EntityName (with substitutions) to an appropriate JS constructor value. Used by the __metadata decorator. */ + function serializeEntityName(node: EntityName, getGeneratedNameForNode: (Node: Node) => string, fallbackPath?: string[]): string { + if (node.kind === SyntaxKind.Identifier) { + var substitution = getExpressionNameSubstitution(node, getGeneratedNameForNode); + var text = substitution || (node).text; + if (fallbackPath) { + fallbackPath.push(text); + } + else { + return text; + } + } + else { + var left = serializeEntityName((node).left, getGeneratedNameForNode, fallbackPath); + var right = serializeEntityName((node).right, getGeneratedNameForNode, fallbackPath); + if (!fallbackPath) { + return left + "." + right; + } + } + } + + /** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */ + function serializeTypeReferenceNode(node: TypeReferenceNode, getGeneratedNameForNode: (Node: Node) => string): string | string[] { + // serialization of a TypeReferenceNode uses the following rules: + // + // * The serialized type of a TypeReference that is `void` is "void 0". + // * The serialized type of a TypeReference that is a `boolean` is "Boolean". + // * The serialized type of a TypeReference that is an enum or `number` is "Number". + // * The serialized type of a TypeReference that is a string literal or `string` is "String". + // * The serialized type of a TypeReference that is a tuple is "Array". + // * The serialized type of a TypeReference that is a `symbol` is "Symbol". + // * The serialized type of a TypeReference with a value declaration is its entity name. + // * The serialized type of a TypeReference with a call or construct signature is "Function". + // * The serialized type of any other type is "Object". + let type = getTypeFromTypeReference(node); + if (type.flags & TypeFlags.Void) { + return "void 0"; + } + else if (type.flags & TypeFlags.Boolean) { + return "Boolean"; + } + else if (type.flags & TypeFlags.NumberLike) { + return "Number"; + } + else if (type.flags & TypeFlags.StringLike) { + return "String"; + } + else if (type.flags & TypeFlags.Tuple) { + return "Array"; + } + else if (type.flags & TypeFlags.ESSymbol) { + return "Symbol"; + } + else if (type === unknownType) { + var fallbackPath: string[] = []; + serializeEntityName(node.typeName, getGeneratedNameForNode, fallbackPath); + return fallbackPath; + } + else if (type.symbol && type.symbol.valueDeclaration) { + return serializeEntityName(node.typeName, getGeneratedNameForNode); + } + else if (typeHasCallOrConstructSignatures(type)) { + return "Function"; + } + + return "Object"; + } + + /** Serializes a TypeNode to an appropriate JS constructor value. Used by the __metadata decorator. */ + function serializeTypeNode(node: TypeNode | LiteralExpression, getGeneratedNameForNode: (Node: Node) => string): string | string[] { + // serialization of a TypeNode uses the following rules: + // + // * The serialized type of `void` is "void 0" (undefined). + // * The serialized type of a parenthesized type is the serialized type of its nested type. + // * The serialized type of a Function or Constructor type is "Function". + // * The serialized type of an Array or Tuple type is "Array". + // * The serialized type of `boolean` is "Boolean". + // * The serialized type of `string` or a string-literal type is "String". + // * The serialized type of a type reference is handled by `serializeTypeReferenceNode`. + // * The serialized type of any other type node is "Object". + if (node) { + switch (node.kind) { + case SyntaxKind.VoidKeyword: + return "void 0"; + case SyntaxKind.ParenthesizedType: + return serializeTypeNode((node).type, getGeneratedNameForNode); + case SyntaxKind.FunctionType: + case SyntaxKind.ConstructorType: + return "Function"; + case SyntaxKind.ArrayType: + case SyntaxKind.TupleType: + return "Array"; + case SyntaxKind.BooleanKeyword: + return "Boolean"; + case SyntaxKind.StringKeyword: + case SyntaxKind.StringLiteral: + return "String"; + case SyntaxKind.NumberKeyword: + return "Number"; + case SyntaxKind.TypeReference: + return serializeTypeReferenceNode(node, getGeneratedNameForNode); + case SyntaxKind.TypeQuery: + case SyntaxKind.TypeLiteral: + case SyntaxKind.UnionType: + case SyntaxKind.AnyKeyword: + break; + default: + Debug.fail("Cannot serialize unexpected type node."); + break; + } + } + + return "Object"; + } + + /** Serializes the type of a declaration to an appropriate JS constructor value. Used by the __metadata decorator for a class member. */ + function serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[] { + // serialization of the type of a declaration uses the following rules: + // + // * The serialized type of a ClassDeclaration is "Function" + // * The serialized type of a ParameterDeclaration is the serialized type of its type annotation. + // * The serialized type of a PropertyDeclaration is the serialized type of its type annotation. + // * The serialized type of an AccessorDeclaration is the serialized type of the return type annotation of its getter or parameter type annotation of its setter. + // * The serialized type of any other FunctionLikeDeclaration is "Function". + // * The serialized type of any other node is "void 0". + // + // For rules on serializing type annotations, see `serializeTypeNode`. + switch (node.kind) { + case SyntaxKind.ClassDeclaration: return "Function"; + case SyntaxKind.PropertyDeclaration: return serializeTypeNode((node).type, getGeneratedNameForNode); + case SyntaxKind.Parameter: return serializeTypeNode((node).type, getGeneratedNameForNode); + case SyntaxKind.GetAccessor: return serializeTypeNode((node).type, getGeneratedNameForNode); + case SyntaxKind.SetAccessor: return serializeTypeNode(getSetAccessorTypeAnnotationNode(node), getGeneratedNameForNode); + } + if (isFunctionLike(node)) { + return "Function"; + } + return "void 0"; + } + + /** Serializes the parameter types of a function or the constructor of a class. Used by the __metadata decorator for a method or set accessor. */ + function serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[] { + // serialization of parameter types uses the following rules: + // + // * If the declaration is a class, the parameters of the first constructor with a body are used. + // * If the declaration is function-like and has a body, the parameters of the function are used. + // + // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. + if (node) { + var valueDeclaration: FunctionLikeDeclaration; + if (node.kind === SyntaxKind.ClassDeclaration) { + valueDeclaration = getFirstConstructorWithBody(node); + } + else if (isFunctionLike(node) && nodeIsPresent((node).body)) { + valueDeclaration = node; + } + if (valueDeclaration) { + var result: (string | string[])[]; + var parameters = valueDeclaration.parameters; + var parameterCount = parameters.length; + if (parameterCount > 0) { + result = new Array(parameterCount); + for (var i = 0; i < parameterCount; i++) { + if (parameters[i].dotDotDotToken) { + var parameterType = parameters[i].type; + if (parameterType.kind === SyntaxKind.ArrayType) { + parameterType = (parameterType).elementType; + } + else if (parameterType.kind === SyntaxKind.TypeReference && (parameterType).typeArguments && (parameterType).typeArguments.length === 1) { + parameterType = (parameterType).typeArguments[0]; + } + else { + parameterType = undefined; + } + result[i] = serializeTypeNode(parameterType, getGeneratedNameForNode); + } + else { + result[i] = serializeTypeOfNode(parameters[i], getGeneratedNameForNode); + } + } + return result; + } + } + } + return emptyArray; + } + + /** Serializes the return type of function. Used by the __metadata decorator for a method. */ + function serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[] { + if (node && isFunctionLike(node)) { + return serializeTypeNode((node).type, getGeneratedNameForNode); + } + return "void 0"; + } + function writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { // Get type of the symbol if this is the valid symbol otherwise get type at location let symbol = getSymbolOfNode(declaration); @@ -11529,6 +11807,9 @@ module ts { resolvesToSomeValue, collectLinkedAliases, getBlockScopedVariableId, + serializeTypeOfNode, + serializeParameterTypesOfNode, + serializeReturnTypeOfNode, }; } @@ -11593,15 +11874,15 @@ module ts { return false; } if (!nodeCanBeDecorated(node)) { - return grammarErrorOnNode(node, Diagnostics.Decorators_are_not_valid_here); + return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here); } else if (languageVersion < ScriptTarget.ES5) { - return grammarErrorOnNode(node, Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); + return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); } else if (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor) { let accessors = getAllAccessorDeclarations((node.parent).members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { - return grammarErrorOnNode(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); + return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); } } return false; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 2f3b15f3777d0..48817798d817a 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -156,6 +156,11 @@ module ts { shortName: "w", type: "boolean", description: Diagnostics.Watch_input_files, + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + experimental: true } ]; diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 86c0bfe1ac5c9..43db3e69cd718 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -23,6 +23,33 @@ module ts { // @internal // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult { + // emit output for the __extends helper function + const extendsHelper = ` +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +};`; + + // emit output for the __decorate helper function + const decorateHelper = ` +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); + } +};`; + + // emit output for the __metadata helper function + const metadataHelper = ` +var __metadata = this.__metadata || (typeof Reflect === "object" && Reflect.metadata) || function () { };`; + + // emit output for the __param helper function + const paramHelper = ` +var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };`; + let compilerOptions = host.getCompilerOptions(); let languageVersion = compilerOptions.target || ScriptTarget.ES3; let sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap ? [] : undefined; @@ -98,6 +125,7 @@ module ts { let extendsEmitted = false; let decorateEmitted = false; + let paramEmitted = false; let tempFlags = 0; let tempVariables: Identifier[]; let tempParameters: Identifier[]; @@ -769,27 +797,34 @@ module ts { } } - function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { + function emitList(nodes: TNode[], start: number, count: number, multiLine: boolean, trailingComma: boolean, leadingComma?: boolean, noTrailingNewLine?: boolean, emitNode?: (node: TNode) => void): number { + if (!emitNode) { + emitNode = emit; + } + for (let i = 0; i < count; i++) { if (multiLine) { - if (i) { + if (i || leadingComma) { write(","); } writeLine(); } else { - if (i) { + if (i || leadingComma) { write(", "); } } - emit(nodes[start + i]); + emitNode(nodes[start + i]); + leadingComma = true; } if (trailingComma) { write(","); } - if (multiLine) { + if (multiLine && !noTrailingNewLine) { writeLine(); } + + return count; } function emitCommaList(nodes: Node[]) { @@ -1109,9 +1144,7 @@ module ts { return; } - let generatedVariable = createTempVariable(TempFlags.Auto); - generatedName = generatedVariable.text; - recordTempDeclaration(generatedVariable); + generatedName = createAndRecordTempVariable(TempFlags.Auto).text; computedPropertyNamesToGeneratedNames[node.id] = generatedName; write(generatedName); write(" = "); @@ -3763,12 +3796,12 @@ module ts { } function emitDecoratorsOfConstructor(node: ClassLikeDeclaration) { + let decorators = node.decorators; let constructor = getFirstConstructorWithBody(node); - if (constructor) { - emitDecoratorsOfParameters(node, constructor); - } + let hasDecoratedParameters = constructor && forEach(constructor.parameters, nodeIsDecorated); - if (!nodeIsDecorated(node)) { + // skip decoration of the constructor if neither it nor its parameters are decorated + if (!decorators && !hasDecoratedParameters) { return; } @@ -3786,8 +3819,23 @@ module ts { writeLine(); emitStart(node); emitDeclarationName(node); - write(" = "); - emitDecorateStart(node.decorators); + write(" = __decorate(["); + increaseIndent(); + writeLine(); + + let decoratorCount = decorators ? decorators.length : 0; + let argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, decorator => { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + + argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); + + decreaseIndent(); + writeLine(); + write("], "); emitDeclarationName(node); write(");"); emitEnd(node); @@ -3795,72 +3843,80 @@ module ts { } function emitDecoratorsOfMembers(node: ClassLikeDeclaration, staticFlag: NodeFlags) { - forEach(node.members, member => { + for (let member of node.members) { + // only emit members in the correct group if ((member.flags & NodeFlags.Static) !== staticFlag) { - return; + continue; } - let decorators: NodeArray; - switch (member.kind) { - case SyntaxKind.MethodDeclaration: - // emit decorators of the method's parameters - emitDecoratorsOfParameters(node, member); - decorators = member.decorators; - break; - - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - let accessors = getAllAccessorDeclarations(node.members, member); - if (member !== accessors.firstAccessor) { - // skip the second accessor as we processed it with the first. - return; - } + // skip members that cannot be decorated (such as the constructor) + if (!nodeCanBeDecorated(member)) { + continue; + } - if (accessors.setAccessor) { - // emit decorators of the set accessor parameter - emitDecoratorsOfParameters(node, accessors.setAccessor); - } + // skip a member if it or any of its parameters are not decorated + if (!nodeOrChildIsDecorated(member)) { + continue; + } - // get the decorators from the first decorated accessor. - decorators = accessors.firstAccessor.decorators; - if (!decorators && accessors.secondAccessor) { - decorators = accessors.secondAccessor.decorators; - } - break; + // skip an accessor declaration if it is not the first accessor + let decorators: NodeArray; + let functionLikeMember: FunctionLikeDeclaration; + if (isAccessor(member)) { + let accessors = getAllAccessorDeclarations(node.members, member); + if (member !== accessors.firstAccessor) { + continue; + } - case SyntaxKind.PropertyDeclaration: - decorators = member.decorators; - break; + // get the decorators from the first accessor with decorators + decorators = accessors.firstAccessor.decorators; + if (!decorators && accessors.secondAccessor) { + decorators = accessors.secondAccessor.decorators; + } - default: - // Constructor cannot be decorated, and its parameters are handled in emitDecoratorsOfConstructor - // Other members (i.e. IndexSignature) cannot be decorated. - return; + // we only decorate parameters of the set accessor + functionLikeMember = accessors.setAccessor; } + else { + decorators = member.decorators; - if (!decorators) { - return; + // we only decorate the parameters here if this is a method + if (member.kind === SyntaxKind.MethodDeclaration) { + functionLikeMember = member; + } } // Emit the call to __decorate. Given the following: // // class C { - // @dec method() {} + // @dec method(@dec2 x) {} // @dec get accessor() {} // @dec prop; // } // // The emit for a method is: // - // Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); + // Object.defineProperty(C.prototype, "method", + // __decorate([ + // dec, + // __param(0, dec2), + // __metadata("design:type", Function), + // __metadata("design:paramtypes", [Object]), + // __metadata("design:returntype", void 0) + // ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); // // The emit for an accessor is: // - // Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); + // Object.defineProperty(C.prototype, "accessor", + // __decorate([ + // dec + // ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); // // The emit for a property is: // - // __decorate([dec], C.prototype, "prop"); + // __decorate([ + // dec + // ], C.prototype, "prop"); // writeLine(); @@ -3872,10 +3928,28 @@ module ts { write(", "); emitExpressionForPropertyName(member.name); emitEnd(member.name); - write(", "); + write(","); + increaseIndent(); + writeLine(); } - emitDecorateStart(decorators); + write("__decorate(["); + increaseIndent(); + writeLine(); + + let decoratorCount = decorators ? decorators.length : 0; + let argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, decorator => { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + emitSerializedTypeMetadata(member, argumentsWritten > 0); + + decreaseIndent(); + writeLine(); + write("], "); emitStart(member.name); emitClassMemberPrefix(node, member); write(", "); @@ -3890,78 +3964,150 @@ module ts { emitExpressionForPropertyName(member.name); emitEnd(member.name); write("))"); + decreaseIndent(); } write(");"); emitEnd(member); writeLine(); - }); + } } - - function emitDecoratorsOfParameters(node: ClassLikeDeclaration, member: FunctionLikeDeclaration) { - forEach(member.parameters, (parameter, parameterIndex) => { - if (!nodeIsDecorated(parameter)) { - return; + + function emitDecoratorsOfParameters(node: FunctionLikeDeclaration, leadingComma: boolean): number { + let argumentsWritten = 0; + if (node) { + let parameterIndex = 0; + for (let parameter of node.parameters) { + if (nodeIsDecorated(parameter)) { + let decorators = parameter.decorators; + argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, decorator => { + emitStart(decorator); + write(`__param(${parameterIndex}, `); + emit(decorator.expression); + write(")"); + emitEnd(decorator); + }); + leadingComma = true; + } + ++parameterIndex; } + } + return argumentsWritten; + } - // Emit the decorators for a parameter. Given the following: - // - // class C { - // constructor(@dec p) { } - // method(@dec p) { } - // set accessor(@dec value) { } - // } - // - // The emit for a constructor is: - // - // __decorate([dec], C, void 0, 0); - // - // The emit for a parameter is: - // - // __decorate([dec], C.prototype, "method", 0); - // - // The emit for an accessor is: - // - // __decorate([dec], C.prototype, "accessor", 0); - // + function shouldEmitTypeMetadata(node: Declaration): boolean { + // This method determines whether to emit the "design:type" metadata based on the node's kind. + // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata + // compiler option is set. + switch (node.kind) { + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.PropertyDeclaration: + return true; + } - writeLine(); - emitStart(parameter); - emitDecorateStart(parameter.decorators); - emitStart(parameter.name); + return false; + } - if (member.kind === SyntaxKind.Constructor) { - emitDeclarationName(node); - write(", void 0"); + function shouldEmitReturnTypeMetadata(node: Declaration): boolean { + // This method determines whether to emit the "design:returntype" metadata based on the node's kind. + // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata + // compiler option is set. + switch (node.kind) { + case SyntaxKind.MethodDeclaration: + return true; + } + return false; + } + + function shouldEmitParamTypesMetadata(node: Declaration): boolean { + // This method determines whether to emit the "design:paramtypes" metadata based on the node's kind. + // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata + // compiler option is set. + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.SetAccessor: + return true; + } + return false; + } + + function emitSerializedTypeMetadata(node: Declaration, writeComma: boolean): number { + // This method emits the serialized type metadata for a decorator target. + // The caller should have already tested whether the node has decorators. + let argumentsWritten = 0; + if (compilerOptions.emitDecoratorMetadata) { + if (shouldEmitTypeMetadata(node)) { + var serializedType = resolver.serializeTypeOfNode(node, getGeneratedNameForNode); + if (serializedType) { + if (writeComma) { + write(", "); + } + writeLine(); + write("__metadata('design:type', "); + emitSerializedType(node, serializedType); + write(")"); + argumentsWritten++; + } } - else { - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); + if (shouldEmitParamTypesMetadata(node)) { + var serializedTypes = resolver.serializeParameterTypesOfNode(node, getGeneratedNameForNode); + if (serializedTypes) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:paramtypes', ["); + for (var i = 0; i < serializedTypes.length; ++i) { + if (i > 0) { + write(", "); + } + emitSerializedType(node, serializedTypes[i]); + } + write("])"); + argumentsWritten++; + } } + if (shouldEmitReturnTypeMetadata(node)) { + var serializedType = resolver.serializeReturnTypeOfNode(node, getGeneratedNameForNode); + if (serializedType) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:returntype', "); + emitSerializedType(node, serializedType); + write(")"); + argumentsWritten++; + } + } + } + return argumentsWritten; + } - write(", "); - write(String(parameterIndex)); - emitEnd(parameter.name); - write(");"); - emitEnd(parameter); - writeLine(); - }); + function serializeTypeNameSegment(location: Node, path: string[], index: number): string { + switch (index) { + case 0: + return `typeof ${path[index]} !== 'undefined' && ${path[index]}`; + case 1: + return `${serializeTypeNameSegment(location, path, index - 1) }.${path[index]}`; + default: + let temp = createAndRecordTempVariable(TempFlags.Auto).text; + return `(${temp} = ${serializeTypeNameSegment(location, path, index - 1) }) && ${temp}.${path[index]}`; + } } - function emitDecorateStart(decorators: Decorator[]): void { - write("__decorate(["); - let decoratorCount = decorators.length; - for (let i = 0; i < decoratorCount; i++) { - if (i > 0) { - write(", "); - } - let decorator = decorators[i]; - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); + function emitSerializedType(location: Node, name: string | string[]): void { + if (typeof name === "string") { + write(name); + return; + } + else { + Debug.assert(name.length > 0, "Invalid serialized type name"); + write(`(${serializeTypeNameSegment(location, name, name.length - 1) }) || Object`); } - write("], "); } function emitInterfaceDeclaration(node: InterfaceDeclaration) { @@ -4594,7 +4740,7 @@ module ts { return statements.length; } - function writeHelper(text: string): void { + function writeLines(text: string): void { let lines = text.split(/\r\n|\r|\n/g); for (let i = 0; i < lines.length; ++i) { let line = lines[i]; @@ -4613,41 +4759,25 @@ module ts { // emit prologue directives prior to __extends var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); // Only Emit __extends function when target ES5. - // For target ES6 and above, we can emit classDeclaration as if. + // For target ES6 and above, we can emit classDeclaration as is. if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitExtends)) { - writeLine(); - write("var __extends = this.__extends || function (d, b) {"); - increaseIndent(); - writeLine(); - write("for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];"); - writeLine(); - write("function __() { this.constructor = d; }"); - writeLine(); - write("__.prototype = b.prototype;"); - writeLine(); - write("d.prototype = new __();"); - decreaseIndent(); - writeLine(); - write("};"); + writeLines(extendsHelper); extendsEmitted = true; } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitDecorate) { - writeHelper(` -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } - } - return value; -};`); + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } decorateEmitted = true; } + + if (!paramEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitParam) { + writeLines(paramHelper); + paramEmitted = true; + } + if (isExternalModule(node)) { if (languageVersion >= ScriptTarget.ES6) { emitES6Module(node, startIndex); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index fbb7805d99836..7477705796396 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1255,6 +1255,9 @@ module ts { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; } export const enum SymbolFlags { @@ -1380,6 +1383,7 @@ module ts { EnumValuesComputed = 0x00000080, BlockScopedBindingInLoop = 0x00000100, EmitDecorate = 0x00000200, // Emit __decorate + EmitParam = 0x00000400, // Emit __param helper for decorators } export interface NodeLinks { @@ -1605,6 +1609,7 @@ module ts { version?: boolean; watch?: boolean; separateCompilation?: boolean; + emitDecoratorMetadata?: boolean; /* @internal */ stripInternal?: boolean; [option: string]: string | number | boolean; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 1deb9ce97e258..e3efd12de0a0c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -449,6 +449,18 @@ module ts { return false; } + export function isAccessor(node: Node): boolean { + if (node) { + switch (node.kind) { + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return true; + } + } + + return false; + } + export function isFunctionLike(node: Node): boolean { if (node) { switch (node.kind) { diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index 3e6ac3f756ce6..8590e2273e05a 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -3513,27 +3513,27 @@ interface ProxyHandler { interface ProxyConstructor { revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handeler: ProxyHandler): T + new (target: T, handler: ProxyHandler): T } declare var Proxy: ProxyConstructor; -declare var Reflect: { - apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - construct(target: Function, argumentsList: ArrayLike): any; - defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - deleteProperty(target: any, propertyKey: PropertyKey): boolean; - enumerate(target: any): IterableIterator; - get(target: any, propertyKey: PropertyKey, receiver?: any): any; - getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - getPrototypeOf(target: any): any; - has(target: any, propertyKey: string): boolean; - has(target: any, propertyKey: symbol): boolean; - isExtensible(target: any): boolean; - ownKeys(target: any): Array; - preventExtensions(target: any): boolean; - set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean; - setPrototypeOf(target: any, proto: any): boolean; -}; +declare module Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): IterableIterator; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} /** * Represents the completion of an asynchronous operation diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 6c28c96a6d8a8..8ded11fd98dc4 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -978,6 +978,9 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; } const enum SymbolFlags { FunctionScopedVariable = 1, @@ -1084,6 +1087,7 @@ declare module "typescript" { EnumValuesComputed = 128, BlockScopedBindingInLoop = 256, EmitDecorate = 512, + EmitParam = 1024, } interface NodeLinks { resolvedType?: Type; @@ -1256,6 +1260,7 @@ declare module "typescript" { version?: boolean; watch?: boolean; separateCompilation?: boolean; + emitDecoratorMetadata?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 635aff7562837..487fbe4404ec1 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -3188,6 +3188,30 @@ declare module "typescript" { >getBlockScopedVariableId : (node: Identifier) => number >node : Identifier >Identifier : Identifier + + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; +>serializeParameterTypesOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => (string | string[])[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeReturnTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node } const enum SymbolFlags { >SymbolFlags : SymbolFlags @@ -3504,6 +3528,9 @@ declare module "typescript" { EmitDecorate = 512, >EmitDecorate : NodeCheckFlags + + EmitParam = 1024, +>EmitParam : NodeCheckFlags } interface NodeLinks { >NodeLinks : NodeLinks @@ -4019,6 +4046,9 @@ declare module "typescript" { separateCompilation?: boolean; >separateCompilation : boolean + emitDecoratorMetadata?: boolean; +>emitDecoratorMetadata : boolean + [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index f59fa91da14f3..3a16f5f0a2670 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1009,6 +1009,9 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; } const enum SymbolFlags { FunctionScopedVariable = 1, @@ -1115,6 +1118,7 @@ declare module "typescript" { EnumValuesComputed = 128, BlockScopedBindingInLoop = 256, EmitDecorate = 512, + EmitParam = 1024, } interface NodeLinks { resolvedType?: Type; @@ -1287,6 +1291,7 @@ declare module "typescript" { version?: boolean; watch?: boolean; separateCompilation?: boolean; + emitDecoratorMetadata?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 12f4ac12fdc20..e06eae534da3c 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -3334,6 +3334,30 @@ declare module "typescript" { >getBlockScopedVariableId : (node: Identifier) => number >node : Identifier >Identifier : Identifier + + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; +>serializeParameterTypesOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => (string | string[])[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeReturnTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node } const enum SymbolFlags { >SymbolFlags : SymbolFlags @@ -3650,6 +3674,9 @@ declare module "typescript" { EmitDecorate = 512, >EmitDecorate : NodeCheckFlags + + EmitParam = 1024, +>EmitParam : NodeCheckFlags } interface NodeLinks { >NodeLinks : NodeLinks @@ -4165,6 +4192,9 @@ declare module "typescript" { separateCompilation?: boolean; >separateCompilation : boolean + emitDecoratorMetadata?: boolean; +>emitDecoratorMetadata : boolean + [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_linter.types.pull b/tests/baselines/reference/APISample_linter.types.pull index 0a2a7ea948a3e..6bb5fca9cf89e 100644 --- a/tests/baselines/reference/APISample_linter.types.pull +++ b/tests/baselines/reference/APISample_linter.types.pull @@ -3334,6 +3334,30 @@ declare module "typescript" { >getBlockScopedVariableId : (node: Identifier) => number >node : Identifier >Identifier : Identifier + + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; +>serializeParameterTypesOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => (string | string[])[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeReturnTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node } const enum SymbolFlags { >SymbolFlags : SymbolFlags @@ -3650,6 +3674,9 @@ declare module "typescript" { EmitDecorate = 512, >EmitDecorate : NodeCheckFlags + + EmitParam = 1024, +>EmitParam : NodeCheckFlags } interface NodeLinks { >NodeLinks : NodeLinks @@ -4165,6 +4192,9 @@ declare module "typescript" { separateCompilation?: boolean; >separateCompilation : boolean + emitDecoratorMetadata?: boolean; +>emitDecoratorMetadata : boolean + [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 6bdf755ae1290..5a897ceaa93d1 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1010,6 +1010,9 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; } const enum SymbolFlags { FunctionScopedVariable = 1, @@ -1116,6 +1119,7 @@ declare module "typescript" { EnumValuesComputed = 128, BlockScopedBindingInLoop = 256, EmitDecorate = 512, + EmitParam = 1024, } interface NodeLinks { resolvedType?: Type; @@ -1288,6 +1292,7 @@ declare module "typescript" { version?: boolean; watch?: boolean; separateCompilation?: boolean; + emitDecoratorMetadata?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 4bd248d70c7f6..d9bc833550573 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -3284,6 +3284,30 @@ declare module "typescript" { >getBlockScopedVariableId : (node: Identifier) => number >node : Identifier >Identifier : Identifier + + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; +>serializeParameterTypesOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => (string | string[])[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeReturnTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node } const enum SymbolFlags { >SymbolFlags : SymbolFlags @@ -3600,6 +3624,9 @@ declare module "typescript" { EmitDecorate = 512, >EmitDecorate : NodeCheckFlags + + EmitParam = 1024, +>EmitParam : NodeCheckFlags } interface NodeLinks { >NodeLinks : NodeLinks @@ -4115,6 +4142,9 @@ declare module "typescript" { separateCompilation?: boolean; >separateCompilation : boolean + emitDecoratorMetadata?: boolean; +>emitDecoratorMetadata : boolean + [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 3c11e27f0e16f..f461ded8ca444 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1047,6 +1047,9 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; resolvesToSomeValue(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; } const enum SymbolFlags { FunctionScopedVariable = 1, @@ -1153,6 +1156,7 @@ declare module "typescript" { EnumValuesComputed = 128, BlockScopedBindingInLoop = 256, EmitDecorate = 512, + EmitParam = 1024, } interface NodeLinks { resolvedType?: Type; @@ -1325,6 +1329,7 @@ declare module "typescript" { version?: boolean; watch?: boolean; separateCompilation?: boolean; + emitDecoratorMetadata?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index f38cdc9b1af8a..d674edbe11b68 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -3457,6 +3457,30 @@ declare module "typescript" { >getBlockScopedVariableId : (node: Identifier) => number >node : Identifier >Identifier : Identifier + + serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[]; +>serializeParameterTypesOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => (string | string[])[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node + + serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[]; +>serializeReturnTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[] +>node : Node +>Node : Node +>getGeneratedNameForNode : (Node: Node) => string +>Node : Node +>Node : Node } const enum SymbolFlags { >SymbolFlags : SymbolFlags @@ -3773,6 +3797,9 @@ declare module "typescript" { EmitDecorate = 512, >EmitDecorate : NodeCheckFlags + + EmitParam = 1024, +>EmitParam : NodeCheckFlags } interface NodeLinks { >NodeLinks : NodeLinks @@ -4288,6 +4315,9 @@ declare module "typescript" { separateCompilation?: boolean; >separateCompilation : boolean + emitDecoratorMetadata?: boolean; +>emitDecoratorMetadata : boolean + [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/classExpressionWithDecorator1.js b/tests/baselines/reference/classExpressionWithDecorator1.js index fd15941996a30..3e25539890440 100644 --- a/tests/baselines/reference/classExpressionWithDecorator1.js +++ b/tests/baselines/reference/classExpressionWithDecorator1.js @@ -2,25 +2,21 @@ var v = @decorate class C { static p = 1 }; //// [classExpressionWithDecorator1.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var v = ; var C = (function () { function C() { } C.p = 1; - C = __decorate([decorate], C); + C = __decorate([ + decorate + ], C); return C; })(); ; diff --git a/tests/baselines/reference/decoratorOnClass1.js b/tests/baselines/reference/decoratorOnClass1.js index 24be2517469fc..cd5c51e7a9350 100644 --- a/tests/baselines/reference/decoratorOnClass1.js +++ b/tests/baselines/reference/decoratorOnClass1.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClass1.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - C = __decorate([dec], C); + C = __decorate([ + dec + ], C); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClass2.js b/tests/baselines/reference/decoratorOnClass2.js index 92741819e9449..fbd9a106ddf12 100644 --- a/tests/baselines/reference/decoratorOnClass2.js +++ b/tests/baselines/reference/decoratorOnClass2.js @@ -6,23 +6,19 @@ export class C { } //// [decoratorOnClass2.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - C = __decorate([dec], C); + C = __decorate([ + dec + ], C); return C; })(); exports.C = C; diff --git a/tests/baselines/reference/decoratorOnClass3.js b/tests/baselines/reference/decoratorOnClass3.js index 766acc42072ed..21536028091d5 100644 --- a/tests/baselines/reference/decoratorOnClass3.js +++ b/tests/baselines/reference/decoratorOnClass3.js @@ -7,22 +7,18 @@ class C { } //// [decoratorOnClass3.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - C = __decorate([dec], C); + C = __decorate([ + dec + ], C); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClass4.js b/tests/baselines/reference/decoratorOnClass4.js index 95bde549379e8..5099d16b5b48f 100644 --- a/tests/baselines/reference/decoratorOnClass4.js +++ b/tests/baselines/reference/decoratorOnClass4.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClass4.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - C = __decorate([dec()], C); + C = __decorate([ + dec() + ], C); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClass5.js b/tests/baselines/reference/decoratorOnClass5.js index a93d625f49136..0555f618e7e22 100644 --- a/tests/baselines/reference/decoratorOnClass5.js +++ b/tests/baselines/reference/decoratorOnClass5.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClass5.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - C = __decorate([dec()], C); + C = __decorate([ + dec() + ], C); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClass8.js b/tests/baselines/reference/decoratorOnClass8.js index 0e782d45e1158..fad73c0c8fcfb 100644 --- a/tests/baselines/reference/decoratorOnClass8.js +++ b/tests/baselines/reference/decoratorOnClass8.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClass8.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - C = __decorate([dec()], C); + C = __decorate([ + dec() + ], C); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassAccessor1.js b/tests/baselines/reference/decoratorOnClassAccessor1.js index c8a96c40721f4..68fa7ccec0a77 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor1.js +++ b/tests/baselines/reference/decoratorOnClassAccessor1.js @@ -6,18 +6,12 @@ class C { } //// [decoratorOnClassAccessor1.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { @@ -27,6 +21,9 @@ var C = (function () { enumerable: true, configurable: true }); - Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); + Object.defineProperty(C.prototype, "accessor", + __decorate([ + dec + ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassAccessor2.js b/tests/baselines/reference/decoratorOnClassAccessor2.js index bffbfb4b7009c..17d3e2e422d4a 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor2.js +++ b/tests/baselines/reference/decoratorOnClassAccessor2.js @@ -6,18 +6,12 @@ class C { } //// [decoratorOnClassAccessor2.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { @@ -27,6 +21,9 @@ var C = (function () { enumerable: true, configurable: true }); - Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); + Object.defineProperty(C.prototype, "accessor", + __decorate([ + dec + ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassAccessor3.js b/tests/baselines/reference/decoratorOnClassAccessor3.js index a2a2221a11935..23e689f311465 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor3.js +++ b/tests/baselines/reference/decoratorOnClassAccessor3.js @@ -6,18 +6,12 @@ class C { } //// [decoratorOnClassAccessor3.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { @@ -27,6 +21,9 @@ var C = (function () { enumerable: true, configurable: true }); - Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); + Object.defineProperty(C.prototype, "accessor", + __decorate([ + dec + ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassAccessor4.js b/tests/baselines/reference/decoratorOnClassAccessor4.js index 1b4853b69bc60..77bcb568fe136 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor4.js +++ b/tests/baselines/reference/decoratorOnClassAccessor4.js @@ -6,18 +6,12 @@ class C { } //// [decoratorOnClassAccessor4.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { @@ -27,6 +21,9 @@ var C = (function () { enumerable: true, configurable: true }); - Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); + Object.defineProperty(C.prototype, "accessor", + __decorate([ + dec + ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassAccessor5.js b/tests/baselines/reference/decoratorOnClassAccessor5.js index eec246c7ead5e..37fc33abefda1 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor5.js +++ b/tests/baselines/reference/decoratorOnClassAccessor5.js @@ -6,18 +6,12 @@ class C { } //// [decoratorOnClassAccessor5.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { @@ -27,6 +21,9 @@ var C = (function () { enumerable: true, configurable: true }); - Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); + Object.defineProperty(C.prototype, "accessor", + __decorate([ + dec + ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassAccessor6.js b/tests/baselines/reference/decoratorOnClassAccessor6.js index ce9776bfc619f..465e13ebb1dbf 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor6.js +++ b/tests/baselines/reference/decoratorOnClassAccessor6.js @@ -6,18 +6,12 @@ class C { } //// [decoratorOnClassAccessor6.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { @@ -27,6 +21,9 @@ var C = (function () { enumerable: true, configurable: true }); - Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); + Object.defineProperty(C.prototype, "accessor", + __decorate([ + dec + ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassConstructor1.errors.txt b/tests/baselines/reference/decoratorOnClassConstructor1.errors.txt index 14a164eccb429..279cf38894f1c 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor1.errors.txt +++ b/tests/baselines/reference/decoratorOnClassConstructor1.errors.txt @@ -6,6 +6,6 @@ tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor class C { @dec constructor() {} - ~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS1206: Decorators are not valid here. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js index 0c86a1ccf7aa7..a1748a725ba65 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js @@ -6,22 +6,19 @@ class C { } //// [decoratorOnClassConstructorParameter1.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; +var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } }; var C = (function () { function C(p) { } - __decorate([dec], C, void 0, 0); + C = __decorate([ + __param(0, dec) + ], C); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js index 3ab9829e72a9a..638cb1cda7ea8 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js @@ -6,22 +6,19 @@ class C { } //// [decoratorOnClassConstructorParameter4.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; +var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } }; var C = (function () { function C(, p) { } - __decorate([dec], C, void 0, 1); + C = __decorate([ + __param(1, dec) + ], C); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassMethod1.js b/tests/baselines/reference/decoratorOnClassMethod1.js index b7230cca8b15f..23be109430593 100644 --- a/tests/baselines/reference/decoratorOnClassMethod1.js +++ b/tests/baselines/reference/decoratorOnClassMethod1.js @@ -6,23 +6,20 @@ class C { } //// [decoratorOnClassMethod1.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } C.prototype.method = function () { }; - Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); + Object.defineProperty(C.prototype, "method", + __decorate([ + dec + ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassMethod10.js b/tests/baselines/reference/decoratorOnClassMethod10.js index 137a0c2839fcf..f87e3137777a9 100644 --- a/tests/baselines/reference/decoratorOnClassMethod10.js +++ b/tests/baselines/reference/decoratorOnClassMethod10.js @@ -6,23 +6,20 @@ class C { } //// [decoratorOnClassMethod10.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } C.prototype.method = function () { }; - Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); + Object.defineProperty(C.prototype, "method", + __decorate([ + dec + ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassMethod2.js b/tests/baselines/reference/decoratorOnClassMethod2.js index ceddff2f15079..33a22f419d4c8 100644 --- a/tests/baselines/reference/decoratorOnClassMethod2.js +++ b/tests/baselines/reference/decoratorOnClassMethod2.js @@ -6,23 +6,20 @@ class C { } //// [decoratorOnClassMethod2.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } C.prototype.method = function () { }; - Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); + Object.defineProperty(C.prototype, "method", + __decorate([ + dec + ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassMethod3.js b/tests/baselines/reference/decoratorOnClassMethod3.js index 7e13f91d86c70..f93b7d7a6b230 100644 --- a/tests/baselines/reference/decoratorOnClassMethod3.js +++ b/tests/baselines/reference/decoratorOnClassMethod3.js @@ -6,23 +6,20 @@ class C { } //// [decoratorOnClassMethod3.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } C.prototype.method = function () { }; - Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); + Object.defineProperty(C.prototype, "method", + __decorate([ + dec + ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassMethod4.js b/tests/baselines/reference/decoratorOnClassMethod4.js index 55798a2e1dbb7..038432f2cf030 100644 --- a/tests/baselines/reference/decoratorOnClassMethod4.js +++ b/tests/baselines/reference/decoratorOnClassMethod4.js @@ -6,21 +6,18 @@ class C { } //// [decoratorOnClassMethod4.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; class C { [_a = "method"]() { } } -Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); +Object.defineProperty(C.prototype, _a, + __decorate([ + dec + ], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); var _a; diff --git a/tests/baselines/reference/decoratorOnClassMethod5.js b/tests/baselines/reference/decoratorOnClassMethod5.js index 2fe671e1b5221..460c11f145b09 100644 --- a/tests/baselines/reference/decoratorOnClassMethod5.js +++ b/tests/baselines/reference/decoratorOnClassMethod5.js @@ -6,21 +6,18 @@ class C { } //// [decoratorOnClassMethod5.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; class C { [_a = "method"]() { } } -Object.defineProperty(C.prototype, _a, __decorate([dec()], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); +Object.defineProperty(C.prototype, _a, + __decorate([ + dec() + ], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); var _a; diff --git a/tests/baselines/reference/decoratorOnClassMethod6.js b/tests/baselines/reference/decoratorOnClassMethod6.js index 2e828d6ad4def..9f12059918349 100644 --- a/tests/baselines/reference/decoratorOnClassMethod6.js +++ b/tests/baselines/reference/decoratorOnClassMethod6.js @@ -6,21 +6,18 @@ class C { } //// [decoratorOnClassMethod6.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; class C { [_a = "method"]() { } } -Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); +Object.defineProperty(C.prototype, _a, + __decorate([ + dec + ], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); var _a; diff --git a/tests/baselines/reference/decoratorOnClassMethod7.js b/tests/baselines/reference/decoratorOnClassMethod7.js index 0b0f5abc4fabc..6ab01e68bba81 100644 --- a/tests/baselines/reference/decoratorOnClassMethod7.js +++ b/tests/baselines/reference/decoratorOnClassMethod7.js @@ -6,21 +6,18 @@ class C { } //// [decoratorOnClassMethod7.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; class C { [_a = "method"]() { } } -Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); +Object.defineProperty(C.prototype, _a, + __decorate([ + dec + ], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a))); var _a; diff --git a/tests/baselines/reference/decoratorOnClassMethod8.js b/tests/baselines/reference/decoratorOnClassMethod8.js index 89afc665143c9..3e88f8c2793d6 100644 --- a/tests/baselines/reference/decoratorOnClassMethod8.js +++ b/tests/baselines/reference/decoratorOnClassMethod8.js @@ -6,23 +6,20 @@ class C { } //// [decoratorOnClassMethod8.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } C.prototype.method = function () { }; - Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); + Object.defineProperty(C.prototype, "method", + __decorate([ + dec + ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassMethodParameter1.js b/tests/baselines/reference/decoratorOnClassMethodParameter1.js index dcd6c123527aa..d228ed9302bd7 100644 --- a/tests/baselines/reference/decoratorOnClassMethodParameter1.js +++ b/tests/baselines/reference/decoratorOnClassMethodParameter1.js @@ -6,23 +6,21 @@ class C { } //// [decoratorOnClassMethodParameter1.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; +var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } }; var C = (function () { function C() { } C.prototype.method = function (p) { }; - __decorate([dec], C.prototype, "method", 0); + Object.defineProperty(C.prototype, "method", + __decorate([ + __param(0, dec) + ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method"))); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassProperty1.js b/tests/baselines/reference/decoratorOnClassProperty1.js index efc6a2c04dbf5..aa38252b995c7 100644 --- a/tests/baselines/reference/decoratorOnClassProperty1.js +++ b/tests/baselines/reference/decoratorOnClassProperty1.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClassProperty1.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - __decorate([dec], C.prototype, "prop"); + __decorate([ + dec + ], C.prototype, "prop"); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassProperty10.js b/tests/baselines/reference/decoratorOnClassProperty10.js index d55eb71e3c637..bccbc0bb73708 100644 --- a/tests/baselines/reference/decoratorOnClassProperty10.js +++ b/tests/baselines/reference/decoratorOnClassProperty10.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClassProperty10.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - __decorate([dec()], C.prototype, "prop"); + __decorate([ + dec() + ], C.prototype, "prop"); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassProperty11.js b/tests/baselines/reference/decoratorOnClassProperty11.js index 63e5f8d02e94c..f31e40d3c4021 100644 --- a/tests/baselines/reference/decoratorOnClassProperty11.js +++ b/tests/baselines/reference/decoratorOnClassProperty11.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClassProperty11.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - __decorate([dec], C.prototype, "prop"); + __decorate([ + dec + ], C.prototype, "prop"); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassProperty2.js b/tests/baselines/reference/decoratorOnClassProperty2.js index d52baa7920273..477320b40fa8d 100644 --- a/tests/baselines/reference/decoratorOnClassProperty2.js +++ b/tests/baselines/reference/decoratorOnClassProperty2.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClassProperty2.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - __decorate([dec], C.prototype, "prop"); + __decorate([ + dec + ], C.prototype, "prop"); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassProperty3.js b/tests/baselines/reference/decoratorOnClassProperty3.js index f8a2cce27df6e..05476c66e7d0d 100644 --- a/tests/baselines/reference/decoratorOnClassProperty3.js +++ b/tests/baselines/reference/decoratorOnClassProperty3.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClassProperty3.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - __decorate([dec], C.prototype, "prop"); + __decorate([ + dec + ], C.prototype, "prop"); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassProperty6.js b/tests/baselines/reference/decoratorOnClassProperty6.js index 7f087156bc7a1..46e2d5fc06981 100644 --- a/tests/baselines/reference/decoratorOnClassProperty6.js +++ b/tests/baselines/reference/decoratorOnClassProperty6.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClassProperty6.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - __decorate([dec], C.prototype, "prop"); + __decorate([ + dec + ], C.prototype, "prop"); return C; })(); diff --git a/tests/baselines/reference/decoratorOnClassProperty7.js b/tests/baselines/reference/decoratorOnClassProperty7.js index ba2c8383a2cce..14ca0612cb1ce 100644 --- a/tests/baselines/reference/decoratorOnClassProperty7.js +++ b/tests/baselines/reference/decoratorOnClassProperty7.js @@ -6,22 +6,18 @@ class C { } //// [decoratorOnClassProperty7.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; var C = (function () { function C() { } - __decorate([dec], C.prototype, "prop"); + __decorate([ + dec + ], C.prototype, "prop"); return C; })(); diff --git a/tests/baselines/reference/decoratorOnEnum.errors.txt b/tests/baselines/reference/decoratorOnEnum.errors.txt index 21a6d39aab501..8adf03e548c96 100644 --- a/tests/baselines/reference/decoratorOnEnum.errors.txt +++ b/tests/baselines/reference/decoratorOnEnum.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts(4,6): error TS1206: Decorators are not valid here. +tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts(3,1): error TS1206: Decorators are not valid here. ==== tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts (1 errors) ==== declare function dec(target: T): T; @dec - enum E { - ~ + ~ !!! error TS1206: Decorators are not valid here. + enum E { } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnFunctionDeclaration.errors.txt b/tests/baselines/reference/decoratorOnFunctionDeclaration.errors.txt index bda00f1a85f82..24d5eb3509259 100644 --- a/tests/baselines/reference/decoratorOnFunctionDeclaration.errors.txt +++ b/tests/baselines/reference/decoratorOnFunctionDeclaration.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts(4,10): error TS1206: Decorators are not valid here. +tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts(3,1): error TS1206: Decorators are not valid here. ==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts (1 errors) ==== declare function dec(target: T): T; @dec - function F() { - ~ + ~ !!! error TS1206: Decorators are not valid here. + function F() { } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnImportEquals1.errors.txt b/tests/baselines/reference/decoratorOnImportEquals1.errors.txt index a09a0b014278d..cc75018ca492f 100644 --- a/tests/baselines/reference/decoratorOnImportEquals1.errors.txt +++ b/tests/baselines/reference/decoratorOnImportEquals1.errors.txt @@ -10,8 +10,7 @@ tests/cases/conformance/decorators/invalid/decoratorOnImportEquals1.ts(8,5): err module M2 { @dec - ~~~~ - import X = M1.X; - ~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS1206: Decorators are not valid here. + import X = M1.X; } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnImportEquals2.errors.txt b/tests/baselines/reference/decoratorOnImportEquals2.errors.txt index 5701afe569be2..0c64db354e891 100644 --- a/tests/baselines/reference/decoratorOnImportEquals2.errors.txt +++ b/tests/baselines/reference/decoratorOnImportEquals2.errors.txt @@ -3,10 +3,9 @@ tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts(1,1): e ==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts (1 errors) ==== @dec - ~~~~ - import lib = require('./decoratorOnImportEquals2_0'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS1206: Decorators are not valid here. + import lib = require('./decoratorOnImportEquals2_0'); declare function dec(target: T): T; ==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_0.ts (0 errors) ==== diff --git a/tests/baselines/reference/decoratorOnInterface.errors.txt b/tests/baselines/reference/decoratorOnInterface.errors.txt index 055b43fa877a4..65aec166d70c8 100644 --- a/tests/baselines/reference/decoratorOnInterface.errors.txt +++ b/tests/baselines/reference/decoratorOnInterface.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts(4,11): error TS1206: Decorators are not valid here. +tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts(3,1): error TS1206: Decorators are not valid here. ==== tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts (1 errors) ==== declare function dec(target: T): T; @dec - interface I { - ~ + ~ !!! error TS1206: Decorators are not valid here. + interface I { } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnInternalModule.errors.txt b/tests/baselines/reference/decoratorOnInternalModule.errors.txt index 2fd92dfb2500a..e34e381d9e586 100644 --- a/tests/baselines/reference/decoratorOnInternalModule.errors.txt +++ b/tests/baselines/reference/decoratorOnInternalModule.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts(4,8): error TS1206: Decorators are not valid here. +tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts(3,1): error TS1206: Decorators are not valid here. ==== tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts (1 errors) ==== declare function dec(target: T): T; @dec - module M { - ~ + ~ !!! error TS1206: Decorators are not valid here. + module M { } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnTypeAlias.errors.txt b/tests/baselines/reference/decoratorOnTypeAlias.errors.txt index 0d3109fe463f2..6d76a0b30d635 100644 --- a/tests/baselines/reference/decoratorOnTypeAlias.errors.txt +++ b/tests/baselines/reference/decoratorOnTypeAlias.errors.txt @@ -5,7 +5,6 @@ tests/cases/conformance/decorators/invalid/decoratorOnTypeAlias.ts(3,1): error T declare function dec(target: T): T; @dec - ~~~~ - type T = number; - ~~~~~~~~~~~~~~~~ -!!! error TS1206: Decorators are not valid here. \ No newline at end of file + ~ +!!! error TS1206: Decorators are not valid here. + type T = number; \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnVar.errors.txt b/tests/baselines/reference/decoratorOnVar.errors.txt index bd87357edad6a..a2262adf748e4 100644 --- a/tests/baselines/reference/decoratorOnVar.errors.txt +++ b/tests/baselines/reference/decoratorOnVar.errors.txt @@ -5,7 +5,6 @@ tests/cases/conformance/decorators/invalid/decoratorOnVar.ts(3,1): error TS1206: declare function dec(target: T): T; @dec - ~~~~ - var x: number; - ~~~~~~~~~~~~~~ -!!! error TS1206: Decorators are not valid here. \ No newline at end of file + ~ +!!! error TS1206: Decorators are not valid here. + var x: number; \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js b/tests/baselines/reference/sourceMapValidationDecorators.js index 81ce9bc60ffb9..5577a6967cd83 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.js +++ b/tests/baselines/reference/sourceMapValidationDecorators.js @@ -55,19 +55,14 @@ class Greeter { } //// [sourceMapValidationDecorators.js] -var __decorate = this.__decorate || function (decorators, target, key, value) { - var kind = typeof (arguments.length == 2 ? value = target : value); - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - switch (kind) { - case "function": value = decorator(value) || value; break; - case "number": decorator(target, key, value); break; - case "undefined": decorator(target, key); break; - case "object": value = decorator(target, key, value) || value; break; - } +var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { + switch (arguments.length) { + case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); + case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); + case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } - return value; }; +var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } }; var Greeter = (function () { function Greeter(greeting) { var b = []; @@ -93,15 +88,39 @@ var Greeter = (function () { configurable: true }); Greeter.x1 = 10; - Object.defineProperty(Greeter.prototype, "greet", __decorate([PropertyDecorator1, PropertyDecorator2(40)], Greeter.prototype, "greet", Object.getOwnPropertyDescriptor(Greeter.prototype, "greet"))); - __decorate([PropertyDecorator1, PropertyDecorator2(50)], Greeter.prototype, "x"); - __decorate([ParameterDecorator1, ParameterDecorator2(70)], Greeter.prototype, "fn", 0); - __decorate([ParameterDecorator1, ParameterDecorator2(90)], Greeter.prototype, "greetings", 0); - Object.defineProperty(Greeter.prototype, "greetings", __decorate([PropertyDecorator1, PropertyDecorator2(80)], Greeter.prototype, "greetings", Object.getOwnPropertyDescriptor(Greeter.prototype, "greetings"))); - __decorate([PropertyDecorator1, PropertyDecorator2(60)], Greeter, "x1"); - __decorate([ParameterDecorator1, ParameterDecorator2(20)], Greeter, void 0, 0); - __decorate([ParameterDecorator1, ParameterDecorator2(30)], Greeter, void 0, 1); - Greeter = __decorate([ClassDecorator1, ClassDecorator2(10)], Greeter); + Object.defineProperty(Greeter.prototype, "greet", + __decorate([ + PropertyDecorator1, + PropertyDecorator2(40) + ], Greeter.prototype, "greet", Object.getOwnPropertyDescriptor(Greeter.prototype, "greet"))); + __decorate([ + PropertyDecorator1, + PropertyDecorator2(50) + ], Greeter.prototype, "x"); + Object.defineProperty(Greeter.prototype, "fn", + __decorate([ + __param(0, ParameterDecorator1), + __param(0, ParameterDecorator2(70)) + ], Greeter.prototype, "fn", Object.getOwnPropertyDescriptor(Greeter.prototype, "fn"))); + Object.defineProperty(Greeter.prototype, "greetings", + __decorate([ + PropertyDecorator1, + PropertyDecorator2(80), + __param(0, ParameterDecorator1), + __param(0, ParameterDecorator2(90)) + ], Greeter.prototype, "greetings", Object.getOwnPropertyDescriptor(Greeter.prototype, "greetings"))); + __decorate([ + PropertyDecorator1, + PropertyDecorator2(60) + ], Greeter, "x1"); + Greeter = __decorate([ + ClassDecorator1, + ClassDecorator2(10), + __param(0, ParameterDecorator1), + __param(0, ParameterDecorator2(20)), + __param(1, ParameterDecorator1), + __param(1, ParameterDecorator2(30)) + ], Greeter); return Greeter; })(); //# sourceMappingURL=sourceMapValidationDecorators.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js.map b/tests/baselines/reference/sourceMapValidationDecorators.js.map index 4cca04a1e3c43..84ebad316fa80 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.js.map +++ b/tests/baselines/reference/sourceMapValidationDecorators.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationDecorators.js.map] -{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":["Greeter","Greeter.constructor","Greeter.greet","Greeter.fn","Greeter.greetings"],"mappings":";;;;;;;;;;;;;AAOA;IAGIA,iBAGSA,QAAgBA;QAEvBC,WAEcA;aAFdA,WAEcA,CAFdA,sBAEcA,CAFdA,IAEcA;YAFdA,0BAEcA;;QAJPA,aAAQA,GAARA,QAAQA,CAAQA;IAKzBA,CAACA;IAIDD,uBAAKA,GAFLA;QAGIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;IAC5CA,CAACA;IAUOF,oBAAEA,GAAVA,UAGEA,CAASA;QACPG,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;IACzBA,CAACA;IAEDH,sBAEIA,8BAASA;aAFbA;YAGII,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;QACzBA,CAACA;aAEDJ,UAGEA,SAAiBA;YACfI,IAAIA,CAACA,QAAQA,GAAGA,SAASA,CAACA;QAC9BA,CAACA;;;OAPAJ;IAbcA,UAAEA,GAAWA,EAAEA,CAACA;IAZ/BA,sBAEAA,0BAAKA,cAFJA,kBAAkBA,EAClBA,kBAAkBA,CAACA,EAAEA,CAACA,GACvBA,0BAAKA,kCAALA,0BAAKA,IAEJA;IAEDA,YAACA,kBAAkBA,EAClBA,kBAAkBA,CAACA,EAAEA,CAACA,GACfA,sBAACA,EAASA;IAOhBA,YAACA,mBAAmBA,EACnBA,mBAAmBA,CAACA,EAAEA,CAACA,GACxBA,0BAACA,EAAQA;IAWTA,YAACA,mBAAmBA,EACnBA,mBAAmBA,CAACA,EAAEA,CAACA,GACxBA,iCAASA,EAAQA;IATnBA,sBAEIA,8BAASA,cAFZA,kBAAkBA,EAClBA,kBAAkBA,CAACA,EAAEA,CAACA,GACnBA,8BAASA,kCAATA,8BAASA,IAEZA;IAfDA,YAACA,kBAAkBA,EAClBA,kBAAkBA,CAACA,EAAEA,CAACA,GACRA,aAAEA,EAAcA;IArB7BA,YAACA,mBAAmBA,EACnBA,mBAAmBA,CAACA,EAAEA,CAACA,GACjBA,kBAAQA,EAAQA;IAEvBA,YAACA,mBAAmBA,EACnBA,mBAAmBA,CAACA,EAAEA,CAACA,GACrBA,kBAACA,EAAUA;IAVpBA,sBAACA,eAAeA,EACfA,eAAeA,CAACA,EAAEA,CAACA,YA6CnBA;IAADA,cAACA;AAADA,CAACA,AA9CD,IA8CC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":["Greeter","Greeter.constructor","Greeter.greet","Greeter.fn","Greeter.greetings"],"mappings":";;;;;;;;AAOA;IAGIA,iBAGSA,QAAgBA;QAEvBC,WAEcA;aAFdA,WAEcA,CAFdA,sBAEcA,CAFdA,IAEcA;YAFdA,0BAEcA;;QAJPA,aAAQA,GAARA,QAAQA,CAAQA;IAKzBA,CAACA;IAIDD,uBAAKA,GAFLA;QAGIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;IAC5CA,CAACA;IAUOF,oBAAEA,GAAVA,UAGEA,CAASA;QACPG,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;IACzBA,CAACA;IAEDH,sBAEIA,8BAASA;aAFbA;YAGII,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;QACzBA,CAACA;aAEDJ,UAGEA,SAAiBA;YACfI,IAAIA,CAACA,QAAQA,GAAGA,SAASA,CAACA;QAC9BA,CAACA;;;OAPAJ;IAbcA,UAAEA,GAAWA,EAAEA,CAACA;IAZ/BA,sBAEAA,0BAAKA;;YAFJA,kBAAkBA;YAClBA,kBAAkBA,CAACA,EAAEA,CAACA;WACvBA,0BAAKA,kCAALA,0BAAKA,IAEJA;IAEDA;QAACA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACfA,sBAACA,EAASA;IAMlBA,sBAAQA,uBAAEA;;YACRA,WAACA,mBAAmBA,CAAAA;YACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;WAFlBA,uBAAEA,kCAAFA,uBAAEA,IAKTA;IAEDA,sBAEIA,8BAASA;;YAFZA,kBAAkBA;YAClBA,kBAAkBA,CAACA,EAAEA,CAACA;YAMrBA,WAACA,mBAAmBA,CAAAA;YACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;WANtBA,8BAASA,kCAATA,8BAASA,IAEZA;IAfDA;QAACA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACRA,aAAEA,EAAcA;IAzBnCA;QAACA,eAAeA;QACfA,eAAeA,CAACA,EAAEA,CAACA;QAGdA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;QAGxBA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;gBAqC7BA;IAADA,cAACA;AAADA,CAACA,AA9CD,IA8CC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt index c0b9d97e6f080..f4c64c49579a4 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt @@ -8,19 +8,14 @@ sources: sourceMapValidationDecorators.ts emittedFile:tests/cases/compiler/sourceMapValidationDecorators.js sourceFile:sourceMapValidationDecorators.ts ------------------------------------------------------------------- ->>>var __decorate = this.__decorate || function (decorators, target, key, value) { ->>> var kind = typeof (arguments.length == 2 ? value = target : value); ->>> for (var i = decorators.length - 1; i >= 0; --i) { ->>> var decorator = decorators[i]; ->>> switch (kind) { ->>> case "function": value = decorator(value) || value; break; ->>> case "number": decorator(target, key, value); break; ->>> case "undefined": decorator(target, key); break; ->>> case "object": value = decorator(target, key, value) || value; break; ->>> } +>>>var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) { +>>> switch (arguments.length) { +>>> case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); +>>> case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0); +>>> case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); >>> } ->>> return value; >>>}; +>>>var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } }; >>>var Greeter = (function () { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> @@ -32,7 +27,7 @@ sourceFile:sourceMapValidationDecorators.ts >declare function ParameterDecorator2(x: number): (target: Function, key: string | symbol, paramIndex: number) => void; > > -1 >Emitted(14, 1) Source(8, 1) + SourceIndex(0) +1 >Emitted(9, 1) Source(8, 1) + SourceIndex(0) --- >>> function Greeter(greeting) { 1->^^^^ @@ -47,9 +42,9 @@ sourceFile:sourceMapValidationDecorators.ts > @ParameterDecorator2(20) > public 3 > greeting: string -1->Emitted(15, 5) Source(11, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(15, 22) Source(14, 14) + SourceIndex(0) name (Greeter) -3 >Emitted(15, 30) Source(14, 30) + SourceIndex(0) name (Greeter) +1->Emitted(10, 5) Source(11, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(10, 22) Source(14, 14) + SourceIndex(0) name (Greeter) +3 >Emitted(10, 30) Source(14, 30) + SourceIndex(0) name (Greeter) --- >>> var b = []; 1 >^^^^^^^^ @@ -61,8 +56,8 @@ sourceFile:sourceMapValidationDecorators.ts 2 > @ParameterDecorator1 > @ParameterDecorator2(30) > ...b: string[] -1 >Emitted(16, 9) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(16, 20) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +1 >Emitted(11, 9) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(11, 20) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) --- >>> for (var _i = 1; _i < arguments.length; _i++) { 1->^^^^^^^^^^^^^ @@ -83,12 +78,12 @@ sourceFile:sourceMapValidationDecorators.ts 6 > @ParameterDecorator1 > @ParameterDecorator2(30) > ...b: string[] -1->Emitted(17, 14) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(17, 25) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) -3 >Emitted(17, 26) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -4 >Emitted(17, 48) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) -5 >Emitted(17, 49) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -6 >Emitted(17, 53) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +1->Emitted(12, 14) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(12, 25) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +3 >Emitted(12, 26) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +4 >Emitted(12, 48) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +5 >Emitted(12, 49) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +6 >Emitted(12, 53) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) --- >>> b[_i - 1] = arguments[_i]; 1 >^^^^^^^^^^^^ @@ -97,8 +92,8 @@ sourceFile:sourceMapValidationDecorators.ts 2 > @ParameterDecorator1 > @ParameterDecorator2(30) > ...b: string[] -1 >Emitted(18, 13) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(18, 39) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) +1 >Emitted(13, 13) Source(16, 7) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(13, 39) Source(18, 21) + SourceIndex(0) name (Greeter.constructor) --- >>> } >>> this.greeting = greeting; @@ -112,11 +107,11 @@ sourceFile:sourceMapValidationDecorators.ts 3 > 4 > greeting 5 > : string -1 >Emitted(20, 9) Source(14, 14) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(20, 22) Source(14, 22) + SourceIndex(0) name (Greeter.constructor) -3 >Emitted(20, 25) Source(14, 14) + SourceIndex(0) name (Greeter.constructor) -4 >Emitted(20, 33) Source(14, 22) + SourceIndex(0) name (Greeter.constructor) -5 >Emitted(20, 34) Source(14, 30) + SourceIndex(0) name (Greeter.constructor) +1 >Emitted(15, 9) Source(14, 14) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(15, 22) Source(14, 22) + SourceIndex(0) name (Greeter.constructor) +3 >Emitted(15, 25) Source(14, 14) + SourceIndex(0) name (Greeter.constructor) +4 >Emitted(15, 33) Source(14, 22) + SourceIndex(0) name (Greeter.constructor) +5 >Emitted(15, 34) Source(14, 30) + SourceIndex(0) name (Greeter.constructor) --- >>> } 1 >^^^^ @@ -129,8 +124,8 @@ sourceFile:sourceMapValidationDecorators.ts > ...b: string[]) { > 2 > } -1 >Emitted(21, 5) Source(19, 5) + SourceIndex(0) name (Greeter.constructor) -2 >Emitted(21, 6) Source(19, 6) + SourceIndex(0) name (Greeter.constructor) +1 >Emitted(16, 5) Source(19, 5) + SourceIndex(0) name (Greeter.constructor) +2 >Emitted(16, 6) Source(19, 6) + SourceIndex(0) name (Greeter.constructor) --- >>> Greeter.prototype.greet = function () { 1->^^^^ @@ -144,9 +139,9 @@ sourceFile:sourceMapValidationDecorators.ts > 2 > greet 3 > -1->Emitted(22, 5) Source(23, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(22, 28) Source(23, 10) + SourceIndex(0) name (Greeter) -3 >Emitted(22, 31) Source(21, 5) + SourceIndex(0) name (Greeter) +1->Emitted(17, 5) Source(23, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(17, 28) Source(23, 10) + SourceIndex(0) name (Greeter) +3 >Emitted(17, 31) Source(21, 5) + SourceIndex(0) name (Greeter) --- >>> return "

" + this.greeting + "

"; 1->^^^^^^^^ @@ -174,17 +169,17 @@ sourceFile:sourceMapValidationDecorators.ts 9 > + 10> "" 11> ; -1->Emitted(23, 9) Source(24, 9) + SourceIndex(0) name (Greeter.greet) -2 >Emitted(23, 15) Source(24, 15) + SourceIndex(0) name (Greeter.greet) -3 >Emitted(23, 16) Source(24, 16) + SourceIndex(0) name (Greeter.greet) -4 >Emitted(23, 22) Source(24, 22) + SourceIndex(0) name (Greeter.greet) -5 >Emitted(23, 25) Source(24, 25) + SourceIndex(0) name (Greeter.greet) -6 >Emitted(23, 29) Source(24, 29) + SourceIndex(0) name (Greeter.greet) -7 >Emitted(23, 30) Source(24, 30) + SourceIndex(0) name (Greeter.greet) -8 >Emitted(23, 38) Source(24, 38) + SourceIndex(0) name (Greeter.greet) -9 >Emitted(23, 41) Source(24, 41) + SourceIndex(0) name (Greeter.greet) -10>Emitted(23, 48) Source(24, 48) + SourceIndex(0) name (Greeter.greet) -11>Emitted(23, 49) Source(24, 49) + SourceIndex(0) name (Greeter.greet) +1->Emitted(18, 9) Source(24, 9) + SourceIndex(0) name (Greeter.greet) +2 >Emitted(18, 15) Source(24, 15) + SourceIndex(0) name (Greeter.greet) +3 >Emitted(18, 16) Source(24, 16) + SourceIndex(0) name (Greeter.greet) +4 >Emitted(18, 22) Source(24, 22) + SourceIndex(0) name (Greeter.greet) +5 >Emitted(18, 25) Source(24, 25) + SourceIndex(0) name (Greeter.greet) +6 >Emitted(18, 29) Source(24, 29) + SourceIndex(0) name (Greeter.greet) +7 >Emitted(18, 30) Source(24, 30) + SourceIndex(0) name (Greeter.greet) +8 >Emitted(18, 38) Source(24, 38) + SourceIndex(0) name (Greeter.greet) +9 >Emitted(18, 41) Source(24, 41) + SourceIndex(0) name (Greeter.greet) +10>Emitted(18, 48) Source(24, 48) + SourceIndex(0) name (Greeter.greet) +11>Emitted(18, 49) Source(24, 49) + SourceIndex(0) name (Greeter.greet) --- >>> }; 1 >^^^^ @@ -193,8 +188,8 @@ sourceFile:sourceMapValidationDecorators.ts 1 > > 2 > } -1 >Emitted(24, 5) Source(25, 5) + SourceIndex(0) name (Greeter.greet) -2 >Emitted(24, 6) Source(25, 6) + SourceIndex(0) name (Greeter.greet) +1 >Emitted(19, 5) Source(25, 5) + SourceIndex(0) name (Greeter.greet) +2 >Emitted(19, 6) Source(25, 6) + SourceIndex(0) name (Greeter.greet) --- >>> Greeter.prototype.fn = function (x) { 1->^^^^ @@ -220,11 +215,11 @@ sourceFile:sourceMapValidationDecorators.ts > @ParameterDecorator2(70) > 5 > x: number -1->Emitted(25, 5) Source(35, 13) + SourceIndex(0) name (Greeter) -2 >Emitted(25, 25) Source(35, 15) + SourceIndex(0) name (Greeter) -3 >Emitted(25, 28) Source(35, 5) + SourceIndex(0) name (Greeter) -4 >Emitted(25, 38) Source(38, 7) + SourceIndex(0) name (Greeter) -5 >Emitted(25, 39) Source(38, 16) + SourceIndex(0) name (Greeter) +1->Emitted(20, 5) Source(35, 13) + SourceIndex(0) name (Greeter) +2 >Emitted(20, 25) Source(35, 15) + SourceIndex(0) name (Greeter) +3 >Emitted(20, 28) Source(35, 5) + SourceIndex(0) name (Greeter) +4 >Emitted(20, 38) Source(38, 7) + SourceIndex(0) name (Greeter) +5 >Emitted(20, 39) Source(38, 16) + SourceIndex(0) name (Greeter) --- >>> return this.greeting; 1 >^^^^^^^^ @@ -242,13 +237,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > . 6 > greeting 7 > ; -1 >Emitted(26, 9) Source(39, 9) + SourceIndex(0) name (Greeter.fn) -2 >Emitted(26, 15) Source(39, 15) + SourceIndex(0) name (Greeter.fn) -3 >Emitted(26, 16) Source(39, 16) + SourceIndex(0) name (Greeter.fn) -4 >Emitted(26, 20) Source(39, 20) + SourceIndex(0) name (Greeter.fn) -5 >Emitted(26, 21) Source(39, 21) + SourceIndex(0) name (Greeter.fn) -6 >Emitted(26, 29) Source(39, 29) + SourceIndex(0) name (Greeter.fn) -7 >Emitted(26, 30) Source(39, 30) + SourceIndex(0) name (Greeter.fn) +1 >Emitted(21, 9) Source(39, 9) + SourceIndex(0) name (Greeter.fn) +2 >Emitted(21, 15) Source(39, 15) + SourceIndex(0) name (Greeter.fn) +3 >Emitted(21, 16) Source(39, 16) + SourceIndex(0) name (Greeter.fn) +4 >Emitted(21, 20) Source(39, 20) + SourceIndex(0) name (Greeter.fn) +5 >Emitted(21, 21) Source(39, 21) + SourceIndex(0) name (Greeter.fn) +6 >Emitted(21, 29) Source(39, 29) + SourceIndex(0) name (Greeter.fn) +7 >Emitted(21, 30) Source(39, 30) + SourceIndex(0) name (Greeter.fn) --- >>> }; 1 >^^^^ @@ -257,8 +252,8 @@ sourceFile:sourceMapValidationDecorators.ts 1 > > 2 > } -1 >Emitted(27, 5) Source(40, 5) + SourceIndex(0) name (Greeter.fn) -2 >Emitted(27, 6) Source(40, 6) + SourceIndex(0) name (Greeter.fn) +1 >Emitted(22, 5) Source(40, 5) + SourceIndex(0) name (Greeter.fn) +2 >Emitted(22, 6) Source(40, 6) + SourceIndex(0) name (Greeter.fn) --- >>> Object.defineProperty(Greeter.prototype, "greetings", { 1->^^^^ @@ -271,15 +266,15 @@ sourceFile:sourceMapValidationDecorators.ts > @PropertyDecorator2(80) > get 3 > greetings -1->Emitted(28, 5) Source(42, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(28, 27) Source(44, 9) + SourceIndex(0) name (Greeter) -3 >Emitted(28, 57) Source(44, 18) + SourceIndex(0) name (Greeter) +1->Emitted(23, 5) Source(42, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(23, 27) Source(44, 9) + SourceIndex(0) name (Greeter) +3 >Emitted(23, 57) Source(44, 18) + SourceIndex(0) name (Greeter) --- >>> get: function () { 1 >^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(29, 14) Source(42, 5) + SourceIndex(0) name (Greeter) +1 >Emitted(24, 14) Source(42, 5) + SourceIndex(0) name (Greeter) --- >>> return this.greeting; 1->^^^^^^^^^^^^ @@ -299,13 +294,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > . 6 > greeting 7 > ; -1->Emitted(30, 13) Source(45, 9) + SourceIndex(0) name (Greeter.greetings) -2 >Emitted(30, 19) Source(45, 15) + SourceIndex(0) name (Greeter.greetings) -3 >Emitted(30, 20) Source(45, 16) + SourceIndex(0) name (Greeter.greetings) -4 >Emitted(30, 24) Source(45, 20) + SourceIndex(0) name (Greeter.greetings) -5 >Emitted(30, 25) Source(45, 21) + SourceIndex(0) name (Greeter.greetings) -6 >Emitted(30, 33) Source(45, 29) + SourceIndex(0) name (Greeter.greetings) -7 >Emitted(30, 34) Source(45, 30) + SourceIndex(0) name (Greeter.greetings) +1->Emitted(25, 13) Source(45, 9) + SourceIndex(0) name (Greeter.greetings) +2 >Emitted(25, 19) Source(45, 15) + SourceIndex(0) name (Greeter.greetings) +3 >Emitted(25, 20) Source(45, 16) + SourceIndex(0) name (Greeter.greetings) +4 >Emitted(25, 24) Source(45, 20) + SourceIndex(0) name (Greeter.greetings) +5 >Emitted(25, 25) Source(45, 21) + SourceIndex(0) name (Greeter.greetings) +6 >Emitted(25, 33) Source(45, 29) + SourceIndex(0) name (Greeter.greetings) +7 >Emitted(25, 34) Source(45, 30) + SourceIndex(0) name (Greeter.greetings) --- >>> }, 1 >^^^^^^^^ @@ -314,8 +309,8 @@ sourceFile:sourceMapValidationDecorators.ts 1 > > 2 > } -1 >Emitted(31, 9) Source(46, 5) + SourceIndex(0) name (Greeter.greetings) -2 >Emitted(31, 10) Source(46, 6) + SourceIndex(0) name (Greeter.greetings) +1 >Emitted(26, 9) Source(46, 5) + SourceIndex(0) name (Greeter.greetings) +2 >Emitted(26, 10) Source(46, 6) + SourceIndex(0) name (Greeter.greetings) --- >>> set: function (greetings) { 1->^^^^^^^^^^^^^ @@ -330,9 +325,9 @@ sourceFile:sourceMapValidationDecorators.ts > @ParameterDecorator2(90) > 3 > greetings: string -1->Emitted(32, 14) Source(48, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(32, 24) Source(51, 7) + SourceIndex(0) name (Greeter) -3 >Emitted(32, 33) Source(51, 24) + SourceIndex(0) name (Greeter) +1->Emitted(27, 14) Source(48, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(27, 24) Source(51, 7) + SourceIndex(0) name (Greeter) +3 >Emitted(27, 33) Source(51, 24) + SourceIndex(0) name (Greeter) --- >>> this.greeting = greetings; 1->^^^^^^^^^^^^ @@ -350,13 +345,13 @@ sourceFile:sourceMapValidationDecorators.ts 5 > = 6 > greetings 7 > ; -1->Emitted(33, 13) Source(52, 9) + SourceIndex(0) name (Greeter.greetings) -2 >Emitted(33, 17) Source(52, 13) + SourceIndex(0) name (Greeter.greetings) -3 >Emitted(33, 18) Source(52, 14) + SourceIndex(0) name (Greeter.greetings) -4 >Emitted(33, 26) Source(52, 22) + SourceIndex(0) name (Greeter.greetings) -5 >Emitted(33, 29) Source(52, 25) + SourceIndex(0) name (Greeter.greetings) -6 >Emitted(33, 38) Source(52, 34) + SourceIndex(0) name (Greeter.greetings) -7 >Emitted(33, 39) Source(52, 35) + SourceIndex(0) name (Greeter.greetings) +1->Emitted(28, 13) Source(52, 9) + SourceIndex(0) name (Greeter.greetings) +2 >Emitted(28, 17) Source(52, 13) + SourceIndex(0) name (Greeter.greetings) +3 >Emitted(28, 18) Source(52, 14) + SourceIndex(0) name (Greeter.greetings) +4 >Emitted(28, 26) Source(52, 22) + SourceIndex(0) name (Greeter.greetings) +5 >Emitted(28, 29) Source(52, 25) + SourceIndex(0) name (Greeter.greetings) +6 >Emitted(28, 38) Source(52, 34) + SourceIndex(0) name (Greeter.greetings) +7 >Emitted(28, 39) Source(52, 35) + SourceIndex(0) name (Greeter.greetings) --- >>> }, 1 >^^^^^^^^ @@ -365,8 +360,8 @@ sourceFile:sourceMapValidationDecorators.ts 1 > > 2 > } -1 >Emitted(34, 9) Source(53, 5) + SourceIndex(0) name (Greeter.greetings) -2 >Emitted(34, 10) Source(53, 6) + SourceIndex(0) name (Greeter.greetings) +1 >Emitted(29, 9) Source(53, 5) + SourceIndex(0) name (Greeter.greetings) +2 >Emitted(29, 10) Source(53, 6) + SourceIndex(0) name (Greeter.greetings) --- >>> enumerable: true, >>> configurable: true @@ -374,7 +369,7 @@ sourceFile:sourceMapValidationDecorators.ts 1->^^^^^^^ 2 > ^^^^^^^^^^^^^^-> 1-> -1->Emitted(37, 8) Source(46, 6) + SourceIndex(0) name (Greeter) +1->Emitted(32, 8) Source(46, 6) + SourceIndex(0) name (Greeter) --- >>> Greeter.x1 = 10; 1->^^^^ @@ -382,455 +377,533 @@ sourceFile:sourceMapValidationDecorators.ts 3 > ^^^ 4 > ^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > x1 3 > : number = 4 > 10 5 > ; -1->Emitted(38, 5) Source(33, 20) + SourceIndex(0) name (Greeter) -2 >Emitted(38, 15) Source(33, 22) + SourceIndex(0) name (Greeter) -3 >Emitted(38, 18) Source(33, 33) + SourceIndex(0) name (Greeter) -4 >Emitted(38, 20) Source(33, 35) + SourceIndex(0) name (Greeter) -5 >Emitted(38, 21) Source(33, 36) + SourceIndex(0) name (Greeter) +1->Emitted(33, 5) Source(33, 20) + SourceIndex(0) name (Greeter) +2 >Emitted(33, 15) Source(33, 22) + SourceIndex(0) name (Greeter) +3 >Emitted(33, 18) Source(33, 33) + SourceIndex(0) name (Greeter) +4 >Emitted(33, 20) Source(33, 35) + SourceIndex(0) name (Greeter) +5 >Emitted(33, 21) Source(33, 36) + SourceIndex(0) name (Greeter) --- ->>> Object.defineProperty(Greeter.prototype, "greet", __decorate([PropertyDecorator1, PropertyDecorator2(40)], Greeter.prototype, "greet", Object.getOwnPropertyDescriptor(Greeter.prototype, "greet"))); +>>> Object.defineProperty(Greeter.prototype, "greet", 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^ -8 > ^ -9 > ^^ -10> ^ -11> ^^^ -12> ^^^^^^^^^^^^^^^^^^^^^^^^^^ -13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -14> ^^^^^^^^^^^^^^^^^^^^^^^^^^ -15> ^^^^ 1-> 2 > @PropertyDecorator1 > @PropertyDecorator2(40) > 3 > greet -4 > -5 > PropertyDecorator1 -6 > - > @ -7 > PropertyDecorator2 -8 > ( -9 > 40 -10> ) -11> - > -12> greet -13> -14> greet -15> () { - > return "

" + this.greeting + "

"; - > } -1->Emitted(39, 5) Source(21, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(39, 27) Source(23, 5) + SourceIndex(0) name (Greeter) -3 >Emitted(39, 53) Source(23, 10) + SourceIndex(0) name (Greeter) -4 >Emitted(39, 67) Source(21, 6) + SourceIndex(0) name (Greeter) -5 >Emitted(39, 85) Source(21, 24) + SourceIndex(0) name (Greeter) -6 >Emitted(39, 87) Source(22, 6) + SourceIndex(0) name (Greeter) -7 >Emitted(39, 105) Source(22, 24) + SourceIndex(0) name (Greeter) -8 >Emitted(39, 106) Source(22, 25) + SourceIndex(0) name (Greeter) -9 >Emitted(39, 108) Source(22, 27) + SourceIndex(0) name (Greeter) -10>Emitted(39, 109) Source(22, 28) + SourceIndex(0) name (Greeter) -11>Emitted(39, 112) Source(23, 5) + SourceIndex(0) name (Greeter) -12>Emitted(39, 138) Source(23, 10) + SourceIndex(0) name (Greeter) -13>Emitted(39, 172) Source(23, 5) + SourceIndex(0) name (Greeter) -14>Emitted(39, 198) Source(23, 10) + SourceIndex(0) name (Greeter) -15>Emitted(39, 202) Source(25, 6) + SourceIndex(0) name (Greeter) ---- ->>> __decorate([PropertyDecorator1, PropertyDecorator2(50)], Greeter.prototype, "x"); +1->Emitted(34, 5) Source(21, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(34, 27) Source(23, 5) + SourceIndex(0) name (Greeter) +3 >Emitted(34, 53) Source(23, 10) + SourceIndex(0) name (Greeter) +--- +>>> __decorate([ +>>> PropertyDecorator1, +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^-> +1 > +2 > PropertyDecorator1 +1 >Emitted(36, 13) Source(21, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(36, 31) Source(21, 24) + SourceIndex(0) name (Greeter) +--- +>>> PropertyDecorator2(40) +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > @ +2 > PropertyDecorator2 +3 > ( +4 > 40 +5 > ) +1->Emitted(37, 13) Source(22, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(37, 31) Source(22, 24) + SourceIndex(0) name (Greeter) +3 >Emitted(37, 32) Source(22, 25) + SourceIndex(0) name (Greeter) +4 >Emitted(37, 34) Source(22, 27) + SourceIndex(0) name (Greeter) +5 >Emitted(37, 35) Source(22, 28) + SourceIndex(0) name (Greeter) +--- +>>> ], Greeter.prototype, "greet", Object.getOwnPropertyDescriptor(Greeter.prototype, "greet"))); +1->^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^ +1-> + > +2 > greet +3 > +4 > greet +5 > () { + > return "

" + this.greeting + "

"; + > } +1->Emitted(38, 12) Source(23, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(38, 38) Source(23, 10) + SourceIndex(0) name (Greeter) +3 >Emitted(38, 72) Source(23, 5) + SourceIndex(0) name (Greeter) +4 >Emitted(38, 98) Source(23, 10) + SourceIndex(0) name (Greeter) +5 >Emitted(38, 102) Source(25, 6) + SourceIndex(0) name (Greeter) +--- +>>> __decorate([ 1 >^^^^ -2 > ^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^ -11> ^^ -12> ^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > > -2 > @ -3 > PropertyDecorator1 -4 > - > @ -5 > PropertyDecorator2 -6 > ( -7 > 50 -8 > ) -9 > - > private -10> x -11> : string; -1 >Emitted(40, 5) Source(27, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(40, 17) Source(27, 6) + SourceIndex(0) name (Greeter) -3 >Emitted(40, 35) Source(27, 24) + SourceIndex(0) name (Greeter) -4 >Emitted(40, 37) Source(28, 6) + SourceIndex(0) name (Greeter) -5 >Emitted(40, 55) Source(28, 24) + SourceIndex(0) name (Greeter) -6 >Emitted(40, 56) Source(28, 25) + SourceIndex(0) name (Greeter) -7 >Emitted(40, 58) Source(28, 27) + SourceIndex(0) name (Greeter) -8 >Emitted(40, 59) Source(28, 28) + SourceIndex(0) name (Greeter) -9 >Emitted(40, 62) Source(29, 13) + SourceIndex(0) name (Greeter) -10>Emitted(40, 84) Source(29, 14) + SourceIndex(0) name (Greeter) -11>Emitted(40, 86) Source(29, 23) + SourceIndex(0) name (Greeter) ---- ->>> __decorate([ParameterDecorator1, ParameterDecorator2(70)], Greeter.prototype, "fn", 0); +1 >Emitted(39, 5) Source(27, 5) + SourceIndex(0) name (Greeter) +--- +>>> PropertyDecorator1, +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^-> +1->@ +2 > PropertyDecorator1 +1->Emitted(40, 9) Source(27, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(40, 27) Source(27, 24) + SourceIndex(0) name (Greeter) +--- +>>> PropertyDecorator2(50) +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^-> +1-> + > @ +2 > PropertyDecorator2 +3 > ( +4 > 50 +5 > ) +1->Emitted(41, 9) Source(28, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(41, 27) Source(28, 24) + SourceIndex(0) name (Greeter) +3 >Emitted(41, 28) Source(28, 25) + SourceIndex(0) name (Greeter) +4 >Emitted(41, 30) Source(28, 27) + SourceIndex(0) name (Greeter) +5 >Emitted(41, 31) Source(28, 28) + SourceIndex(0) name (Greeter) +--- +>>> ], Greeter.prototype, "x"); +1->^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^-> +1-> + > private +2 > x +3 > : string; +1->Emitted(42, 8) Source(29, 13) + SourceIndex(0) name (Greeter) +2 >Emitted(42, 30) Source(29, 14) + SourceIndex(0) name (Greeter) +3 >Emitted(42, 32) Source(29, 23) + SourceIndex(0) name (Greeter) +--- +>>> Object.defineProperty(Greeter.prototype, "fn", 1->^^^^ -2 > ^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^ -11> ^^ -12> ^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ 1-> > > @PropertyDecorator1 > @PropertyDecorator2(60) > private static x1: number = 10; > - > private fn( + > +2 > private +3 > fn +1->Emitted(43, 5) Source(35, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(43, 27) Source(35, 13) + SourceIndex(0) name (Greeter) +3 >Emitted(43, 50) Source(35, 15) + SourceIndex(0) name (Greeter) +--- +>>> __decorate([ +>>> __param(0, ParameterDecorator1), +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^-> +1 >( > -2 > @ -3 > ParameterDecorator1 -4 > - > @ -5 > ParameterDecorator2 -6 > ( -7 > 70 -8 > ) -9 > - > -10> x -11> : number -1->Emitted(41, 5) Source(36, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(41, 17) Source(36, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(41, 36) Source(36, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(41, 38) Source(37, 8) + SourceIndex(0) name (Greeter) -5 >Emitted(41, 57) Source(37, 27) + SourceIndex(0) name (Greeter) -6 >Emitted(41, 58) Source(37, 28) + SourceIndex(0) name (Greeter) -7 >Emitted(41, 60) Source(37, 30) + SourceIndex(0) name (Greeter) -8 >Emitted(41, 61) Source(37, 31) + SourceIndex(0) name (Greeter) -9 >Emitted(41, 64) Source(38, 7) + SourceIndex(0) name (Greeter) -10>Emitted(41, 90) Source(38, 8) + SourceIndex(0) name (Greeter) -11>Emitted(41, 92) Source(38, 16) + SourceIndex(0) name (Greeter) ---- ->>> __decorate([ParameterDecorator1, ParameterDecorator2(90)], Greeter.prototype, "greetings", 0); -1->^^^^ -2 > ^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^^^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -11> ^^ -12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { - > return this.greeting; - > } +2 > @ +3 > ParameterDecorator1 +4 > +1 >Emitted(45, 13) Source(36, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(45, 24) Source(36, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(45, 43) Source(36, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(45, 44) Source(36, 27) + SourceIndex(0) name (Greeter) +--- +>>> __param(0, ParameterDecorator2(70)) +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > @ +3 > ParameterDecorator2 +4 > ( +5 > 70 +6 > ) +7 > +1->Emitted(46, 13) Source(37, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(46, 24) Source(37, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(46, 43) Source(37, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(46, 44) Source(37, 28) + SourceIndex(0) name (Greeter) +5 >Emitted(46, 46) Source(37, 30) + SourceIndex(0) name (Greeter) +6 >Emitted(46, 47) Source(37, 31) + SourceIndex(0) name (Greeter) +7 >Emitted(46, 48) Source(37, 31) + SourceIndex(0) name (Greeter) +--- +>>> ], Greeter.prototype, "fn", Object.getOwnPropertyDescriptor(Greeter.prototype, "fn"))); +1->^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^ +1-> +2 > fn +3 > +4 > fn +5 > ( + > @ParameterDecorator1 + > @ParameterDecorator2(70) + > x: number) { + > return this.greeting; + > } +1->Emitted(47, 12) Source(35, 13) + SourceIndex(0) name (Greeter) +2 >Emitted(47, 35) Source(35, 15) + SourceIndex(0) name (Greeter) +3 >Emitted(47, 69) Source(35, 13) + SourceIndex(0) name (Greeter) +4 >Emitted(47, 92) Source(35, 15) + SourceIndex(0) name (Greeter) +5 >Emitted(47, 96) Source(40, 6) + SourceIndex(0) name (Greeter) +--- +>>> Object.defineProperty(Greeter.prototype, "greetings", +1 >^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > > - > @PropertyDecorator1 - > @PropertyDecorator2(80) + > +2 > @PropertyDecorator1 + > @PropertyDecorator2(80) + > get +3 > greetings +1 >Emitted(48, 5) Source(42, 5) + SourceIndex(0) name (Greeter) +2 >Emitted(48, 27) Source(44, 9) + SourceIndex(0) name (Greeter) +3 >Emitted(48, 57) Source(44, 18) + SourceIndex(0) name (Greeter) +--- +>>> __decorate([ +>>> PropertyDecorator1, +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^-> +1 > +2 > PropertyDecorator1 +1 >Emitted(50, 13) Source(42, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(50, 31) Source(42, 24) + SourceIndex(0) name (Greeter) +--- +>>> PropertyDecorator2(80), +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^^^^-> +1-> + > @ +2 > PropertyDecorator2 +3 > ( +4 > 80 +5 > ) +1->Emitted(51, 13) Source(43, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(51, 31) Source(43, 24) + SourceIndex(0) name (Greeter) +3 >Emitted(51, 32) Source(43, 25) + SourceIndex(0) name (Greeter) +4 >Emitted(51, 34) Source(43, 27) + SourceIndex(0) name (Greeter) +5 >Emitted(51, 35) Source(43, 28) + SourceIndex(0) name (Greeter) +--- +>>> __param(0, ParameterDecorator1), +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^-> +1-> > get greetings() { > return this.greeting; > } > > set greetings( > -2 > @ -3 > ParameterDecorator1 -4 > - > @ -5 > ParameterDecorator2 -6 > ( -7 > 90 -8 > ) -9 > - > -10> greetings -11> : string -1->Emitted(42, 5) Source(49, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(42, 17) Source(49, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(42, 36) Source(49, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(42, 38) Source(50, 8) + SourceIndex(0) name (Greeter) -5 >Emitted(42, 57) Source(50, 27) + SourceIndex(0) name (Greeter) -6 >Emitted(42, 58) Source(50, 28) + SourceIndex(0) name (Greeter) -7 >Emitted(42, 60) Source(50, 30) + SourceIndex(0) name (Greeter) -8 >Emitted(42, 61) Source(50, 31) + SourceIndex(0) name (Greeter) -9 >Emitted(42, 64) Source(51, 7) + SourceIndex(0) name (Greeter) -10>Emitted(42, 97) Source(51, 16) + SourceIndex(0) name (Greeter) -11>Emitted(42, 99) Source(51, 24) + SourceIndex(0) name (Greeter) ---- ->>> Object.defineProperty(Greeter.prototype, "greetings", __decorate([PropertyDecorator1, PropertyDecorator2(80)], Greeter.prototype, "greetings", Object.getOwnPropertyDescriptor(Greeter.prototype, "greetings"))); -1->^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^^^^^^^^^^^^^^^^^^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^ -8 > ^ -9 > ^^ -10> ^ -11> ^^^ -12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -13> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -15> ^^^^ +2 > @ +3 > ParameterDecorator1 +4 > +1->Emitted(52, 13) Source(49, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(52, 24) Source(49, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(52, 43) Source(49, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(52, 44) Source(49, 27) + SourceIndex(0) name (Greeter) +--- +>>> __param(0, ParameterDecorator2(90)) +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > @ +3 > ParameterDecorator2 +4 > ( +5 > 90 +6 > ) +7 > +1->Emitted(53, 13) Source(50, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(53, 24) Source(50, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(53, 43) Source(50, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(53, 44) Source(50, 28) + SourceIndex(0) name (Greeter) +5 >Emitted(53, 46) Source(50, 30) + SourceIndex(0) name (Greeter) +6 >Emitted(53, 47) Source(50, 31) + SourceIndex(0) name (Greeter) +7 >Emitted(53, 48) Source(50, 31) + SourceIndex(0) name (Greeter) +--- +>>> ], Greeter.prototype, "greetings", Object.getOwnPropertyDescriptor(Greeter.prototype, "greetings"))); +1->^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^^^^ 1-> -2 > @PropertyDecorator1 - > @PropertyDecorator2(80) - > get -3 > greetings -4 > -5 > PropertyDecorator1 -6 > - > @ -7 > PropertyDecorator2 -8 > ( -9 > 80 -10> ) -11> - > get -12> greetings -13> -14> greetings -15> () { - > return this.greeting; - > } -1->Emitted(43, 5) Source(42, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(43, 27) Source(44, 9) + SourceIndex(0) name (Greeter) -3 >Emitted(43, 57) Source(44, 18) + SourceIndex(0) name (Greeter) -4 >Emitted(43, 71) Source(42, 6) + SourceIndex(0) name (Greeter) -5 >Emitted(43, 89) Source(42, 24) + SourceIndex(0) name (Greeter) -6 >Emitted(43, 91) Source(43, 6) + SourceIndex(0) name (Greeter) -7 >Emitted(43, 109) Source(43, 24) + SourceIndex(0) name (Greeter) -8 >Emitted(43, 110) Source(43, 25) + SourceIndex(0) name (Greeter) -9 >Emitted(43, 112) Source(43, 27) + SourceIndex(0) name (Greeter) -10>Emitted(43, 113) Source(43, 28) + SourceIndex(0) name (Greeter) -11>Emitted(43, 116) Source(44, 9) + SourceIndex(0) name (Greeter) -12>Emitted(43, 146) Source(44, 18) + SourceIndex(0) name (Greeter) -13>Emitted(43, 180) Source(44, 9) + SourceIndex(0) name (Greeter) -14>Emitted(43, 210) Source(44, 18) + SourceIndex(0) name (Greeter) -15>Emitted(43, 214) Source(46, 6) + SourceIndex(0) name (Greeter) ---- ->>> __decorate([PropertyDecorator1, PropertyDecorator2(60)], Greeter, "x1"); +2 > greetings +3 > +4 > greetings +5 > () { + > return this.greeting; + > } +1->Emitted(54, 12) Source(44, 9) + SourceIndex(0) name (Greeter) +2 >Emitted(54, 42) Source(44, 18) + SourceIndex(0) name (Greeter) +3 >Emitted(54, 76) Source(44, 9) + SourceIndex(0) name (Greeter) +4 >Emitted(54, 106) Source(44, 18) + SourceIndex(0) name (Greeter) +5 >Emitted(54, 110) Source(46, 6) + SourceIndex(0) name (Greeter) +--- +>>> __decorate([ 1 >^^^^ -2 > ^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^^^ -10> ^^^^^^^^^^^^^ -11> ^^ -12> ^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -2 > @ -3 > PropertyDecorator1 -4 > - > @ -5 > PropertyDecorator2 -6 > ( -7 > 60 -8 > ) -9 > - > private static -10> x1 -11> : number = 10; -1 >Emitted(44, 5) Source(31, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(44, 17) Source(31, 6) + SourceIndex(0) name (Greeter) -3 >Emitted(44, 35) Source(31, 24) + SourceIndex(0) name (Greeter) -4 >Emitted(44, 37) Source(32, 6) + SourceIndex(0) name (Greeter) -5 >Emitted(44, 55) Source(32, 24) + SourceIndex(0) name (Greeter) -6 >Emitted(44, 56) Source(32, 25) + SourceIndex(0) name (Greeter) -7 >Emitted(44, 58) Source(32, 27) + SourceIndex(0) name (Greeter) -8 >Emitted(44, 59) Source(32, 28) + SourceIndex(0) name (Greeter) -9 >Emitted(44, 62) Source(33, 20) + SourceIndex(0) name (Greeter) -10>Emitted(44, 75) Source(33, 22) + SourceIndex(0) name (Greeter) -11>Emitted(44, 77) Source(33, 36) + SourceIndex(0) name (Greeter) ---- ->>> __decorate([ParameterDecorator1, ParameterDecorator2(20)], Greeter, void 0, 0); +1 >Emitted(55, 5) Source(31, 5) + SourceIndex(0) name (Greeter) +--- +>>> PropertyDecorator1, +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^^^-> +1->@ +2 > PropertyDecorator1 +1->Emitted(56, 9) Source(31, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(56, 27) Source(31, 24) + SourceIndex(0) name (Greeter) +--- +>>> PropertyDecorator2(60) +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +1-> + > @ +2 > PropertyDecorator2 +3 > ( +4 > 60 +5 > ) +1->Emitted(57, 9) Source(32, 6) + SourceIndex(0) name (Greeter) +2 >Emitted(57, 27) Source(32, 24) + SourceIndex(0) name (Greeter) +3 >Emitted(57, 28) Source(32, 25) + SourceIndex(0) name (Greeter) +4 >Emitted(57, 30) Source(32, 27) + SourceIndex(0) name (Greeter) +5 >Emitted(57, 31) Source(32, 28) + SourceIndex(0) name (Greeter) +--- +>>> ], Greeter, "x1"); +1 >^^^^^^^ +2 > ^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^-> +1 > + > private static +2 > x1 +3 > : number = 10; +1 >Emitted(58, 8) Source(33, 20) + SourceIndex(0) name (Greeter) +2 >Emitted(58, 21) Source(33, 22) + SourceIndex(0) name (Greeter) +3 >Emitted(58, 23) Source(33, 36) + SourceIndex(0) name (Greeter) +--- +>>> Greeter = __decorate([ 1->^^^^ -2 > ^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^^^ -10> ^^^^^^^^^^^^^^^^^^ -11> ^^ -12> ^-> +2 > ^^^^^^^^^^^^^^^^^^^^^-> 1-> -2 > @ -3 > ParameterDecorator1 -4 > - > @ -5 > ParameterDecorator2 -6 > ( -7 > 20 -8 > ) -9 > - > public -10> greeting -11> : string -1->Emitted(45, 5) Source(12, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(45, 17) Source(12, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(45, 36) Source(12, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(45, 38) Source(13, 8) + SourceIndex(0) name (Greeter) -5 >Emitted(45, 57) Source(13, 27) + SourceIndex(0) name (Greeter) -6 >Emitted(45, 58) Source(13, 28) + SourceIndex(0) name (Greeter) -7 >Emitted(45, 60) Source(13, 30) + SourceIndex(0) name (Greeter) -8 >Emitted(45, 61) Source(13, 31) + SourceIndex(0) name (Greeter) -9 >Emitted(45, 64) Source(14, 14) + SourceIndex(0) name (Greeter) -10>Emitted(45, 82) Source(14, 22) + SourceIndex(0) name (Greeter) -11>Emitted(45, 84) Source(14, 30) + SourceIndex(0) name (Greeter) ---- ->>> __decorate([ParameterDecorator1, ParameterDecorator2(30)], Greeter, void 0, 1); -1->^^^^ -2 > ^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^^^ -10> ^^^^^^^^^^^^^^^^^^ -11> ^^ -1->, +1->Emitted(59, 5) Source(8, 1) + SourceIndex(0) name (Greeter) +--- +>>> ClassDecorator1, +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^^^^^^-> +1->@ +2 > ClassDecorator1 +1->Emitted(60, 9) Source(8, 2) + SourceIndex(0) name (Greeter) +2 >Emitted(60, 24) Source(8, 17) + SourceIndex(0) name (Greeter) +--- +>>> ClassDecorator2(10), +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^^^^^^^-> +1-> + >@ +2 > ClassDecorator2 +3 > ( +4 > 10 +5 > ) +1->Emitted(61, 9) Source(9, 2) + SourceIndex(0) name (Greeter) +2 >Emitted(61, 24) Source(9, 17) + SourceIndex(0) name (Greeter) +3 >Emitted(61, 25) Source(9, 18) + SourceIndex(0) name (Greeter) +4 >Emitted(61, 27) Source(9, 20) + SourceIndex(0) name (Greeter) +5 >Emitted(61, 28) Source(9, 21) + SourceIndex(0) name (Greeter) +--- +>>> __param(0, ParameterDecorator1), +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^-> +1-> + >class Greeter { + > constructor( + > +2 > @ +3 > ParameterDecorator1 +4 > +1->Emitted(62, 9) Source(12, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(62, 20) Source(12, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(62, 39) Source(12, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(62, 40) Source(12, 27) + SourceIndex(0) name (Greeter) +--- +>>> __param(0, ParameterDecorator2(20)), +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^ +1-> + > +2 > @ +3 > ParameterDecorator2 +4 > ( +5 > 20 +6 > ) +7 > +1->Emitted(63, 9) Source(13, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(63, 20) Source(13, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(63, 39) Source(13, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(63, 40) Source(13, 28) + SourceIndex(0) name (Greeter) +5 >Emitted(63, 42) Source(13, 30) + SourceIndex(0) name (Greeter) +6 >Emitted(63, 43) Source(13, 31) + SourceIndex(0) name (Greeter) +7 >Emitted(63, 44) Source(13, 31) + SourceIndex(0) name (Greeter) +--- +>>> __param(1, ParameterDecorator1), +1 >^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^-> +1 > + > public greeting: string, > > -2 > @ -3 > ParameterDecorator1 -4 > - > @ -5 > ParameterDecorator2 -6 > ( -7 > 30 -8 > ) -9 > - > ... -10> b -11> : string[] -1->Emitted(46, 5) Source(16, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(46, 17) Source(16, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(46, 36) Source(16, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(46, 38) Source(17, 8) + SourceIndex(0) name (Greeter) -5 >Emitted(46, 57) Source(17, 27) + SourceIndex(0) name (Greeter) -6 >Emitted(46, 58) Source(17, 28) + SourceIndex(0) name (Greeter) -7 >Emitted(46, 60) Source(17, 30) + SourceIndex(0) name (Greeter) -8 >Emitted(46, 61) Source(17, 31) + SourceIndex(0) name (Greeter) -9 >Emitted(46, 64) Source(18, 10) + SourceIndex(0) name (Greeter) -10>Emitted(46, 82) Source(18, 11) + SourceIndex(0) name (Greeter) -11>Emitted(46, 84) Source(18, 21) + SourceIndex(0) name (Greeter) ---- ->>> Greeter = __decorate([ClassDecorator1, ClassDecorator2(10)], Greeter); -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^^^^^^^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^^^^^^^^^^^^ -1 > -2 > @ -3 > ClassDecorator1 -4 > - > @ -5 > ClassDecorator2 -6 > ( -7 > 10 -8 > ) -9 > - > class Greeter { - > constructor( - > @ParameterDecorator1 - > @ParameterDecorator2(20) - > public greeting: string, - > - > @ParameterDecorator1 - > @ParameterDecorator2(30) - > ...b: string[]) { - > } - > - > @PropertyDecorator1 - > @PropertyDecorator2(40) - > greet() { - > return "

" + this.greeting + "

"; - > } - > - > @PropertyDecorator1 - > @PropertyDecorator2(50) - > private x: string; - > - > @PropertyDecorator1 - > @PropertyDecorator2(60) - > private static x1: number = 10; - > - > private fn( - > @ParameterDecorator1 - > @ParameterDecorator2(70) - > x: number) { - > return this.greeting; - > } - > - > @PropertyDecorator1 - > @PropertyDecorator2(80) - > get greetings() { - > return this.greeting; - > } - > - > set greetings( - > @ParameterDecorator1 - > @ParameterDecorator2(90) - > greetings: string) { - > this.greeting = greetings; - > } - > } -1 >Emitted(47, 5) Source(8, 1) + SourceIndex(0) name (Greeter) -2 >Emitted(47, 27) Source(8, 2) + SourceIndex(0) name (Greeter) -3 >Emitted(47, 42) Source(8, 17) + SourceIndex(0) name (Greeter) -4 >Emitted(47, 44) Source(9, 2) + SourceIndex(0) name (Greeter) -5 >Emitted(47, 59) Source(9, 17) + SourceIndex(0) name (Greeter) -6 >Emitted(47, 60) Source(9, 18) + SourceIndex(0) name (Greeter) -7 >Emitted(47, 62) Source(9, 20) + SourceIndex(0) name (Greeter) -8 >Emitted(47, 63) Source(9, 21) + SourceIndex(0) name (Greeter) -9 >Emitted(47, 75) Source(54, 2) + SourceIndex(0) name (Greeter) +2 > @ +3 > ParameterDecorator1 +4 > +1 >Emitted(64, 9) Source(16, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(64, 20) Source(16, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(64, 39) Source(16, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(64, 40) Source(16, 27) + SourceIndex(0) name (Greeter) +--- +>>> __param(1, ParameterDecorator2(30)) +1->^^^^^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^ +4 > ^ +5 > ^^ +6 > ^ +7 > ^ +1-> + > +2 > @ +3 > ParameterDecorator2 +4 > ( +5 > 30 +6 > ) +7 > +1->Emitted(65, 9) Source(17, 7) + SourceIndex(0) name (Greeter) +2 >Emitted(65, 20) Source(17, 8) + SourceIndex(0) name (Greeter) +3 >Emitted(65, 39) Source(17, 27) + SourceIndex(0) name (Greeter) +4 >Emitted(65, 40) Source(17, 28) + SourceIndex(0) name (Greeter) +5 >Emitted(65, 42) Source(17, 30) + SourceIndex(0) name (Greeter) +6 >Emitted(65, 43) Source(17, 31) + SourceIndex(0) name (Greeter) +7 >Emitted(65, 44) Source(17, 31) + SourceIndex(0) name (Greeter) +--- +>>> ], Greeter); +1 >^^^^^^^^^^^^^^^^ +2 > ^^^^-> +1 > + > ...b: string[]) { + > } + > + > @PropertyDecorator1 + > @PropertyDecorator2(40) + > greet() { + > return "

" + this.greeting + "

"; + > } + > + > @PropertyDecorator1 + > @PropertyDecorator2(50) + > private x: string; + > + > @PropertyDecorator1 + > @PropertyDecorator2(60) + > private static x1: number = 10; + > + > private fn( + > @ParameterDecorator1 + > @ParameterDecorator2(70) + > x: number) { + > return this.greeting; + > } + > + > @PropertyDecorator1 + > @PropertyDecorator2(80) + > get greetings() { + > return this.greeting; + > } + > + > set greetings( + > @ParameterDecorator1 + > @ParameterDecorator2(90) + > greetings: string) { + > this.greeting = greetings; + > } + >} +1 >Emitted(66, 17) Source(54, 2) + SourceIndex(0) name (Greeter) --- >>> return Greeter; -1 >^^^^ +1->^^^^ 2 > ^^^^^^^^^^^^^^ -1 > +1-> 2 > } -1 >Emitted(48, 5) Source(54, 1) + SourceIndex(0) name (Greeter) -2 >Emitted(48, 19) Source(54, 2) + SourceIndex(0) name (Greeter) +1->Emitted(67, 5) Source(54, 1) + SourceIndex(0) name (Greeter) +2 >Emitted(67, 19) Source(54, 2) + SourceIndex(0) name (Greeter) --- >>>})(); 1 > @@ -888,9 +961,9 @@ sourceFile:sourceMapValidationDecorators.ts > this.greeting = greetings; > } > } -1 >Emitted(49, 1) Source(54, 1) + SourceIndex(0) name (Greeter) -2 >Emitted(49, 2) Source(54, 2) + SourceIndex(0) name (Greeter) -3 >Emitted(49, 2) Source(8, 1) + SourceIndex(0) -4 >Emitted(49, 6) Source(54, 2) + SourceIndex(0) +1 >Emitted(68, 1) Source(54, 1) + SourceIndex(0) name (Greeter) +2 >Emitted(68, 2) Source(54, 2) + SourceIndex(0) name (Greeter) +3 >Emitted(68, 2) Source(8, 1) + SourceIndex(0) +4 >Emitted(68, 6) Source(54, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationDecorators.js.map \ No newline at end of file