diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 1bd4b90f333..a51e71ad8d6 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -163,7 +163,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let writeComment = writeCommentRange; /** Emit a node */ - let emit = emitNodeWithoutSourceMap; + let emit = emitNodeWithCommentsAndWithoutSourcemap; /** Called just before starting emit of a node */ let emitStart = function (node: Node) { }; @@ -687,9 +687,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } } + + function emitNodeWithCommentsAndWithSourcemap(node: Node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithSourceMap; + emit = emitNodeWithCommentsAndWithSourcemap; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -2096,7 +2100,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } write("."); - emitNodeWithoutSourceMap(node.right); + emit(node.right); } function emitEntityNameAsExpression(node: EntityName, useFallback: boolean) { @@ -2788,7 +2792,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); emitEnd(node.initializer); @@ -2823,7 +2827,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi else { // The following call does not include the initializer, so we have // to emit it separately. - emitNodeWithoutSourceMap(declaration); + emitNodeWithCommentsAndWithoutSourcemap(declaration); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -2846,7 +2850,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); } else { - emitNodeWithoutSourceMap(assignmentExpression); + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); } } emitEnd(node.initializer); @@ -3002,7 +3006,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("exports."); } } - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); emitEnd(node.name); } @@ -3048,7 +3052,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("default"); } else { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } write(`", `); emitDeclarationName(node); @@ -3082,7 +3086,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (compilerOptions.module === ModuleKind.System) { emitStart(specifier.name); write(`${exportFunctionForFile}("`); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); write(`", `); emitExpressionIdentifier(name); write(")"); @@ -3092,7 +3096,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitStart(specifier.name); emitContainingModuleName(specifier); write("."); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); emitEnd(specifier.name); write(" = "); emitExpressionIdentifier(name); @@ -3139,7 +3143,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (exportChanged) { write(`${exportFunctionForFile}("`); - emitNodeWithoutSourceMap(name); + emitNodeWithCommentsAndWithoutSourcemap(name); write(`", `); } @@ -3371,7 +3375,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (exportChanged) { write(`${exportFunctionForFile}("`); - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); write(`", `); } @@ -3527,9 +3531,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitEnd(parameter); write(" { "); emitStart(parameter); - emitNodeWithoutSourceMap(paramName); + emitNodeWithCommentsAndWithoutSourcemap(paramName); write(" = "); - emitNodeWithoutSourceMap(initializer); + emitNodeWithCommentsAndWithoutSourcemap(initializer); emitEnd(parameter); write("; }"); } @@ -3552,7 +3556,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -3573,7 +3577,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi increaseIndent(); writeLine(); emitStart(restParam); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -3594,7 +3598,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitDeclarationName(node: Declaration) { if (node.name) { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } else { write(getGeneratedNameForNode(node)); @@ -3622,6 +3626,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitLeadingComments(node); } + emitStart(node); // For targeting below es6, emit functions-like declaration including arrow function using function keyword. // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead if (!shouldEmitAsArrowFunction(node)) { @@ -3647,6 +3652,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments((node).name); } + + emitEnd(node); if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) { emitTrailingComments(node); } @@ -4002,10 +4009,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitMemberAccessForPropertyName(memberName: DeclarationName) { - // TODO: (jfreeman,drosen): comment on why this is emitNodeWithoutSourceMap instead of emit here. + // This does not emit source map because it is emitted by caller as caller + // is aware how the property name changes to the property access + // eg. public x = 10; becomes this.x and static x = 10 becomes className.x if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { write("["); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } else if (memberName.kind === SyntaxKind.ComputedPropertyName) { @@ -4013,7 +4022,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } else { write("."); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); } } @@ -4081,10 +4090,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitMemberAccessForPropertyName((member).name); emitEnd((member).name); write(" = "); - emitStart(member); emitFunctionDeclaration(member); emitEnd(member); - emitEnd(member); write(";"); emitTrailingComments(member); } @@ -5501,11 +5508,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); write(" = "); write(generatedName); write("."); - emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); } @@ -5528,7 +5535,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } else { if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - emitStart(node); write("export "); if (node.exportClause) { // export { x, y, ... } @@ -5541,10 +5547,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } if (node.moduleSpecifier) { write(" from "); - emitNodeWithoutSourceMap(node.moduleSpecifier); + emit(node.moduleSpecifier); } write(";"); - emitEnd(node); } } } @@ -5558,13 +5563,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (needsComma) { write(", "); } - emitStart(specifier); if (specifier.propertyName) { - emitNodeWithoutSourceMap(specifier.propertyName); + emit(specifier.propertyName); write(" as "); } - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier); + emit(specifier.name); needsComma = true; } } @@ -5851,7 +5854,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi writeLine(); write("'"); if (node.kind === SyntaxKind.Identifier) { - emitNodeWithoutSourceMap(node); + emitNodeWithCommentsAndWithoutSourcemap(node); } else { emitDeclarationName(node); @@ -6178,9 +6181,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi writeLine(); for (let e of (importNode).exportClause.elements) { write(`${reexportsVariableName}["`); - emitNodeWithoutSourceMap(e.name); + emitNodeWithCommentsAndWithoutSourcemap(e.name); write(`"] = ${parameterName}["`); - emitNodeWithoutSourceMap(e.propertyName || e.name); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); write(`"];`); writeLine(); } @@ -6594,28 +6597,41 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitLeadingComments(node.endOfFileToken); } - function emitNodeWithoutSourceMap(node: Node): void { - if (!node) { - return; - } + function emitNodeWithCommentsAndWithoutSourcemap(node: Node): void { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } - if (node.flags & NodeFlags.Ambient) { - return emitOnlyPinnedOrTripleSlashComments(node); - } + function emitNodeConsideringCommentsOption(node: Node, emitNodeConsideringSourcemap: (node: Node) => void): void { + if (node) { + if (node.flags & NodeFlags.Ambient) { + return emitOnlyPinnedOrTripleSlashComments(node); + } - let emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { - emitLeadingComments(node); - } + if (isSpecializedCommentHandling(node)) { + // This is the node that will handle its own comments and sourcemap + return emitNodeWithoutSourceMap(node); + } - emitJavaScriptWorker(node); + let emitComments = shouldEmitLeadingAndTrailingComments(node); + if (emitComments) { + emitLeadingComments(node); + } - if (emitComments) { - emitTrailingComments(node); + emitNodeConsideringSourcemap(node); + + if (emitComments) { + emitTrailingComments(node); + } } } - function shouldEmitLeadingAndTrailingComments(node: Node) { + function emitNodeWithoutSourceMap(node: Node): void { + if (node) { + emitJavaScriptWorker(node); + } + } + + function isSpecializedCommentHandling(node: Node): boolean { switch (node.kind) { // All of these entities are emitted in a specialized fashion. As such, we allow // the specialized methods for each to handle the comments on the nodes. @@ -6625,8 +6641,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.ExportAssignment: - return false; + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node: Node) { + switch (node.kind) { case SyntaxKind.VariableStatement: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); @@ -6641,6 +6661,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return shouldEmitEnumDeclaration(node); } + // If the node is emitted in specialized fashion, dont emit comments as this node will handle + // emitting comments when emitting itself + Debug.assert(!isSpecializedCommentHandling(node)); + // If this is the expression body of an arrow function that we're down-leveling, // then we don't want to emit comments when we emit the body. It will have already // been taken care of when we emitted the 'return' statement for the function diff --git a/tests/baselines/reference/sourceMap-Comments.js.map b/tests/baselines/reference/sourceMap-Comments.js.map index c873a13fd5e..6e5e0dca071 100644 --- a/tests/baselines/reference/sourceMap-Comments.js.map +++ b/tests/baselines/reference/sourceMap-Comments.js.map @@ -1,2 +1,2 @@ //// [sourceMap-Comments.js.map] -{"version":3,"file":"sourceMap-Comments.js","sourceRoot":"","sources":["sourceMap-Comments.ts"],"names":["sas","sas.tools","sas.tools.Test","sas.tools.Test.constructor","sas.tools.Test.doX"],"mappings":"AAAA,IAAO,GAAG,CAkBT;AAlBD,WAAO,GAAG;IAACA,IAAAA,KAAKA,CAkBfA;IAlBUA,WAAAA,KAAKA,EAACA,CAACA;QACdC;YAAAC;YAeAC,CAACA;YAdUD,kBAAGA,GAAVA;gBACIE,IAAIA,CAACA,GAAWA,CAACA,CAACA;gBAClBA,MAAMA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;oBACRA,KAAKA,CAACA;wBACFA,KAAKA,CAACA;oBACVA,KAAKA,CAACA;wBAGFA,AAFAA,gBAAgBA;wBAChBA,gBAAgBA;wBAChBA,KAAKA,CAACA;oBACVA,KAAKA,CAACA;wBAEFA,AADAA,WAAWA;wBACXA,KAAKA,CAACA;gBACdA,CAACA;YACLA,CAACA;YACLF,WAACA;QAADA,CAACA,AAfDD,IAeCA;QAfYA,UAAIA,OAehBA,CAAAA;IAELA,CAACA,EAlBUD,KAAKA,GAALA,SAAKA,KAALA,SAAKA,QAkBfA;AAADA,CAACA,EAlBM,GAAG,KAAH,GAAG,QAkBT"} \ No newline at end of file +{"version":3,"file":"sourceMap-Comments.js","sourceRoot":"","sources":["sourceMap-Comments.ts"],"names":["sas","sas.tools","sas.tools.Test","sas.tools.Test.constructor","sas.tools.Test.doX"],"mappings":"AAAA,IAAO,GAAG,CAkBT;AAlBD,WAAO,GAAG;IAACA,IAAAA,KAAKA,CAkBfA;IAlBUA,WAAAA,KAAKA,EAACA,CAACA;QACdC;YAAAC;YAeAC,CAACA;YAdUD,kBAAGA,GAAVA;gBACIE,IAAIA,CAACA,GAAWA,CAACA,CAACA;gBAClBA,MAAMA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;oBACRA,KAAKA,CAACA;wBACFA,KAAKA,CAACA;oBACVA,KAAKA,CAACA;wBACFA,gBAAgBA;wBAChBA,gBAAgBA;wBAChBA,KAAKA,CAACA;oBACVA,KAAKA,CAACA;wBACFA,WAAWA;wBACXA,KAAKA,CAACA;gBACdA,CAACA;YACLA,CAACA;YACLF,WAACA;QAADA,CAACA,AAfDD,IAeCA;QAfYA,UAAIA,OAehBA,CAAAA;IAELA,CAACA,EAlBUD,KAAKA,GAALA,SAAKA,KAALA,SAAKA,QAkBfA;AAADA,CAACA,EAlBM,GAAG,KAAH,GAAG,QAkBT"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-Comments.sourcemap.txt b/tests/baselines/reference/sourceMap-Comments.sourcemap.txt index 999343c51de..fe0b9276994 100644 --- a/tests/baselines/reference/sourceMap-Comments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-Comments.sourcemap.txt @@ -241,18 +241,13 @@ sourceFile:sourceMap-Comments.ts --- >>> //line comment 1 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^ -4 > ^-> +2 > ^^^^^^^^^^^^^^^^ +3 > ^-> 1->: - > //line comment 1 - > //line comment 2 > -2 > -3 > //line comment 1 -1->Emitted(14, 25) Source(11, 21) + SourceIndex(0) name (sas.tools.Test.doX) -2 >Emitted(14, 25) Source(9, 21) + SourceIndex(0) name (sas.tools.Test.doX) -3 >Emitted(14, 41) Source(9, 37) + SourceIndex(0) name (sas.tools.Test.doX) +2 > //line comment 1 +1->Emitted(14, 25) Source(9, 21) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(14, 41) Source(9, 37) + SourceIndex(0) name (sas.tools.Test.doX) --- >>> //line comment 2 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -290,16 +285,12 @@ sourceFile:sourceMap-Comments.ts --- >>> //a comment 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^ +2 > ^^^^^^^^^^^ 1->: - > //a comment > -2 > -3 > //a comment -1->Emitted(18, 25) Source(14, 21) + SourceIndex(0) name (sas.tools.Test.doX) -2 >Emitted(18, 25) Source(13, 21) + SourceIndex(0) name (sas.tools.Test.doX) -3 >Emitted(18, 36) Source(13, 32) + SourceIndex(0) name (sas.tools.Test.doX) +2 > //a comment +1->Emitted(18, 25) Source(13, 21) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(18, 36) Source(13, 32) + SourceIndex(0) name (sas.tools.Test.doX) --- >>> break; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/sourceMap-Comments2.js.map b/tests/baselines/reference/sourceMap-Comments2.js.map index 1dbd4604329..be5a88d795d 100644 --- a/tests/baselines/reference/sourceMap-Comments2.js.map +++ b/tests/baselines/reference/sourceMap-Comments2.js.map @@ -1,2 +1,2 @@ //// [sourceMap-Comments2.js.map] -{"version":3,"file":"sourceMap-Comments2.js","sourceRoot":"","sources":["sourceMap-Comments2.ts"],"names":["foo","bar","baz","qat"],"mappings":"AAAA,aAAa,GAAW,EAAE,GAAW;IACjCA,MAAMA,CAACA;AACXA,CAACA;AAKD,AAHA;;GAEG;aACU,GAAW,EAAE,GAAW;IACjCC,MAAMA,CAACA;AACXA,CAACA;AAGD,AADA,uBAAuB;aACV,GAAW,EAAE,GAAW;IACjCC,MAAMA,CAACA;AACXA,CAACA;AAED,aAAa,GAAW,EAAE,GAAW;IACjCC,MAAMA,CAACA;AACXA,CAACA"} \ No newline at end of file +{"version":3,"file":"sourceMap-Comments2.js","sourceRoot":"","sources":["sourceMap-Comments2.ts"],"names":["foo","bar","baz","qat"],"mappings":"AAAA,aAAa,GAAW,EAAE,GAAW;IACjCA,MAAMA,CAACA;AACXA,CAACA;AAED;;GAEG;AACH,aAAa,GAAW,EAAE,GAAW;IACjCC,MAAMA,CAACA;AACXA,CAACA;AAED,uBAAuB;AACvB,aAAa,GAAW,EAAE,GAAW;IACjCC,MAAMA,CAACA;AACXA,CAACA;AAED,aAAa,GAAW,EAAE,GAAW;IACjCC,MAAMA,CAACA;AACXA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-Comments2.sourcemap.txt b/tests/baselines/reference/sourceMap-Comments2.sourcemap.txt index b9eddfc4aab..d6230b83dfb 100644 --- a/tests/baselines/reference/sourceMap-Comments2.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-Comments2.sourcemap.txt @@ -49,17 +49,11 @@ sourceFile:sourceMap-Comments2.ts --- >>>/** 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > - >/** - > * some sort of block quote - > */ > -2 > -1->Emitted(4, 1) Source(8, 1) + SourceIndex(0) -2 >Emitted(4, 1) Source(5, 1) + SourceIndex(0) +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) --- >>> * some sort of block quote >>> */ @@ -71,19 +65,22 @@ sourceFile:sourceMap-Comments2.ts 1->Emitted(6, 4) Source(7, 4) + SourceIndex(0) --- >>>function bar(str, num) { -1->^^^^^^^^^^^^^ -2 > ^^^ -3 > ^^ -4 > ^^^ +1-> +2 >^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^^^ 1-> - >function bar( -2 > str: string -3 > , -4 > num: number -1->Emitted(7, 14) Source(8, 14) + SourceIndex(0) -2 >Emitted(7, 17) Source(8, 25) + SourceIndex(0) -3 >Emitted(7, 19) Source(8, 27) + SourceIndex(0) -4 >Emitted(7, 22) Source(8, 38) + SourceIndex(0) + > +2 >function bar( +3 > str: string +4 > , +5 > num: number +1->Emitted(7, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(7, 14) Source(8, 14) + SourceIndex(0) +3 >Emitted(7, 17) Source(8, 25) + SourceIndex(0) +4 >Emitted(7, 19) Source(8, 27) + SourceIndex(0) +5 >Emitted(7, 22) Source(8, 38) + SourceIndex(0) --- >>> return; 1 >^^^^ @@ -109,33 +106,32 @@ sourceFile:sourceMap-Comments2.ts --- >>>// some sort of comment 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^-> 1-> > - >// some sort of comment > -2 > -3 >// some sort of comment -1->Emitted(10, 1) Source(13, 1) + SourceIndex(0) -2 >Emitted(10, 1) Source(12, 1) + SourceIndex(0) -3 >Emitted(10, 24) Source(12, 24) + SourceIndex(0) +2 >// some sort of comment +1->Emitted(10, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(10, 24) Source(12, 24) + SourceIndex(0) --- >>>function baz(str, num) { -1->^^^^^^^^^^^^^ -2 > ^^^ -3 > ^^ -4 > ^^^ +1-> +2 >^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^^^ 1-> - >function baz( -2 > str: string -3 > , -4 > num: number -1->Emitted(11, 14) Source(13, 14) + SourceIndex(0) -2 >Emitted(11, 17) Source(13, 25) + SourceIndex(0) -3 >Emitted(11, 19) Source(13, 27) + SourceIndex(0) -4 >Emitted(11, 22) Source(13, 38) + SourceIndex(0) + > +2 >function baz( +3 > str: string +4 > , +5 > num: number +1->Emitted(11, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(11, 14) Source(13, 14) + SourceIndex(0) +3 >Emitted(11, 17) Source(13, 25) + SourceIndex(0) +4 >Emitted(11, 19) Source(13, 27) + SourceIndex(0) +5 >Emitted(11, 22) Source(13, 38) + SourceIndex(0) --- >>> return; 1 >^^^^