Skip to content

Commit 7b43d7a

Browse files
author
Kanchalai Tanglertsampan
committed
Merge branch 'master' into master-14217
# Conflicts: # tests/baselines/reference/controlFlowIterationErrors.errors.txt # tests/baselines/reference/implicitAnyFromCircularInference.errors.txt
2 parents b7ce6f0 + 3295ca3 commit 7b43d7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+840
-703
lines changed

Jakefile.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,14 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
328328
if (opts.stripInternal) {
329329
options += " --stripInternal";
330330
}
331-
332-
options += " --target es5 --lib es5,scripthost --noUnusedLocals --noUnusedParameters";
331+
options += " --target es5";
332+
if (opts.lib) {
333+
options += " --lib " + opts.lib
334+
}
335+
else {
336+
options += " --lib es5,scripthost"
337+
}
338+
options += " --noUnusedLocals --noUnusedParameters";
333339

334340
var cmd = host + " " + compilerPath + " " + options + " ";
335341
cmd = cmd + sources.join(" ");
@@ -1110,7 +1116,7 @@ desc("Compiles tslint rules to js");
11101116
task("build-rules", ["build-rules-start"].concat(tslintRulesOutFiles).concat(["build-rules-end"]));
11111117
tslintRulesFiles.forEach(function (ruleFile, i) {
11121118
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false,
1113-
{ noOutFile: true, generateDeclarations: false, outDir: path.join(builtLocalDirectory, "tslint") });
1119+
{ noOutFile: true, generateDeclarations: false, outDir: path.join(builtLocalDirectory, "tslint"), lib: "es6" });
11141120
});
11151121

11161122
desc("Emit the start of the build-rules fold");

scripts/parallel-lint.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var tslint = require("tslint");
22
var fs = require("fs");
3+
var path = require("path");
34

