diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts
index 422a5562e968d..28cd6fe2a44b3 100644
--- a/src/compiler/emitter.ts
+++ b/src/compiler/emitter.ts
@@ -2845,6 +2845,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
}
+ function emitEmptyBlockComments(node: Node) {
+ // special handling for empty blocks
+ let pos = node.pos;
+
+ // skipping leading comments
+ const comments = getLeadingCommentRanges(currentText, node.pos);
+
+ if (comments) {
+ const lastComment = lastOrUndefined(comments);
+ if (lastComment) {
+ pos = lastComment.end;
+ }
+ }
+
+ pos = currentText.indexOf("{", pos) + 1;
+ // emitting all comments after '{'
+ emitTrailingCommentsOfPosition(pos);
+ emitLeadingCommentsOfPosition(pos);
+ }
+
function emitBlock(node: Block) {
if (isSingleLineEmptyBlock(node)) {
emitToken(SyntaxKind.OpenBraceToken, node.pos);
@@ -2855,6 +2875,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
emitToken(SyntaxKind.OpenBraceToken, node.pos);
increaseIndent();
+
+ if (!!node.statements.length) {
+ const firstStatementNode = node.statements[0];
+ emitTrailingCommentsOfPosition(firstStatementNode.pos);
+ }
+ else {
+ emitEmptyBlockComments(node);
+ }
+
if (node.kind === SyntaxKind.ModuleBlock) {
Debug.assert(node.parent.kind === SyntaxKind.ModuleDeclaration);
emitCaptureThisForNodeIfNecessary(node.parent);
@@ -2863,6 +2892,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
if (node.kind === SyntaxKind.ModuleBlock) {
emitTempDeclarations(/*newLine*/ true);
}
+
+ if (!!node.statements.length) {
+ const lastStatementNode = lastOrUndefined(node.statements);
+ emitLeadingCommentsOfPosition(lastStatementNode.end);
+ }
+
decreaseIndent();
writeLine();
emitToken(SyntaxKind.CloseBraceToken, node.statements.end);
@@ -2894,6 +2929,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
emitToken(SyntaxKind.CloseParenToken, node.expression.end);
emitEmbeddedStatement(node.thenStatement);
if (node.elseStatement) {
+ emitLeadingCommentsOfPosition(node.thenStatement.end);
writeLine();
emitToken(SyntaxKind.ElseKeyword, node.thenStatement.end);
if (node.elseStatement.kind === SyntaxKind.IfStatement) {
@@ -4558,6 +4594,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
const { kind, parent } = node;
if (kind !== SyntaxKind.MethodDeclaration &&
kind !== SyntaxKind.MethodSignature &&
+ kind !== SyntaxKind.ArrowFunction &&
parent &&
parent.kind !== SyntaxKind.PropertyAssignment &&
parent.kind !== SyntaxKind.CallExpression &&
diff --git a/tests/baselines/reference/amdImportAsPrimaryExpression.js b/tests/baselines/reference/amdImportAsPrimaryExpression.js
index 1281b7f7f4757..802e82932a80b 100644
--- a/tests/baselines/reference/amdImportAsPrimaryExpression.js
+++ b/tests/baselines/reference/amdImportAsPrimaryExpression.js
@@ -26,5 +26,6 @@ define(["require", "exports"], function (require, exports) {
define(["require", "exports", "./foo_0"], function (require, exports, foo) {
"use strict";
if (foo.E1.A === 0) {
+ // Should cause runtime import - interesting optimization possibility, as gets inlined to 0.
}
});
diff --git a/tests/baselines/reference/argsInScope.js b/tests/baselines/reference/argsInScope.js
index 90906426d240e..a38bc77803980 100644
--- a/tests/baselines/reference/argsInScope.js
+++ b/tests/baselines/reference/argsInScope.js
@@ -17,6 +17,7 @@ var C = (function () {
}
C.prototype.P = function (ii, j, k) {
for (var i = 0; i < arguments.length; i++) {
+ // WScript.Echo("param: " + arguments[i]);
}
};
return C;
diff --git a/tests/baselines/reference/augmentedTypesModules.js b/tests/baselines/reference/augmentedTypesModules.js
index 39a4c17454bbd..63d4e86f3c88a 100644
--- a/tests/baselines/reference/augmentedTypesModules.js
+++ b/tests/baselines/reference/augmentedTypesModules.js
@@ -111,7 +111,7 @@ var m1b;
var m1b = 1; // error
var m1c = 1; // Should be allowed
var m1d;
-(function (m1d) {
+(function (m1d) {// error
var I = (function () {
function I() {
}
diff --git a/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js
index fd502b32ccf7d..b408898bc3cae 100644
--- a/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js
+++ b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js
@@ -79,7 +79,7 @@ var M;
}());
})(M || (M = {}));
var M;
-(function (M) {
+(function (M) {// Shouldnt be _M
var e = (function () {
function e() {
}
@@ -110,7 +110,7 @@ var M;
}());
})(M || (M = {}));
var M;
-(function (M) {
+(function (M) {// Shouldnt be _M
var e = (function () {
function e() {
}
diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js
index a42b650248376..9d6debd8d7d54 100644
--- a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js
+++ b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js
@@ -71,7 +71,7 @@ var M;
}());
})(M || (M = {}));
var M;
-(function (M) {
+(function (M) {// Shouldnt bn _M
var f = (function () {
function f() {
}
diff --git a/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js
index 6726d32d77d40..3e54309c4de29 100644
--- a/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js
+++ b/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js
@@ -76,7 +76,7 @@ var M;
})(m3 || (m3 = {}));
})(M || (M = {}));
var M;
-(function (M) {
+(function (M) {// shouldnt be _M
var m3;
(function (m3) {
var p = M.x;
diff --git a/tests/baselines/reference/collisionThisExpressionAndModuleInGlobal.js b/tests/baselines/reference/collisionThisExpressionAndModuleInGlobal.js
index 240817ac0b944..09ca662893b62 100644
--- a/tests/baselines/reference/collisionThisExpressionAndModuleInGlobal.js
+++ b/tests/baselines/reference/collisionThisExpressionAndModuleInGlobal.js
@@ -8,7 +8,7 @@ var f = () => this;
//// [collisionThisExpressionAndModuleInGlobal.js]
var _this = this;
var _this;
-(function (_this) {
+(function (_this) {//Error
var c = (function () {
function c() {
}
diff --git a/tests/baselines/reference/commentOnIfElseStatement1.js b/tests/baselines/reference/commentOnIfElseStatement1.js
new file mode 100644
index 0000000000000..8a0ce9c988e81
--- /dev/null
+++ b/tests/baselines/reference/commentOnIfElseStatement1.js
@@ -0,0 +1,24 @@
+//// [commentOnIfElseStatement1.ts]
+
+// 1
+if (false) {
+}
+// 2
+else if (!true) {
+
+}
+// 3
+else {
+
+}
+
+//// [commentOnIfElseStatement1.js]
+// 1
+if (false) {
+}
+// 2
+else if (!true) {
+}
+// 3
+else {
+}
diff --git a/tests/baselines/reference/commentOnIfElseStatement1.symbols b/tests/baselines/reference/commentOnIfElseStatement1.symbols
new file mode 100644
index 0000000000000..7cf57847436ee
--- /dev/null
+++ b/tests/baselines/reference/commentOnIfElseStatement1.symbols
@@ -0,0 +1,14 @@
+=== tests/cases/compiler/commentOnIfElseStatement1.ts ===
+
+No type information for this code.// 1
+No type information for this code.if (false) {
+No type information for this code.}
+No type information for this code.// 2
+No type information for this code.else if (!true) {
+No type information for this code.
+No type information for this code.}
+No type information for this code.// 3
+No type information for this code.else {
+No type information for this code.
+No type information for this code.}
+No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/commentOnIfElseStatement1.types b/tests/baselines/reference/commentOnIfElseStatement1.types
new file mode 100644
index 0000000000000..fc03458a125e9
--- /dev/null
+++ b/tests/baselines/reference/commentOnIfElseStatement1.types
@@ -0,0 +1,16 @@
+=== tests/cases/compiler/commentOnIfElseStatement1.ts ===
+
+// 1
+if (false) {
+>false : boolean
+}
+// 2
+else if (!true) {
+>!true : boolean
+>true : boolean
+
+}
+// 3
+else {
+
+}
diff --git a/tests/baselines/reference/commentsBeforeFunctionExpression1.js b/tests/baselines/reference/commentsBeforeFunctionExpression1.js
index 5b250b9c06476..dd1f097922258 100644
--- a/tests/baselines/reference/commentsBeforeFunctionExpression1.js
+++ b/tests/baselines/reference/commentsBeforeFunctionExpression1.js
@@ -2,9 +2,13 @@
var v = {
f: /**own f*/ (a) => 0
}
+var w =
+/* 1 */ (a) => 0;
//// [commentsBeforeFunctionExpression1.js]
var v = {
f: /**own f*/ function (a) { return 0; }
};
+var w =
+/* 1 */ function (a) { return 0; };
diff --git a/tests/baselines/reference/commentsBeforeFunctionExpression1.symbols b/tests/baselines/reference/commentsBeforeFunctionExpression1.symbols
index adeea60711e27..817ff53c3d0b5 100644
--- a/tests/baselines/reference/commentsBeforeFunctionExpression1.symbols
+++ b/tests/baselines/reference/commentsBeforeFunctionExpression1.symbols
@@ -6,4 +6,9 @@ var v = {
>f : Symbol(f, Decl(commentsBeforeFunctionExpression1.ts, 0, 9))
>a : Symbol(a, Decl(commentsBeforeFunctionExpression1.ts, 1, 19))
}
+var w =
+>w : Symbol(w, Decl(commentsBeforeFunctionExpression1.ts, 3, 3))
+
+/* 1 */ (a) => 0;
+>a : Symbol(a, Decl(commentsBeforeFunctionExpression1.ts, 4, 9))
diff --git a/tests/baselines/reference/commentsBeforeFunctionExpression1.types b/tests/baselines/reference/commentsBeforeFunctionExpression1.types
index a057918a74d7c..2e921a5c07bb5 100644
--- a/tests/baselines/reference/commentsBeforeFunctionExpression1.types
+++ b/tests/baselines/reference/commentsBeforeFunctionExpression1.types
@@ -9,4 +9,11 @@ var v = {
>a : any
>0 : number
}
+var w =
+>w : (a: any) => number
+
+/* 1 */ (a) => 0;
+>(a) => 0 : (a: any) => number
+>a : any
+>0 : number
diff --git a/tests/baselines/reference/commonJSImportAsPrimaryExpression.js b/tests/baselines/reference/commonJSImportAsPrimaryExpression.js
index 3f49588c10331..f5e27ddb15334 100644
--- a/tests/baselines/reference/commonJSImportAsPrimaryExpression.js
+++ b/tests/baselines/reference/commonJSImportAsPrimaryExpression.js
@@ -27,4 +27,5 @@ exports.C1 = C1;
"use strict";
var foo = require("./foo_0");
if (foo.C1.s1) {
+ // Should cause runtime import
}
diff --git a/tests/baselines/reference/duplicateAnonymousInners1.js b/tests/baselines/reference/duplicateAnonymousInners1.js
index 5bb73bf68ed14..24f79566d5682 100644
--- a/tests/baselines/reference/duplicateAnonymousInners1.js
+++ b/tests/baselines/reference/duplicateAnonymousInners1.js
@@ -49,4 +49,6 @@ var Foo;
}
return Helper;
}());
+ // Inner should not show up in intellisense
+ // Outer should show up in intellisense
})(Foo || (Foo = {}));
diff --git a/tests/baselines/reference/duplicateLocalVariable1.js b/tests/baselines/reference/duplicateLocalVariable1.js
index 734b01eaed72d..ad9c478036f21 100644
--- a/tests/baselines/reference/duplicateLocalVariable1.js
+++ b/tests/baselines/reference/duplicateLocalVariable1.js
@@ -382,7 +382,7 @@ var TestRunner = (function () {
exception = true;
testResult = false;
if (typeof testcase.errorMessageRegEx === "string") {
- if (testcase.errorMessageRegEx === "") {
+ if (testcase.errorMessageRegEx === "") {// Any error is fine
testResult = true;
}
else if (e.message) {
@@ -391,6 +391,7 @@ var TestRunner = (function () {
}
}
if (testResult === false) {
+ //console.log(e.message);
}
}
if ((testcase.errorMessageRegEx !== undefined) && !exception) {
diff --git a/tests/baselines/reference/duplicateSymbolsExportMatching.js b/tests/baselines/reference/duplicateSymbolsExportMatching.js
index d37d1efb3bb09..92bd53eb5f886 100644
--- a/tests/baselines/reference/duplicateSymbolsExportMatching.js
+++ b/tests/baselines/reference/duplicateSymbolsExportMatching.js
@@ -76,7 +76,7 @@ define(["require", "exports"], function (require, exports) {
var t;
})(inst || (inst = {}));
var inst;
- (function (inst) {
+ (function (inst) {// one error
var t;
})(inst = M.inst || (M.inst = {}));
})(M || (M = {}));
@@ -103,7 +103,7 @@ define(["require", "exports"], function (require, exports) {
return C;
}());
var C;
- (function (C) {
+ (function (C) {// Two visibility errors (one for the clodule symbol, and one for the merged container symbol)
var t;
})(C = M.C || (M.C = {}));
})(M || (M = {}));
diff --git a/tests/baselines/reference/for.js b/tests/baselines/reference/for.js
index 857d42bafdbbc..e0a59ba9942ce 100644
--- a/tests/baselines/reference/for.js
+++ b/tests/baselines/reference/for.js
@@ -32,26 +32,26 @@ for () { // error
}
//// [for.js]
-for (var i = 0; i < 10; i++) {
+for (var i = 0; i < 10; i++) {// ok
var x1 = i;
}
-for (var j = 0; j < 10; j++) {
+for (var j = 0; j < 10; j++) {// ok
var x2 = j;
}
-for (var k = 0; k < 10;) {
+for (var k = 0; k < 10;) {// ok
k++;
}
-for (; i < 10;) {
+for (; i < 10;) {// ok
i++;
}
-for (; i > 1; i--) {
+for (; i > 1; i--) {// ok
}
-for (var l = 0;; l++) {
+for (var l = 0;; l++) {// ok
if (l > 10) {
break;
}
}
-for (;;) {
+for (;;) {// ok
}
-for (;;) {
+for (;;) {// error
}
diff --git a/tests/baselines/reference/forIn.js b/tests/baselines/reference/forIn.js
index 28e395a9cf30e..50e6f1c62f29c 100644
--- a/tests/baselines/reference/forIn.js
+++ b/tests/baselines/reference/forIn.js
@@ -23,16 +23,16 @@ for (var l in arr) {
//// [forIn.js]
var arr = null;
-for (var i in arr) {
+for (var i in arr) {// error
var x1 = arr[i];
var y1 = arr[i];
}
-for (var j in arr) {
+for (var j in arr) {// ok
var x2 = arr[j];
var y2 = arr[j];
}
var arr2 = [];
-for (j in arr2) {
+for (j in arr2) {// ok
var x3 = arr2[j];
var y3 = arr2[j];
}
diff --git a/tests/baselines/reference/invalidTryStatements2.js b/tests/baselines/reference/invalidTryStatements2.js
index 1b2976dc4e785..309f6ccc7a485 100644
--- a/tests/baselines/reference/invalidTryStatements2.js
+++ b/tests/baselines/reference/invalidTryStatements2.js
@@ -32,7 +32,7 @@ function fn2() {
function fn() {
try {
}
- catch () {
+ catch () {// syntax error, missing '(x)'
}
try {
}
diff --git a/tests/baselines/reference/jsFileCompilationLetBeingRenamed.js b/tests/baselines/reference/jsFileCompilationLetBeingRenamed.js
index c9e16f359816d..a87dad3c91400 100644
--- a/tests/baselines/reference/jsFileCompilationLetBeingRenamed.js
+++ b/tests/baselines/reference/jsFileCompilationLetBeingRenamed.js
@@ -9,5 +9,6 @@ function foo(a) {
//// [out.js]
function foo(a) {
for (var a_1 = 0; a_1 < 10; a_1++) {
+ // do something
}
}
diff --git a/tests/baselines/reference/moduleDuplicateIdentifiers.js b/tests/baselines/reference/moduleDuplicateIdentifiers.js
index 1d64c0490c5f8..af0c86629ad7c 100644
--- a/tests/baselines/reference/moduleDuplicateIdentifiers.js
+++ b/tests/baselines/reference/moduleDuplicateIdentifiers.js
@@ -49,7 +49,7 @@ var FooBar;
FooBar.member1 = 2;
})(FooBar = exports.FooBar || (exports.FooBar = {}));
var FooBar;
-(function (FooBar) {
+(function (FooBar) {// Shouldn't error
FooBar.member2 = 42;
})(FooBar = exports.FooBar || (exports.FooBar = {}));
var Kettle = (function () {
diff --git a/tests/baselines/reference/nameCollisions.js b/tests/baselines/reference/nameCollisions.js
index a36f66e8dc9b4..e084f27acb226 100644
--- a/tests/baselines/reference/nameCollisions.js
+++ b/tests/baselines/reference/nameCollisions.js
@@ -52,7 +52,7 @@ var T;
(function (T) {
var x = 2;
var x;
- (function (x) {
+ (function (x) {// error
var Bar = (function () {
function Bar() {
}
diff --git a/tests/baselines/reference/noCatchBlock.js b/tests/baselines/reference/noCatchBlock.js
index 7b0404c3cadd7..ecc9c7f8c7ea7 100644
--- a/tests/baselines/reference/noCatchBlock.js
+++ b/tests/baselines/reference/noCatchBlock.js
@@ -8,7 +8,9 @@ try {
//// [noCatchBlock.js]
try {
+ // ...
}
finally {
+ // N.B. No 'catch' block
}
//# sourceMappingURL=noCatchBlock.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/noCatchBlock.js.map b/tests/baselines/reference/noCatchBlock.js.map
index 149a2167f46c6..392ec58810852 100644
--- a/tests/baselines/reference/noCatchBlock.js.map
+++ b/tests/baselines/reference/noCatchBlock.js.map
@@ -1,2 +1,2 @@
//// [noCatchBlock.js.map]
-{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AACA,IAAI,CAAC;AAEL,CAAC;QAAS,CAAC;AAEX,CAAC"}
\ No newline at end of file
+{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AACA,IAAI,CAAC;IACJ,MAAM;AACP,CAAC;QAAS,CAAC;IACV,wBAAwB;AACzB,CAAC"}
\ No newline at end of file
diff --git a/tests/baselines/reference/noCatchBlock.sourcemap.txt b/tests/baselines/reference/noCatchBlock.sourcemap.txt
index 18cb0d5a479c0..5210f12d734ec 100644
--- a/tests/baselines/reference/noCatchBlock.sourcemap.txt
+++ b/tests/baselines/reference/noCatchBlock.sourcemap.txt
@@ -12,6 +12,7 @@ sourceFile:noCatchBlock.ts
1 >
2 >^^^^
3 > ^
+4 > ^^^^^^->
1 >
>
2 >try
@@ -20,34 +21,51 @@ sourceFile:noCatchBlock.ts
2 >Emitted(1, 5) Source(2, 5) + SourceIndex(0)
3 >Emitted(1, 6) Source(2, 6) + SourceIndex(0)
---
+>>> // ...
+1->^^^^
+2 > ^^^^^^
+1->
+ >
+2 > // ...
+1->Emitted(2, 5) Source(3, 2) + SourceIndex(0)
+2 >Emitted(2, 11) Source(3, 8) + SourceIndex(0)
+---
>>>}
1 >
2 >^
3 > ^^^^^^^^^->
1 >
- > // ...
>
2 >}
-1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0)
-2 >Emitted(2, 2) Source(4, 2) + SourceIndex(0)
+1 >Emitted(3, 1) Source(4, 1) + SourceIndex(0)
+2 >Emitted(3, 2) Source(4, 2) + SourceIndex(0)
---
>>>finally {
1->^^^^^^^^
2 > ^
+3 > ^^^^^^^^^^^^^^^^^^^^->
1-> finally
2 > {
-1->Emitted(3, 9) Source(4, 11) + SourceIndex(0)
-2 >Emitted(3, 10) Source(4, 12) + SourceIndex(0)
+1->Emitted(4, 9) Source(4, 11) + SourceIndex(0)
+2 >Emitted(4, 10) Source(4, 12) + SourceIndex(0)
+---
+>>> // N.B. No 'catch' block
+1->^^^^
+2 > ^^^^^^^^^^^^^^^^^^^^^^^^
+1->
+ >
+2 > // N.B. No 'catch' block
+1->Emitted(5, 5) Source(5, 2) + SourceIndex(0)
+2 >Emitted(5, 29) Source(5, 26) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
- > // N.B. No 'catch' block
>
2 >}
-1 >Emitted(4, 1) Source(6, 1) + SourceIndex(0)
-2 >Emitted(4, 2) Source(6, 2) + SourceIndex(0)
+1 >Emitted(6, 1) Source(6, 1) + SourceIndex(0)
+2 >Emitted(6, 2) Source(6, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=noCatchBlock.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/parserRealSource14.js b/tests/baselines/reference/parserRealSource14.js
index c31a9dd6c7244..9341ab69841db 100644
--- a/tests/baselines/reference/parserRealSource14.js
+++ b/tests/baselines/reference/parserRealSource14.js
@@ -1011,6 +1011,7 @@ var TypeScript;
ctx.path.push(cur);
}
else {
+ //logger.log("TODO: Ignoring node because minChar, limChar not better than previous node in stack");
}
}
// The AST walker skips comments, but we might be in one, so check the pre/post comments for this node manually
diff --git a/tests/baselines/reference/parserRealSource7.js b/tests/baselines/reference/parserRealSource7.js
index edc290c35d82a..f0cd74b0cd8ce 100644
--- a/tests/baselines/reference/parserRealSource7.js
+++ b/tests/baselines/reference/parserRealSource7.js
@@ -1369,7 +1369,7 @@ var TypeScript;
fgSym.declAST = ast;
}
}
- else {
+ else {// there exists a symbol with this name
if ((fgSym.kind() == SymbolKind.Type)) {
fgSym = context.checker.createFunctionSignature(funcDecl, containerSym, containerScope, fgSym, false).declAST.type.symbol;
}
@@ -1428,7 +1428,7 @@ var TypeScript;
funcDecl.accessorSymbol = context.checker.createAccessorSymbol(funcDecl, fgSym, containerSym.type, (funcDecl.isMethod() && isStatic), true, containerScope, containerSym);
}
funcDecl.type.symbol.declAST = ast;
- if (funcDecl.isConstructor) {
+ if (funcDecl.isConstructor) {// REVIEW: Remove when classes completely replace oldclass
go = true;
}
;
@@ -1482,6 +1482,8 @@ var TypeScript;
else if (ast.nodeType == NodeType.InterfaceDeclaration) {
go = preCollectInterfaceTypes(ast, parent, context);
}
+ // This will be a constructor arg because this pass only traverses
+ // constructor arg lists
else if (ast.nodeType == NodeType.ArgDecl) {
go = preCollectArgDeclTypes(ast, parent, context);
}
diff --git a/tests/baselines/reference/privacyGloImport.js b/tests/baselines/reference/privacyGloImport.js
index 407ac5bb8d5d3..ecafec9d639da 100644
--- a/tests/baselines/reference/privacyGloImport.js
+++ b/tests/baselines/reference/privacyGloImport.js
@@ -235,6 +235,8 @@ var m1;
//var m1_im4_private_v4_private = m1_im4_private.f1();
m1.m1_im1_public = m1_M1_public;
m1.m1_im2_public = m1_M2_private;
+ //export import m1_im3_public = require("m1_M3_public");
+ //export import m1_im4_public = require("m1_M4_private");
})(m1 || (m1 = {}));
var glo_M1_public;
(function (glo_M1_public) {
@@ -256,5 +258,6 @@ var m2;
var m4;
(function (m4) {
var a = 10;
+ //import m2 = require("use_glo_M1_public");
})(m4 || (m4 = {}));
})(m2 || (m2 = {}));
diff --git a/tests/baselines/reference/privacyImport.js b/tests/baselines/reference/privacyImport.js
index debb1e3b4bd2b..fcac37bac3670 100644
--- a/tests/baselines/reference/privacyImport.js
+++ b/tests/baselines/reference/privacyImport.js
@@ -440,6 +440,8 @@ var m1;
//var m1_im4_private_v4_private = m1_im4_private.f1();
m1.m1_im1_public = m1_M1_public;
m1.m1_im2_public = m1_M2_private;
+ //export import m1_im3_public = require("m1_M3_public");
+ //export import m1_im4_public = require("m1_M4_private");
})(m1 = exports.m1 || (exports.m1 = {}));
var m2;
(function (m2) {
@@ -524,6 +526,8 @@ var m2;
// Parse error to export module
m2.m1_im1_public = m2_M1_public;
m2.m1_im2_public = m2_M2_private;
+ //export import m1_im3_public = require("m2_M3_public");
+ //export import m1_im4_public = require("m2_M4_private");
})(m2 || (m2 = {}));
var glo_M1_public;
(function (glo_M1_public) {
@@ -686,6 +690,7 @@ var m2;
var m4;
(function (m4) {
var a = 10;
+ //import m2 = require("use_glo_M1_public");
})(m4 || (m4 = {}));
})(m2 || (m2 = {}));
var m3;
@@ -694,5 +699,6 @@ var m3;
var m4;
(function (m4) {
var a = 10;
+ //import m2 = require("use_glo_M1_public");
})(m4 || (m4 = {}));
})(m3 = exports.m3 || (exports.m3 = {}));
diff --git a/tests/baselines/reference/recursiveReturns.js b/tests/baselines/reference/recursiveReturns.js
index 18c9ed4dd7cab..d2619e18796fc 100644
--- a/tests/baselines/reference/recursiveReturns.js
+++ b/tests/baselines/reference/recursiveReturns.js
@@ -23,6 +23,7 @@ function R1() {
function R2() { R2(); }
function R3(n) {
if (n == 0) {
+ //return;
}
else {
R3(n--);
diff --git a/tests/baselines/reference/sourceMap-SkippedNode.js b/tests/baselines/reference/sourceMap-SkippedNode.js
index 656b5a244e901..f25c0d75c8246 100644
--- a/tests/baselines/reference/sourceMap-SkippedNode.js
+++ b/tests/baselines/reference/sourceMap-SkippedNode.js
@@ -7,7 +7,9 @@ try {
//// [sourceMap-SkippedNode.js]
try {
+ // ...
}
finally {
+ // N.B. No 'catch' block
}
//# sourceMappingURL=sourceMap-SkippedNode.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMap-SkippedNode.js.map b/tests/baselines/reference/sourceMap-SkippedNode.js.map
index 77340424640dc..f3444919d41b0 100644
--- a/tests/baselines/reference/sourceMap-SkippedNode.js.map
+++ b/tests/baselines/reference/sourceMap-SkippedNode.js.map
@@ -1,2 +1,2 @@
//// [sourceMap-SkippedNode.js.map]
-{"version":3,"file":"sourceMap-SkippedNode.js","sourceRoot":"","sources":["sourceMap-SkippedNode.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;AAEL,CAAC;QAAS,CAAC;AAEX,CAAC"}
\ No newline at end of file
+{"version":3,"file":"sourceMap-SkippedNode.js","sourceRoot":"","sources":["sourceMap-SkippedNode.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;IACL,MAAM;AACN,CAAC;QAAS,CAAC;IACX,wBAAwB;AACxB,CAAC"}
\ No newline at end of file
diff --git a/tests/baselines/reference/sourceMap-SkippedNode.sourcemap.txt b/tests/baselines/reference/sourceMap-SkippedNode.sourcemap.txt
index f68320a531fd1..c54676a697e21 100644
--- a/tests/baselines/reference/sourceMap-SkippedNode.sourcemap.txt
+++ b/tests/baselines/reference/sourceMap-SkippedNode.sourcemap.txt
@@ -12,6 +12,7 @@ sourceFile:sourceMap-SkippedNode.ts
1 >
2 >^^^^
3 > ^
+4 > ^^^^^^->
1 >
2 >try
3 > {
@@ -19,34 +20,51 @@ sourceFile:sourceMap-SkippedNode.ts
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
---
+>>> // ...
+1->^^^^
+2 > ^^^^^^
+1->
+ >
+2 > // ...
+1->Emitted(2, 5) Source(2, 1) + SourceIndex(0)
+2 >Emitted(2, 11) Source(2, 7) + SourceIndex(0)
+---
>>>}
1 >
2 >^
3 > ^^^^^^^^^->
1 >
- >// ...
>
2 >}
-1 >Emitted(2, 1) Source(3, 1) + SourceIndex(0)
-2 >Emitted(2, 2) Source(3, 2) + SourceIndex(0)
+1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0)
+2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0)
---
>>>finally {
1->^^^^^^^^
2 > ^
+3 > ^^^^^^^^^^^^^^^^^^^^->
1-> finally
2 > {
-1->Emitted(3, 9) Source(3, 11) + SourceIndex(0)
-2 >Emitted(3, 10) Source(3, 12) + SourceIndex(0)
+1->Emitted(4, 9) Source(3, 11) + SourceIndex(0)
+2 >Emitted(4, 10) Source(3, 12) + SourceIndex(0)
+---
+>>> // N.B. No 'catch' block
+1->^^^^
+2 > ^^^^^^^^^^^^^^^^^^^^^^^^
+1->
+ >
+2 > // N.B. No 'catch' block
+1->Emitted(5, 5) Source(4, 1) + SourceIndex(0)
+2 >Emitted(5, 29) Source(4, 25) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
- >// N.B. No 'catch' block
>
2 >}
-1 >Emitted(4, 1) Source(5, 1) + SourceIndex(0)
-2 >Emitted(4, 2) Source(5, 2) + SourceIndex(0)
+1 >Emitted(6, 1) Source(5, 1) + SourceIndex(0)
+2 >Emitted(6, 2) Source(5, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=sourceMap-SkippedNode.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/tsxEmit3.js b/tests/baselines/reference/tsxEmit3.js
index 9501df4e23782..33e1975cdbc47 100644
--- a/tests/baselines/reference/tsxEmit3.js
+++ b/tests/baselines/reference/tsxEmit3.js
@@ -58,6 +58,8 @@ var M;
return Bar;
}());
S.Bar = Bar;
+ // Emit Foo
+ // Foo, ;
})(S = M.S || (M.S = {}));
})(M || (M = {}));
var M;
diff --git a/tests/baselines/reference/tsxEmit3.js.map b/tests/baselines/reference/tsxEmit3.js.map
index 1a19c6b6bf39d..a0e4c964f160c 100644
--- a/tests/baselines/reference/tsxEmit3.js.map
+++ b/tests/baselines/reference/tsxEmit3.js.map
@@ -1,2 +1,2 @@
//// [file.jsx.map]
-{"version":3,"file":"file.jsx","sourceRoot":"","sources":["file.tsx"],"names":[],"mappings":"AAMA,IAAO,CAAC,CAQP;AARD,WAAO,CAAC,EAAC,CAAC;IACT;QAAmB;QAAgB,CAAC;QAAC,UAAC;IAAD,CAAC,AAAtC,IAAsC;IAAzB,KAAG,MAAsB,CAAA;IACtC,IAAc,CAAC,CAKd;IALD,WAAc,CAAC,EAAC,CAAC;QAChB;YAAA;YAAmB,CAAC;YAAD,UAAC;QAAD,CAAC,AAApB,IAAoB;QAAP,KAAG,MAAI,CAAA;IAIrB,CAAC,EALa,CAAC,GAAD,GAAC,KAAD,GAAC,QAKd;AACF,CAAC,EARM,CAAC,KAAD,CAAC,QAQP;AAED,IAAO,CAAC,CAYP;AAZD,WAAO,CAAC,EAAC,CAAC;IACT,aAAa;IACb,KAAG,EAAE,CAAC,KAAG,GAAG,CAAC;IAEb,IAAc,CAAC,CAMd;IAND,WAAc,CAAC,EAAC,CAAC;QAChB,aAAa;QACb,KAAG,EAAE,CAAC,KAAG,GAAG,CAAC;QAEb,aAAa;QACb,KAAG,EAAE,CAAC,KAAG,GAAG,CAAC;IACd,CAAC,EANa,CAAC,GAAD,GAAC,KAAD,GAAC,QAMd;AAEF,CAAC,EAZM,CAAC,KAAD,CAAC,QAYP;AAED,IAAO,CAAC,CAGP;AAHD,WAAO,CAAC,EAAC,CAAC;IACT,eAAe;IACf,GAAC,CAAC,GAAG,EAAE,CAAC,GAAC,CAAC,GAAG,GAAG,CAAC;AAClB,CAAC,EAHM,CAAC,KAAD,CAAC,QAGP;AAED,IAAO,CAAC,CAIP;AAJD,WAAO,GAAC,EAAC,CAAC;IACT,IAAI,CAAC,GAAG,GAAG,CAAC;IACZ,eAAe;IACf,OAAG,EAAE,CAAC,OAAG,GAAG,CAAC;AACd,CAAC,EAJM,CAAC,KAAD,CAAC,QAIP"}
\ No newline at end of file
+{"version":3,"file":"file.jsx","sourceRoot":"","sources":["file.tsx"],"names":[],"mappings":"AAMA,IAAO,CAAC,CAQP;AARD,WAAO,CAAC,EAAC,CAAC;IACT;QAAmB;QAAgB,CAAC;QAAC,UAAC;IAAD,CAAC,AAAtC,IAAsC;IAAzB,KAAG,MAAsB,CAAA;IACtC,IAAc,CAAC,CAKd;IALD,WAAc,CAAC,EAAC,CAAC;QAChB;YAAA;YAAmB,CAAC;YAAD,UAAC;QAAD,CAAC,AAApB,IAAoB;QAAP,KAAG,MAAI,CAAA;QAEpB,WAAW;QACX,gBAAgB;IACjB,CAAC,EALa,CAAC,GAAD,GAAC,KAAD,GAAC,QAKd;AACF,CAAC,EARM,CAAC,KAAD,CAAC,QAQP;AAED,IAAO,CAAC,CAYP;AAZD,WAAO,CAAC,EAAC,CAAC;IACT,aAAa;IACb,KAAG,EAAE,CAAC,KAAG,GAAG,CAAC;IAEb,IAAc,CAAC,CAMd;IAND,WAAc,CAAC,EAAC,CAAC;QAChB,aAAa;QACb,KAAG,EAAE,CAAC,KAAG,GAAG,CAAC;QAEb,aAAa;QACb,KAAG,EAAE,CAAC,KAAG,GAAG,CAAC;IACd,CAAC,EANa,CAAC,GAAD,GAAC,KAAD,GAAC,QAMd;AAEF,CAAC,EAZM,CAAC,KAAD,CAAC,QAYP;AAED,IAAO,CAAC,CAGP;AAHD,WAAO,CAAC,EAAC,CAAC;IACT,eAAe;IACf,GAAC,CAAC,GAAG,EAAE,CAAC,GAAC,CAAC,GAAG,GAAG,CAAC;AAClB,CAAC,EAHM,CAAC,KAAD,CAAC,QAGP;AAED,IAAO,CAAC,CAIP;AAJD,WAAO,GAAC,EAAC,CAAC;IACT,IAAI,CAAC,GAAG,GAAG,CAAC;IACZ,eAAe;IACf,OAAG,EAAE,CAAC,OAAG,GAAG,CAAC;AACd,CAAC,EAJM,CAAC,KAAD,CAAC,QAIP"}
\ No newline at end of file
diff --git a/tests/baselines/reference/tsxEmit3.sourcemap.txt b/tests/baselines/reference/tsxEmit3.sourcemap.txt
index b8fdbbfc4ba8b..c014dd83c9a98 100644
--- a/tests/baselines/reference/tsxEmit3.sourcemap.txt
+++ b/tests/baselines/reference/tsxEmit3.sourcemap.txt
@@ -203,7 +203,6 @@ sourceFile:file.tsx
2 > ^^^^^
3 > ^^^^^^
4 > ^
-5 > ^^^^^^^^^^^->
1->
2 > Bar
3 > { }
@@ -213,6 +212,27 @@ sourceFile:file.tsx
3 >Emitted(16, 20) Source(10, 23) + SourceIndex(0)
4 >Emitted(16, 21) Source(10, 23) + SourceIndex(0)
---
+>>> // Emit Foo
+1 >^^^^^^^^
+2 > ^^^^^^^^^^^
+3 > ^^^^^^->
+1 >
+ >
+ >
+2 > // Emit Foo
+1 >Emitted(17, 9) Source(12, 3) + SourceIndex(0)
+2 >Emitted(17, 20) Source(12, 14) + SourceIndex(0)
+---
+>>> // Foo, ;
+1->^^^^^^^^
+2 > ^^^^^^^^^^^^^^^^
+3 > ^^^^^^^->
+1->
+ >
+2 > // Foo, ;
+1->Emitted(18, 9) Source(13, 3) + SourceIndex(0)
+2 >Emitted(18, 25) Source(13, 19) + SourceIndex(0)
+---
>>> })(S = M.S || (M.S = {}));
1->^^^^
2 > ^
@@ -224,9 +244,6 @@ sourceFile:file.tsx
8 > ^^^
9 > ^^^^^^^^
1->
- >
- > // Emit Foo
- > // Foo, ;
>
2 > }
3 >
@@ -241,15 +258,15 @@ sourceFile:file.tsx
> // Emit Foo
> // Foo, ;
> }
-1->Emitted(17, 5) Source(14, 2) + SourceIndex(0)
-2 >Emitted(17, 6) Source(14, 3) + SourceIndex(0)
-3 >Emitted(17, 8) Source(9, 16) + SourceIndex(0)
-4 >Emitted(17, 9) Source(9, 17) + SourceIndex(0)
-5 >Emitted(17, 12) Source(9, 16) + SourceIndex(0)
-6 >Emitted(17, 15) Source(9, 17) + SourceIndex(0)
-7 >Emitted(17, 20) Source(9, 16) + SourceIndex(0)
-8 >Emitted(17, 23) Source(9, 17) + SourceIndex(0)
-9 >Emitted(17, 31) Source(14, 3) + SourceIndex(0)
+1->Emitted(19, 5) Source(14, 2) + SourceIndex(0)
+2 >Emitted(19, 6) Source(14, 3) + SourceIndex(0)
+3 >Emitted(19, 8) Source(9, 16) + SourceIndex(0)
+4 >Emitted(19, 9) Source(9, 17) + SourceIndex(0)
+5 >Emitted(19, 12) Source(9, 16) + SourceIndex(0)
+6 >Emitted(19, 15) Source(9, 17) + SourceIndex(0)
+7 >Emitted(19, 20) Source(9, 16) + SourceIndex(0)
+8 >Emitted(19, 23) Source(9, 17) + SourceIndex(0)
+9 >Emitted(19, 31) Source(14, 3) + SourceIndex(0)
---
>>>})(M || (M = {}));
1 >
@@ -275,13 +292,13 @@ sourceFile:file.tsx
> // Foo, ;
> }
> }
-1 >Emitted(18, 1) Source(15, 1) + SourceIndex(0)
-2 >Emitted(18, 2) Source(15, 2) + SourceIndex(0)
-3 >Emitted(18, 4) Source(7, 8) + SourceIndex(0)
-4 >Emitted(18, 5) Source(7, 9) + SourceIndex(0)
-5 >Emitted(18, 10) Source(7, 8) + SourceIndex(0)
-6 >Emitted(18, 11) Source(7, 9) + SourceIndex(0)
-7 >Emitted(18, 19) Source(15, 2) + SourceIndex(0)
+1 >Emitted(20, 1) Source(15, 1) + SourceIndex(0)
+2 >Emitted(20, 2) Source(15, 2) + SourceIndex(0)
+3 >Emitted(20, 4) Source(7, 8) + SourceIndex(0)
+4 >Emitted(20, 5) Source(7, 9) + SourceIndex(0)
+5 >Emitted(20, 10) Source(7, 8) + SourceIndex(0)
+6 >Emitted(20, 11) Source(7, 9) + SourceIndex(0)
+7 >Emitted(20, 19) Source(15, 2) + SourceIndex(0)
---
>>>var M;
1 >
@@ -307,10 +324,10 @@ sourceFile:file.tsx
> }
>
> }
-1 >Emitted(19, 1) Source(17, 1) + SourceIndex(0)
-2 >Emitted(19, 5) Source(17, 8) + SourceIndex(0)
-3 >Emitted(19, 6) Source(17, 9) + SourceIndex(0)
-4 >Emitted(19, 7) Source(29, 2) + SourceIndex(0)
+1 >Emitted(21, 1) Source(17, 1) + SourceIndex(0)
+2 >Emitted(21, 5) Source(17, 8) + SourceIndex(0)
+3 >Emitted(21, 6) Source(17, 9) + SourceIndex(0)
+4 >Emitted(21, 7) Source(29, 2) + SourceIndex(0)
---
>>>(function (M) {
1->
@@ -324,11 +341,11 @@ sourceFile:file.tsx
3 > M
4 >
5 > {
-1->Emitted(20, 1) Source(17, 1) + SourceIndex(0)
-2 >Emitted(20, 12) Source(17, 8) + SourceIndex(0)
-3 >Emitted(20, 13) Source(17, 9) + SourceIndex(0)
-4 >Emitted(20, 15) Source(17, 10) + SourceIndex(0)
-5 >Emitted(20, 16) Source(17, 11) + SourceIndex(0)
+1->Emitted(22, 1) Source(17, 1) + SourceIndex(0)
+2 >Emitted(22, 12) Source(17, 8) + SourceIndex(0)
+3 >Emitted(22, 13) Source(17, 9) + SourceIndex(0)
+4 >Emitted(22, 15) Source(17, 10) + SourceIndex(0)
+5 >Emitted(22, 16) Source(17, 11) + SourceIndex(0)
---
>>> // Emit M.Foo
1->^^^^
@@ -337,8 +354,8 @@ sourceFile:file.tsx
1->
>
2 > // Emit M.Foo
-1->Emitted(21, 5) Source(18, 2) + SourceIndex(0)
-2 >Emitted(21, 18) Source(18, 15) + SourceIndex(0)
+1->Emitted(23, 5) Source(18, 2) + SourceIndex(0)
+2 >Emitted(23, 18) Source(18, 15) + SourceIndex(0)
---
>>> M.Foo, ;
1->^^^^
@@ -356,13 +373,13 @@ sourceFile:file.tsx
5 > Foo
6 > />
7 > ;
-1->Emitted(22, 5) Source(19, 2) + SourceIndex(0)
-2 >Emitted(22, 10) Source(19, 5) + SourceIndex(0)
-3 >Emitted(22, 12) Source(19, 7) + SourceIndex(0)
-4 >Emitted(22, 13) Source(19, 8) + SourceIndex(0)
-5 >Emitted(22, 18) Source(19, 11) + SourceIndex(0)
-6 >Emitted(22, 21) Source(19, 14) + SourceIndex(0)
-7 >Emitted(22, 22) Source(19, 15) + SourceIndex(0)
+1->Emitted(24, 5) Source(19, 2) + SourceIndex(0)
+2 >Emitted(24, 10) Source(19, 5) + SourceIndex(0)
+3 >Emitted(24, 12) Source(19, 7) + SourceIndex(0)
+4 >Emitted(24, 13) Source(19, 8) + SourceIndex(0)
+5 >Emitted(24, 18) Source(19, 11) + SourceIndex(0)
+6 >Emitted(24, 21) Source(19, 14) + SourceIndex(0)
+7 >Emitted(24, 22) Source(19, 15) + SourceIndex(0)
---
>>> var S;
1 >^^^^
@@ -382,10 +399,10 @@ sourceFile:file.tsx
> // Emit S.Bar
> Bar, ;
> }
-1 >Emitted(23, 5) Source(21, 2) + SourceIndex(0)
-2 >Emitted(23, 9) Source(21, 16) + SourceIndex(0)
-3 >Emitted(23, 10) Source(21, 17) + SourceIndex(0)
-4 >Emitted(23, 11) Source(27, 3) + SourceIndex(0)
+1 >Emitted(25, 5) Source(21, 2) + SourceIndex(0)
+2 >Emitted(25, 9) Source(21, 16) + SourceIndex(0)
+3 >Emitted(25, 10) Source(21, 17) + SourceIndex(0)
+4 >Emitted(25, 11) Source(27, 3) + SourceIndex(0)
---
>>> (function (S) {
1->^^^^
@@ -399,11 +416,11 @@ sourceFile:file.tsx
3 > S
4 >
5 > {
-1->Emitted(24, 5) Source(21, 2) + SourceIndex(0)
-2 >Emitted(24, 16) Source(21, 16) + SourceIndex(0)
-3 >Emitted(24, 17) Source(21, 17) + SourceIndex(0)
-4 >Emitted(24, 19) Source(21, 18) + SourceIndex(0)
-5 >Emitted(24, 20) Source(21, 19) + SourceIndex(0)
+1->Emitted(26, 5) Source(21, 2) + SourceIndex(0)
+2 >Emitted(26, 16) Source(21, 16) + SourceIndex(0)
+3 >Emitted(26, 17) Source(21, 17) + SourceIndex(0)
+4 >Emitted(26, 19) Source(21, 18) + SourceIndex(0)
+5 >Emitted(26, 20) Source(21, 19) + SourceIndex(0)
---
>>> // Emit M.Foo
1->^^^^^^^^
@@ -412,8 +429,8 @@ sourceFile:file.tsx
1->
>
2 > // Emit M.Foo
-1->Emitted(25, 9) Source(22, 3) + SourceIndex(0)
-2 >Emitted(25, 22) Source(22, 16) + SourceIndex(0)
+1->Emitted(27, 9) Source(22, 3) + SourceIndex(0)
+2 >Emitted(27, 22) Source(22, 16) + SourceIndex(0)
---
>>> M.Foo, ;
1->^^^^^^^^
@@ -431,13 +448,13 @@ sourceFile:file.tsx
5 > Foo
6 > />
7 > ;
-1->Emitted(26, 9) Source(23, 3) + SourceIndex(0)
-2 >Emitted(26, 14) Source(23, 6) + SourceIndex(0)
-3 >Emitted(26, 16) Source(23, 8) + SourceIndex(0)
-4 >Emitted(26, 17) Source(23, 9) + SourceIndex(0)
-5 >Emitted(26, 22) Source(23, 12) + SourceIndex(0)
-6 >Emitted(26, 25) Source(23, 15) + SourceIndex(0)
-7 >Emitted(26, 26) Source(23, 16) + SourceIndex(0)
+1->Emitted(28, 9) Source(23, 3) + SourceIndex(0)
+2 >Emitted(28, 14) Source(23, 6) + SourceIndex(0)
+3 >Emitted(28, 16) Source(23, 8) + SourceIndex(0)
+4 >Emitted(28, 17) Source(23, 9) + SourceIndex(0)
+5 >Emitted(28, 22) Source(23, 12) + SourceIndex(0)
+6 >Emitted(28, 25) Source(23, 15) + SourceIndex(0)
+7 >Emitted(28, 26) Source(23, 16) + SourceIndex(0)
---
>>> // Emit S.Bar
1 >^^^^^^^^
@@ -447,8 +464,8 @@ sourceFile:file.tsx
>
>
2 > // Emit S.Bar
-1 >Emitted(27, 9) Source(25, 3) + SourceIndex(0)
-2 >Emitted(27, 22) Source(25, 16) + SourceIndex(0)
+1 >Emitted(29, 9) Source(25, 3) + SourceIndex(0)
+2 >Emitted(29, 22) Source(25, 16) + SourceIndex(0)
---
>>> S.Bar, ;
1->^^^^^^^^
@@ -467,13 +484,13 @@ sourceFile:file.tsx
5 > Bar
6 > />
7 > ;
-1->Emitted(28, 9) Source(26, 3) + SourceIndex(0)
-2 >Emitted(28, 14) Source(26, 6) + SourceIndex(0)
-3 >Emitted(28, 16) Source(26, 8) + SourceIndex(0)
-4 >Emitted(28, 17) Source(26, 9) + SourceIndex(0)
-5 >Emitted(28, 22) Source(26, 12) + SourceIndex(0)
-6 >Emitted(28, 25) Source(26, 15) + SourceIndex(0)
-7 >Emitted(28, 26) Source(26, 16) + SourceIndex(0)
+1->Emitted(30, 9) Source(26, 3) + SourceIndex(0)
+2 >Emitted(30, 14) Source(26, 6) + SourceIndex(0)
+3 >Emitted(30, 16) Source(26, 8) + SourceIndex(0)
+4 >Emitted(30, 17) Source(26, 9) + SourceIndex(0)
+5 >Emitted(30, 22) Source(26, 12) + SourceIndex(0)
+6 >Emitted(30, 25) Source(26, 15) + SourceIndex(0)
+7 >Emitted(30, 26) Source(26, 16) + SourceIndex(0)
---
>>> })(S = M.S || (M.S = {}));
1->^^^^
@@ -501,15 +518,15 @@ sourceFile:file.tsx
> // Emit S.Bar
> Bar, ;
> }
-1->Emitted(29, 5) Source(27, 2) + SourceIndex(0)
-2 >Emitted(29, 6) Source(27, 3) + SourceIndex(0)
-3 >Emitted(29, 8) Source(21, 16) + SourceIndex(0)
-4 >Emitted(29, 9) Source(21, 17) + SourceIndex(0)
-5 >Emitted(29, 12) Source(21, 16) + SourceIndex(0)
-6 >Emitted(29, 15) Source(21, 17) + SourceIndex(0)
-7 >Emitted(29, 20) Source(21, 16) + SourceIndex(0)
-8 >Emitted(29, 23) Source(21, 17) + SourceIndex(0)
-9 >Emitted(29, 31) Source(27, 3) + SourceIndex(0)
+1->Emitted(31, 5) Source(27, 2) + SourceIndex(0)
+2 >Emitted(31, 6) Source(27, 3) + SourceIndex(0)
+3 >Emitted(31, 8) Source(21, 16) + SourceIndex(0)
+4 >Emitted(31, 9) Source(21, 17) + SourceIndex(0)
+5 >Emitted(31, 12) Source(21, 16) + SourceIndex(0)
+6 >Emitted(31, 15) Source(21, 17) + SourceIndex(0)
+7 >Emitted(31, 20) Source(21, 16) + SourceIndex(0)
+8 >Emitted(31, 23) Source(21, 17) + SourceIndex(0)
+9 >Emitted(31, 31) Source(27, 3) + SourceIndex(0)
---
>>>})(M || (M = {}));
1 >
@@ -540,13 +557,13 @@ sourceFile:file.tsx
> }
>
> }
-1 >Emitted(30, 1) Source(29, 1) + SourceIndex(0)
-2 >Emitted(30, 2) Source(29, 2) + SourceIndex(0)
-3 >Emitted(30, 4) Source(17, 8) + SourceIndex(0)
-4 >Emitted(30, 5) Source(17, 9) + SourceIndex(0)
-5 >Emitted(30, 10) Source(17, 8) + SourceIndex(0)
-6 >Emitted(30, 11) Source(17, 9) + SourceIndex(0)
-7 >Emitted(30, 19) Source(29, 2) + SourceIndex(0)
+1 >Emitted(32, 1) Source(29, 1) + SourceIndex(0)
+2 >Emitted(32, 2) Source(29, 2) + SourceIndex(0)
+3 >Emitted(32, 4) Source(17, 8) + SourceIndex(0)
+4 >Emitted(32, 5) Source(17, 9) + SourceIndex(0)
+5 >Emitted(32, 10) Source(17, 8) + SourceIndex(0)
+6 >Emitted(32, 11) Source(17, 9) + SourceIndex(0)
+7 >Emitted(32, 19) Source(29, 2) + SourceIndex(0)
---
>>>var M;
1 >
@@ -563,10 +580,10 @@ sourceFile:file.tsx
> // Emit M.S.Bar
> S.Bar, ;
> }
-1 >Emitted(31, 1) Source(31, 1) + SourceIndex(0)
-2 >Emitted(31, 5) Source(31, 8) + SourceIndex(0)
-3 >Emitted(31, 6) Source(31, 9) + SourceIndex(0)
-4 >Emitted(31, 7) Source(34, 2) + SourceIndex(0)
+1 >Emitted(33, 1) Source(31, 1) + SourceIndex(0)
+2 >Emitted(33, 5) Source(31, 8) + SourceIndex(0)
+3 >Emitted(33, 6) Source(31, 9) + SourceIndex(0)
+4 >Emitted(33, 7) Source(34, 2) + SourceIndex(0)
---
>>>(function (M) {
1->
@@ -580,11 +597,11 @@ sourceFile:file.tsx
3 > M
4 >
5 > {
-1->Emitted(32, 1) Source(31, 1) + SourceIndex(0)
-2 >Emitted(32, 12) Source(31, 8) + SourceIndex(0)
-3 >Emitted(32, 13) Source(31, 9) + SourceIndex(0)
-4 >Emitted(32, 15) Source(31, 10) + SourceIndex(0)
-5 >Emitted(32, 16) Source(31, 11) + SourceIndex(0)
+1->Emitted(34, 1) Source(31, 1) + SourceIndex(0)
+2 >Emitted(34, 12) Source(31, 8) + SourceIndex(0)
+3 >Emitted(34, 13) Source(31, 9) + SourceIndex(0)
+4 >Emitted(34, 15) Source(31, 10) + SourceIndex(0)
+5 >Emitted(34, 16) Source(31, 11) + SourceIndex(0)
---
>>> // Emit M.S.Bar
1->^^^^
@@ -593,8 +610,8 @@ sourceFile:file.tsx
1->
>
2 > // Emit M.S.Bar
-1->Emitted(33, 5) Source(32, 2) + SourceIndex(0)
-2 >Emitted(33, 20) Source(32, 17) + SourceIndex(0)
+1->Emitted(35, 5) Source(32, 2) + SourceIndex(0)
+2 >Emitted(35, 20) Source(32, 17) + SourceIndex(0)
---
>>> M.S.Bar, ;
1->^^^^
@@ -620,17 +637,17 @@ sourceFile:file.tsx
9 > Bar
10> />
11> ;
-1->Emitted(34, 5) Source(33, 2) + SourceIndex(0)
-2 >Emitted(34, 8) Source(33, 3) + SourceIndex(0)
-3 >Emitted(34, 9) Source(33, 4) + SourceIndex(0)
-4 >Emitted(34, 12) Source(33, 7) + SourceIndex(0)
-5 >Emitted(34, 14) Source(33, 9) + SourceIndex(0)
-6 >Emitted(34, 15) Source(33, 10) + SourceIndex(0)
-7 >Emitted(34, 18) Source(33, 11) + SourceIndex(0)
-8 >Emitted(34, 19) Source(33, 12) + SourceIndex(0)
-9 >Emitted(34, 22) Source(33, 15) + SourceIndex(0)
-10>Emitted(34, 25) Source(33, 18) + SourceIndex(0)
-11>Emitted(34, 26) Source(33, 19) + SourceIndex(0)
+1->Emitted(36, 5) Source(33, 2) + SourceIndex(0)
+2 >Emitted(36, 8) Source(33, 3) + SourceIndex(0)
+3 >Emitted(36, 9) Source(33, 4) + SourceIndex(0)
+4 >Emitted(36, 12) Source(33, 7) + SourceIndex(0)
+5 >Emitted(36, 14) Source(33, 9) + SourceIndex(0)
+6 >Emitted(36, 15) Source(33, 10) + SourceIndex(0)
+7 >Emitted(36, 18) Source(33, 11) + SourceIndex(0)
+8 >Emitted(36, 19) Source(33, 12) + SourceIndex(0)
+9 >Emitted(36, 22) Source(33, 15) + SourceIndex(0)
+10>Emitted(36, 25) Source(33, 18) + SourceIndex(0)
+11>Emitted(36, 26) Source(33, 19) + SourceIndex(0)
---
>>>})(M || (M = {}));
1 >
@@ -651,13 +668,13 @@ sourceFile:file.tsx
> // Emit M.S.Bar
> S.Bar, ;
> }
-1 >Emitted(35, 1) Source(34, 1) + SourceIndex(0)
-2 >Emitted(35, 2) Source(34, 2) + SourceIndex(0)
-3 >Emitted(35, 4) Source(31, 8) + SourceIndex(0)
-4 >Emitted(35, 5) Source(31, 9) + SourceIndex(0)
-5 >Emitted(35, 10) Source(31, 8) + SourceIndex(0)
-6 >Emitted(35, 11) Source(31, 9) + SourceIndex(0)
-7 >Emitted(35, 19) Source(34, 2) + SourceIndex(0)
+1 >Emitted(37, 1) Source(34, 1) + SourceIndex(0)
+2 >Emitted(37, 2) Source(34, 2) + SourceIndex(0)
+3 >Emitted(37, 4) Source(31, 8) + SourceIndex(0)
+4 >Emitted(37, 5) Source(31, 9) + SourceIndex(0)
+5 >Emitted(37, 10) Source(31, 8) + SourceIndex(0)
+6 >Emitted(37, 11) Source(31, 9) + SourceIndex(0)
+7 >Emitted(37, 19) Source(34, 2) + SourceIndex(0)
---
>>>var M;
1 >
@@ -675,10 +692,10 @@ sourceFile:file.tsx
> // Emit M_1.Foo
> Foo, ;
> }
-1 >Emitted(36, 1) Source(36, 1) + SourceIndex(0)
-2 >Emitted(36, 5) Source(36, 8) + SourceIndex(0)
-3 >Emitted(36, 6) Source(36, 9) + SourceIndex(0)
-4 >Emitted(36, 7) Source(40, 2) + SourceIndex(0)
+1 >Emitted(38, 1) Source(36, 1) + SourceIndex(0)
+2 >Emitted(38, 5) Source(36, 8) + SourceIndex(0)
+3 >Emitted(38, 6) Source(36, 9) + SourceIndex(0)
+4 >Emitted(38, 7) Source(40, 2) + SourceIndex(0)
---
>>>(function (M_1) {
1->
@@ -691,11 +708,11 @@ sourceFile:file.tsx
3 > M
4 >
5 > {
-1->Emitted(37, 1) Source(36, 1) + SourceIndex(0)
-2 >Emitted(37, 12) Source(36, 8) + SourceIndex(0)
-3 >Emitted(37, 15) Source(36, 9) + SourceIndex(0)
-4 >Emitted(37, 17) Source(36, 10) + SourceIndex(0)
-5 >Emitted(37, 18) Source(36, 11) + SourceIndex(0)
+1->Emitted(39, 1) Source(36, 1) + SourceIndex(0)
+2 >Emitted(39, 12) Source(36, 8) + SourceIndex(0)
+3 >Emitted(39, 15) Source(36, 9) + SourceIndex(0)
+4 >Emitted(39, 17) Source(36, 10) + SourceIndex(0)
+5 >Emitted(39, 18) Source(36, 11) + SourceIndex(0)
---
>>> var M = 100;
1 >^^^^
@@ -712,12 +729,12 @@ sourceFile:file.tsx
4 > =
5 > 100
6 > ;
-1 >Emitted(38, 5) Source(37, 2) + SourceIndex(0)
-2 >Emitted(38, 9) Source(37, 6) + SourceIndex(0)
-3 >Emitted(38, 10) Source(37, 7) + SourceIndex(0)
-4 >Emitted(38, 13) Source(37, 10) + SourceIndex(0)
-5 >Emitted(38, 16) Source(37, 13) + SourceIndex(0)
-6 >Emitted(38, 17) Source(37, 14) + SourceIndex(0)
+1 >Emitted(40, 5) Source(37, 2) + SourceIndex(0)
+2 >Emitted(40, 9) Source(37, 6) + SourceIndex(0)
+3 >Emitted(40, 10) Source(37, 7) + SourceIndex(0)
+4 >Emitted(40, 13) Source(37, 10) + SourceIndex(0)
+5 >Emitted(40, 16) Source(37, 13) + SourceIndex(0)
+6 >Emitted(40, 17) Source(37, 14) + SourceIndex(0)
---
>>> // Emit M_1.Foo
1->^^^^
@@ -726,8 +743,8 @@ sourceFile:file.tsx
1->
>
2 > // Emit M_1.Foo
-1->Emitted(39, 5) Source(38, 2) + SourceIndex(0)
-2 >Emitted(39, 20) Source(38, 17) + SourceIndex(0)
+1->Emitted(41, 5) Source(38, 2) + SourceIndex(0)
+2 >Emitted(41, 20) Source(38, 17) + SourceIndex(0)
---
>>> M_1.Foo, ;
1->^^^^
@@ -745,13 +762,13 @@ sourceFile:file.tsx
5 > Foo
6 > />
7 > ;
-1->Emitted(40, 5) Source(39, 2) + SourceIndex(0)
-2 >Emitted(40, 12) Source(39, 5) + SourceIndex(0)
-3 >Emitted(40, 14) Source(39, 7) + SourceIndex(0)
-4 >Emitted(40, 15) Source(39, 8) + SourceIndex(0)
-5 >Emitted(40, 22) Source(39, 11) + SourceIndex(0)
-6 >Emitted(40, 25) Source(39, 14) + SourceIndex(0)
-7 >Emitted(40, 26) Source(39, 15) + SourceIndex(0)
+1->Emitted(42, 5) Source(39, 2) + SourceIndex(0)
+2 >Emitted(42, 12) Source(39, 5) + SourceIndex(0)
+3 >Emitted(42, 14) Source(39, 7) + SourceIndex(0)
+4 >Emitted(42, 15) Source(39, 8) + SourceIndex(0)
+5 >Emitted(42, 22) Source(39, 11) + SourceIndex(0)
+6 >Emitted(42, 25) Source(39, 14) + SourceIndex(0)
+7 >Emitted(42, 26) Source(39, 15) + SourceIndex(0)
---
>>>})(M || (M = {}));
1 >
@@ -774,12 +791,12 @@ sourceFile:file.tsx
> // Emit M_1.Foo
> Foo, ;
> }
-1 >Emitted(41, 1) Source(40, 1) + SourceIndex(0)
-2 >Emitted(41, 2) Source(40, 2) + SourceIndex(0)
-3 >Emitted(41, 4) Source(36, 8) + SourceIndex(0)
-4 >Emitted(41, 5) Source(36, 9) + SourceIndex(0)
-5 >Emitted(41, 10) Source(36, 8) + SourceIndex(0)
-6 >Emitted(41, 11) Source(36, 9) + SourceIndex(0)
-7 >Emitted(41, 19) Source(40, 2) + SourceIndex(0)
+1 >Emitted(43, 1) Source(40, 1) + SourceIndex(0)
+2 >Emitted(43, 2) Source(40, 2) + SourceIndex(0)
+3 >Emitted(43, 4) Source(36, 8) + SourceIndex(0)
+4 >Emitted(43, 5) Source(36, 9) + SourceIndex(0)
+5 >Emitted(43, 10) Source(36, 8) + SourceIndex(0)
+6 >Emitted(43, 11) Source(36, 9) + SourceIndex(0)
+7 >Emitted(43, 19) Source(40, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=file.jsx.map
\ No newline at end of file
diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js
index 1d33fa927a79b..42361058079c6 100644
--- a/tests/baselines/reference/typeAssertions.js
+++ b/tests/baselines/reference/typeAssertions.js
@@ -101,11 +101,11 @@ var numOrStr;
var str;
if (is)
string > (numOrStr === undefined);
-{
+{// Error
str = numOrStr; // Error, no narrowing occurred
}
if ((numOrStr === undefined))
is;
string;
-{
+{// Error
}
diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js
index 7e6b332447062..d2f19791686bb 100644
--- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js
+++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js
@@ -192,89 +192,89 @@ if (obj16 instanceof H) { // can't narrow type from 'any'
//// [typeGuardsWithInstanceOfByConstructorSignature.js]
var obj1;
-if (obj1 instanceof A) {
+if (obj1 instanceof A) {// narrowed to A.
obj1.foo;
obj1.bar;
}
var obj2;
-if (obj2 instanceof A) {
+if (obj2 instanceof A) {// can't narrow type from 'any'
obj2.foo;
obj2.bar;
}
var obj3;
-if (obj3 instanceof B) {
+if (obj3 instanceof B) {// narrowed to B.
obj3.foo = 1;
obj3.foo = "str";
obj3.bar = "str";
}
var obj4;
-if (obj4 instanceof B) {
+if (obj4 instanceof B) {// can't narrow type from 'any'
obj4.foo = "str";
obj4.foo = 1;
obj4.bar = "str";
}
var obj5;
-if (obj5 instanceof C) {
+if (obj5 instanceof C) {// narrowed to C1|C2.
obj5.foo;
obj5.c;
obj5.bar1;
obj5.bar2;
}
var obj6;
-if (obj6 instanceof C) {
+if (obj6 instanceof C) {// can't narrow type from 'any'
obj6.foo;
obj6.bar1;
obj6.bar2;
}
var obj7;
-if (obj7 instanceof D) {
+if (obj7 instanceof D) {// narrowed to D.
obj7.foo;
obj7.bar;
}
var obj8;
-if (obj8 instanceof D) {
+if (obj8 instanceof D) {// can't narrow type from 'any'
obj8.foo;
obj8.bar;
}
var obj9;
-if (obj9 instanceof E) {
+if (obj9 instanceof E) {// narrowed to E1 | E2
obj9.foo;
obj9.bar1;
obj9.bar2;
}
var obj10;
-if (obj10 instanceof E) {
+if (obj10 instanceof E) {// can't narrow type from 'any'
obj10.foo;
obj10.bar1;
obj10.bar2;
}
var obj11;
-if (obj11 instanceof F) {
+if (obj11 instanceof F) {// can't type narrowing, construct signature returns any.
obj11.foo;
obj11.bar;
}
var obj12;
-if (obj12 instanceof F) {
+if (obj12 instanceof F) {// can't narrow type from 'any'
obj12.foo;
obj12.bar;
}
var obj13;
-if (obj13 instanceof G) {
+if (obj13 instanceof G) {// narrowed to G1. G1 is return type of prototype property.
obj13.foo1;
obj13.foo2;
}
var obj14;
-if (obj14 instanceof G) {
+if (obj14 instanceof G) {// can't narrow type from 'any'
obj14.foo1;
obj14.foo2;
}
var obj15;
-if (obj15 instanceof H) {
+if (obj15 instanceof H) {// narrowed to H.
obj15.foo;
obj15.bar;
}
var obj16;
-if (obj16 instanceof H) {
+if (obj16 instanceof H) {// can't narrow type from 'any'
obj16.foo1;
obj16.foo2;
}
diff --git a/tests/baselines/reference/unknownSymbols2.js b/tests/baselines/reference/unknownSymbols2.js
index b158f5c950385..27ded35389c3f 100644
--- a/tests/baselines/reference/unknownSymbols2.js
+++ b/tests/baselines/reference/unknownSymbols2.js
@@ -42,7 +42,7 @@ var M;
}
try {
}
- catch (asdf) {
+ catch (asdf) {// no error
}
switch (asdf) {
case qwerty:
diff --git a/tests/baselines/reference/withStatement.js b/tests/baselines/reference/withStatement.js
index e422448205912..df0964f169556 100644
--- a/tests/baselines/reference/withStatement.js
+++ b/tests/baselines/reference/withStatement.js
@@ -13,7 +13,7 @@ with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) { // error
//// [withStatement.js]
-with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) {
+with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) {// error
bing = true; // no error
bang = true; // no error
function bar() { }
diff --git a/tests/baselines/reference/withStatementErrors.js b/tests/baselines/reference/withStatementErrors.js
index de2fb40dac917..df49f17735f0c 100644
--- a/tests/baselines/reference/withStatementErrors.js
+++ b/tests/baselines/reference/withStatementErrors.js
@@ -19,7 +19,7 @@ with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) { // error
//// [withStatementErrors.js]
-with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) {
+with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) {// error
bing = true; // no error
bang = true; // no error
function bar() { } // no error
diff --git a/tests/cases/compiler/commentOnIfElseStatement1.ts b/tests/cases/compiler/commentOnIfElseStatement1.ts
new file mode 100644
index 0000000000000..66557cedd655e
--- /dev/null
+++ b/tests/cases/compiler/commentOnIfElseStatement1.ts
@@ -0,0 +1,13 @@
+// @removeComments: false
+
+// 1
+if (false) {
+}
+// 2
+else if (!true) {
+
+}
+// 3
+else {
+
+}
\ No newline at end of file
diff --git a/tests/cases/compiler/commentsBeforeFunctionExpression1.ts b/tests/cases/compiler/commentsBeforeFunctionExpression1.ts
index d3b21c1847591..e005ba998d3d3 100644
--- a/tests/cases/compiler/commentsBeforeFunctionExpression1.ts
+++ b/tests/cases/compiler/commentsBeforeFunctionExpression1.ts
@@ -1,4 +1,6 @@
-// @removeComments: false
-var v = {
- f: /**own f*/ (a) => 0
-}
+// @removeComments: false
+var v = {
+ f: /**own f*/ (a) => 0
+}
+var w =
+/* 1 */ (a) => 0;