Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/compiler/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,11 @@ namespace ts {
let pendingKind: CommentKind;
let pendingHasTrailingNewLine: boolean;
let hasPendingCommentRange = false;
let collecting = trailing || pos === 0;
const beginningOfFile = /^\s*$/.test(text.substr(0, pos));
if (trailing && beginningOfFile) {
return initial;
}
let collecting = trailing || beginningOfFile;
let accumulator = initial;
scan: while (pos >= 0 && pos < text.length) {
const ch = text.charCodeAt(pos);
Expand Down
1 change: 0 additions & 1 deletion tests/baselines/reference/alwaysStrictModule3.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export const a = 1;

//// [alwaysStrictModule3.js]
// module ES2015
// module ES2015
export var a = 1;
1 change: 0 additions & 1 deletion tests/baselines/reference/alwaysStrictModule5.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export const a = 1;

//// [alwaysStrictModule5.js]
// Targeting ES6
// Targeting ES6
export const a = 1;
1 change: 0 additions & 1 deletion tests/baselines/reference/capturedLetConstInLoop4_ES6.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ for (const y = 0; y < 1;) {

//// [capturedLetConstInLoop4_ES6.js]
//======let
//======let
export function exportedFoo() {
return v0 + v00 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ var temp = 10;

//// [exponentiationOperatorSyntaxError1.js]
// Error: early syntax error using ES7 SimpleUnaryExpression on left-hand side without ()
Math.pow(// Error: early syntax error using ES7 SimpleUnaryExpression on left-hand side without ()
-1, 2);
Math.pow(-1, 2);
Math.pow(+1, 2);
Math.pow(1, Math.pow(-2, 3));
Math.pow(1, Math.pow(-2, -3));
Expand Down