mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Ensure that checkGrammarModuleElementContext reliably returns true when there is bad grammar.
This commit is contained in:
@@ -17706,9 +17706,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkGrammarModuleElementContext(node: Statement, errorMessage: DiagnosticMessage): boolean {
|
||||
if (node.parent.kind !== SyntaxKind.SourceFile && node.parent.kind !== SyntaxKind.ModuleBlock && node.parent.kind !== SyntaxKind.ModuleDeclaration) {
|
||||
return grammarErrorOnFirstToken(node, errorMessage);
|
||||
const isInAppropriateContext = node.parent.kind === SyntaxKind.SourceFile || node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.ModuleDeclaration;
|
||||
if (!isInAppropriateContext) {
|
||||
grammarErrorOnFirstToken(node, errorMessage);
|
||||
}
|
||||
return !isInAppropriateContext;
|
||||
}
|
||||
|
||||
function checkExportSpecifier(node: ExportSpecifier) {
|
||||
@@ -17749,7 +17751,7 @@ namespace ts {
|
||||
checkExpressionCached(node.expression);
|
||||
}
|
||||
|
||||
checkExternalModuleExports(<SourceFile | ModuleDeclaration>container);
|
||||
checkExternalModuleExports(container);
|
||||
|
||||
if (node.isExportEquals && !isInAmbientContext(node)) {
|
||||
if (modulekind === ModuleKind.ES6) {
|
||||
|
||||
Reference in New Issue
Block a user