mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-23 10:29:01 -06:00
Correct the external module check to determine if declaration is part of export assignment
This commit is contained in:
parent
bb7f7fb8dd
commit
d1cdf03d53
@ -1891,7 +1891,10 @@ module ts {
|
||||
}
|
||||
|
||||
// If this node is in external module, check if this is export assigned
|
||||
if (getContainerOfModuleElementDeclaration(node).flags & NodeFlags.ExternalModule) {
|
||||
var moduleDeclaration = getContainerOfModuleElementDeclaration(node);
|
||||
if ((moduleDeclaration.flags & NodeFlags.ExternalModule) || // Source file with external module flag
|
||||
// Ambient external module declaration
|
||||
(moduleDeclaration.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>moduleDeclaration).name.kind === SyntaxKind.StringLiteral)) {
|
||||
return resolver.isReferencedInExportAssignment(node);
|
||||
}
|
||||
|
||||
@ -2083,6 +2086,7 @@ module ts {
|
||||
}
|
||||
|
||||
function emitVariableDeclaration(node: VariableDeclaration) {
|
||||
// If we are emitting property it isnt moduleElement and doesnt need canEmitModuleElement check
|
||||
if (node.kind !== SyntaxKind.VariableDeclaration || canEmitModuleElementDeclaration(node)) {
|
||||
emitSourceTextOfNode(node.name);
|
||||
// If optional property emit ?
|
||||
|
||||
@ -275,7 +275,8 @@ module ts {
|
||||
|
||||
export function getContainerOfModuleElementDeclaration(node: Declaration) {
|
||||
// If the declaration is var declaration, then the parent is variable statement but we actually want the module
|
||||
return node.kind === SyntaxKind.VariableDeclaration ? node.parent.parent : node.parent;
|
||||
var container = node.kind === SyntaxKind.VariableDeclaration ? node.parent.parent : node.parent;
|
||||
return container.kind == SyntaxKind.ModuleBlock ? container.parent : container;
|
||||
}
|
||||
|
||||
enum ParsingContext {
|
||||
|
||||
@ -35,6 +35,11 @@ module.exports = MainModule;
|
||||
|
||||
//// [missingImportAfterModuleImport_0.d.ts]
|
||||
declare module "SubModule" {
|
||||
class SubModule {
|
||||
static StaticVar;
|
||||
InstanceVar;
|
||||
constructor ();
|
||||
}
|
||||
export = SubModule;
|
||||
}
|
||||
//// [missingImportAfterModuleImport_1.d.ts]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user