From e23b0c65ea7bd2cbc742703c2b2b7e937a7995d7 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 19 Nov 2015 15:43:35 -0800 Subject: [PATCH] Fix the source map emit for decorators Handled #5584 --- src/compiler/emitter.ts | 66 ++-- src/compiler/utilities.ts | 17 - .../sourceMapValidationDecorators.js.map | 2 +- ...ourceMapValidationDecorators.sourcemap.txt | 355 +++++++----------- 4 files changed, 170 insertions(+), 270 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 76682dadc50..4dbdc36e31e 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -503,10 +503,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let emit = emitNodeWithCommentsAndWithoutSourcemap; /** Called just before starting emit of a node */ - let emitStart = function (node: Node) { }; + let emitStart = function (node: Node | TextRange) { }; /** Called once the emit of the node is done */ - let emitEnd = function (node: Node) { }; + let emitEnd = function (node: Node | TextRange) { }; /** Emit the text for the given token that comes after startPos * This by default writes the text provided with the given tokenKind @@ -849,12 +849,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - function recordEmitNodeStartSpan(node: Node) { + function recordEmitNodeStartSpan(node: Node | TextRange) { // Get the token pos after skipping to the token (ignoring the leading trivia) - recordSourceMapSpan(skipTrivia(currentText, node.decorators ? node.decorators.end : node.pos)); + recordSourceMapSpan(skipTrivia(currentText, (node as Node).decorators ? (node as Node).decorators.end : node.pos)); } - function recordEmitNodeEndSpan(node: Node) { + function recordEmitNodeEndSpan(node: Node | TextRange) { recordSourceMapSpan(node.end); } @@ -5656,10 +5656,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitDecoratorsOfConstructor(node: ClassLikeDeclaration) { const decorators = node.decorators; const constructor = getFirstConstructorWithBody(node); - const hasDecoratedParameters = constructor && forEach(constructor.parameters, nodeIsDecorated); + const parameterDecorators = constructor && forEach(constructor.parameters, parameter => parameter.decorators); // skip decoration of the constructor if neither it nor its parameters are decorated - if (!decorators && !hasDecoratedParameters) { + if (!decorators && !parameterDecorators) { return; } @@ -5675,28 +5675,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // writeLine(); - emitStart(node); + emitStart(node.decorators || parameterDecorators); emitDeclarationName(node); write(" = __decorate(["); increaseIndent(); writeLine(); const 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); + let argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, + decorator => emit(decorator.expression)); + if (parameterDecorators) { + argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + } emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); decreaseIndent(); writeLine(); write("], "); emitDeclarationName(node); - write(");"); - emitEnd(node); + write(")"); + emitEnd(node.decorators || parameterDecorators); + write(";"); writeLine(); } @@ -5712,11 +5711,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi continue; } - // skip a member if it or any of its parameters are not decorated - if (!nodeOrChildIsDecorated(member)) { - continue; - } - // skip an accessor declaration if it is not the first accessor let decorators: NodeArray; let functionLikeMember: FunctionLikeDeclaration; @@ -5743,6 +5737,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi functionLikeMember = member; } } + const parameterDecorators = functionLikeMember && forEach(functionLikeMember.parameters, parameter => parameter.decorators); + + // skip a member if it or any of its parameters are not decorated + if (!decorators && !parameterDecorators) { + continue; + } // Emit the call to __decorate. Given the following: // @@ -5776,29 +5776,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // writeLine(); - emitStart(member); + emitStart(decorators || parameterDecorators); write("__decorate(["); increaseIndent(); writeLine(); const 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); - }); + let argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, + decorator => emit(decorator.expression)); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + if (parameterDecorators) { + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + } emitSerializedTypeMetadata(member, argumentsWritten > 0); decreaseIndent(); writeLine(); write("], "); - emitStart(member.name); emitClassMemberPrefix(node, member); write(", "); emitExpressionForPropertyName(member.name); - emitEnd(member.name); if (languageVersion > ScriptTarget.ES3) { if (member.kind !== SyntaxKind.PropertyDeclaration) { @@ -5813,8 +5810,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - write(");"); - emitEnd(member); + write(")"); + emitEnd(decorators || parameterDecorators); + write(";"); writeLine(); } } @@ -5827,11 +5825,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (nodeIsDecorated(parameter)) { const 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; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index eef6dbe9702..3c8e5deb467 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -909,23 +909,6 @@ namespace ts { return false; } - export function childIsDecorated(node: Node): boolean { - switch (node.kind) { - case SyntaxKind.ClassDeclaration: - return forEach((node).members, nodeOrChildIsDecorated); - - case SyntaxKind.MethodDeclaration: - case SyntaxKind.SetAccessor: - return forEach((node).parameters, nodeIsDecorated); - } - - return false; - } - - export function nodeOrChildIsDecorated(node: Node): boolean { - return nodeIsDecorated(node) || childIsDecorated(node); - } - export function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression { return node.kind === SyntaxKind.PropertyAccessExpression; } diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js.map b/tests/baselines/reference/sourceMapValidationDecorators.js.map index 00de6b40b80..355cb0cb55f 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":";;;;;;;;;AASA;IACIA,iBAGSA,QAAgBA;QAIvBC,WAAcA;aAAdA,WAAcA,CAAdA,sBAAcA,CAAdA,IAAcA;YAAdA,0BAAcA;;QAJPA,aAAQA,GAARA,QAAQA,CAAQA;IAKzBA,CAACA;IAIDD,uBAAKA,GAALA;QACIE,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;IAIDH,sBAAIA,8BAASA;aAAbA;YACII,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;IAV/BA;QAFCA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACvBA,0BAAKA,QAEJA;IAIDA;QAFCA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACfA,sBAACA,UAASA;IAMlBA;QACEA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;OAFlBA,uBAAEA,QAKTA;IAIDA;QAFCA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;QAMrBA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;OANtBA,8BAASA,QAEZA;IAbDA;QAFCA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACRA,aAAEA,UAAcA;IAvBnCA;QAFCA,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,AA5CD,IA4CC"} \ 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":";;;;;;;;;AASA;IACIA,iBAGSA,QAAgBA;QAIvBC,WAAcA;aAAdA,WAAcA,CAAdA,sBAAcA,CAAdA,IAAcA;YAAdA,0BAAcA;;QAJPA,aAAQA,GAARA,QAAQA,CAAQA;IAKzBA,CAACA;IAIDD,uBAAKA,GAALA;QACIE,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;IAIDH,sBAAIA,8BAASA;aAAbA;YACII,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;IAZ9BA;QAAAA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;wCAAAA;IAKtBA;QAAAA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;sCAAAA;IAQpBA;mBAAAA,mBAAmBA;mBACnBA,mBAAmBA,CAACA,EAAEA,CAACA;qCAAAA;IAKzBA;QAAAA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;mBAMpBA,mBAAmBA;mBACnBA,mBAAmBA,CAACA,EAAEA,CAACA;4CAPHA;IAZtBA;QAAAA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;6BAAAA;IAxB1BA;QAAAA,eAAeA;QACfA,eAAeA,CAACA,EAAEA,CAACA;mBAGbA,mBAAmBA;mBACnBA,mBAAmBA,CAACA,EAAEA,CAACA;mBAGvBA,mBAAmBA;mBACnBA,mBAAmBA,CAACA,EAAEA,CAACA;eARVA;IA6CpBA,cAACA;AAADA,CAACA,AA5CD,IA4CC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt index b6d01db06a2..face3de6218 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt @@ -381,7 +381,7 @@ sourceFile:sourceMapValidationDecorators.ts 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(35, 5) Source(23, 5) + SourceIndex(0) name (Greeter) +1 >Emitted(35, 5) Source(21, 6) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator1, 1->^^^^^^^^ @@ -412,28 +412,20 @@ sourceFile:sourceMapValidationDecorators.ts 5 >Emitted(37, 31) Source(22, 28) + SourceIndex(0) name (Greeter) --- >>> ], Greeter.prototype, "greet", null); -1->^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^ -1-> - > -2 > greet -3 > () { - > return "

