move checking modifiers out of parser
This commit is contained in:
parent
47c95c48b4
commit
4fb489e64b
19 changed files with 279 additions and 256 deletions
|
@ -821,6 +821,18 @@ module ts {
|
||||||
_syntacticDiagnostics: Diagnostic[];
|
_syntacticDiagnostics: Diagnostic[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function modifierToFlag(token: SyntaxKind): NodeFlags {
|
||||||
|
switch (token) {
|
||||||
|
case SyntaxKind.StaticKeyword: return NodeFlags.Static;
|
||||||
|
case SyntaxKind.PublicKeyword: return NodeFlags.Public;
|
||||||
|
case SyntaxKind.ProtectedKeyword: return NodeFlags.Protected;
|
||||||
|
case SyntaxKind.PrivateKeyword: return NodeFlags.Private;
|
||||||
|
case SyntaxKind.ExportKeyword: return NodeFlags.Export;
|
||||||
|
case SyntaxKind.DeclareKeyword: return NodeFlags.Ambient;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
export function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, version: string, isOpen: boolean = false): SourceFile {
|
export function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, version: string, isOpen: boolean = false): SourceFile {
|
||||||
var file: SourceFileInternal;
|
var file: SourceFileInternal;
|
||||||
var scanner: Scanner;
|
var scanner: Scanner;
|
||||||
|
@ -1488,7 +1500,11 @@ module ts {
|
||||||
|
|
||||||
function parseParameter(flags: NodeFlags = 0): ParameterDeclaration {
|
function parseParameter(flags: NodeFlags = 0): ParameterDeclaration {
|
||||||
var node = <ParameterDeclaration>createNode(SyntaxKind.Parameter);
|
var node = <ParameterDeclaration>createNode(SyntaxKind.Parameter);
|
||||||
node.flags |= parseAndCheckModifiers(ModifierContext.Parameters);
|
var modifiers = parseModifiers(ModifierContext.Parameters);
|
||||||
|
if (modifiers) {
|
||||||
|
node.flags |= modifiers.flags;
|
||||||
|
node.modifiers = modifiers;
|
||||||
|
}
|
||||||
if (parseOptional(SyntaxKind.DotDotDotToken)) {
|
if (parseOptional(SyntaxKind.DotDotDotToken)) {
|
||||||
node.flags |= NodeFlags.Rest;
|
node.flags |= NodeFlags.Rest;
|
||||||
}
|
}
|
||||||
|
@ -2472,7 +2488,7 @@ module ts {
|
||||||
var initialToken = token;
|
var initialToken = token;
|
||||||
if (parseContextualModifier(SyntaxKind.GetKeyword) || parseContextualModifier(SyntaxKind.SetKeyword)) {
|
if (parseContextualModifier(SyntaxKind.GetKeyword) || parseContextualModifier(SyntaxKind.SetKeyword)) {
|
||||||
var kind = initialToken === SyntaxKind.GetKeyword ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor;
|
var kind = initialToken === SyntaxKind.GetKeyword ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor;
|
||||||
return parseMemberAccessorDeclaration(kind, initialPos, 0);
|
return parseMemberAccessorDeclaration(kind, initialPos, /*modifiers*/ undefined);
|
||||||
}
|
}
|
||||||
return parsePropertyAssignment();
|
return parsePropertyAssignment();
|
||||||
}
|
}
|
||||||
|
@ -2982,19 +2998,23 @@ module ts {
|
||||||
return finishNode(node);
|
return finishNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseConstructorDeclaration(pos: number, flags: NodeFlags): ConstructorDeclaration {
|
function parseConstructorDeclaration(pos: number, modifiers: ModifiersArray): ConstructorDeclaration {
|
||||||
var node = <ConstructorDeclaration>createNode(SyntaxKind.Constructor, pos);
|
var node = <ConstructorDeclaration>createNode(SyntaxKind.Constructor, pos);
|
||||||
node.flags = flags;
|
if (modifiers) {
|
||||||
|
node.modifiers = modifiers;
|
||||||
|
node.flags = modifiers.flags;
|
||||||
|
}
|
||||||
parseExpected(SyntaxKind.ConstructorKeyword);
|
parseExpected(SyntaxKind.ConstructorKeyword);
|
||||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false);
|
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false);
|
||||||
node.typeParameters = sig.typeParameters;
|
node.typeParameters = sig.typeParameters;
|
||||||
node.parameters = sig.parameters;
|
node.parameters = sig.parameters;
|
||||||
node.type = sig.type;
|
node.type = sig.type;
|
||||||
node.body = parseFunctionBlockOrSemicolon();
|
node.body = parseFunctionBlockOrSemicolon();
|
||||||
|
|
||||||
return finishNode(node);
|
return finishNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parsePropertyMemberDeclaration(pos: number, flags: NodeFlags): Declaration {
|
function parsePropertyMemberDeclaration(pos: number, modifiers: ModifiersArray): Declaration {
|
||||||
var errorCountBeforePropertyDeclaration = file.parseDiagnostics.length;
|
var errorCountBeforePropertyDeclaration = file.parseDiagnostics.length;
|
||||||
var name = parsePropertyName();
|
var name = parsePropertyName();
|
||||||
|
|
||||||
|
@ -3005,18 +3025,25 @@ module ts {
|
||||||
|
|
||||||
if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||||
var method = <MethodDeclaration>createNode(SyntaxKind.Method, pos);
|
var method = <MethodDeclaration>createNode(SyntaxKind.Method, pos);
|
||||||
method.flags = flags;
|
if (modifiers) {
|
||||||
|
method.modifiers = modifiers;
|
||||||
|
method.flags = modifiers.flags;
|
||||||
|
}
|
||||||
method.name = name;
|
method.name = name;
|
||||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false);
|
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false);
|
||||||
method.typeParameters = sig.typeParameters;
|
method.typeParameters = sig.typeParameters;
|
||||||
method.parameters = sig.parameters;
|
method.parameters = sig.parameters;
|
||||||
method.type = sig.type;
|
method.type = sig.type;
|
||||||
method.body = parseFunctionBlockOrSemicolon();
|
method.body = parseFunctionBlockOrSemicolon();
|
||||||
|
|
||||||
return finishNode(method);
|
return finishNode(method);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var property = <PropertyDeclaration>createNode(SyntaxKind.Property, pos);
|
var property = <PropertyDeclaration>createNode(SyntaxKind.Property, pos);
|
||||||
property.flags = flags;
|
if (modifiers) {
|
||||||
|
property.modifiers = modifiers;
|
||||||
|
property.flags = modifiers.flags;
|
||||||
|
}
|
||||||
property.name = name;
|
property.name = name;
|
||||||
property.type = parseTypeAnnotation();
|
property.type = parseTypeAnnotation();
|
||||||
|
|
||||||
|
@ -3032,9 +3059,12 @@ module ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseMemberAccessorDeclaration(kind: SyntaxKind, pos: number, flags: NodeFlags): MethodDeclaration {
|
function parseMemberAccessorDeclaration(kind: SyntaxKind, pos: number, modifiers: ModifiersArray): MethodDeclaration {
|
||||||
var node = <MethodDeclaration>createNode(kind, pos);
|
var node = <MethodDeclaration>createNode(kind, pos);
|
||||||
node.flags = flags;
|
if (modifiers) {
|
||||||
|
node.modifiers = modifiers;
|
||||||
|
node.flags = modifiers.flags;
|
||||||
|
}
|
||||||
node.name = parsePropertyName();
|
node.name = parsePropertyName();
|
||||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false);
|
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false);
|
||||||
node.typeParameters = sig.typeParameters;
|
node.typeParameters = sig.typeParameters;
|
||||||
|
@ -3103,175 +3133,44 @@ module ts {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseAndCheckModifiers(context: ModifierContext): number {
|
function parseModifiers(context: ModifierContext): ModifiersArray {
|
||||||
var flags = 0;
|
var flags = 0;
|
||||||
var lastStaticModifierStart: number;
|
var modifiers: ModifiersArray;
|
||||||
var lastStaticModifierLength: number;
|
|
||||||
var lastDeclareModifierStart: number;
|
|
||||||
var lastDeclareModifierLength: number;
|
|
||||||
var lastPrivateModifierStart: number;
|
|
||||||
var lastPrivateModifierLength: number;
|
|
||||||
var lastProtectedModifierStart: number;
|
|
||||||
var lastProtectedModifierLength: number;
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
var modifierStart = scanner.getTokenPos();
|
var modifierStart = scanner.getTokenPos();
|
||||||
var modifierToken = token;
|
var modifierToken = token;
|
||||||
|
|
||||||
// Try to parse the modifier
|
|
||||||
if (!parseAnyContextualModifier()) break;
|
if (!parseAnyContextualModifier()) break;
|
||||||
|
|
||||||
var modifierLength = scanner.getStartPos() - modifierStart;
|
if (!modifiers) {
|
||||||
|
modifiers = <ModifiersArray>[];
|
||||||
switch (modifierToken) {
|
|
||||||
case SyntaxKind.PublicKeyword:
|
|
||||||
if (flags & NodeFlags.AccessibilityModifier) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics.Accessibility_modifier_already_seen);
|
|
||||||
}
|
|
||||||
else if (flags & NodeFlags.Static) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_must_precede_1_modifier, "public", "static");
|
|
||||||
}
|
|
||||||
else if (context === ModifierContext.ModuleElements || context === ModifierContext.SourceElements) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "public");
|
|
||||||
}
|
|
||||||
flags |= NodeFlags.Public;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SyntaxKind.PrivateKeyword:
|
|
||||||
if (flags & NodeFlags.AccessibilityModifier) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics.Accessibility_modifier_already_seen);
|
|
||||||
}
|
|
||||||
else if (flags & NodeFlags.Static) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_must_precede_1_modifier, "private", "static");
|
|
||||||
}
|
|
||||||
else if (context === ModifierContext.ModuleElements || context === ModifierContext.SourceElements) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "private");
|
|
||||||
}
|
|
||||||
lastPrivateModifierStart = modifierStart;
|
|
||||||
lastPrivateModifierLength = modifierLength;
|
|
||||||
flags |= NodeFlags.Private;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SyntaxKind.ProtectedKeyword:
|
|
||||||
if (flags & NodeFlags.Public || flags & NodeFlags.Private || flags & NodeFlags.Protected) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics.Accessibility_modifier_already_seen);
|
|
||||||
}
|
|
||||||
else if (flags & NodeFlags.Static) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_must_precede_1_modifier, "protected", "static");
|
|
||||||
}
|
|
||||||
else if (context === ModifierContext.ModuleElements || context === ModifierContext.SourceElements) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "protected");
|
|
||||||
}
|
|
||||||
lastProtectedModifierStart = modifierStart;
|
|
||||||
lastProtectedModifierLength = modifierLength;
|
|
||||||
flags |= NodeFlags.Protected;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SyntaxKind.StaticKeyword:
|
|
||||||
if (flags & NodeFlags.Static) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_already_seen, "static");
|
|
||||||
}
|
|
||||||
else if (context === ModifierContext.ModuleElements || context === ModifierContext.SourceElements) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static");
|
|
||||||
}
|
|
||||||
else if (context === ModifierContext.Parameters) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
|
|
||||||
}
|
|
||||||
lastStaticModifierStart = modifierStart;
|
|
||||||
lastStaticModifierLength = modifierLength;
|
|
||||||
flags |= NodeFlags.Static;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SyntaxKind.ExportKeyword:
|
|
||||||
if (flags & NodeFlags.Export) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_already_seen, "export");
|
|
||||||
}
|
|
||||||
else if (flags & NodeFlags.Ambient) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare");
|
|
||||||
}
|
|
||||||
else if (context === ModifierContext.ClassMembers) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
|
|
||||||
}
|
|
||||||
else if (context === ModifierContext.Parameters) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
|
|
||||||
}
|
|
||||||
flags |= NodeFlags.Export;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SyntaxKind.DeclareKeyword:
|
|
||||||
if (flags & NodeFlags.Ambient) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_already_seen, "declare");
|
|
||||||
}
|
|
||||||
else if (context === ModifierContext.ClassMembers) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
|
|
||||||
}
|
|
||||||
else if (context === ModifierContext.Parameters) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
|
|
||||||
}
|
|
||||||
else if (inAmbientContext && context === ModifierContext.ModuleElements) {
|
|
||||||
grammarErrorAtPos(modifierStart, modifierLength, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
|
|
||||||
}
|
|
||||||
lastDeclareModifierStart = modifierStart;
|
|
||||||
lastDeclareModifierLength = modifierLength;
|
|
||||||
flags |= NodeFlags.Ambient;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
flags |= modifierToFlag(modifierToken);
|
||||||
|
modifiers.push(finishNode(createNode(modifierToken, modifierStart)));
|
||||||
}
|
}
|
||||||
|
if (modifiers) {
|
||||||
if (token === SyntaxKind.ConstructorKeyword && flags & NodeFlags.Static) {
|
modifiers.flags = flags;
|
||||||
grammarErrorAtPos(lastStaticModifierStart, lastStaticModifierLength, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
|
|
||||||
}
|
}
|
||||||
else if (token === SyntaxKind.ConstructorKeyword && flags & NodeFlags.Private) {
|
return modifiers;
|
||||||
grammarErrorAtPos(lastPrivateModifierStart, lastPrivateModifierLength, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private");
|
|
||||||
}
|
|
||||||
else if (token === SyntaxKind.ConstructorKeyword && flags & NodeFlags.Protected) {
|
|
||||||
grammarErrorAtPos(lastProtectedModifierStart, lastProtectedModifierLength, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected");
|
|
||||||
}
|
|
||||||
else if (token === SyntaxKind.ImportKeyword) {
|
|
||||||
if (flags & NodeFlags.Ambient) {
|
|
||||||
grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (token === SyntaxKind.InterfaceKeyword) {
|
|
||||||
if (flags & NodeFlags.Ambient) {
|
|
||||||
grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (token !== SyntaxKind.ExportKeyword && !(flags & NodeFlags.Ambient) && inAmbientContext && context === ModifierContext.SourceElements) {
|
|
||||||
// A declare modifier is required for any top level .d.ts declaration except export=, interfaces and imports:
|
|
||||||
// categories:
|
|
||||||
//
|
|
||||||
// DeclarationElement:
|
|
||||||
// ExportAssignment
|
|
||||||
// export_opt InterfaceDeclaration
|
|
||||||
// export_opt ImportDeclaration
|
|
||||||
// export_opt ExternalImportDeclaration
|
|
||||||
// export_opt AmbientDeclaration
|
|
||||||
//
|
|
||||||
var declarationStart = scanner.getTokenPos();
|
|
||||||
var declarationFirstTokenLength = scanner.getTextPos() - declarationStart;
|
|
||||||
grammarErrorAtPos(declarationStart, declarationFirstTokenLength, Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
|
|
||||||
}
|
|
||||||
return flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseClassMemberDeclaration(): Declaration {
|
function parseClassMemberDeclaration(): Declaration {
|
||||||
var pos = getNodePos();
|
var pos = getNodePos();
|
||||||
var flags = parseAndCheckModifiers(ModifierContext.ClassMembers);
|
var modifiers = parseModifiers(ModifierContext.ClassMembers);
|
||||||
if (parseContextualModifier(SyntaxKind.GetKeyword)) {
|
if (parseContextualModifier(SyntaxKind.GetKeyword)) {
|
||||||
return parseMemberAccessorDeclaration(SyntaxKind.GetAccessor, pos, flags);
|
return parseMemberAccessorDeclaration(SyntaxKind.GetAccessor, pos, modifiers);
|
||||||
}
|
}
|
||||||
if (parseContextualModifier(SyntaxKind.SetKeyword)) {
|
if (parseContextualModifier(SyntaxKind.SetKeyword)) {
|
||||||
return parseMemberAccessorDeclaration(SyntaxKind.SetAccessor, pos, flags);
|
return parseMemberAccessorDeclaration(SyntaxKind.SetAccessor, pos, modifiers);
|
||||||
}
|
}
|
||||||
if (token === SyntaxKind.ConstructorKeyword) {
|
if (token === SyntaxKind.ConstructorKeyword) {
|
||||||
return parseConstructorDeclaration(pos, flags);
|
return parseConstructorDeclaration(pos, modifiers);
|
||||||
}
|
}
|
||||||
if (token >= SyntaxKind.Identifier || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral) {
|
if (token >= SyntaxKind.Identifier || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral) {
|
||||||
return parsePropertyMemberDeclaration(pos, flags);
|
return parsePropertyMemberDeclaration(pos, modifiers);
|
||||||
}
|
}
|
||||||
if (token === SyntaxKind.OpenBracketToken) {
|
if (token === SyntaxKind.OpenBracketToken) {
|
||||||
if (flags) {
|
if (modifiers) {
|
||||||
var start = getTokenPos(pos);
|
var start = getTokenPos(pos);
|
||||||
var length = getNodePos() - start;
|
var length = getNodePos() - start;
|
||||||
errorAtPos(start, length, Diagnostics.Modifiers_not_permitted_on_index_signature_members);
|
errorAtPos(start, length, Diagnostics.Modifiers_not_permitted_on_index_signature_members);
|
||||||
|
@ -3472,14 +3371,13 @@ module ts {
|
||||||
function parseDeclaration(modifierContext: ModifierContext): Statement {
|
function parseDeclaration(modifierContext: ModifierContext): Statement {
|
||||||
var pos = getNodePos();
|
var pos = getNodePos();
|
||||||
var errorCountBeforeModifiers = file.parseDiagnostics.length;
|
var errorCountBeforeModifiers = file.parseDiagnostics.length;
|
||||||
var flags = parseAndCheckModifiers(modifierContext);
|
var modifiers = parseModifiers(modifierContext);
|
||||||
|
|
||||||
if (token === SyntaxKind.ExportKeyword) {
|
if (token === SyntaxKind.ExportKeyword) {
|
||||||
var modifiersEnd = scanner.getStartPos();
|
var modifiersEnd = scanner.getStartPos();
|
||||||
nextToken();
|
nextToken();
|
||||||
if (parseOptional(SyntaxKind.EqualsToken)) {
|
if (parseOptional(SyntaxKind.EqualsToken)) {
|
||||||
var exportAssignmentTail = parseExportAssignmentTail(pos);
|
var exportAssignmentTail = parseExportAssignmentTail(pos);
|
||||||
if (flags !== 0 && errorCountBeforeModifiers === file.parseDiagnostics.length) {
|
if (modifiers && errorCountBeforeModifiers === file.parseDiagnostics.length) {
|
||||||
var modifiersStart = skipTrivia(sourceText, pos);
|
var modifiersStart = skipTrivia(sourceText, pos);
|
||||||
grammarErrorAtPos(modifiersStart, modifiersEnd - modifiersStart, Diagnostics.An_export_assignment_cannot_have_modifiers);
|
grammarErrorAtPos(modifiersStart, modifiersEnd - modifiersStart, Diagnostics.An_export_assignment_cannot_have_modifiers);
|
||||||
}
|
}
|
||||||
|
@ -3488,10 +3386,10 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
var saveInAmbientContext = inAmbientContext;
|
var saveInAmbientContext = inAmbientContext;
|
||||||
if (flags & NodeFlags.Ambient) {
|
if (modifiers && modifiers.flags & NodeFlags.Ambient) {
|
||||||
inAmbientContext = true;
|
inAmbientContext = true;
|
||||||
}
|
}
|
||||||
|
var flags = modifiers ? modifiers.flags : 0;
|
||||||
var result: Declaration;
|
var result: Declaration;
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case SyntaxKind.VarKeyword:
|
case SyntaxKind.VarKeyword:
|
||||||
|
@ -3532,6 +3430,10 @@ module ts {
|
||||||
error(Diagnostics.Declaration_expected);
|
error(Diagnostics.Declaration_expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modifiers) {
|
||||||
|
result.modifiers = modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
inAmbientContext = saveInAmbientContext;
|
inAmbientContext = saveInAmbientContext;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3711,14 +3613,17 @@ module ts {
|
||||||
node.parent = parent;
|
node.parent = parent;
|
||||||
parent = node;
|
parent = node;
|
||||||
|
|
||||||
var savedInAmbientContext = inAmbientContext
|
if (!checkModifiers(node)) {
|
||||||
if (node.flags & NodeFlags.Ambient) {
|
var savedInAmbientContext = inAmbientContext
|
||||||
inAmbientContext = true;
|
if (node.flags & NodeFlags.Ambient) {
|
||||||
|
inAmbientContext = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkNode(node);
|
||||||
|
|
||||||
|
inAmbientContext = savedInAmbientContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkNode(node);
|
|
||||||
|
|
||||||
inAmbientContext = savedInAmbientContext;
|
|
||||||
parent = savedParent;
|
parent = savedParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3743,7 +3648,7 @@ module ts {
|
||||||
dispatch(node);
|
dispatch(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dispatch(node: Node) {
|
function dispatch(node: Node): void {
|
||||||
switch (node.kind) {
|
switch (node.kind) {
|
||||||
case SyntaxKind.ArrowFunction: return visitArrowFunction(<FunctionExpression>node);
|
case SyntaxKind.ArrowFunction: return visitArrowFunction(<FunctionExpression>node);
|
||||||
case SyntaxKind.BinaryExpression: return visitBinaryExpression(<BinaryExpression>node);
|
case SyntaxKind.BinaryExpression: return visitBinaryExpression(<BinaryExpression>node);
|
||||||
|
@ -4026,8 +3931,13 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function visitEnumDeclaration(enumDecl: EnumDeclaration) {
|
function visitEnumDeclaration(enumDecl: EnumDeclaration) {
|
||||||
|
checkEnumInitializer(enumDecl);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkEnumInitializer(enumDecl: EnumDeclaration): boolean {
|
||||||
var enumIsConst = (enumDecl.flags & NodeFlags.Const) !== 0;
|
var enumIsConst = (enumDecl.flags & NodeFlags.Const) !== 0;
|
||||||
|
|
||||||
|
var hasError = false;
|
||||||
// skip checks below for const enums - they allow arbitrary initializers as long as they can be evaluated to constant expressions.
|
// skip checks below for const enums - they allow arbitrary initializers as long as they can be evaluated to constant expressions.
|
||||||
// since all values are known in compile time - it is not necessary to check that constant enum section precedes computed enum members.
|
// since all values are known in compile time - it is not necessary to check that constant enum section precedes computed enum members.
|
||||||
if (!enumIsConst) {
|
if (!enumIsConst) {
|
||||||
|
@ -4036,17 +3946,18 @@ module ts {
|
||||||
var node = enumDecl.members[i];
|
var node = enumDecl.members[i];
|
||||||
if (inAmbientContext) {
|
if (inAmbientContext) {
|
||||||
if (node.initializer && !isIntegerLiteral(node.initializer)) {
|
if (node.initializer && !isIntegerLiteral(node.initializer)) {
|
||||||
grammarErrorOnNode(node.name, Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers);
|
hasError = grammarErrorOnNode(node.name, Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (node.initializer) {
|
else if (node.initializer) {
|
||||||
inConstantEnumMemberSection = isIntegerLiteral(node.initializer);
|
inConstantEnumMemberSection = isIntegerLiteral(node.initializer);
|
||||||
}
|
}
|
||||||
else if (!inConstantEnumMemberSection) {
|
else if (!inConstantEnumMemberSection) {
|
||||||
grammarErrorOnNode(node.name, Diagnostics.Enum_member_must_have_initializer);
|
hasError = grammarErrorOnNode(node.name, Diagnostics.Enum_member_must_have_initializer) || hasError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return hasError;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isIntegerLiteral(expression: Expression): boolean {
|
function isIntegerLiteral(expression: Expression): boolean {
|
||||||
|
@ -4177,14 +4088,18 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function visitModuleDeclaration(node: ModuleDeclaration): void {
|
function visitModuleDeclaration(node: ModuleDeclaration): void {
|
||||||
|
checkInternalModule(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkInternalModule(node: ModuleDeclaration): boolean {
|
||||||
if (node.name.kind === SyntaxKind.Identifier && node.body.kind === SyntaxKind.ModuleBlock) {
|
if (node.name.kind === SyntaxKind.Identifier && node.body.kind === SyntaxKind.ModuleBlock) {
|
||||||
forEach((<Block>node.body).statements, s => {
|
return forEach((<Block>node.body).statements, s => {
|
||||||
if (s.kind === SyntaxKind.ExportAssignment) {
|
if (s.kind === SyntaxKind.ExportAssignment) {
|
||||||
// Export assignments are not allowed in an internal module
|
// Export assignments are not allowed in an internal module
|
||||||
grammarErrorOnNode(s, Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module);
|
return grammarErrorOnNode(s, Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module);
|
||||||
}
|
}
|
||||||
else if (s.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>s).externalModuleName) {
|
else if (s.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>s).externalModuleName) {
|
||||||
grammarErrorOnNode(s, Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module);
|
return grammarErrorOnNode(s, Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -4261,6 +4176,148 @@ module ts {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkTopLevelDeclareModifierInAmbientContext(node: Node): boolean {
|
||||||
|
// A declare modifier is required for any top level .d.ts declaration except export=, interfaces and imports:
|
||||||
|
// categories:
|
||||||
|
//
|
||||||
|
// DeclarationElement:
|
||||||
|
// ExportAssignment
|
||||||
|
// export_opt InterfaceDeclaration
|
||||||
|
// export_opt ImportDeclaration
|
||||||
|
// export_opt ExternalImportDeclaration
|
||||||
|
// export_opt AmbientDeclaration
|
||||||
|
//
|
||||||
|
|
||||||
|
if (!inAmbientContext ||
|
||||||
|
!(isDeclaration(node) || node.kind === SyntaxKind.VariableStatement) ||
|
||||||
|
!node.parent ||
|
||||||
|
node.parent.kind !== SyntaxKind.SourceFile) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.kind === SyntaxKind.InterfaceDeclaration ||
|
||||||
|
node.kind === SyntaxKind.ImportDeclaration ||
|
||||||
|
node.kind === SyntaxKind.ExportAssignment ||
|
||||||
|
(node.flags & NodeFlags.Ambient) ||
|
||||||
|
(node.flags & NodeFlags.Export)) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grammarErrorOnFirstToken(node, Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function checkModifiers(node: Node): boolean {
|
||||||
|
if (!node.modifiers) {
|
||||||
|
return checkTopLevelDeclareModifierInAmbientContext(node);
|
||||||
|
}
|
||||||
|
var lastStatic: Node, lastPrivate: Node, lastProtected: Node, lastDeclare: Node;
|
||||||
|
var flags = 0;
|
||||||
|
var hasErrors = forEach(node.modifiers, m => {
|
||||||
|
switch (m.kind) {
|
||||||
|
case SyntaxKind.PublicKeyword:
|
||||||
|
case SyntaxKind.ProtectedKeyword:
|
||||||
|
case SyntaxKind.PrivateKeyword:
|
||||||
|
var text: string;
|
||||||
|
if (m.kind === SyntaxKind.PublicKeyword) {
|
||||||
|
text = "public";
|
||||||
|
}
|
||||||
|
else if (m.kind === SyntaxKind.ProtectedKeyword) {
|
||||||
|
text = "protected";
|
||||||
|
lastProtected = m;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
text = "private";
|
||||||
|
lastPrivate = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & NodeFlags.AccessibilityModifier) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics.Accessibility_modifier_already_seen);
|
||||||
|
}
|
||||||
|
else if (flags & NodeFlags.Static) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_must_precede_1_modifier, text, "static");
|
||||||
|
}
|
||||||
|
else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_cannot_appear_on_a_module_element, text);
|
||||||
|
}
|
||||||
|
flags |= modifierToFlag(m.kind);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SyntaxKind.StaticKeyword:
|
||||||
|
if (flags & NodeFlags.Static) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_already_seen, "static");
|
||||||
|
}
|
||||||
|
else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static");
|
||||||
|
}
|
||||||
|
else if (node.kind === SyntaxKind.Parameter) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
|
||||||
|
}
|
||||||
|
flags |= NodeFlags.Static;
|
||||||
|
lastStatic = m;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SyntaxKind.ExportKeyword:
|
||||||
|
if (flags & NodeFlags.Export) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_already_seen, "export");
|
||||||
|
}
|
||||||
|
else if (flags & NodeFlags.Ambient) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare");
|
||||||
|
}
|
||||||
|
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
|
||||||
|
}
|
||||||
|
else if (node.kind === SyntaxKind.Parameter) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
|
||||||
|
}
|
||||||
|
flags |= NodeFlags.Export;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SyntaxKind.DeclareKeyword:
|
||||||
|
if (flags & NodeFlags.Ambient) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_already_seen, "declare");
|
||||||
|
}
|
||||||
|
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
|
||||||
|
}
|
||||||
|
else if (node.kind === SyntaxKind.Parameter) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
|
||||||
|
}
|
||||||
|
else if (inAmbientContext && node.parent.kind === SyntaxKind.ModuleBlock) {
|
||||||
|
return grammarErrorOnNode(m, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
|
||||||
|
}
|
||||||
|
flags |= NodeFlags.Ambient;
|
||||||
|
lastDeclare = m;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (hasErrors) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.kind === SyntaxKind.Constructor) {
|
||||||
|
if (flags & NodeFlags.Static) {
|
||||||
|
return grammarErrorOnNode(lastStatic, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
|
||||||
|
}
|
||||||
|
else if (flags & NodeFlags.Protected) {
|
||||||
|
return grammarErrorOnNode(lastProtected, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected");
|
||||||
|
}
|
||||||
|
else if (flags & NodeFlags.Private) {
|
||||||
|
return grammarErrorOnNode(lastPrivate, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (node.kind === SyntaxKind.ImportDeclaration && flags & NodeFlags.Ambient) {
|
||||||
|
return grammarErrorOnNode(lastDeclare, Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare");
|
||||||
|
}
|
||||||
|
else if (node.kind === SyntaxKind.InterfaceDeclaration && flags & NodeFlags.Ambient) {
|
||||||
|
return grammarErrorOnNode(lastDeclare, Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare");
|
||||||
|
}
|
||||||
|
|
||||||
|
return checkTopLevelDeclareModifierInAmbientContext(node);
|
||||||
|
}
|
||||||
|
|
||||||
function visitParameter(node: ParameterDeclaration): void {
|
function visitParameter(node: ParameterDeclaration): void {
|
||||||
checkParameterName(node);
|
checkParameterName(node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,12 +288,17 @@ module ts {
|
||||||
locals?: SymbolTable; // Locals associated with node (initialized by binding)
|
locals?: SymbolTable; // Locals associated with node (initialized by binding)
|
||||||
nextContainer?: Node; // Next container in declaration order (initialized by binding)
|
nextContainer?: Node; // Next container in declaration order (initialized by binding)
|
||||||
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
|
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
|
||||||
|
modifiers?: ModifiersArray; // Array of modifiers
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NodeArray<T> extends Array<T>, TextRange {
|
export interface NodeArray<T> extends Array<T>, TextRange {
|
||||||
hasTrailingComma?: boolean;
|
hasTrailingComma?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ModifiersArray extends Array<Node> {
|
||||||
|
flags: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Identifier extends Node {
|
export interface Identifier extends Node {
|
||||||
text: string; // Text of identifier (with escapes converted to characters)
|
text: string; // Text of identifier (with escapes converted to characters)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,12 @@ tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifier
|
||||||
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(34,12): error TS1029: 'public' modifier must precede 'static' modifier.
|
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(34,12): error TS1029: 'public' modifier must precede 'static' modifier.
|
||||||
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(35,12): error TS1029: 'public' modifier must precede 'static' modifier.
|
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(35,12): error TS1029: 'public' modifier must precede 'static' modifier.
|
||||||
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(40,13): error TS1028: Accessibility modifier already seen.
|
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(40,13): error TS1028: Accessibility modifier already seen.
|
||||||
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(40,20): error TS1028: Accessibility modifier already seen.
|
|
||||||
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(41,12): error TS1028: Accessibility modifier already seen.
|
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(41,12): error TS1028: Accessibility modifier already seen.
|
||||||
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(42,13): error TS1028: Accessibility modifier already seen.
|
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(42,13): error TS1028: Accessibility modifier already seen.
|
||||||
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(43,12): error TS1028: Accessibility modifier already seen.
|
tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(43,12): error TS1028: Accessibility modifier already seen.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts (17 errors) ====
|
==== tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts (16 errors) ====
|
||||||
|
|
||||||
// No errors
|
// No errors
|
||||||
class C {
|
class C {
|
||||||
|
@ -83,8 +82,6 @@ tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifier
|
||||||
class E {
|
class E {
|
||||||
private public protected property;
|
private public protected property;
|
||||||
~~~~~~
|
~~~~~~
|
||||||
!!! error TS1028: Accessibility modifier already seen.
|
|
||||||
~~~~~~~~~
|
|
||||||
!!! error TS1028: Accessibility modifier already seen.
|
!!! error TS1028: Accessibility modifier already seen.
|
||||||
public protected method() { }
|
public protected method() { }
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(2,12): error TS1030: 'export' modifier already seen.
|
tests/cases/compiler/exportAlreadySeen.ts(2,12): error TS1030: 'export' modifier already seen.
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(3,12): error TS1030: 'export' modifier already seen.
|
tests/cases/compiler/exportAlreadySeen.ts(3,12): error TS1030: 'export' modifier already seen.
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(5,12): error TS1030: 'export' modifier already seen.
|
tests/cases/compiler/exportAlreadySeen.ts(5,12): error TS1030: 'export' modifier already seen.
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(6,16): error TS1030: 'export' modifier already seen.
|
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(7,16): error TS1030: 'export' modifier already seen.
|
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(12,12): error TS1030: 'export' modifier already seen.
|
tests/cases/compiler/exportAlreadySeen.ts(12,12): error TS1030: 'export' modifier already seen.
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(13,12): error TS1030: 'export' modifier already seen.
|
tests/cases/compiler/exportAlreadySeen.ts(13,12): error TS1030: 'export' modifier already seen.
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(15,12): error TS1030: 'export' modifier already seen.
|
tests/cases/compiler/exportAlreadySeen.ts(15,12): error TS1030: 'export' modifier already seen.
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(16,16): error TS1030: 'export' modifier already seen.
|
|
||||||
tests/cases/compiler/exportAlreadySeen.ts(17,16): error TS1030: 'export' modifier already seen.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/exportAlreadySeen.ts (10 errors) ====
|
==== tests/cases/compiler/exportAlreadySeen.ts (6 errors) ====
|
||||||
module M {
|
module M {
|
||||||
export export var x = 1;
|
export export var x = 1;
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
@ -23,11 +19,7 @@ tests/cases/compiler/exportAlreadySeen.ts(17,16): error TS1030: 'export' modifie
|
||||||
~~~~~~
|
~~~~~~
|
||||||
!!! error TS1030: 'export' modifier already seen.
|
!!! error TS1030: 'export' modifier already seen.
|
||||||
export export class C { }
|
export export class C { }
|
||||||
~~~~~~
|
|
||||||
!!! error TS1030: 'export' modifier already seen.
|
|
||||||
export export interface I { }
|
export export interface I { }
|
||||||
~~~~~~
|
|
||||||
!!! error TS1030: 'export' modifier already seen.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,10 +35,6 @@ tests/cases/compiler/exportAlreadySeen.ts(17,16): error TS1030: 'export' modifie
|
||||||
~~~~~~
|
~~~~~~
|
||||||
!!! error TS1030: 'export' modifier already seen.
|
!!! error TS1030: 'export' modifier already seen.
|
||||||
export export class C { }
|
export export class C { }
|
||||||
~~~~~~
|
|
||||||
!!! error TS1030: 'export' modifier already seen.
|
|
||||||
export export interface I { }
|
export export interface I { }
|
||||||
~~~~~~
|
|
||||||
!!! error TS1030: 'export' modifier already seen.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,10 +34,6 @@ tests/cases/compiler/giant.ts(430,9): error TS1005: '{' expected.
|
||||||
tests/cases/compiler/giant.ts(432,9): error TS1005: '{' expected.
|
tests/cases/compiler/giant.ts(432,9): error TS1005: '{' expected.
|
||||||
tests/cases/compiler/giant.ts(436,9): error TS1005: '{' expected.
|
tests/cases/compiler/giant.ts(436,9): error TS1005: '{' expected.
|
||||||
tests/cases/compiler/giant.ts(438,5): error TS1005: '{' expected.
|
tests/cases/compiler/giant.ts(438,5): error TS1005: '{' expected.
|
||||||
tests/cases/compiler/giant.ts(615,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
tests/cases/compiler/giant.ts(616,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
tests/cases/compiler/giant.ts(617,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
tests/cases/compiler/giant.ts(618,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
tests/cases/compiler/giant.ts(23,12): error TS2300: Duplicate identifier 'pgF'.
|
tests/cases/compiler/giant.ts(23,12): error TS2300: Duplicate identifier 'pgF'.
|
||||||
tests/cases/compiler/giant.ts(24,16): error TS2300: Duplicate identifier 'pgF'.
|
tests/cases/compiler/giant.ts(24,16): error TS2300: Duplicate identifier 'pgF'.
|
||||||
tests/cases/compiler/giant.ts(24,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
tests/cases/compiler/giant.ts(24,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||||
|
@ -174,7 +170,7 @@ tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all
|
||||||
tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required.
|
tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/giant.ts (174 errors) ====
|
==== tests/cases/compiler/giant.ts (170 errors) ====
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Prefixes
|
Prefixes
|
||||||
|
@ -1128,17 +1124,9 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||||
export interface eI { }
|
export interface eI { }
|
||||||
export module eM { }
|
export module eM { }
|
||||||
export declare var eaV
|
export declare var eaV
|
||||||
~~~~~~~
|
|
||||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
export declare function eaF() { };
|
export declare function eaF() { };
|
||||||
~~~~~~~
|
|
||||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
export declare class eaC { }
|
export declare class eaC { }
|
||||||
~~~~~~~
|
|
||||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
export declare module eaM { }
|
export declare module eaM { }
|
||||||
~~~~~~~
|
|
||||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
}
|
}
|
||||||
export var eV;
|
export var eV;
|
||||||
export function eF() { };
|
export function eF() { };
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1079: A 'declare' modifier cannot be used with an import declaration.
|
|
||||||
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||||
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier.
|
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier.
|
||||||
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS2305: Module 'x' has no exported member 'c'.
|
tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS2305: Module 'x' has no exported member 'c'.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/importDeclWithDeclareModifier.ts (4 errors) ====
|
==== tests/cases/compiler/importDeclWithDeclareModifier.ts (3 errors) ====
|
||||||
module x {
|
module x {
|
||||||
interface c {
|
interface c {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare export import a = x.c;
|
declare export import a = x.c;
|
||||||
~~~~~~~
|
|
||||||
!!! error TS1079: A 'declare' modifier cannot be used with an import declaration.
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts(6,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts(6,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||||
tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts(6,5): error TS1079: A 'declare' modifier cannot be used with an import declaration.
|
|
||||||
tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts(6,13): error TS1029: 'export' modifier must precede 'declare' modifier.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts (3 errors) ====
|
==== tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts (1 errors) ====
|
||||||
declare module "m" {
|
declare module "m" {
|
||||||
module x {
|
module x {
|
||||||
interface c {
|
interface c {
|
||||||
|
@ -12,10 +10,6 @@ tests/cases/compiler/importDeclWithDeclareModifierInAmbientContext.ts(6,13): err
|
||||||
declare export import a = x.c;
|
declare export import a = x.c;
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||||
~~~~~~~
|
|
||||||
!!! error TS1079: A 'declare' modifier cannot be used with an import declaration.
|
|
||||||
~~~~~~
|
|
||||||
!!! error TS1029: 'export' modifier must precede 'declare' modifier.
|
|
||||||
var b: a;
|
var b: a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration7.ts(2,10): error TS1028: Accessibility modifier already seen.
|
tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration7.ts(2,10): error TS1028: Accessibility modifier already seen.
|
||||||
tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration7.ts(2,10): error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration7.ts (2 errors) ====
|
==== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration7.ts (1 errors) ====
|
||||||
class C {
|
class C {
|
||||||
public private constructor() { }
|
public private constructor() { }
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
!!! error TS1028: Accessibility modifier already seen.
|
!!! error TS1028: Accessibility modifier already seen.
|
||||||
~~~~~~~
|
|
||||||
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
||||||
}
|
}
|
|
@ -1,12 +1,9 @@
|
||||||
tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts(2,4): error TS1145: Modifiers not permitted on index signature members.
|
tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts(2,4): error TS1145: Modifiers not permitted on index signature members.
|
||||||
tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts(2,11): error TS1030: 'static' modifier already seen.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts (2 errors) ====
|
==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts (1 errors) ====
|
||||||
class C {
|
class C {
|
||||||
static static [x: string]: string;
|
static static [x: string]: string;
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
!!! error TS1145: Modifiers not permitted on index signature members.
|
!!! error TS1145: Modifiers not permitted on index signature members.
|
||||||
~~~~~~
|
|
||||||
!!! error TS1030: 'static' modifier already seen.
|
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration9.ts(2,4): error TS1031: 'export' modifier cannot appear on a class element.
|
tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration9.ts(2,4): error TS1145: Modifiers not permitted on index signature members.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration9.ts (1 errors) ====
|
==== tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration9.ts (1 errors) ====
|
||||||
class C {
|
class C {
|
||||||
export [x: string]: string;
|
export [x: string]: string;
|
||||||
~~~~~~
|
~~~~~~
|
||||||
!!! error TS1031: 'export' modifier cannot appear on a class element.
|
!!! error TS1145: Modifiers not permitted on index signature members.
|
||||||
}
|
}
|
|
@ -1,13 +1,10 @@
|
||||||
tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration4.d.ts(1,1): error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file.
|
tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration4.d.ts(1,1): error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file.
|
||||||
tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration4.d.ts(2,3): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration4.d.ts (2 errors) ====
|
==== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration4.d.ts (1 errors) ====
|
||||||
module M {
|
module M {
|
||||||
~~~~~~
|
~~~~~~
|
||||||
!!! error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file.
|
!!! error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file.
|
||||||
declare module M1 {
|
declare module M1 {
|
||||||
~~~~~~~
|
|
||||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,7 @@
|
||||||
|
tests/cases/compiler/privacyGloImportParseErrors.ts(59,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
|
tests/cases/compiler/privacyGloImportParseErrors.ts(125,13): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
tests/cases/compiler/privacyGloImportParseErrors.ts(133,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
tests/cases/compiler/privacyGloImportParseErrors.ts(133,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||||
|
tests/cases/compiler/privacyGloImportParseErrors.ts(149,9): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
tests/cases/compiler/privacyGloImportParseErrors.ts(22,27): error TS2435: Ambient external modules cannot be nested in other modules.
|
tests/cases/compiler/privacyGloImportParseErrors.ts(22,27): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||||
tests/cases/compiler/privacyGloImportParseErrors.ts(30,20): error TS2435: Ambient external modules cannot be nested in other modules.
|
tests/cases/compiler/privacyGloImportParseErrors.ts(30,20): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||||
tests/cases/compiler/privacyGloImportParseErrors.ts(59,37): error TS2307: Cannot find external module 'm1_M3_public'.
|
tests/cases/compiler/privacyGloImportParseErrors.ts(59,37): error TS2307: Cannot find external module 'm1_M3_public'.
|
||||||
|
@ -8,7 +11,7 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(138,16): error TS2435: Ambie
|
||||||
tests/cases/compiler/privacyGloImportParseErrors.ts(141,12): error TS2435: Ambient external modules cannot be nested in other modules.
|
tests/cases/compiler/privacyGloImportParseErrors.ts(141,12): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/privacyGloImportParseErrors.ts (8 errors) ====
|
==== tests/cases/compiler/privacyGloImportParseErrors.ts (11 errors) ====
|
||||||
module m1 {
|
module m1 {
|
||||||
export module m1_M1_public {
|
export module m1_M1_public {
|
||||||
export class c1 {
|
export class c1 {
|
||||||
|
@ -72,6 +75,8 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(141,12): error TS2435: Ambie
|
||||||
var m1_im2_private_v4_private = m1_im2_private.f1();
|
var m1_im2_private_v4_private = m1_im2_private.f1();
|
||||||
|
|
||||||
import m1_im3_private = require("m1_M3_public");
|
import m1_im3_private = require("m1_M3_public");
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
!!! error TS2307: Cannot find external module 'm1_M3_public'.
|
!!! error TS2307: Cannot find external module 'm1_M3_public'.
|
||||||
export var m1_im3_private_v1_public = m1_im3_private.c1;
|
export var m1_im3_private_v1_public = m1_im3_private.c1;
|
||||||
|
@ -142,6 +147,8 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(141,12): error TS2435: Ambie
|
||||||
|
|
||||||
module m5 {
|
module m5 {
|
||||||
import m5_errorImport = require("glo_M2_public");
|
import m5_errorImport = require("glo_M2_public");
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
import m5_nonerrorImport = glo_M1_public;
|
import m5_nonerrorImport = glo_M1_public;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,6 +181,8 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(141,12): error TS2435: Ambie
|
||||||
module m4 {
|
module m4 {
|
||||||
var a = 10;
|
var a = 10;
|
||||||
import m2 = require("use_glo_M1_public");
|
import m2 = require("use_glo_M1_public");
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,11 @@
|
||||||
|
tests/cases/compiler/privacyImportParseErrors.ts(59,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
|
tests/cases/compiler/privacyImportParseErrors.ts(143,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
|
tests/cases/compiler/privacyImportParseErrors.ts(277,13): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
|
tests/cases/compiler/privacyImportParseErrors.ts(306,13): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
tests/cases/compiler/privacyImportParseErrors.ts(314,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
tests/cases/compiler/privacyImportParseErrors.ts(314,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||||
tests/cases/compiler/privacyImportParseErrors.ts(326,9): error TS1029: 'export' modifier must precede 'declare' modifier.
|
tests/cases/compiler/privacyImportParseErrors.ts(326,9): error TS1029: 'export' modifier must precede 'declare' modifier.
|
||||||
tests/cases/compiler/privacyImportParseErrors.ts(328,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
tests/cases/compiler/privacyImportParseErrors.ts(344,9): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
|
tests/cases/compiler/privacyImportParseErrors.ts(353,9): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
tests/cases/compiler/privacyImportParseErrors.ts(22,27): error TS2435: Ambient external modules cannot be nested in other modules.
|
tests/cases/compiler/privacyImportParseErrors.ts(22,27): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||||
tests/cases/compiler/privacyImportParseErrors.ts(30,20): error TS2435: Ambient external modules cannot be nested in other modules.
|
tests/cases/compiler/privacyImportParseErrors.ts(30,20): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||||
tests/cases/compiler/privacyImportParseErrors.ts(59,37): error TS2307: Cannot find external module 'm1_M3_public'.
|
tests/cases/compiler/privacyImportParseErrors.ts(59,37): error TS2307: Cannot find external module 'm1_M3_public'.
|
||||||
|
@ -33,7 +38,7 @@ tests/cases/compiler/privacyImportParseErrors.ts(333,16): error TS2435: Ambient
|
||||||
tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient external modules cannot be nested in other modules.
|
tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/privacyImportParseErrors.ts (33 errors) ====
|
==== tests/cases/compiler/privacyImportParseErrors.ts (38 errors) ====
|
||||||
export module m1 {
|
export module m1 {
|
||||||
export module m1_M1_public {
|
export module m1_M1_public {
|
||||||
export class c1 {
|
export class c1 {
|
||||||
|
@ -97,6 +102,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient
|
||||||
var m1_im2_private_v4_private = m1_im2_private.f1();
|
var m1_im2_private_v4_private = m1_im2_private.f1();
|
||||||
|
|
||||||
import m1_im3_private = require("m1_M3_public");
|
import m1_im3_private = require("m1_M3_public");
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
!!! error TS2307: Cannot find external module 'm1_M3_public'.
|
!!! error TS2307: Cannot find external module 'm1_M3_public'.
|
||||||
export var m1_im3_private_v1_public = m1_im3_private.c1;
|
export var m1_im3_private_v1_public = m1_im3_private.c1;
|
||||||
|
@ -189,6 +196,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient
|
||||||
var m1_im2_private_v4_private = m1_im2_private.f1();
|
var m1_im2_private_v4_private = m1_im2_private.f1();
|
||||||
|
|
||||||
import m1_im3_private = require("m2_M3_public");
|
import m1_im3_private = require("m2_M3_public");
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
!!! error TS2307: Cannot find external module 'm2_M3_public'.
|
!!! error TS2307: Cannot find external module 'm2_M3_public'.
|
||||||
export var m1_im3_private_v1_public = m1_im3_private.c1;
|
export var m1_im3_private_v1_public = m1_im3_private.c1;
|
||||||
|
@ -347,6 +356,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient
|
||||||
|
|
||||||
module m5 {
|
module m5 {
|
||||||
import m5_errorImport = require("glo_M2_public");
|
import m5_errorImport = require("glo_M2_public");
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
import m5_nonerrorImport = glo_M1_public;
|
import m5_nonerrorImport = glo_M1_public;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,6 +395,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient
|
||||||
|
|
||||||
module m5 {
|
module m5 {
|
||||||
import m5_errorImport = require("glo_M4_private");
|
import m5_errorImport = require("glo_M4_private");
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
import m5_nonerrorImport = glo_M3_private;
|
import m5_nonerrorImport = glo_M3_private;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -420,8 +433,6 @@ tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient
|
||||||
!!! error TS2435: Ambient external modules cannot be nested in other modules.
|
!!! error TS2435: Ambient external modules cannot be nested in other modules.
|
||||||
module m2 {
|
module m2 {
|
||||||
declare module "abc" {
|
declare module "abc" {
|
||||||
~~~~~~~
|
|
||||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
|
||||||
~~~~~
|
~~~~~
|
||||||
!!! error TS2435: Ambient external modules cannot be nested in other modules.
|
!!! error TS2435: Ambient external modules cannot be nested in other modules.
|
||||||
}
|
}
|
||||||
|
@ -444,6 +455,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient
|
||||||
module m4 {
|
module m4 {
|
||||||
var a = 10;
|
var a = 10;
|
||||||
import m2 = require("use_glo_M1_public");
|
import m2 = require("use_glo_M1_public");
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -453,6 +466,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient
|
||||||
module m4 {
|
module m4 {
|
||||||
var a = 10;
|
var a = 10;
|
||||||
import m2 = require("use_glo_M1_public");
|
import m2 = require("use_glo_M1_public");
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,8 +1,7 @@
|
||||||
testGlo.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
testGlo.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
testGlo.ts(21,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
|
|
||||||
|
|
||||||
==== testGlo.ts (2 errors) ====
|
==== testGlo.ts (1 errors) ====
|
||||||
module m2 {
|
module m2 {
|
||||||
export import mExported = require("mExported");
|
export import mExported = require("mExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -26,8 +25,6 @@ testGlo.ts(21,5): error TS1147: Import declarations in an internal module cannot
|
||||||
}
|
}
|
||||||
|
|
||||||
import mNonExported = require("mNonExported");
|
import mNonExported = require("mNonExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
export var c3 = new mNonExported.mne.class1;
|
export var c3 = new mNonExported.mne.class1;
|
||||||
export function f3() {
|
export function f3() {
|
||||||
return new mNonExported.mne.class1();
|
return new mNonExported.mne.class1();
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
testGlo.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
testGlo.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
testGlo.ts(21,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
|
|
||||||
|
|
||||||
==== testGlo.ts (2 errors) ====
|
==== testGlo.ts (1 errors) ====
|
||||||
module m2 {
|
module m2 {
|
||||||
export import mExported = require("mExported");
|
export import mExported = require("mExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -26,8 +25,6 @@ testGlo.ts(21,5): error TS1147: Import declarations in an internal module cannot
|
||||||
}
|
}
|
||||||
|
|
||||||
import mNonExported = require("mNonExported");
|
import mNonExported = require("mNonExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
export var c3 = new mNonExported.mne.class1;
|
export var c3 = new mNonExported.mne.class1;
|
||||||
export function f3() {
|
export function f3() {
|
||||||
return new mNonExported.mne.class1();
|
return new mNonExported.mne.class1();
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
test.ts(5,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
test.ts(5,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
test.ts(24,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
|
|
||||||
|
|
||||||
==== test.ts (2 errors) ====
|
==== test.ts (1 errors) ====
|
||||||
export module m1 {
|
export module m1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +28,6 @@ test.ts(24,5): error TS1147: Import declarations in an internal module cannot re
|
||||||
}
|
}
|
||||||
|
|
||||||
import mNonExported = require("mNonExported");
|
import mNonExported = require("mNonExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
export var c3 = new mNonExported.mne.class1;
|
export var c3 = new mNonExported.mne.class1;
|
||||||
export function f3() {
|
export function f3() {
|
||||||
return new mNonExported.mne.class1();
|
return new mNonExported.mne.class1();
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
test.ts(5,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
test.ts(5,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
test.ts(24,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
|
|
||||||
|
|
||||||
==== test.ts (2 errors) ====
|
==== test.ts (1 errors) ====
|
||||||
export module m1 {
|
export module m1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +28,6 @@ test.ts(24,5): error TS1147: Import declarations in an internal module cannot re
|
||||||
}
|
}
|
||||||
|
|
||||||
import mNonExported = require("mNonExported");
|
import mNonExported = require("mNonExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
export var c3 = new mNonExported.mne.class1;
|
export var c3 = new mNonExported.mne.class1;
|
||||||
export function f3() {
|
export function f3() {
|
||||||
return new mNonExported.mne.class1();
|
return new mNonExported.mne.class1();
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
test.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
test.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
test.ts(42,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
|
|
||||||
|
|
||||||
==== test.ts (2 errors) ====
|
==== test.ts (1 errors) ====
|
||||||
export module m2 {
|
export module m2 {
|
||||||
export import mExported = require("mExported");
|
export import mExported = require("mExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -47,8 +46,6 @@ test.ts(42,5): error TS1147: Import declarations in an internal module cannot re
|
||||||
}
|
}
|
||||||
|
|
||||||
import mNonExported = require("mNonExported");
|
import mNonExported = require("mNonExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
module Internal_M3 {
|
module Internal_M3 {
|
||||||
export var c3 = new mNonExported.mne.class1;
|
export var c3 = new mNonExported.mne.class1;
|
||||||
export function f3() {
|
export function f3() {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
test.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
test.ts(2,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
||||||
test.ts(42,5): error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
|
|
||||||
|
|
||||||
==== test.ts (2 errors) ====
|
==== test.ts (1 errors) ====
|
||||||
export module m2 {
|
export module m2 {
|
||||||
export import mExported = require("mExported");
|
export import mExported = require("mExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -47,8 +46,6 @@ test.ts(42,5): error TS1147: Import declarations in an internal module cannot re
|
||||||
}
|
}
|
||||||
|
|
||||||
import mNonExported = require("mNonExported");
|
import mNonExported = require("mNonExported");
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
|
|
||||||
module Internal_M3 {
|
module Internal_M3 {
|
||||||
export var c3 = new mNonExported.mne.class1;
|
export var c3 = new mNonExported.mne.class1;
|
||||||
export function f3() {
|
export function f3() {
|
||||||
|
|
Loading…
Reference in a new issue