45
function getLinterOptions() {
56
return {
@@ -9,7 +10,7 @@ function getLinterOptions() {
910
};
1011
}
1112
function getLinterConfiguration() {
12-
return require("../tslint.json");
13+
return tslint.Configuration.loadConfigurationFromPath(path.join(__dirname, "../tslint.json"));
1314
}
1415

1516
function lintFileContents(options, configuration, path, contents) {

src/compiler/checker.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ namespace ts {
141141
getAugmentedPropertiesOfType,
142142
getRootSymbols,
143143
getContextualType: node => {
144-
node = getParseTreeNode(node, isExpression)
144+
node = getParseTreeNode(node, isExpression);
145145
return node ? getContextualType(node) : undefined;
146146
},
147147
getFullyQualifiedName,
@@ -16131,7 +16131,7 @@ namespace ts {
1613116131
}
1613216132

1613316133
function checkDeclarationInitializer(declaration: VariableLikeDeclaration) {
16134-
const type = checkExpressionCached(declaration.initializer);
16134+
const type = getTypeOfExpression(declaration.initializer, /*cache*/ true);
1613516135
return getCombinedNodeFlags(declaration) & NodeFlags.Const ||
1613616136
getCombinedModifierFlags(declaration) & ModifierFlags.Readonly && !isParameterPropertyDeclaration(declaration) ||
1613716137
isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type);
@@ -16204,10 +16204,12 @@ namespace ts {
1620416204

1620516205
// Returns the type of an expression. Unlike checkExpression, this function is simply concerned
1620616206
// with computing the type and may not fully check all contained sub-expressions for errors.
16207-
function getTypeOfExpression(node: Expression) {
16207+
// A cache argument of true indicates that if the function performs a full type check, it is ok
16208+
// to cache the result.
16209+
function getTypeOfExpression(node: Expression, cache?: boolean) {
1620816210
// Optimize for the common case of a call to a function with a single non-generic call
1620916211
// signature where we can just fetch the return type without checking the arguments.
16210-
if (node.kind === SyntaxKind.CallExpression && (<CallExpression>node).expression.kind !== SyntaxKind.SuperKeyword) {
16212+
if (node.kind === SyntaxKind.CallExpression && (<CallExpression>node).expression.kind !== SyntaxKind.SuperKeyword && !isRequireCall(node, /*checkArgumentIsStringLiteral*/true)) {
1621116213
const funcType = checkNonNullExpression((<CallExpression>node).expression);
1621216214
const signature = getSingleCallSignature(funcType);
1621316215
if (signature && !signature.typeParameters) {
@@ -16217,7 +16219,7 @@ namespace ts {
1621716219
// Otherwise simply call checkExpression. Ideally, the entire family of checkXXX functions
1621816220
// should have a parameter that indicates whether full error checking is required such that
1621916221
// we can perform the optimizations locally.
16220-
return checkExpression(node);
16222+
return cache ? checkExpressionCached(node) : checkExpression(node);
1622116223
}
1622216224

1622316225
// Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When
@@ -20674,7 +20676,7 @@ namespace ts {
2067420676
}
2067520677

2067620678
if (potentialNewTargetCollisions.length) {
20677-
forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope)
20679+
forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope);
2067820680
potentialNewTargetCollisions.length = 0;
2067920681
}
2068020682

src/compiler/core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ namespace ts {
8484
this.index++;
8585
return { value: this.selector(this.data, this.keys[index]), done: false };
8686
}
87-
return { value: undefined as never, done: true }
87+
return { value: undefined as never, done: true };
8888
}
8989
}
9090

@@ -140,7 +140,7 @@ namespace ts {
140140
action(this.data[key], key);
141141
}
142142
}
143-
}
143+
};
144144
}
145145

146146
export function createFileMap<T>(keyMapper?: (key: string) => string): FileMap<T> {

src/compiler/declarationEmitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ namespace ts {
11641164
emitTypeParameters(node.typeParameters);
11651165
const baseTypeNode = getClassExtendsHeritageClauseElement(node);
11661166
if (baseTypeNode) {
1167-
node.name
1167+
node.name;
11681168
emitHeritageClause(node.name, [baseTypeNode], /*isImplementsList*/ false);
11691169
}
11701170
emitHeritageClause(node.name, getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true);

src/compiler/moduleNameResolver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ namespace ts {
675675
}
676676

677677
export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations {
678-
return nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, /* jsOnly*/ false);
678+
return nodeModuleNameResolverWorker(moduleName, containingFile, compilerOptions, host, cache, /*jsOnly*/ false);
679679
}
680680

681681
/* @internal */
@@ -962,7 +962,7 @@ namespace ts {
962962
const result = cache && cache.get(containingDirectory);
963963
if (result) {
964964
if (traceEnabled) {
965-
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName)
965+
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName);
966966
}
967967
return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } };
968968
}

src/compiler/transformer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ namespace ts {
121121
enableEmitNotification,
122122
isSubstitutionEnabled,
123123
isEmitNotificationEnabled,
124-
get onSubstituteNode() { return onSubstituteNode },
124+
get onSubstituteNode() { return onSubstituteNode; },
125125
set onSubstituteNode(value) {
126126
Debug.assert(state < TransformationState.Initialized, "Cannot modify transformation hooks after initialization has completed.");
127127
Debug.assert(value !== undefined, "Value must not be 'undefined'");
128128
onSubstituteNode = value;
129129
},
130-
get onEmitNode() { return onEmitNode },
130+
get onEmitNode() { return onEmitNode; },
131131
set onEmitNode(value) {
132132
Debug.assert(state < TransformationState.Initialized, "Cannot modify transformation hooks after initialization has completed.");
133133
Debug.assert(value !== undefined, "Value must not be 'undefined'");

src/compiler/transformers/es2015.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2690,7 +2690,7 @@ namespace ts {
26902690
if (loopOutParameters.length) {
26912691
copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements);
26922692
}
2693-
addRange(statements, lexicalEnvironment)
2693+
addRange(statements, lexicalEnvironment);
26942694
loopBody = createBlock(statements, /*multiline*/ true);
26952695
}
26962696

src/compiler/transformers/module/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ namespace ts {
11521152
createIdentifier("__esModule"),
11531153
createLiteral(true)
11541154
)
1155-
)
1155+
);
11561156
}
11571157
else {
11581158
statement = createStatement(

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3297,7 +3297,7 @@
32973297
}
32983298

32993299
export interface PluginImport {
3300-
name: string
3300+
name: string;
33013301
}
33023302

33033303
export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[];

0 commit comments

Comments
 (0)