" + this.greeting + "

"; - > } -1->Emitted(38, 8) Source(23, 5) + SourceIndex(0) name (Greeter) -2 >Emitted(38, 34) Source(23, 10) + SourceIndex(0) name (Greeter) -3 >Emitted(38, 42) Source(25, 6) + SourceIndex(0) name (Greeter) +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +1->Emitted(38, 41) Source(22, 28) + SourceIndex(0) name (Greeter) --- >>> __decorate([ 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > + > greet() { + > return "

" + this.greeting + "

"; + > } > - > @PropertyDecorator1 - > @PropertyDecorator2(50) - > -1 >Emitted(39, 5) Source(29, 5) + SourceIndex(0) name (Greeter) + > @ +1 >Emitted(39, 5) Source(27, 6) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator1, 1->^^^^^^^^ @@ -464,94 +456,66 @@ sourceFile:sourceMapValidationDecorators.ts 5 >Emitted(41, 31) Source(28, 28) + SourceIndex(0) name (Greeter) --- >>> ], Greeter.prototype, "x", void 0); -1->^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^ -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, 40) Source(29, 23) + SourceIndex(0) name (Greeter) +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +1->Emitted(42, 39) Source(28, 28) + SourceIndex(0) name (Greeter) --- >>> __decorate([ 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > + > private x: string; > > @PropertyDecorator1 > @PropertyDecorator2(60) > private static x1: number = 10; > - > -1 >Emitted(43, 5) Source(35, 5) + SourceIndex(0) name (Greeter) + > private fn( + > @ +1 >Emitted(43, 5) Source(36, 8) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator1), -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^-> -1->private fn( - > -2 > @ -3 > ParameterDecorator1 -4 > -1->Emitted(44, 9) Source(36, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(44, 20) Source(36, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(44, 39) Source(36, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(44, 40) Source(36, 27) + SourceIndex(0) name (Greeter) +1->^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^-> +1-> +2 > ParameterDecorator1 +1->Emitted(44, 20) Source(36, 8) + SourceIndex(0) name (Greeter) +2 >Emitted(44, 39) Source(36, 27) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator2(70)) -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ +1->^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ 1-> - > -2 > @ -3 > ParameterDecorator2 -4 > ( -5 > 70 -6 > ) -7 > -1->Emitted(45, 9) Source(37, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(45, 20) Source(37, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(45, 39) Source(37, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(45, 40) Source(37, 28) + SourceIndex(0) name (Greeter) -5 >Emitted(45, 42) Source(37, 30) + SourceIndex(0) name (Greeter) -6 >Emitted(45, 43) Source(37, 31) + SourceIndex(0) name (Greeter) -7 >Emitted(45, 44) Source(37, 31) + SourceIndex(0) name (Greeter) + > @ +2 > ParameterDecorator2 +3 > ( +4 > 70 +5 > ) +1->Emitted(45, 20) Source(37, 8) + SourceIndex(0) name (Greeter) +2 >Emitted(45, 39) Source(37, 27) + SourceIndex(0) name (Greeter) +3 >Emitted(45, 40) Source(37, 28) + SourceIndex(0) name (Greeter) +4 >Emitted(45, 42) Source(37, 30) + SourceIndex(0) name (Greeter) +5 >Emitted(45, 43) Source(37, 31) + SourceIndex(0) name (Greeter) --- >>> ], Greeter.prototype, "fn", null); -1 >^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^ +1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > -2 > fn -3 > ( - > @ParameterDecorator1 - > @ParameterDecorator2(70) - > x: number) { - > return this.greeting; - > } -1 >Emitted(46, 8) Source(35, 13) + SourceIndex(0) name (Greeter) -2 >Emitted(46, 31) Source(35, 15) + SourceIndex(0) name (Greeter) -3 >Emitted(46, 39) Source(40, 6) + SourceIndex(0) name (Greeter) +1 >Emitted(46, 38) Source(37, 31) + SourceIndex(0) name (Greeter) --- >>> __decorate([ 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > +1 > + > x: number) { + > return this.greeting; + > } > - > @PropertyDecorator1 - > @PropertyDecorator2(80) - > -1 >Emitted(47, 5) Source(44, 5) + SourceIndex(0) name (Greeter) + > @ +1 >Emitted(47, 5) Source(42, 6) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator1, 1->^^^^^^^^ @@ -582,69 +546,49 @@ sourceFile:sourceMapValidationDecorators.ts 5 >Emitted(49, 31) Source(43, 28) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator1), -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^-> +1->^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^-> 1-> > get greetings() { > return this.greeting; > } > > set greetings( - > -2 > @ -3 > ParameterDecorator1 -4 > -1->Emitted(50, 9) Source(49, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(50, 20) Source(49, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(50, 39) Source(49, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(50, 40) Source(49, 27) + SourceIndex(0) name (Greeter) + > @ +2 > ParameterDecorator1 +1->Emitted(50, 20) Source(49, 8) + SourceIndex(0) name (Greeter) +2 >Emitted(50, 39) Source(49, 27) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator2(90)) -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -8 > ^^^-> +1->^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^^^-> 1-> - > -2 > @ -3 > ParameterDecorator2 -4 > ( -5 > 90 -6 > ) -7 > -1->Emitted(51, 9) Source(50, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(51, 20) Source(50, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(51, 39) Source(50, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(51, 40) Source(50, 28) + SourceIndex(0) name (Greeter) -5 >Emitted(51, 42) Source(50, 30) + SourceIndex(0) name (Greeter) -6 >Emitted(51, 43) Source(50, 31) + SourceIndex(0) name (Greeter) -7 >Emitted(51, 44) Source(50, 31) + SourceIndex(0) name (Greeter) + > @ +2 > ParameterDecorator2 +3 > ( +4 > 90 +5 > ) +1->Emitted(51, 20) Source(50, 8) + SourceIndex(0) name (Greeter) +2 >Emitted(51, 39) Source(50, 27) + SourceIndex(0) name (Greeter) +3 >Emitted(51, 40) Source(50, 28) + SourceIndex(0) name (Greeter) +4 >Emitted(51, 42) Source(50, 30) + SourceIndex(0) name (Greeter) +5 >Emitted(51, 43) Source(50, 31) + SourceIndex(0) name (Greeter) --- >>> ], Greeter.prototype, "greetings", null); -1->^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^ +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> -2 > greetings -3 > () { - > return this.greeting; - > } -1->Emitted(52, 8) Source(44, 9) + SourceIndex(0) name (Greeter) -2 >Emitted(52, 38) Source(44, 18) + SourceIndex(0) name (Greeter) -3 >Emitted(52, 46) Source(46, 6) + SourceIndex(0) name (Greeter) +1->Emitted(52, 45) Source(43, 28) + SourceIndex(0) name (Greeter) --- >>> __decorate([ 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(53, 5) Source(33, 5) + SourceIndex(0) name (Greeter) +1 >Emitted(53, 5) Source(31, 6) + SourceIndex(0) name (Greeter) --- >>> PropertyDecorator1, 1->^^^^^^^^ @@ -675,22 +619,15 @@ sourceFile:sourceMapValidationDecorators.ts 5 >Emitted(55, 31) Source(32, 28) + SourceIndex(0) name (Greeter) --- >>> ], Greeter, "x1", void 0); -1->^^^^^^^ -2 > ^^^^^^^^^^^^^ -3 > ^^^^^^^^^^ -1-> - > private static -2 > x1 -3 > : number = 10; -1->Emitted(56, 8) Source(33, 20) + SourceIndex(0) name (Greeter) -2 >Emitted(56, 21) Source(33, 22) + SourceIndex(0) name (Greeter) -3 >Emitted(56, 31) Source(33, 36) + SourceIndex(0) name (Greeter) +1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +1->Emitted(56, 30) Source(32, 28) + SourceIndex(0) name (Greeter) --- >>> Greeter = __decorate([ 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(57, 5) Source(10, 1) + SourceIndex(0) name (Greeter) +1 >Emitted(57, 5) Source(8, 2) + SourceIndex(0) name (Greeter) --- >>> ClassDecorator1, 1->^^^^^^^^ @@ -721,93 +658,83 @@ sourceFile:sourceMapValidationDecorators.ts 5 >Emitted(59, 28) Source(9, 21) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator1), -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^^-> +1->^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^-> 1-> >class Greeter { > constructor( - > -2 > @ -3 > ParameterDecorator1 -4 > -1->Emitted(60, 9) Source(12, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(60, 20) Source(12, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(60, 39) Source(12, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(60, 40) Source(12, 27) + SourceIndex(0) name (Greeter) + > @ +2 > ParameterDecorator1 +1->Emitted(60, 20) Source(12, 8) + SourceIndex(0) name (Greeter) +2 >Emitted(60, 39) Source(12, 27) + SourceIndex(0) name (Greeter) --- >>> __param(0, ParameterDecorator2(20)), -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ +1->^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ 1-> - > -2 > @ -3 > ParameterDecorator2 -4 > ( -5 > 20 -6 > ) -7 > -1->Emitted(61, 9) Source(13, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(61, 20) Source(13, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(61, 39) Source(13, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(61, 40) Source(13, 28) + SourceIndex(0) name (Greeter) -5 >Emitted(61, 42) Source(13, 30) + SourceIndex(0) name (Greeter) -6 >Emitted(61, 43) Source(13, 31) + SourceIndex(0) name (Greeter) -7 >Emitted(61, 44) Source(13, 31) + SourceIndex(0) name (Greeter) + > @ +2 > ParameterDecorator2 +3 > ( +4 > 20 +5 > ) +1->Emitted(61, 20) Source(13, 8) + SourceIndex(0) name (Greeter) +2 >Emitted(61, 39) Source(13, 27) + SourceIndex(0) name (Greeter) +3 >Emitted(61, 40) Source(13, 28) + SourceIndex(0) name (Greeter) +4 >Emitted(61, 42) Source(13, 30) + SourceIndex(0) name (Greeter) +5 >Emitted(61, 43) Source(13, 31) + SourceIndex(0) name (Greeter) --- >>> __param(1, ParameterDecorator1), -1 >^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^-> 1 > > public greeting: string, > - > -2 > @ -3 > ParameterDecorator1 -4 > -1 >Emitted(62, 9) Source(16, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(62, 20) Source(16, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(62, 39) Source(16, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(62, 40) Source(16, 27) + SourceIndex(0) name (Greeter) + > @ +2 > ParameterDecorator1 +1 >Emitted(62, 20) Source(16, 8) + SourceIndex(0) name (Greeter) +2 >Emitted(62, 39) Source(16, 27) + SourceIndex(0) name (Greeter) --- >>> __param(1, ParameterDecorator2(30)) -1->^^^^^^^^ -2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ +1->^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^ +5 > ^ 1-> - > -2 > @ -3 > ParameterDecorator2 -4 > ( -5 > 30 -6 > ) -7 > -1->Emitted(63, 9) Source(17, 7) + SourceIndex(0) name (Greeter) -2 >Emitted(63, 20) Source(17, 8) + SourceIndex(0) name (Greeter) -3 >Emitted(63, 39) Source(17, 27) + SourceIndex(0) name (Greeter) -4 >Emitted(63, 40) Source(17, 28) + SourceIndex(0) name (Greeter) -5 >Emitted(63, 42) Source(17, 30) + SourceIndex(0) name (Greeter) -6 >Emitted(63, 43) Source(17, 31) + SourceIndex(0) name (Greeter) -7 >Emitted(63, 44) Source(17, 31) + SourceIndex(0) name (Greeter) + > @ +2 > ParameterDecorator2 +3 > ( +4 > 30 +5 > ) +1->Emitted(63, 20) Source(17, 8) + SourceIndex(0) name (Greeter) +2 >Emitted(63, 39) Source(17, 27) + SourceIndex(0) name (Greeter) +3 >Emitted(63, 40) Source(17, 28) + SourceIndex(0) name (Greeter) +4 >Emitted(63, 42) Source(17, 30) + SourceIndex(0) name (Greeter) +5 >Emitted(63, 43) Source(17, 31) + SourceIndex(0) name (Greeter) --- >>> ], Greeter); -1 >^^^^^^^^^^^^^^^^ -2 > ^^^^-> -1 > +1 >^^^^^^^^^^^^^^^ +2 > ^^^^^-> +1 > +1 >Emitted(64, 16) Source(9, 21) + SourceIndex(0) name (Greeter) +--- +>>> return Greeter; +1->^^^^ +2 > ^^^^^^^^^^^^^^ +1-> + >class Greeter { + > constructor( + > @ParameterDecorator1 + > @ParameterDecorator2(20) + > public greeting: string, + > + > @ParameterDecorator1 + > @ParameterDecorator2(30) > ...b: string[]) { > } > @@ -844,13 +771,7 @@ sourceFile:sourceMapValidationDecorators.ts > greetings: string) { > this.greeting = greetings; > } - >} -1 >Emitted(64, 17) Source(54, 2) + SourceIndex(0) name (Greeter) ---- ->>> return Greeter; -1->^^^^ -2 > ^^^^^^^^^^^^^^ -1-> + > 2 > } 1->Emitted(65, 5) Source(54, 1) + SourceIndex(0) name (Greeter) 2 >Emitted(65, 19) Source(54, 2) + SourceIndex(0) name (Greeter)