Skip to content

Commit 5a4be34

Browse files
author
Andy Hanson
committed
Merge branch 'master' into union-completion
2 parents e12b708 + 1a7c193 commit 5a4be34

File tree

367 files changed

+8385
-3354
lines changed

Some content is hidden

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

367 files changed

+8385
-3354
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"@types/gulp-help": "latest",
4040
"@types/gulp-newer": "latest",
4141
"@types/gulp-sourcemaps": "latest",
42-
"@types/gulp-typescript": "latest",
4342
"@types/merge2": "latest",
4443
"@types/minimatch": "latest",
4544
"@types/minimist": "latest",

src/compiler/binder.ts

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,19 @@ namespace ts {
221221
// other kinds of value declarations take precedence over modules
222222
symbol.valueDeclaration = node;
223223
}
224-
}
224+
}
225225
}
226226

227227
// Should not be called on a declaration with a computed property name,
228228
// unless it is a well known Symbol.
229229
function getDeclarationName(node: Declaration): string {
230-
if (node.name) {
230+
const name = getNameOfDeclaration(node);
231+
if (name) {
231232
if (isAmbientModule(node)) {
232-
return isGlobalScopeAugmentation(<ModuleDeclaration>node) ? "__global" : `"${(<LiteralExpression>node.name).text}"`;
233+
return isGlobalScopeAugmentation(<ModuleDeclaration>node) ? "__global" : `"${(<LiteralExpression>name).text}"`;
233234
}
234-
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
235-
const nameExpression = (<ComputedPropertyName>node.name).expression;
235+
if (name.kind === SyntaxKind.ComputedPropertyName) {
236+
const nameExpression = (<ComputedPropertyName>name).expression;
236237
// treat computed property names where expression is string/numeric literal as just string/numeric literal
237238
if (isStringOrNumericLiteral(nameExpression)) {
238239
return nameExpression.text;
@@ -241,7 +242,7 @@ namespace ts {
241242
Debug.assert(isWellKnownSymbolSyntactically(nameExpression));
242243
return getPropertyNameForKnownSymbolName((<PropertyAccessExpression>nameExpression).name.text);
243244
}
244-
return (<Identifier | LiteralExpression>node.name).text;
245+
return (<Identifier | LiteralExpression>name).text;
245246
}
246247
switch (node.kind) {
247248
case SyntaxKind.Constructor:
@@ -303,7 +304,7 @@ namespace ts {
303304
}
304305

305306
function getDisplayName(node: Declaration): string {
306-
return node.name ? declarationNameToString(node.name) : getDeclarationName(node);
307+
return (node as NamedDeclaration).name ? declarationNameToString((node as NamedDeclaration).name) : getDeclarationName(node);
307308
}
308309

309310
/**
@@ -366,8 +367,8 @@ namespace ts {
366367
symbolTable.set(name, symbol = createSymbol(SymbolFlags.None, name));
367368
}
368369
else {
369-
if (node.name) {
370-
node.name.parent = node;
370+
if ((node as NamedDeclaration).name) {
371+
(node as NamedDeclaration).name.parent = node;
371372
}
372373

373374
// Report errors every position with duplicate declaration
@@ -389,16 +390,16 @@ namespace ts {
389390
// 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default
390391
// 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)
391392
if (symbol.declarations && symbol.declarations.length &&
392-
(isDefaultExport || (node.kind === SyntaxKind.ExportAssignment && !(<ExportAssignment>node).isExportEquals))) {
393-
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
394-
}
393+
(isDefaultExport || (node.kind === SyntaxKind.ExportAssignment && !(<ExportAssignment>node).isExportEquals))) {
394+
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
395+
}
395396
}
396397
}
397398

398399
forEach(symbol.declarations, declaration => {
399-
file.bindDiagnostics.push(createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration)));
400+
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(declaration) || declaration, message, getDisplayName(declaration)));
400401
});
401-
file.bindDiagnostics.push(createDiagnosticForNode(node.name || node, message, getDisplayName(node)));
402+
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(node) || node, message, getDisplayName(node)));
402403

403404
symbol = createSymbol(SymbolFlags.None, name);
404405
}
@@ -439,9 +440,9 @@ namespace ts {
439440
// and this case is specially handled. Module augmentations should only be merged with original module definition
440441
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
441442
const isJSDocTypedefInJSDocNamespace = node.kind === SyntaxKind.JSDocTypedefTag &&
442-
node.name &&
443-
node.name.kind === SyntaxKind.Identifier &&
444-
(<Identifier>node.name).isInJSDocNamespace;
443+
(node as JSDocTypedefTag).name &&
444+
(node as JSDocTypedefTag).name.kind === SyntaxKind.Identifier &&
445+
((node as JSDocTypedefTag).name as Identifier).isInJSDocNamespace;
445446
if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || isJSDocTypedefInJSDocNamespace) {
446447
const exportKind =
447448
(symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
@@ -1414,7 +1415,7 @@ namespace ts {
14141415
if (isObjectLiteralOrClassExpressionMethod(node)) {
14151416
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike | ContainerFlags.IsObjectLiteralOrClassExpressionMethod;
14161417
}
1417-
// falls through
1418+
// falls through
14181419
case SyntaxKind.Constructor:
14191420
case SyntaxKind.FunctionDeclaration:
14201421
case SyntaxKind.MethodSignature:
@@ -1716,7 +1717,7 @@ namespace ts {
17161717
declareModuleMember(node, symbolFlags, symbolExcludes);
17171718
break;
17181719
}
1719-
// falls through
1720+
// falls through
17201721
default:
17211722
if (!blockScopeContainer.locals) {
17221723
blockScopeContainer.locals = createMap<Symbol>();
@@ -2010,7 +2011,7 @@ namespace ts {
20102011
bindBlockScopedDeclaration(<Declaration>parentNode, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
20112012
break;
20122013
}
2013-
// falls through
2014+
// falls through
20142015
case SyntaxKind.ThisKeyword:
20152016
if (currentFlow && (isExpression(node) || parent.kind === SyntaxKind.ShorthandPropertyAssignment)) {
20162017
node.flowNode = currentFlow;
@@ -2186,7 +2187,7 @@ namespace ts {
21862187
if (!isFunctionLike(node.parent)) {
21872188
return;
21882189
}
2189-
// falls through
2190+
// falls through
21902191
case SyntaxKind.ModuleBlock:
21912192
return updateStrictModeStatementList((<Block | ModuleBlock>node).statements);
21922193
}
@@ -2211,7 +2212,7 @@ namespace ts {
22112212
}
22122213

22132214
function bindSourceFileAsExternalModule() {
2214-
bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName) }"`);
2215+
bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName)}"`);
22152216
}
22162217

22172218
function bindExportAssignment(node: ExportAssignment | BinaryExpression) {
@@ -2504,7 +2505,7 @@ namespace ts {
25042505
}
25052506

25062507
function bindParameter(node: ParameterDeclaration) {
2507-
if (inStrictMode) {
2508+
if (inStrictMode && !isInAmbientContext(node)) {
25082509
// It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
25092510
// strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
25102511
checkStrictModeEvalOrArguments(node, node.name);

0 commit comments

Comments
 (0)