Skip to content

Commit 68cd4e5

Browse files
committed
Merge branch 'master' into optimizeTypeRelations
2 parents 21732eb + f1fb1b9 commit 68cd4e5

13 files changed

Lines changed: 111 additions & 4 deletions

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ namespace ts {
10531053
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnosticMessage, keyText));
10541054
}
10551055
const value = convertPropertyValueToJson(element.initializer, option);
1056-
if (typeof keyText !== undefined && typeof value !== undefined) {
1056+
if (typeof keyText !== "undefined" && typeof value !== "undefined") {
10571057
result[keyText] = value;
10581058
// Notify key value set, if user asked for it
10591059
if (jsonConversionNotifier &&

src/compiler/core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ namespace ts {
955955
* @param map A map-like.
956956
* @param key A property key.
957957
*/
958-
export function hasProperty<T>(map: MapLike<T>, key: string): boolean {
958+
export function hasProperty(map: MapLike<any>, key: string): boolean {
959959
return hasOwnProperty.call(map, key);
960960
}
961961

@@ -2344,7 +2344,7 @@ namespace ts {
23442344

23452345
export function fail(message?: string, stackCrawlMark?: Function): void {
23462346
debugger;
2347-
const e = new Error(message ? `Debug Failure. ` : "Debug Failure.");
2347+
const e = new Error(message ? `Debug Failure. ${message}` : "Debug Failure.");
23482348
if ((<any>Error).captureStackTrace) {
23492349
(<any>Error).captureStackTrace(e, stackCrawlMark || fail);
23502350
}

src/compiler/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3733,7 +3733,7 @@ namespace ts {
37333733
// 3)we have a MemberExpression which either completes the LeftHandSideExpression,
37343734
// or starts the beginning of the first four CallExpression productions.
37353735
let expression: MemberExpression;
3736-
if (token() === SyntaxKind.ImportKeyword) {
3736+
if (token() === SyntaxKind.ImportKeyword && lookAhead(nextTokenIsOpenParenOrLessThan)) {
37373737
// We don't want to eagerly consume all import keyword as import call expression so we look a head to find "("
37383738
// For example:
37393739
// var foo3 = require("subfolder

src/compiler/program.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,10 @@ namespace ts {
803803
// moduleAugmentations has changed
804804
oldProgram.structureIsReused = StructureIsReused.SafeModules;
805805
}
806+
if ((oldSourceFile.flags & NodeFlags.PossiblyContainsDynamicImport) !== (newSourceFile.flags & NodeFlags.PossiblyContainsDynamicImport)) {
807+
// dynamicImport has changed
808+
oldProgram.structureIsReused = StructureIsReused.SafeModules;
809+
}
806810

807811
if (!arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
808812
// 'types' references has changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
tests/cases/conformance/dynamicImport/1.ts(2,1): error TS1109: Expression expected.
2+
3+
4+
==== tests/cases/conformance/dynamicImport/0.ts (0 errors) ====
5+
export function foo() { return "foo"; }
6+
7+
==== tests/cases/conformance/dynamicImport/1.ts (1 errors) ====
8+
import
9+
import { foo } from './0';
10+
~~~~~~
11+
!!! error TS1109: Expression expected.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//// [tests/cases/conformance/dynamicImport/importCallExpressionIncorrect1.ts] ////
2+
3+
//// [0.ts]
4+
export function foo() { return "foo"; }
5+
6+
//// [1.ts]
7+
import
8+
import { foo } from './0';
9+
10+
//// [0.js]
11+
export function foo() { return "foo"; }
12+
//// [1.js]
13+
import ;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
tests/cases/conformance/dynamicImport/1.ts(1,9): error TS1109: Expression expected.
2+
3+
4+
==== tests/cases/conformance/dynamicImport/0.ts (0 errors) ====
5+
export function foo() { return "foo"; }
6+
7+
==== tests/cases/conformance/dynamicImport/1.ts (1 errors) ====
8+
var x = import { foo } from './0';
9+
~~~~~~
10+
!!! error TS1109: Expression expected.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//// [tests/cases/conformance/dynamicImport/importCallExpressionIncorrect2.ts] ////
2+
3+
//// [0.ts]
4+
export function foo() { return "foo"; }
5+
6+
//// [1.ts]
7+
var x = import { foo } from './0';
8+
9+
//// [0.js]
10+
export function foo() { return "foo"; }
11+
//// [1.js]
12+
var x = ;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// @module: esnext
2+
// @target: esnext
3+
// @filename: 0.ts
4+
export function foo() { return "foo"; }
5+
6+
// @filename: 1.ts
7+
import
8+
import { foo } from './0';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @module: esnext
2+
// @target: esnext
3+
// @filename: 0.ts
4+
export function foo() { return "foo"; }
5+
6+
// @filename: 1.ts
7+
var x = import { foo } from './0';

0 commit comments

Comments
 (0)