Merge pull request #8485 from RyanCavanaugh/fix8478

Allow module augmentations to add new top-level names.
This commit is contained in:
Ryan Cavanaugh
2016-05-05 15:28:49 -07:00
26 changed files with 744 additions and 400 deletions

View File

@@ -15741,13 +15741,6 @@ namespace ts {
grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
case SyntaxKind.ImportEqualsDeclaration:
if ((<ImportEqualsDeclaration>node).moduleReference.kind !== SyntaxKind.StringLiteral) {
if (!isGlobalAugmentation) {
error((<ImportEqualsDeclaration>node).name, Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope);
}
break;
}
// fallthrough
case SyntaxKind.ImportDeclaration:
grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
@@ -15782,9 +15775,6 @@ namespace ts {
// symbol should not originate in augmentation
reportError = isExternalModuleAugmentation(symbol.parent.declarations[0]);
}
if (reportError) {
error(node, Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope);
}
}
break;
}

View File

@@ -1843,10 +1843,6 @@
"category": "Error",
"code": 2664
},
"Module augmentation cannot introduce new names in the top level scope.": {
"category": "Error",
"code": 2665
},
"Exports and export assignments are not permitted in module augmentations.": {
"category": "Error",
"code": 2666