mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-15 14:05:47 -05:00
Move ambient function block checks to the grammar checker.
This commit is contained in:
@@ -3156,21 +3156,16 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function parseAndCheckFunctionBody(isConstructor: boolean): Block {
|
||||
var initialPosition = scanner.getTokenPos();
|
||||
var errorCountBeforeBody = file._parserDiagnostics.length;
|
||||
function parseFunctionBlockOrSemicolon(): Block {
|
||||
if (token === SyntaxKind.OpenBraceToken) {
|
||||
var body = parseBody(/* ignoreMissingOpenBrace */ false);
|
||||
if (body && inAmbientContext && file._parserDiagnostics.length === errorCountBeforeBody) {
|
||||
var diagnostic = isConstructor ? Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context : Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context;
|
||||
grammarErrorAtPos(initialPosition, 1, diagnostic);
|
||||
}
|
||||
return body;
|
||||
return parseBody(/* ignoreMissingOpenBrace */ false);
|
||||
}
|
||||
|
||||
if (canParseSemicolon()) {
|
||||
parseSemicolon();
|
||||
return undefined;
|
||||
}
|
||||
|
||||
error(Diagnostics.Block_or_expected); // block or ';' expected
|
||||
}
|
||||
|
||||
@@ -3225,7 +3220,7 @@ module ts {
|
||||
node.typeParameters = sig.typeParameters;
|
||||
node.parameters = sig.parameters;
|
||||
node.type = sig.type;
|
||||
node.body = parseAndCheckFunctionBody(/*isConstructor*/ false);
|
||||
node.body = parseFunctionBlockOrSemicolon();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -3237,7 +3232,7 @@ module ts {
|
||||
node.typeParameters = sig.typeParameters;
|
||||
node.parameters = sig.parameters;
|
||||
node.type = sig.type;
|
||||
node.body = parseAndCheckFunctionBody(/*isConstructor*/ true);
|
||||
node.body = parseFunctionBlockOrSemicolon();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -3258,7 +3253,7 @@ module ts {
|
||||
method.typeParameters = sig.typeParameters;
|
||||
method.parameters = sig.parameters;
|
||||
method.type = sig.type;
|
||||
method.body = parseAndCheckFunctionBody(/*isConstructor*/ false);
|
||||
method.body = parseFunctionBlockOrSemicolon();
|
||||
return finishNode(method);
|
||||
}
|
||||
else {
|
||||
@@ -4152,7 +4147,8 @@ module ts {
|
||||
checkTypeParameterList(node.typeParameters) ||
|
||||
checkParameterList(node.parameters) ||
|
||||
checkConstructorTypeParameters(node) ||
|
||||
checkConstructorTypeAnnotation(node);
|
||||
checkConstructorTypeAnnotation(node) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ true);
|
||||
}
|
||||
|
||||
function checkConstructorTypeParameters(node: ConstructorDeclaration) {
|
||||
@@ -4242,7 +4238,8 @@ module ts {
|
||||
function visitFunctionDeclaration(node: FunctionLikeDeclaration) {
|
||||
checkTypeParameterList(node.typeParameters) ||
|
||||
checkParameterList(node.parameters) ||
|
||||
checkFunctionName(node.name);
|
||||
checkFunctionName(node.name) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false);
|
||||
}
|
||||
|
||||
function visitFunctionExpression(node: FunctionExpression) {
|
||||
@@ -4314,7 +4311,17 @@ module ts {
|
||||
|
||||
function visitMethod(node: MethodDeclaration) {
|
||||
checkTypeParameterList(node.typeParameters) ||
|
||||
checkParameterList(node.parameters);
|
||||
checkParameterList(node.parameters) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false);
|
||||
}
|
||||
|
||||
function checkForBodyInAmbientContext(body: Block | Expression, isConstructor: boolean): boolean {
|
||||
if (inAmbientContext && body && body.kind === SyntaxKind.FunctionBlock) {
|
||||
var diagnostic = isConstructor
|
||||
? Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context
|
||||
: Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context;
|
||||
return grammarErrorOnFirstToken(body, diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
function visitModuleDeclaration(node: ModuleDeclaration): void {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(35,19): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(37,18): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(38,11): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||
@@ -12,7 +7,7 @@ tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient e
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements.
|
||||
|
||||
|
||||
==== tests/cases/conformance/ambient/ambientErrors.ts (12 errors) ====
|
||||
==== tests/cases/conformance/ambient/ambientErrors.ts (7 errors) ====
|
||||
// Ambient variable with an initializer
|
||||
declare var x = 4;
|
||||
|
||||
@@ -37,8 +32,6 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
|
||||
|
||||
// Ambient function with function body
|
||||
declare function fn4() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
||||
// Ambient enum with non - integer literal constant member
|
||||
declare enum E1 {
|
||||
@@ -54,8 +47,6 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
|
||||
declare module M1 {
|
||||
var x = 3;
|
||||
function fn() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
class C {
|
||||
static x = 3;
|
||||
~
|
||||
@@ -64,14 +55,8 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
|
||||
~
|
||||
!!! error TS1039: Initializers are not allowed in ambient contexts.
|
||||
constructor() { }
|
||||
~
|
||||
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
fn() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static sfn() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
tests/cases/compiler/exportDeclareClass1.ts(2,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/exportDeclareClass1.ts(2,24): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/compiler/exportDeclareClass1.ts(3,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/exportDeclareClass1.ts(3,34): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/exportDeclareClass1.ts (4 errors) ====
|
||||
==== tests/cases/compiler/exportDeclareClass1.ts (2 errors) ====
|
||||
export declare class eaC {
|
||||
static tF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
static tsF(param:any) { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
};
|
||||
|
||||
@@ -10,27 +10,12 @@ tests/cases/compiler/giant.ts(93,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(95,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(99,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(101,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(154,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(168,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(170,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(172,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(174,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(178,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(180,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(233,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(238,35): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(240,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(243,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(244,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(245,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(247,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(249,23): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(251,32): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(254,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(255,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(257,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(262,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(267,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(283,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(285,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(287,5): error TS1005: '{' expected.
|
||||
@@ -43,55 +28,16 @@ tests/cases/compiler/giant.ts(351,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(353,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(357,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(359,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(412,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(426,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(428,9): error TS1005: '{' expected.
|
||||
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(436,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(438,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(491,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(496,35): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(498,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(501,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(502,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(503,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(505,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(507,23): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(509,32): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(512,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(513,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(515,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(520,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(525,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(532,31): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(534,20): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(537,17): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(538,18): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(539,18): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(541,27): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(543,19): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(545,28): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(548,17): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(549,27): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(551,18): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(556,18): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(558,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(561,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(563,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(606,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(611,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
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(616,39): error TS1037: A function implementation cannot be declared in an 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(621,26): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(623,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(626,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(628,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(672,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(676,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
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 TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
@@ -228,7 +174,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 (228 errors) ====
|
||||
==== tests/cases/compiler/giant.ts (174 errors) ====
|
||||
|
||||
/*
|
||||
Prefixes
|
||||
@@ -471,8 +417,6 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
export module eM { };
|
||||
export declare var eaV;
|
||||
export declare function eaF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export declare class eaC { };
|
||||
export declare module eaM { };
|
||||
}
|
||||
@@ -596,54 +540,36 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
export module eM { };
|
||||
export declare var eaV;
|
||||
export declare function eaF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export declare class eaC { };
|
||||
export declare module eaM { };
|
||||
}
|
||||
export declare var eaV;
|
||||
export declare function eaF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export declare class eaC {
|
||||
constructor () { }
|
||||
~
|
||||
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
public pV;
|
||||
private rV;
|
||||
public pF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
private rF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public pgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
public get pgF()
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
public psF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
public set psF(param:any)
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
private rgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
private get rgF()
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
private rsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rsF'.
|
||||
private set rsF(param:any)
|
||||
@@ -651,19 +577,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
!!! error TS2300: Duplicate identifier 'rsF'.
|
||||
static tV;
|
||||
static tF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static tsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
static set tsF(param:any)
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
static tgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tgF'.
|
||||
static get tgF()
|
||||
@@ -673,15 +593,11 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
export declare module eaM {
|
||||
var V;
|
||||
function F() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
class C { }
|
||||
interface I { }
|
||||
module M { }
|
||||
export var eV;
|
||||
export function eF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export class eC { }
|
||||
export interface eI { }
|
||||
export module eM { }
|
||||
@@ -915,8 +831,6 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
export module eM { };
|
||||
export declare var eaV;
|
||||
export declare function eaF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export declare class eaC { };
|
||||
export declare module eaM { };
|
||||
}
|
||||
@@ -1040,54 +954,36 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
export module eM { };
|
||||
export declare var eaV;
|
||||
export declare function eaF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export declare class eaC { };
|
||||
export declare module eaM { };
|
||||
}
|
||||
export declare var eaV;
|
||||
export declare function eaF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export declare class eaC {
|
||||
constructor () { }
|
||||
~
|
||||
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
public pV;
|
||||
private rV;
|
||||
public pF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
private rF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public pgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
public get pgF()
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
public psF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
public set psF(param:any)
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
private rgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
private get rgF()
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
private rsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rsF'.
|
||||
private set rsF(param:any)
|
||||
@@ -1095,19 +991,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
!!! error TS2300: Duplicate identifier 'rsF'.
|
||||
static tV;
|
||||
static tF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static tsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
static set tsF(param:any)
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
static tgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tgF'.
|
||||
static get tgF()
|
||||
@@ -1117,15 +1007,11 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
export declare module eaM {
|
||||
var V;
|
||||
function F() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
class C { }
|
||||
interface I { }
|
||||
module M { }
|
||||
export var eV;
|
||||
export function eF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export class eC { }
|
||||
export interface eI { }
|
||||
export module eM { }
|
||||
@@ -1133,47 +1019,31 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
}
|
||||
export declare var eaV;
|
||||
export declare function eaF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export declare class eaC {
|
||||
constructor () { }
|
||||
~
|
||||
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
public pV;
|
||||
private rV;
|
||||
public pF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
private rF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
public pgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
public get pgF()
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'pgF'.
|
||||
public psF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
public set psF(param:any)
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'psF'.
|
||||
private rgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
private get rgF()
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rgF'.
|
||||
private rsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'rsF'.
|
||||
private set rsF(param:any)
|
||||
@@ -1181,19 +1051,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
!!! error TS2300: Duplicate identifier 'rsF'.
|
||||
static tV;
|
||||
static tF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static tsF(param:any) { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
static set tsF(param:any)
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tsF'.
|
||||
static tgF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'tgF'.
|
||||
static get tgF()
|
||||
@@ -1203,21 +1067,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
export declare module eaM {
|
||||
var V;
|
||||
function F() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
class C {
|
||||
constructor () { }
|
||||
~
|
||||
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
public pV;
|
||||
private rV;
|
||||
public pF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static tV;
|
||||
static tF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
}
|
||||
interface I {
|
||||
//Call Signature
|
||||
@@ -1263,15 +1119,11 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
module M {
|
||||
var V;
|
||||
function F() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
class C { }
|
||||
interface I { }
|
||||
module M { }
|
||||
export var eV;
|
||||
export function eF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export class eC { }
|
||||
export interface eI { }
|
||||
export module eM { }
|
||||
@@ -1281,8 +1133,6 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
export declare function eaF() { };
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export declare class eaC { }
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
@@ -1292,21 +1142,13 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
}
|
||||
export var eV;
|
||||
export function eF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export class eC {
|
||||
constructor () { }
|
||||
~
|
||||
!!! error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
public pV;
|
||||
private rV;
|
||||
public pF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
static tV
|
||||
static tF() { }
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
}
|
||||
export interface eI {
|
||||
//Call Signature
|
||||
@@ -1353,14 +1195,10 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
||||
export module eM {
|
||||
var V;
|
||||
function F() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
class C { }
|
||||
module M { }
|
||||
export var eV;
|
||||
export function eF() { };
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
export class eC { }
|
||||
export interface eI { }
|
||||
export module eM { }
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
tests/cases/conformance/externalModules/initializersInDeclarations.ts(5,7): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/conformance/externalModules/initializersInDeclarations.ts(6,14): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/conformance/externalModules/initializersInDeclarations.ts(7,16): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/initializersInDeclarations.ts (3 errors) ====
|
||||
==== tests/cases/conformance/externalModules/initializersInDeclarations.ts (2 errors) ====
|
||||
|
||||
// Errors: Initializers & statements in declaration file
|
||||
|
||||
@@ -15,8 +14,6 @@ tests/cases/conformance/externalModules/initializersInDeclarations.ts(7,16): err
|
||||
~
|
||||
!!! error TS1039: Initializers are not allowed in ambient contexts.
|
||||
fn(): boolean {
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.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/FunctionDeclarations/parserFunctionDeclaration2.d.ts(1,14): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration2.d.ts (1 errors) ====
|
||||
function F() {
|
||||
~~~~~~~~
|
||||
!!! error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file.
|
||||
~
|
||||
!!! error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
}
|
||||
Reference in New Issue
Block a user