Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a4e80b5

Browse filesBrowse files
committed
Merge branch 'master' into strictChecks
2 parents cda741d + b152034 commit a4e80b5
Copy full SHA for a4e80b5

47 files changed

+288-154Lines changed: 288 additions & 154 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Jakefile.js‎

Copy file name to clipboardExpand all lines: Jakefile.js
+9-3Lines 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");
Collapse file

‎scripts/parallel-lint.js‎

Copy file name to clipboardExpand all lines: scripts/parallel-lint.js
+2-1Lines 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) {
Collapse file

‎src/compiler/checker.ts‎

Copy file name to clipboardExpand all lines: src/compiler/checker.ts
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ namespace ts {
143143
getAugmentedPropertiesOfType,
144144
getRootSymbols,
145145
getContextualType: node => {
146-
node = getParseTreeNode(node, isExpression)
146+
node = getParseTreeNode(node, isExpression);
147147
return node ? getContextualType(node) : undefined;
148148
},
149149
getFullyQualifiedName,
@@ -16133,7 +16133,7 @@ namespace ts {
1613316133
}
1613416134

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

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

1622516227
// Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When
@@ -20676,7 +20678,7 @@ namespace ts {
2067620678
}
2067720679

2067820680
if (potentialNewTargetCollisions.length) {
20679-
forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope)
20681+
forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope);
2068020682
potentialNewTargetCollisions.length = 0;
2068120683
}
2068220684

Collapse file

‎src/compiler/core.ts‎

Copy file name to clipboardExpand all lines: src/compiler/core.ts
+2-2Lines 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> {
Collapse file

‎src/compiler/declarationEmitter.ts‎

Copy file name to clipboardExpand all lines: src/compiler/declarationEmitter.ts
+1-1Lines 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);
Collapse file

‎src/compiler/moduleNameResolver.ts‎

Copy file name to clipboardExpand all lines: src/compiler/moduleNameResolver.ts
+2-2Lines 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
}
Collapse file

‎src/compiler/transformer.ts‎

Copy file name to clipboardExpand all lines: src/compiler/transformer.ts
+2-2Lines 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'");
Collapse file

‎src/compiler/transformers/es2015.ts‎

Copy file name to clipboardExpand all lines: src/compiler/transformers/es2015.ts
+1-1Lines 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

Collapse file

‎src/compiler/transformers/module/module.ts‎

Copy file name to clipboardExpand all lines: src/compiler/transformers/module/module.ts
+1-1Lines 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(
Collapse file

‎src/compiler/types.ts‎

Copy file name to clipboardExpand all lines: src/compiler/types.ts
+1-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.