8000 Encode compiler files as UTF8. · johnangularjs/TypeScript@13ed900 · GitHub
[go: up one dir, main page]

Skip to content

Commit 13ed900

Browse files
Encode compiler files as UTF8.
1 parent ddbc909 commit 13ed900

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

src/compiler/checker.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3603,7 +3603,8 @@ module ts {
36033603
function getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments): Type {
36043604
let links = getNodeLinks(node);
36053605
if (!links.resolvedType) {
3606-
// We only support expressions that are simple qualified names. For other expressions this produces undefined. let typeNameOrExpression = node.kind === SyntaxKind.TypeReference ? (<TypeReferenceNode>node).typeName :
3606+
// We only support expressions that are simple qualified names. For other expressions this produces undefined.
3607+
let typeNameOrExpression = node.kind === SyntaxKind.TypeReference ? (<TypeReferenceNode>node).typeName :
36073608
isSupportedExpressionWithTypeArguments(<ExpressionWithTypeArguments>node) ? (<ExpressionWithTypeArguments>node).expression :
36083609
undefined;
36093610
let symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, SymbolFlags.Type) || unknownSymbol;
@@ -5255,14 +5256,14 @@ module ts {
52555256
if (source.typePredicate && target.typePredicate) {
52565257
if (target.typePredicate.parameterIndex === source.typePredicate.parameterIndex) {
52575258
// Return types from type predicates are treated as booleans. In order to infer types
5258-
// from type predicates we would need to infer from the type of type predicates. Since
5259-
// we can't infer any type information from the return types — we can just add a return
5260-
// statement after the below infer type statement.
5259+
// from type predicates we would need to infer using the type within the type predicate
5260+
// (i.e. 'Foo' from 'x is Foo').
52615261
inferFromTypes(source.typePredicate.type, target.typePredicate.type);
52625262
}
5263-
return;
52645263
}
5265-
inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
5264+
else {
5265+
inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
5266+
}
52665267
}
52675268

52685269
function inferFromIndexTypes(source: Type, target: Type, sourceKind: IndexKind, targetKind: IndexKind) {

src/compiler/emitter.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,23 +1903,21 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
19031903
function emitNewExpression(node: NewExpression) {
19041904
write("new ");
19051905

1906-
// Spread operator logic can be supported in new expressions in ES5 using a combination
1906+
// Spread operator logic is supported in new expressions in ES5 using a combination
19071907
// of Function.prototype.bind() and Function.prototype.apply().
19081908
//
19091909
// Example:
19101910
//
1911-
// var arguments = [1, 2, 3, 4, 5];
1912-
// new Array(...arguments);
1911+
// var args = [1, 2, 3, 4, 5];
1912+
// new Array(...args);
19131913
//
1914-
// Could be transpiled into ES5:
1914+
// is compiled into the following ES5:
19151915
//
1916-
// var arguments = [1, 2, 3, 4, 5];
1917-
// new (Array.bind.apply(Array, [void 0].concat(arguments)));
1916+
// var args = [1, 2, 3, 4, 5];
1917+
// new (Array.bind.apply(Array, [void 0].concat(args)));
19181918
//
1919-
// `[void 0]` is the first argument which represents `thisArg` to the bind method above.
1920-
// And `thisArg` will be set to the return value of the constructor when instantiated
1921-
// with the new operator — regardless of any value we set `thisArg` to. Thus, we set it
1922-
// to an undefined, `void 0`.
1919+
// The 'thisArg' to 'bind' is ignored when invoking the result of 'bind' with 'new',
1920+
// Thus, we set it to undefined ('void 0').
19231921
if (languageVersion === ScriptTarget.ES5 &&
19241922
node.arguments &&
19251923
hasSpreadElement(node.arguments)) {

0 commit comments

Comments
 (0)
0