mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
PR feedback
This commit is contained in:
+47
-30
@@ -103,7 +103,7 @@ module ts {
|
||||
let globalTypedPropertyDescriptorType: ObjectType;
|
||||
let globalClassDecoratorType: ObjectType;
|
||||
let globalClassAnnotationType: ObjectType;
|
||||
let globalParameterAnnotationType: ObjectType;
|
||||
let globalParameterDecoratorType: ObjectType;
|
||||
let globalPropertyAnnotationType: ObjectType;
|
||||
let globalPropertyDecoratorType: ObjectType;
|
||||
|
||||
@@ -417,22 +417,23 @@ module ts {
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Decorator:
|
||||
if (location.parent) {
|
||||
// Decorators are resolved at the class declaration as that point where they are evaluated in the emit:
|
||||
//
|
||||
// function y() {}
|
||||
// class C {
|
||||
// method(@y x, y) {} // <-- All references to decorators should occur at the class declaration
|
||||
// }
|
||||
//
|
||||
let parent = location.parent;
|
||||
if (parent && parent.kind === SyntaxKind.Parameter) {
|
||||
parent = parent.parent;
|
||||
}
|
||||
if (parent && isClassElement(parent)) {
|
||||
parent = parent.parent;
|
||||
}
|
||||
if (parent) {
|
||||
lastLocation = location;
|
||||
grandparent = location.parent.parent;
|
||||
if (location.parent.kind === SyntaxKind.Parameter) {
|
||||
// Parameter decorators are resolved in the context of their great-grandparent
|
||||
if (grandparent) {
|
||||
location = grandparent.parent;
|
||||
}
|
||||
else {
|
||||
break loop;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// all other decorators are resolved in the context of their grandparent
|
||||
location = grandparent;
|
||||
}
|
||||
location = parent;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@@ -8121,8 +8122,8 @@ module ts {
|
||||
checkFunctionLikeDeclaration(node);
|
||||
}
|
||||
|
||||
function checkIncompleteDeclaration(node: Declaration) {
|
||||
error(node, Diagnostics.Declaration_expected);
|
||||
function checkMissingDeclaration(node: Node) {
|
||||
checkDecorators(node);
|
||||
}
|
||||
|
||||
function checkTypeReference(node: TypeReferenceNode) {
|
||||
@@ -8538,9 +8539,9 @@ module ts {
|
||||
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
let classSymbol = getSymbolOfNode(node.parent);
|
||||
let classSymbol = getSymbolOfNode(node.parent);
|
||||
let classType = getTypeOfSymbol(classSymbol);
|
||||
checkDecoratorSignature(node, exprType, globalClassAnnotationType, classType, globalClassDecoratorType, Diagnostics.Decorators_may_not_change_the_type_of_a_class);
|
||||
checkDecoratorSignature(node, exprType, globalClassAnnotationType, classType, globalClassDecoratorType, Diagnostics.A_decorator_may_not_change_the_type_of_a_class);
|
||||
break;
|
||||
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
@@ -8548,11 +8549,11 @@ module ts {
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
let propertyType = getTypeOfNode(node.parent);
|
||||
checkDecoratorSignature(node, exprType, globalPropertyAnnotationType, propertyType, globalPropertyDecoratorType, Diagnostics.Decorators_may_not_change_the_type_of_a_member);
|
||||
checkDecoratorSignature(node, exprType, globalPropertyAnnotationType, propertyType, globalPropertyDecoratorType, Diagnostics.A_decorator_may_not_change_the_type_of_a_member);
|
||||
break;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
checkDecoratorSignature(node, exprType, globalParameterAnnotationType);
|
||||
checkDecoratorSignature(node, exprType, globalParameterDecoratorType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -8561,7 +8562,7 @@ module ts {
|
||||
function checkDecorators(node: Node): void {
|
||||
if (!node.decorators) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
@@ -10330,8 +10331,6 @@ module ts {
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return checkAccessorDeclaration(<AccessorDeclaration>node);
|
||||
case SyntaxKind.IncompleteDeclaration:
|
||||
return checkIncompleteDeclaration(<Declaration>node);
|
||||
case SyntaxKind.TypeReference:
|
||||
return checkTypeReference(<TypeReferenceNode>node);
|
||||
case SyntaxKind.TypeQuery:
|
||||
@@ -10410,6 +10409,8 @@ module ts {
|
||||
case SyntaxKind.DebuggerStatement:
|
||||
checkGrammarStatementInAmbientContext(node);
|
||||
return;
|
||||
case SyntaxKind.MissingDeclaration:
|
||||
return checkMissingDeclaration(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11315,6 +11316,20 @@ module ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getAnnotationTypeForDecoratorType(type: Type, typeArgument: Type): Type {
|
||||
if (type === unknownType) {
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
let signature = getSingleCallSignature(type);
|
||||
if (!signature) {
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
let instantiatedSignature = getSignatureInstantiation(signature, [typeArgument]);
|
||||
return getOrCreateTypeFromSignature(instantiatedSignature);
|
||||
}
|
||||
|
||||
function createResolver(): EmitResolver {
|
||||
return {
|
||||
getGeneratedNameForNode,
|
||||
@@ -11365,10 +11380,10 @@ module ts {
|
||||
globalRegExpType = getGlobalType("RegExp");
|
||||
globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1);
|
||||
globalClassDecoratorType = getGlobalType("ClassDecorator");
|
||||
globalClassAnnotationType = getAnnotationTypeForDecoratorType(globalClassDecoratorType, globalFunctionType);
|
||||
globalPropertyDecoratorType = getGlobalType("PropertyDecorator");
|
||||
globalClassAnnotationType = getGlobalType("ClassAnnotation");
|
||||
globalPropertyAnnotationType = getGlobalType("PropertyAnnotation");
|
||||
globalParameterAnnotationType = getGlobalType("ParameterAnnotation");
|
||||
globalPropertyAnnotationType = getAnnotationTypeForDecoratorType(globalPropertyDecoratorType, anyType);
|
||||
globalParameterDecoratorType = getGlobalType("ParameterDecorator");
|
||||
|
||||
// If we're in ES6 mode, load the TemplateStringsArray.
|
||||
// Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios.
|
||||
@@ -11402,6 +11417,9 @@ module ts {
|
||||
while (target) {
|
||||
switch (target.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
if (languageVersion < ScriptTarget.ES5) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher);
|
||||
}
|
||||
return false;
|
||||
|
||||
case SyntaxKind.Constructor:
|
||||
@@ -11414,7 +11432,6 @@ module ts {
|
||||
target = target.parent;
|
||||
continue;
|
||||
|
||||
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -11426,7 +11443,7 @@ module ts {
|
||||
}
|
||||
break;
|
||||
}
|
||||
return grammarErrorOnNode(node, Diagnostics.Decorators_are_not_valid_on_this_declaration_type);
|
||||
return grammarErrorOnNode(node, Diagnostics.Decorators_are_not_valid_here);
|
||||
}
|
||||
|
||||
function checkGrammarModifiers(node: Node): boolean {
|
||||
|
||||
@@ -162,11 +162,10 @@ module ts {
|
||||
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
|
||||
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
|
||||
Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." },
|
||||
Decorators_are_only_supported_on_class_members_when_targeting_ECMAScript_5_or_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only supported on class members when targeting ECMAScript 5 or higher." },
|
||||
Decorators_are_not_valid_on_this_declaration_type: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid on this declaration type." },
|
||||
Argument_to_ambient_decorator_must_be_constant_expression: { code: 1207, category: DiagnosticCategory.Error, key: "Argument to ambient decorator must be constant expression." },
|
||||
Decorators_may_not_change_the_type_of_a_member: { code: 1208, category: DiagnosticCategory.Error, key: "Decorators may not change the type of a member." },
|
||||
Decorators_may_not_change_the_type_of_a_class: { code: 1209, category: DiagnosticCategory.Error, key: "Decorators may not change the type of a class." },
|
||||
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
|
||||
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
|
||||
A_decorator_may_not_change_the_type_of_a_member: { code: 1208, category: DiagnosticCategory.Error, key: "A decorator may not change the type of a member." },
|
||||
A_decorator_may_not_change_the_type_of_a_class: { code: 1209, category: DiagnosticCategory.Error, key: "A decorator may not change the type of a class." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
|
||||
@@ -639,23 +639,19 @@
|
||||
"category": "Error",
|
||||
"code": 1204
|
||||
},
|
||||
"Decorators are only supported on class members when targeting ECMAScript 5 or higher.": {
|
||||
"Decorators are only available when targeting ECMAScript 5 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 1205
|
||||
},
|
||||
"Decorators are not valid on this declaration type.": {
|
||||
"Decorators are not valid here.": {
|
||||
"category": "Error",
|
||||
"code": 1206
|
||||
},
|
||||
"Argument to ambient decorator must be constant expression.": {
|
||||
"category": "Error",
|
||||
"code": 1207
|
||||
},
|
||||
"Decorators may not change the type of a member.": {
|
||||
"A decorator may not change the type of a member.": {
|
||||
"category": "Error",
|
||||
"code": 1208
|
||||
},
|
||||
"Decorators may not change the type of a class.": {
|
||||
"A decorator may not change the type of a class.": {
|
||||
"category": "Error",
|
||||
"code": 1209
|
||||
},
|
||||
|
||||
@@ -277,6 +277,14 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration {
|
||||
return forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.Constructor && nodeIsPresent((<ConstructorDeclaration>member).body)) {
|
||||
return <ConstructorDeclaration>member;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration) {
|
||||
let firstAccessor: AccessorDeclaration;
|
||||
let lastAccessor: AccessorDeclaration;
|
||||
|
||||
+59
-308
@@ -119,9 +119,7 @@ module ts {
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
return visitNodes(cbNodes, (<BindingPattern>node).elements);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return visitNode(cbNode, (<ArrayLiteralExpression>node).openBracketToken) ||
|
||||
visitNodes(cbNodes, (<ArrayLiteralExpression>node).elements) ||
|
||||
visitNode(cbNode, (<ArrayLiteralExpression>node).closeBracketToken);
|
||||
return visitNodes(cbNodes, (<ArrayLiteralExpression>node).elements);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return visitNodes(cbNodes, (<ObjectLiteralExpression>node).properties);
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
@@ -130,9 +128,7 @@ module ts {
|
||||
visitNode(cbNode, (<PropertyAccessExpression>node).name);
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
return visitNode(cbNode, (<ElementAccessExpression>node).expression) ||
|
||||
visitNode(cbNode, (<ElementAccessExpression>node).openBracketToken) ||
|
||||
visitNode(cbNode, (<ElementAccessExpression>node).argumentExpression) ||
|
||||
visitNode(cbNode, (<ElementAccessExpression>node).closeBracketToken);
|
||||
visitNode(cbNode, (<ElementAccessExpression>node).argumentExpression);
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
return visitNode(cbNode, (<CallExpression>node).expression) ||
|
||||
@@ -239,8 +235,7 @@ module ts {
|
||||
return visitNode(cbNode, (<CatchClause>node).variableDeclaration) ||
|
||||
visitNode(cbNode, (<CatchClause>node).block);
|
||||
case SyntaxKind.Decorator:
|
||||
return visitNode(cbNode, (<Decorator>node).atToken) ||
|
||||
visitNode(cbNode, (<Decorator>node).expression);
|
||||
return visitNode(cbNode, (<Decorator>node).expression);
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return visitNodes(cbNodes, node.decorators) ||
|
||||
visitNodes(cbNodes, node.modifiers) ||
|
||||
@@ -315,9 +310,8 @@ module ts {
|
||||
return visitNodes(cbNodes, (<HeritageClause>node).types);
|
||||
case SyntaxKind.ExternalModuleReference:
|
||||
return visitNode(cbNode, (<ExternalModuleReference>node).expression);
|
||||
case SyntaxKind.IncompleteDeclaration:
|
||||
return visitNodes(cbNodes, node.decorators) ||
|
||||
visitNodes(cbNodes, node.modifiers);
|
||||
case SyntaxKind.MissingDeclaration:
|
||||
return visitNodes(cbNodes, node.decorators);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,12 +346,6 @@ module ts {
|
||||
Unknown
|
||||
}
|
||||
|
||||
interface SignatureResult {
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
parameters?: NodeArray<ParameterDeclaration>;
|
||||
type?: TypeNode;
|
||||
}
|
||||
|
||||
function parsingContextErrors(context: ParsingContext): DiagnosticMessage {
|
||||
switch (context) {
|
||||
case ParsingContext.SourceElements: return Diagnostics.Declaration_or_statement_expected;
|
||||
@@ -1016,6 +1004,8 @@ module ts {
|
||||
}
|
||||
|
||||
function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: SyntaxCursor, setParentNodes = false): SourceFile {
|
||||
const disallowInAndDecoratorContext = ParserContextFlags.DisallowIn | ParserContextFlags.Decorator;
|
||||
|
||||
let parsingContext: ParsingContext = 0;
|
||||
let identifiers: Map<string> = {};
|
||||
let identifierCount = 0;
|
||||
@@ -1163,6 +1153,19 @@ module ts {
|
||||
setContextFlag(val, ParserContextFlags.Decorator);
|
||||
}
|
||||
|
||||
function doOutsideOfContext<T>(flags: ParserContextFlags, func: () => T): T {
|
||||
let currentContextFlags = contextFlags & flags;
|
||||
if (currentContextFlags) {
|
||||
setContextFlag(false, currentContextFlags);
|
||||
let result = func();
|
||||
setContextFlag(true, currentContextFlags);
|
||||
return result;
|
||||
}
|
||||
|
||||
// no need to do anything special as we are not in any of the requested contexts
|
||||
return func();
|
||||
}
|
||||
|
||||
function allowInAnd<T>(func: () => T): T {
|
||||
if (contextFlags & ParserContextFlags.DisallowIn) {
|
||||
setDisallowInContext(false);
|
||||
@@ -1223,18 +1226,6 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function doOutsideOfDecoratorContext<T>(func: () => T): T {
|
||||
if (contextFlags & ParserContextFlags.Decorator) {
|
||||
setDecoratorContext(false);
|
||||
let result = func();
|
||||
setDecoratorContext(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
// no need to do anything special if we're not in the [Decorator] context.
|
||||
return func();
|
||||
}
|
||||
|
||||
function inYieldContext() {
|
||||
return (contextFlags & ParserContextFlags.Yield) !== 0;
|
||||
}
|
||||
@@ -1447,12 +1438,8 @@ module ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
function finishNode<T extends Node>(node: T, end?: number): T {
|
||||
if (!(end >= 0)) {
|
||||
end = scanner.getStartPos();
|
||||
}
|
||||
|
||||
node.end = end;
|
||||
function finishNode<T extends Node>(node: T): T {
|
||||
node.end = scanner.getStartPos();
|
||||
|
||||
if (contextFlags) {
|
||||
node.parserContextFlags = contextFlags;
|
||||
@@ -1468,14 +1455,7 @@ module ts {
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function createMissingNodeAtPosition(pos: number, kind: SyntaxKind, diagnosticMessage: DiagnosticMessage, arg0?: any): Node {
|
||||
parseErrorAtPosition(pos, 0, diagnosticMessage, arg0);
|
||||
let result = createNode(kind, pos);
|
||||
(<Identifier>result).text = "";
|
||||
return finishNode(result, pos);
|
||||
}
|
||||
|
||||
|
||||
function createMissingNode(kind: SyntaxKind, reportAtCurrentPosition: boolean, diagnosticMessage: DiagnosticMessage, arg0?: any): Node {
|
||||
if (reportAtCurrentPosition) {
|
||||
parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0);
|
||||
@@ -3294,7 +3274,7 @@ module ts {
|
||||
let node = <ConditionalExpression>createNode(SyntaxKind.ConditionalExpression, leftOperand.pos);
|
||||
node.condition = leftOperand;
|
||||
node.questionToken = questionToken;
|
||||
node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher);
|
||||
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
|
||||
node.colonToken = parseExpectedToken(SyntaxKind.ColonToken, /*reportAtCurrentPosition:*/ false,
|
||||
Diagnostics._0_expected, tokenToString(SyntaxKind.ColonToken));
|
||||
node.whenFalse = parseAssignmentExpressionOrHigher();
|
||||
@@ -3585,11 +3565,10 @@ module ts {
|
||||
continue;
|
||||
}
|
||||
|
||||
let openBracketToken = parseOptionalToken(SyntaxKind.OpenBracketToken);
|
||||
if (openBracketToken) {
|
||||
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
|
||||
if (!inDecoratorContext() && parseOptional(SyntaxKind.OpenBracketToken)) {
|
||||
let indexedAccess = <ElementAccessExpression>createNode(SyntaxKind.ElementAccessExpression, expression.pos);
|
||||
indexedAccess.expression = expression;
|
||||
indexedAccess.openBracketToken = openBracketToken;
|
||||
|
||||
// It's not uncommon for a user to write: "new Type[]".
|
||||
// Check for that common pattern and report a better error message.
|
||||
@@ -3601,7 +3580,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
indexedAccess.closeBracketToken = parseExpectedToken(SyntaxKind.CloseBracketToken, /*reportAtCurrentPosition*/false, Diagnostics._0_expected, "]");
|
||||
parseExpected(SyntaxKind.CloseBracketToken);
|
||||
expression = finishNode(indexedAccess);
|
||||
continue;
|
||||
}
|
||||
@@ -3623,16 +3602,6 @@ module ts {
|
||||
function parseCallExpressionRest(expression: LeftHandSideExpression): LeftHandSideExpression {
|
||||
while (true) {
|
||||
expression = parseMemberExpressionRest(expression);
|
||||
if (inDecoratorContext() &&
|
||||
parsingContext === ParsingContext.ClassMembers &&
|
||||
(token === SyntaxKind.LessThanToken || token === SyntaxKind.OpenParenToken) &&
|
||||
(expression.kind === SyntaxKind.ElementAccessExpression || expression.kind === SyntaxKind.Identifier)) {
|
||||
// TODO(rbuckton): switch to tryParse and reuse the parsed signature information?
|
||||
let result = lookAhead(isStartOfMethodSignature);
|
||||
if (result) {
|
||||
return expression;
|
||||
}
|
||||
}
|
||||
if (token === SyntaxKind.LessThanToken) {
|
||||
// See if this is the start of a generic invocation. If so, consume it and
|
||||
// keep checking for postfix expressions. Otherwise, it's just a '<' that's
|
||||
@@ -3662,28 +3631,6 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isStartOfMethodSignature() {
|
||||
// try to parse it as a signature, if successful and we are followed by an open brace or semicolon, this is really a method signature
|
||||
var parameters: NodeArray<ParameterDeclaration>;
|
||||
var type: TypeNode;
|
||||
if (token === SyntaxKind.LessThanToken && !parseTypeParameters()) {
|
||||
// failed to parse type parameters here, this is not a method
|
||||
return false;
|
||||
}
|
||||
if (token === SyntaxKind.OpenParenToken) {
|
||||
if (!parseParameterList(/*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ true)) {
|
||||
// failed to parse a parameter list here, this is not a method
|
||||
return false;
|
||||
}
|
||||
if (token === SyntaxKind.ColonToken || token === SyntaxKind.SemicolonToken || token === SyntaxKind.OpenBraceToken) {
|
||||
// found a type annotation, semicolon, or open brace, this is a method signature
|
||||
type = parseTypeAnnotation();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function parseArgumentList() {
|
||||
parseExpected(SyntaxKind.OpenParenToken);
|
||||
let result = parseDelimitedList(ParsingContext.ArgumentExpressions, parseArgumentExpression);
|
||||
@@ -3801,15 +3748,15 @@ module ts {
|
||||
}
|
||||
|
||||
function parseArgumentExpression(): Expression {
|
||||
return allowInAnd(parseArgumentOrArrayLiteralElement);
|
||||
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
||||
}
|
||||
|
||||
function parseArrayLiteralExpression(): ArrayLiteralExpression {
|
||||
let node = <ArrayLiteralExpression>createNode(SyntaxKind.ArrayLiteralExpression);
|
||||
node.openBracketToken = parseExpectedToken(SyntaxKind.OpenBracketToken, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, "[");
|
||||
parseExpected(SyntaxKind.OpenBracketToken);
|
||||
if (scanner.hasPrecedingLineBreak()) node.flags |= NodeFlags.MultiLine;
|
||||
node.elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement);
|
||||
node.closeBracketToken = parseExpectedToken(SyntaxKind.CloseBracketToken, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, "]");
|
||||
parseExpected(SyntaxKind.CloseBracketToken);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -3928,6 +3875,8 @@ module ts {
|
||||
let savedYieldContext = inYieldContext();
|
||||
setYieldContext(allowYield);
|
||||
|
||||
// We may be in a [Decorator] context when parsing a function expression or
|
||||
// arrow function. The body of the function is not in [Decorator] context.
|
||||
let saveDecoratorContext = inDecoratorContext();
|
||||
if (saveDecoratorContext) {
|
||||
setDecoratorContext(false);
|
||||
@@ -4186,7 +4135,7 @@ module ts {
|
||||
// as the parser will produce the same FunctionDeclaraiton or VariableStatement if it has
|
||||
// the same text regardless of whether it is inside a block or not.
|
||||
if (isModifier(token)) {
|
||||
let result = lookAhead(parseVariableStatementOrFunctionDeclarationWithModifiers);
|
||||
let result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers);
|
||||
if (result) {
|
||||
return true;
|
||||
}
|
||||
@@ -4318,7 +4267,7 @@ module ts {
|
||||
// Even though variable statements and function declarations cannot have decorators,
|
||||
// we parse them here to provide better error recovery.
|
||||
if (isModifier(token) || token === SyntaxKind.AtToken) {
|
||||
let result = tryParse(parseVariableStatementOrFunctionDeclarationWithModifiers);
|
||||
let result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
@@ -4328,7 +4277,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function parseVariableStatementOrFunctionDeclarationWithModifiers(): FunctionDeclaration | VariableStatement {
|
||||
function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement {
|
||||
let start = scanner.getStartPos();
|
||||
let decorators = parseDecorators();
|
||||
let modifiers = parseModifiers();
|
||||
@@ -4522,10 +4471,22 @@ module ts {
|
||||
return finishNode(method);
|
||||
}
|
||||
|
||||
function parsePropertyDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, name: DeclarationName, questionToken: Node): ClassElement {
|
||||
let property = <PropertyDeclaration>createNode(SyntaxKind.PropertyDeclaration, fullStart);
|
||||
property.decorators = decorators;
|
||||
setModifiers(property, modifiers);
|
||||
property.name = name;
|
||||
property.questionToken = questionToken;
|
||||
property.type = parseTypeAnnotation();
|
||||
property.initializer = allowInAnd(parseNonParameterInitializer);
|
||||
parseSemicolon();
|
||||
return finishNode(property);
|
||||
}
|
||||
|
||||
function parsePropertyOrMethodDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ClassElement {
|
||||
let asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
let name = parsePropertyName();
|
||||
|
||||
|
||||
// Note: this is not legal as per the grammar. But we allow it in the parser and
|
||||
// report an error in the grammar checker.
|
||||
let questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
|
||||
@@ -4533,15 +4494,7 @@ module ts {
|
||||
return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, Diagnostics.or_expected);
|
||||
}
|
||||
else {
|
||||
let property = <PropertyDeclaration>createNode(SyntaxKind.PropertyDeclaration, fullStart);
|
||||
property.decorators = decorators;
|
||||
setModifiers(property, modifiers);
|
||||
property.name = name;
|
||||
property.questionToken = questionToken;
|
||||
property.type = parseTypeAnnotation();
|
||||
property.initializer = allowInAnd(parseNonParameterInitializer);
|
||||
parseSemicolon();
|
||||
return finishNode(property);
|
||||
return parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4620,7 +4573,8 @@ module ts {
|
||||
function parseDecorators(): NodeArray<Decorator> {
|
||||
let decorators: NodeArray<Decorator>;
|
||||
while (true) {
|
||||
if (token !== SyntaxKind.AtToken) {
|
||||
let decoratorStart = getNodePos();
|
||||
if (!parseOptional(SyntaxKind.AtToken)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4629,13 +4583,12 @@ module ts {
|
||||
decorators.pos = scanner.getStartPos();
|
||||
}
|
||||
|
||||
let decorator = <Decorator>createNode(SyntaxKind.Decorator);
|
||||
decorator.atToken = parseTokenNode();
|
||||
let decorator = <Decorator>createNode(SyntaxKind.Decorator, decoratorStart);
|
||||
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
|
||||
decorators.push(finishNode(decorator));
|
||||
}
|
||||
if (decorators) {
|
||||
decorators.end = scanner.getStartPos();
|
||||
decorators.end = getNodeEnd();
|
||||
}
|
||||
return decorators;
|
||||
}
|
||||
@@ -4665,211 +4618,6 @@ module ts {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
function extractCallExpressionFromDecoratorTail(decorator: Decorator): CallExpression {
|
||||
// We could have greedily parsed a method signature name as a call expression, so we extract it from the decorator.
|
||||
let expression = decorator.expression;
|
||||
if (expression.kind === SyntaxKind.CallExpression) {
|
||||
decorator.expression = (<CallExpression>expression).expression;
|
||||
decorator.end = decorator.expression.end;
|
||||
return <CallExpression>expression;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function extractDeclarationNameFromDecoratorTail(decorator: Decorator): DeclarationName {
|
||||
let expression = decorator.expression;
|
||||
let name: DeclarationName;
|
||||
switch (expression.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
// We could have greedily parsed a property name as an identifier, so
|
||||
// we extract it from the decorator for a better editor experience:
|
||||
// @
|
||||
// id() {}
|
||||
//
|
||||
var end = Math.min(getTokenPosOfNode(decorator.atToken, sourceFile) + 1, decorator.atToken.end);
|
||||
if (lineBreakBetween(sourceFile, end, getTokenPosOfNode(expression, sourceFile))) {
|
||||
decorator.expression = <LeftHandSideExpression>createMissingNodeAtPosition(end, SyntaxKind.Identifier, Diagnostics.Expression_expected);
|
||||
decorator.end = decorator.atToken.end;
|
||||
return <Identifier>expression;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
// We could have greedily parsed a computed property name as an array literal expression, so
|
||||
// we extract it from the decorator for a better editor experience:
|
||||
// @
|
||||
// ["computed"]() {}
|
||||
//
|
||||
var end = Math.min(getTokenPosOfNode(decorator.atToken, sourceFile) + 1, decorator.atToken.end);
|
||||
if (lineBreakBetween(sourceFile, end, getTokenPosOfNode(expression, sourceFile))) {
|
||||
let arrayExpr = <ArrayLiteralExpression>expression;
|
||||
decorator.expression = <LeftHandSideExpression>createMissingNodeAtPosition(end, SyntaxKind.Identifier, Diagnostics.Expression_expected);
|
||||
decorator.end = decorator.atToken.end;
|
||||
|
||||
var computedPropertyName = <ComputedPropertyName>createNode(SyntaxKind.ComputedPropertyName, arrayExpr.pos);
|
||||
if (arrayExpr.elements.length === 0) {
|
||||
end = Math.min(getTokenPosOfNode(arrayExpr.openBracketToken, sourceFile) + 1, arrayExpr.openBracketToken.end);
|
||||
computedPropertyName.expression = <Expression>createMissingNodeAtPosition(end, SyntaxKind.Identifier, Diagnostics.Expression_expected);
|
||||
}
|
||||
else {
|
||||
let i = arrayExpr.elements.length - 1;
|
||||
let expr = arrayExpr.elements[i--];
|
||||
while (i >= 0) {
|
||||
var element = arrayExpr.elements[i--];
|
||||
var commaExpr = <BinaryExpression>createNode(SyntaxKind.BinaryExpression, element.pos);
|
||||
commaExpr.operatorToken = finishNode(createNode(SyntaxKind.CommaToken, 0), 0);
|
||||
commaExpr.left = element;
|
||||
commaExpr.right = expr;
|
||||
expr = finishNode(commaExpr, expr.end);
|
||||
}
|
||||
computedPropertyName.expression = expr;
|
||||
}
|
||||
|
||||
return finishNode(computedPropertyName, arrayExpr.end);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
// We could have greedily parsed a property name as a property access, so we extract it from the decorator
|
||||
// for a better editor experience.
|
||||
// @expr.
|
||||
// id() {}
|
||||
//
|
||||
let propExpr = <PropertyAccessExpression>expression;
|
||||
var end = Math.min(getTokenPosOfNode(propExpr.dotToken, sourceFile) + 1, propExpr.dotToken.end);
|
||||
if (lineBreakBetween(sourceFile, end, getTokenPosOfNode(propExpr.name, sourceFile))) {
|
||||
name = propExpr.name;
|
||||
propExpr.name = <Identifier>createMissingNodeAtPosition(end, SyntaxKind.Identifier, Diagnostics.Identifier_expected);
|
||||
propExpr.end = propExpr.dotToken.end;
|
||||
decorator.end = propExpr.dotToken.end;
|
||||
return name;
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
// We could have greedily parsed a computed property name as an element access, so we extract it from the decorator.
|
||||
// @expr
|
||||
// ["expr"]()
|
||||
//
|
||||
let elementExpr = <ElementAccessExpression>expression;
|
||||
decorator.expression = elementExpr.expression;
|
||||
decorator.end = elementExpr.expression.end;
|
||||
|
||||
var computedPropertyName = <ComputedPropertyName>createNode(SyntaxKind.ComputedPropertyName, getTokenPosOfNode(elementExpr.argumentExpression, sourceFile));
|
||||
computedPropertyName.expression = elementExpr.argumentExpression;
|
||||
return finishNode(computedPropertyName, elementExpr.end);
|
||||
}
|
||||
|
||||
return <Identifier>createMissingNodeAtPosition(expression.end, SyntaxKind.Identifier, Diagnostics.Identifier_expected);
|
||||
}
|
||||
|
||||
function reparseTypeArgumentsAsTypeParameters(typeArguments: NodeArray<TypeNode>): NodeArray<TypeParameterDeclaration> {
|
||||
let typeParameters = <NodeArray<TypeParameterDeclaration>>[];
|
||||
typeParameters.pos = typeArguments.pos;
|
||||
typeParameters.end = typeArguments.end;
|
||||
for (let i = 0; i < typeArguments.length; i++) {
|
||||
let typeArgument = typeArguments[i];
|
||||
let typeParameter = <TypeParameterDeclaration>createNode(SyntaxKind.TypeParameter, typeArgument.pos);
|
||||
Debug.assert(typeArgument.kind === SyntaxKind.TypeReference);
|
||||
let typeReference = <TypeReferenceNode>typeArgument;
|
||||
Debug.assert(typeReference.typeName.kind === SyntaxKind.Identifier);
|
||||
typeParameter.name = <Identifier>typeReference.typeName;
|
||||
finishNode(typeParameter, typeArgument.end);
|
||||
typeParameters.push(typeParameter);
|
||||
}
|
||||
return typeParameters;
|
||||
}
|
||||
|
||||
function reparseArgumentsAsParameters(argumentList: NodeArray<Expression>): NodeArray<ParameterDeclaration> {
|
||||
let parameters = <NodeArray<ParameterDeclaration>>[];
|
||||
parameters.pos = argumentList.pos;
|
||||
parameters.end = argumentList.end;
|
||||
for (let i = 0; i < argumentList.length; i++) {
|
||||
let argument = argumentList[i];
|
||||
|
||||
// TODO: Object literal as object binding
|
||||
// TODO: Array literal as array binding
|
||||
let name: Identifier;
|
||||
let initializer: Expression;
|
||||
if (argument.kind === SyntaxKind.Identifier) {
|
||||
name = <Identifier>argument;
|
||||
}
|
||||
else if (argument.kind === SyntaxKind.BinaryExpression) {
|
||||
let binaryExpression = <BinaryExpression>argument;
|
||||
Debug.assert(binaryExpression.operatorToken.kind === SyntaxKind.EqualsToken);
|
||||
if (binaryExpression.left.kind === SyntaxKind.Identifier) {
|
||||
name = <Identifier>binaryExpression.left;
|
||||
initializer = binaryExpression.right;
|
||||
}
|
||||
else {
|
||||
Debug.fail("Invalid attempt to reclassify expression.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Debug.fail("Invalid attempt to reclassify expression.");
|
||||
}
|
||||
|
||||
let parameter = <ParameterDeclaration>createNode(SyntaxKind.Parameter, argument.pos);
|
||||
parameter.name = name;
|
||||
parameter.initializer = initializer;
|
||||
finishNode(parameter, argument.end);
|
||||
parameters.push(parameter);
|
||||
}
|
||||
return parameters;
|
||||
}
|
||||
|
||||
function reparseCallExpressionAsSignature(node: CallExpression, signature: SignatureDeclaration): void {
|
||||
if (node.typeArguments) {
|
||||
signature.typeParameters = reparseTypeArgumentsAsTypeParameters(node.typeArguments);
|
||||
}
|
||||
signature.parameters = reparseArgumentsAsParameters(node.arguments);
|
||||
signature.type = parseTypeAnnotation();
|
||||
}
|
||||
|
||||
function reparseClassElement(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ClassElement {
|
||||
// We may have parsed a decorator that greedily included part of the member as its expression.
|
||||
let lastDecorator = decorators[decorators.length - 1];
|
||||
|
||||
// TODO(rbuckton): pull out the call expression or declaration name from the consise body of an arrow function
|
||||
|
||||
// If we parsed a call expression, extract the call expression to reparse as a signature
|
||||
let callExpression = extractCallExpressionFromDecoratorTail(lastDecorator);
|
||||
|
||||
// Extract the declaration name from the decorator
|
||||
let name = extractDeclarationNameFromDecoratorTail(lastDecorator);
|
||||
let questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
|
||||
decorators.end = lastDecorator.end;
|
||||
|
||||
if (callExpression) {
|
||||
// Reparse as method
|
||||
let method = <MethodDeclaration>createNode(SyntaxKind.MethodDeclaration, fullStart);
|
||||
method.decorators = decorators;
|
||||
setModifiers(method, modifiers);
|
||||
method.name = name;
|
||||
method.questionToken = questionToken;
|
||||
reparseCallExpressionAsSignature(callExpression, method);
|
||||
method.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false);
|
||||
return finishNode(method);
|
||||
}
|
||||
else {
|
||||
if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
return parseMethodDeclaration(fullStart, decorators, modifiers, /*asteriskToken*/ undefined, name, questionToken, Diagnostics.or_expected);
|
||||
}
|
||||
|
||||
// Reparse as property declaration with a missing name.
|
||||
let property = <PropertyDeclaration>createNode(SyntaxKind.PropertyDeclaration, fullStart);
|
||||
property.decorators = decorators;
|
||||
setModifiers(property, modifiers);
|
||||
property.name = name;
|
||||
property.type = parseTypeAnnotation();
|
||||
property.initializer = allowInAnd(parseNonParameterInitializer);
|
||||
parseSemicolon();
|
||||
return finishNode(property);
|
||||
}
|
||||
}
|
||||
|
||||
function parseClassElement(): ClassElement {
|
||||
let fullStart = getNodePos();
|
||||
let decorators = parseDecorators();
|
||||
@@ -4900,7 +4648,9 @@ module ts {
|
||||
}
|
||||
|
||||
if (decorators) {
|
||||
return reparseClassElement(fullStart, decorators, modifiers);
|
||||
// treat this as a property declaration with a missing name.
|
||||
let name = <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
|
||||
return parsePropertyDeclaration(fullStart, decorators, modifiers, name, /*questionToken*/ undefined);
|
||||
}
|
||||
|
||||
// 'isClassMemberStart' should have hinted not to attempt parsing.
|
||||
@@ -5397,8 +5147,9 @@ module ts {
|
||||
default:
|
||||
if (decorators) {
|
||||
// We reached this point because we encountered an AtToken and assumed a declaration would
|
||||
// follow. For recovery and error reporting purposes, return an incomplete declaration.
|
||||
let node = <ModuleElement>createNode(SyntaxKind.IncompleteDeclaration, fullStart);
|
||||
// follow. For recovery and error reporting purposes, return an incomplete declaration.
|
||||
let node = <ModuleElement>createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
|
||||
node.pos = fullStart;
|
||||
node.decorators = decorators;
|
||||
setModifiers(node, modifiers);
|
||||
return finishNode(node);
|
||||
|
||||
@@ -246,7 +246,7 @@ module ts {
|
||||
ExportDeclaration,
|
||||
NamedExports,
|
||||
ExportSpecifier,
|
||||
IncompleteDeclaration,
|
||||
MissingDeclaration,
|
||||
|
||||
// Module references
|
||||
ExternalModuleReference,
|
||||
@@ -405,7 +405,6 @@ module ts {
|
||||
}
|
||||
|
||||
export interface Decorator extends Node {
|
||||
atToken: Node;
|
||||
expression: LeftHandSideExpression;
|
||||
}
|
||||
|
||||
@@ -699,9 +698,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface ArrayLiteralExpression extends PrimaryExpression {
|
||||
openBracketToken: Node;
|
||||
elements: NodeArray<Expression>;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
|
||||
export interface SpreadElementExpression extends Expression {
|
||||
@@ -721,9 +718,7 @@ module ts {
|
||||
|
||||
export interface ElementAccessExpression extends MemberExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
openBracketToken: Node;
|
||||
argumentExpression?: Expression;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
|
||||
export interface CallExpression extends LeftHandSideExpression {
|
||||
|
||||
+14
-12
@@ -1,4 +1,4 @@
|
||||
/// <reference path="core.ts" />
|
||||
/// <reference path="binder.ts" />
|
||||
|
||||
module ts {
|
||||
export interface ReferencePathMatchResult {
|
||||
@@ -575,17 +575,6 @@ module ts {
|
||||
return (<CallExpression>node).expression;
|
||||
}
|
||||
|
||||
function getConstructorWithBody(member: ClassElement): ConstructorDeclaration {
|
||||
if (member.kind === SyntaxKind.Constructor && nodeIsPresent((<ConstructorDeclaration>member).body)) {
|
||||
return <ConstructorDeclaration>member;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration {
|
||||
return forEach(node.members, getConstructorWithBody);
|
||||
}
|
||||
|
||||
export function nodeOrChildIsDecorated(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
@@ -897,6 +886,19 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function isClassElement(n: Node): boolean {
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// True if the given identifier, string literal, or number literal is the name of a declaration node
|
||||
export function isDeclarationName(name: Node): boolean {
|
||||
if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) {
|
||||
|
||||
Vendored
+1
-3
@@ -1167,6 +1167,4 @@ interface TypedPropertyDescriptor<T> {
|
||||
|
||||
interface ClassDecorator { <TFunction extends Function>(target: TFunction): TFunction | void; }
|
||||
interface PropertyDecorator { <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void; }
|
||||
interface ClassAnnotation { (target: Function): void; }
|
||||
interface PropertyAnnotation { (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void; }
|
||||
interface ParameterAnnotation { (target: Function, parameterIndex: number): void; }
|
||||
interface ParameterDecorator { (target: Function, parameterIndex: number): void; }
|
||||
|
||||
@@ -274,7 +274,7 @@ declare module "typescript" {
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
IncompleteDeclaration = 215,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
@@ -380,7 +380,6 @@ declare module "typescript" {
|
||||
expression: Expression;
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
atToken: Node;
|
||||
expression: LeftHandSideExpression;
|
||||
}
|
||||
interface TypeParameterDeclaration extends Declaration {
|
||||
@@ -585,9 +584,7 @@ declare module "typescript" {
|
||||
expression: Expression;
|
||||
}
|
||||
interface ArrayLiteralExpression extends PrimaryExpression {
|
||||
openBracketToken: Node;
|
||||
elements: NodeArray<Expression>;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
interface SpreadElementExpression extends Expression {
|
||||
expression: Expression;
|
||||
@@ -602,9 +599,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface ElementAccessExpression extends MemberExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
openBracketToken: Node;
|
||||
argumentExpression?: Expression;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
|
||||
@@ -840,8 +840,8 @@ declare module "typescript" {
|
||||
ExportSpecifier = 214,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
IncompleteDeclaration = 215,
|
||||
>IncompleteDeclaration : SyntaxKind
|
||||
MissingDeclaration = 215,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 216,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
@@ -1156,10 +1156,6 @@ declare module "typescript" {
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
>Decorator : Decorator
|
||||
>Node : Node
|
||||
|
||||
atToken: Node;
|
||||
>atToken : Node
|
||||
>Node : Node
|
||||
|
||||
expression: LeftHandSideExpression;
|
||||
@@ -1764,18 +1760,10 @@ declare module "typescript" {
|
||||
>ArrayLiteralExpression : ArrayLiteralExpression
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
|
||||
openBracketToken: Node;
|
||||
>openBracketToken : Node
|
||||
>Node : Node
|
||||
|
||||
elements: NodeArray<Expression>;
|
||||
>elements : NodeArray<Expression>
|
||||
>NodeArray : NodeArray<T>
|
||||
>Expression : Expression
|
||||
|
||||
closeBracketToken: Node;
|
||||
>closeBracketToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface SpreadElementExpression extends Expression {
|
||||
>SpreadElementExpression : SpreadElementExpression
|
||||
@@ -1819,17 +1807,9 @@ declare module "typescript" {
|
||||
>expression : LeftHandSideExpression
|
||||
>LeftHandSideExpression : LeftHandSideExpression
|
||||
|
||||
openBracketToken: Node;
|
||||
>openBracketToken : Node
|
||||
>Node : Node
|
||||
|
||||
argumentExpression?: Expression;
|
||||
>argumentExpression : Expression
|
||||
>Expression : Expression
|
||||
|
||||
closeBracketToken: Node;
|
||||
>closeBracketToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
>CallExpression : CallExpression
|
||||
|
||||
@@ -305,7 +305,7 @@ declare module "typescript" {
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
IncompleteDeclaration = 215,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
@@ -411,7 +411,6 @@ declare module "typescript" {
|
||||
expression: Expression;
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
atToken: Node;
|
||||
expression: LeftHandSideExpression;
|
||||
}
|
||||
interface TypeParameterDeclaration extends Declaration {
|
||||
@@ -616,9 +615,7 @@ declare module "typescript" {
|
||||
expression: Expression;
|
||||
}
|
||||
interface ArrayLiteralExpression extends PrimaryExpression {
|
||||
openBracketToken: Node;
|
||||
elements: NodeArray<Expression>;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
interface SpreadElementExpression extends Expression {
|
||||
expression: Expression;
|
||||
@@ -633,9 +630,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface ElementAccessExpression extends MemberExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
openBracketToken: Node;
|
||||
argumentExpression?: Expression;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
|
||||
@@ -986,8 +986,8 @@ declare module "typescript" {
|
||||
ExportSpecifier = 214,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
IncompleteDeclaration = 215,
|
||||
>IncompleteDeclaration : SyntaxKind
|
||||
MissingDeclaration = 215,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 216,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
@@ -1302,10 +1302,6 @@ declare module "typescript" {
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
>Decorator : Decorator
|
||||
>Node : Node
|
||||
|
||||
atToken: Node;
|
||||
>atToken : Node
|
||||
>Node : Node
|
||||
|
||||
expression: LeftHandSideExpression;
|
||||
@@ -1910,18 +1906,10 @@ declare module "typescript" {
|
||||
>ArrayLiteralExpression : ArrayLiteralExpression
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
|
||||
openBracketToken: Node;
|
||||
>openBracketToken : Node
|
||||
>Node : Node
|
||||
|
||||
elements: NodeArray<Expression>;
|
||||
>elements : NodeArray<Expression>
|
||||
>NodeArray : NodeArray<T>
|
||||
>Expression : Expression
|
||||
|
||||
closeBracketToken: Node;
|
||||
>closeBracketToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface SpreadElementExpression extends Expression {
|
||||
>SpreadElementExpression : SpreadElementExpression
|
||||
@@ -1965,17 +1953,9 @@ declare module "typescript" {
|
||||
>expression : LeftHandSideExpression
|
||||
>LeftHandSideExpression : LeftHandSideExpression
|
||||
|
||||
openBracketToken: Node;
|
||||
>openBracketToken : Node
|
||||
>Node : Node
|
||||
|
||||
argumentExpression?: Expression;
|
||||
>argumentExpression : Expression
|
||||
>Expression : Expression
|
||||
|
||||
closeBracketToken: Node;
|
||||
>closeBracketToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
>CallExpression : CallExpression
|
||||
|
||||
@@ -306,7 +306,7 @@ declare module "typescript" {
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
IncompleteDeclaration = 215,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
@@ -412,7 +412,6 @@ declare module "typescript" {
|
||||
expression: Expression;
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
atToken: Node;
|
||||
expression: LeftHandSideExpression;
|
||||
}
|
||||
interface TypeParameterDeclaration extends Declaration {
|
||||
@@ -617,9 +616,7 @@ declare module "typescript" {
|
||||
expression: Expression;
|
||||
}
|
||||
interface ArrayLiteralExpression extends PrimaryExpression {
|
||||
openBracketToken: Node;
|
||||
elements: NodeArray<Expression>;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
interface SpreadElementExpression extends Expression {
|
||||
expression: Expression;
|
||||
@@ -634,9 +631,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface ElementAccessExpression extends MemberExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
openBracketToken: Node;
|
||||
argumentExpression?: Expression;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
|
||||
@@ -936,8 +936,8 @@ declare module "typescript" {
|
||||
ExportSpecifier = 214,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
IncompleteDeclaration = 215,
|
||||
>IncompleteDeclaration : SyntaxKind
|
||||
MissingDeclaration = 215,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 216,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
@@ -1252,10 +1252,6 @@ declare module "typescript" {
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
>Decorator : Decorator
|
||||
>Node : Node
|
||||
|
||||
atToken: Node;
|
||||
>atToken : Node
|
||||
>Node : Node
|
||||
|
||||
expression: LeftHandSideExpression;
|
||||
@@ -1860,18 +1856,10 @@ declare module "typescript" {
|
||||
>ArrayLiteralExpression : ArrayLiteralExpression
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
|
||||
openBracketToken: Node;
|
||||
>openBracketToken : Node
|
||||
>Node : Node
|
||||
|
||||
elements: NodeArray<Expression>;
|
||||
>elements : NodeArray<Expression>
|
||||
>NodeArray : NodeArray<T>
|
||||
>Expression : Expression
|
||||
|
||||
closeBracketToken: Node;
|
||||
>closeBracketToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface SpreadElementExpression extends Expression {
|
||||
>SpreadElementExpression : SpreadElementExpression
|
||||
@@ -1915,17 +1903,9 @@ declare module "typescript" {
|
||||
>expression : LeftHandSideExpression
|
||||
>LeftHandSideExpression : LeftHandSideExpression
|
||||
|
||||
openBracketToken: Node;
|
||||
>openBracketToken : Node
|
||||
>Node : Node
|
||||
|
||||
argumentExpression?: Expression;
|
||||
>argumentExpression : Expression
|
||||
>Expression : Expression
|
||||
|
||||
closeBracketToken: Node;
|
||||
>closeBracketToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
>CallExpression : CallExpression
|
||||
|
||||
@@ -343,7 +343,7 @@ declare module "typescript" {
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
IncompleteDeclaration = 215,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
@@ -449,7 +449,6 @@ declare module "typescript" {
|
||||
expression: Expression;
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
atToken: Node;
|
||||
expression: LeftHandSideExpression;
|
||||
}
|
||||
interface TypeParameterDeclaration extends Declaration {
|
||||
@@ -654,9 +653,7 @@ declare module "typescript" {
|
||||
expression: Expression;
|
||||
}
|
||||
interface ArrayLiteralExpression extends PrimaryExpression {
|
||||
openBracketToken: Node;
|
||||
elements: NodeArray<Expression>;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
interface SpreadElementExpression extends Expression {
|
||||
expression: Expression;
|
||||
@@ -671,9 +668,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface ElementAccessExpression extends MemberExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
openBracketToken: Node;
|
||||
argumentExpression?: Expression;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
|
||||
@@ -1109,8 +1109,8 @@ declare module "typescript" {
|
||||
ExportSpecifier = 214,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
IncompleteDeclaration = 215,
|
||||
>IncompleteDeclaration : SyntaxKind
|
||||
MissingDeclaration = 215,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 216,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
@@ -1425,10 +1425,6 @@ declare module "typescript" {
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
>Decorator : Decorator
|
||||
>Node : Node
|
||||
|
||||
atToken: Node;
|
||||
>atToken : Node
|
||||
>Node : Node
|
||||
|
||||
expression: LeftHandSideExpression;
|
||||
@@ -2033,18 +2029,10 @@ declare module "typescript" {
|
||||
>ArrayLiteralExpression : ArrayLiteralExpression
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
|
||||
openBracketToken: Node;
|
||||
>openBracketToken : Node
|
||||
>Node : Node
|
||||
|
||||
elements: NodeArray<Expression>;
|
||||
>elements : NodeArray<Expression>
|
||||
>NodeArray : NodeArray<T>
|
||||
>Expression : Expression
|
||||
|
||||
closeBracketToken: Node;
|
||||
>closeBracketToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface SpreadElementExpression extends Expression {
|
||||
>SpreadElementExpression : SpreadElementExpression
|
||||
@@ -2088,17 +2076,9 @@ declare module "typescript" {
|
||||
>expression : LeftHandSideExpression
|
||||
>LeftHandSideExpression : LeftHandSideExpression
|
||||
|
||||
openBracketToken: Node;
|
||||
>openBracketToken : Node
|
||||
>Node : Node
|
||||
|
||||
argumentExpression?: Expression;
|
||||
>argumentExpression : Expression
|
||||
>Expression : Expression
|
||||
|
||||
closeBracketToken: Node;
|
||||
>closeBracketToken : Node
|
||||
>Node : Node
|
||||
}
|
||||
interface CallExpression extends LeftHandSideExpression {
|
||||
>CallExpression : CallExpression
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,9): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,17): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts (3 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
var F = @dec () => {
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,16): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,17): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts (3 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
var F = @dec () => {
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'ClassAnnotation'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/decoratorOnClass8.ts (1 errors) ====
|
||||
declare function dec(): (target: Function, paramIndex: number) => void;
|
||||
|
||||
@dec()
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'ClassAnnotation'.
|
||||
class C {
|
||||
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Function) => void | Function'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/decoratorOnClass8.ts (1 errors) ====
|
||||
declare function dec(): (target: Function, paramIndex: number) => void;
|
||||
|
||||
@dec()
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Function) => void | Function'.
|
||||
class C {
|
||||
}
|
||||
@@ -1,35 +1,35 @@
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,12): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,17): error TS2304: Cannot find name 'get'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS2304: Cannot find name 'accessor'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,32): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts (9 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec get accessor() { return 1; }
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'get'.
|
||||
~~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'accessor'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,16): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,17): error TS2304: Cannot find name 'get'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS2304: Cannot find name 'accessor'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,32): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts (9 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec get accessor() { return 1; }
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'get'.
|
||||
~~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'accessor'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,44 +1,44 @@
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,12): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,17): error TS2304: Cannot find name 'set'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS2304: Cannot find name 'accessor'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,30): error TS2304: Cannot find name 'value'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,35): error TS1005: ',' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,37): error TS2304: Cannot find name 'number'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,45): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts (12 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec set accessor(value: number) { }
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'set'.
|
||||
~~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'accessor'.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'value'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'number'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,16): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,17): error TS2304: Cannot find name 'set'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS2304: Cannot find name 'accessor'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,30): error TS2304: Cannot find name 'value'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,35): error TS1005: ',' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,37): error TS2304: Cannot find name 'number'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,45): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts (12 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec set accessor(value: number) { }
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'set'.
|
||||
~~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'accessor'.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'value'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'number'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor1.ts(4,5): error TS1206: Decorators are not valid on this declaration type.
|
||||
tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor1.ts(4,5): error TS1206: Decorators are not valid here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor1.ts (1 errors) ====
|
||||
@@ -7,5 +7,5 @@ tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor
|
||||
class C {
|
||||
@dec constructor() {}
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1206: Decorators are not valid on this declaration type.
|
||||
!!! error TS1206: Decorators are not valid here.
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'PropertyAnnotation'.
|
||||
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
Type 'number' is not assignable to type 'string | symbol'.
|
||||
Type 'number' is not assignable to type 'symbol'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts (1 errors) ====
|
||||
declare function dec(target: Function, paramIndex: number): void;
|
||||
|
||||
class C {
|
||||
@dec method() {}
|
||||
~~~~
|
||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'PropertyAnnotation'.
|
||||
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => void | TypedPropertyDescriptor<any>'.
|
||||
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
Type 'number' is not assignable to type 'string | symbol'.
|
||||
Type 'number' is not assignable to type 'symbol'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts (1 errors) ====
|
||||
declare function dec(target: Function, paramIndex: number): void;
|
||||
|
||||
class C {
|
||||
@dec method() {}
|
||||
~~~~
|
||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => void | TypedPropertyDescriptor<any>'.
|
||||
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
|
||||
}
|
||||
@@ -1,29 +1,29 @@
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,17): error TS2304: Cannot find name 'method'.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts (7 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec method() {}
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'method'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,16): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,17): error TS2304: Cannot find name 'method'.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts (7 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec method() {}
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'method'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts(4,5): error TS1208: Decorators may not change the type of a member.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts(4,5): error TS1208: A decorator may not change the type of a member.
|
||||
Type 'TypedPropertyDescriptor<number>' is not assignable to type 'void | TypedPropertyDescriptor<string>'.
|
||||
Type 'TypedPropertyDescriptor<number>' is not assignable to type 'TypedPropertyDescriptor<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
@@ -10,7 +10,7 @@ tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts(
|
||||
class C {
|
||||
@dec prop: string;
|
||||
~~~~
|
||||
!!! error TS1208: Decorators may not change the type of a member.
|
||||
!!! error TS1208: A decorator may not change the type of a member.
|
||||
!!! error TS1208: Type 'TypedPropertyDescriptor<number>' is not assignable to type 'void | TypedPropertyDescriptor<string>'.
|
||||
!!! error TS1208: Type 'TypedPropertyDescriptor<number>' is not assignable to type 'TypedPropertyDescriptor<string>'.
|
||||
!!! error TS1208: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,12): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,17): error TS2304: Cannot find name 'prop'.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts (6 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec prop;
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'prop'.
|
||||
}
|
||||
~
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,16): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,17): error TS2304: Cannot find name 'prop'.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts (6 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec prop;
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'prop'.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,17 +1,17 @@
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'PropertyAnnotation'.
|
||||
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
Type 'number' is not assignable to type 'string | symbol'.
|
||||
Type 'number' is not assignable to type 'symbol'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts (1 errors) ====
|
||||
declare function dec(target: Function, paramIndex: number): void;
|
||||
|
||||
class C {
|
||||
@dec prop;
|
||||
~~~~
|
||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'PropertyAnnotation'.
|
||||
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => void | TypedPropertyDescriptor<any>'.
|
||||
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
Type 'number' is not assignable to type 'string | symbol'.
|
||||
Type 'number' is not assignable to type 'symbol'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts (1 errors) ====
|
||||
declare function dec(target: Function, paramIndex: number): void;
|
||||
|
||||
class C {
|
||||
@dec prop;
|
||||
~~~~
|
||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => void | TypedPropertyDescriptor<any>'.
|
||||
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts(4,6): error TS1206: Decorators are not valid on this declaration type.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts(4,6): error TS1206: Decorators are not valid here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts (1 errors) ====
|
||||
@@ -7,5 +7,5 @@ tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts(4,6): error TS1206
|
||||
@dec
|
||||
enum E {
|
||||
~
|
||||
!!! error TS1206: Decorators are not valid on this declaration type.
|
||||
!!! error TS1206: Decorators are not valid here.
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(4,5): error TS1132: Enum member expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(4,5): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(4,10): error TS2304: Cannot find name 'A'.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts (4 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
enum E {
|
||||
@dec A
|
||||
~
|
||||
!!! error TS1132: Enum member expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'A'.
|
||||
}
|
||||
~
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(4,5): error TS1132: Enum member expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(4,9): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(4,10): error TS2304: Cannot find name 'A'.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts (4 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
enum E {
|
||||
@dec A
|
||||
~
|
||||
!!! error TS1132: Enum member expected.
|
||||
|
||||
!!! error TS1146: Declaration expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'A'.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts(4,10): error TS1206: Decorators are not valid on this declaration type.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts(4,10): error TS1206: Decorators are not valid here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts (1 errors) ====
|
||||
@@ -7,5 +7,5 @@ tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts(4,1
|
||||
@dec
|
||||
function F() {
|
||||
~
|
||||
!!! error TS1206: Decorators are not valid on this declaration type.
|
||||
!!! error TS1206: Decorators are not valid here.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnImportEquals1.ts(8,5): error TS1206: Decorators are not valid on this declaration type.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnImportEquals1.ts(8,5): error TS1206: Decorators are not valid here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals1.ts (1 errors) ====
|
||||
@@ -13,5 +13,5 @@ tests/cases/conformance/decorators/invalid/decoratorOnImportEquals1.ts(8,5): err
|
||||
~~~~
|
||||
import X = M1.X;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1206: Decorators are not valid on this declaration type.
|
||||
!!! error TS1206: Decorators are not valid here.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts(1,1): error TS1206: Decorators are not valid on this declaration type.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts(1,1): error TS1206: Decorators are not valid here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts (1 errors) ====
|
||||
@@ -6,7 +6,7 @@ tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts(1,1): e
|
||||
~~~~
|
||||
import lib = require('./decoratorOnImportEquals2_0');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1206: Decorators are not valid on this declaration type.
|
||||
!!! error TS1206: Decorators are not valid here.
|
||||
|
||||
declare function dec<T>(target: T): T;
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_0.ts (0 errors) ====
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts(4,11): error TS1206: Decorators are not valid on this declaration type.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts(4,11): error TS1206: Decorators are not valid here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts (1 errors) ====
|
||||
@@ -7,5 +7,5 @@ tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts(4,11): error
|
||||
@dec
|
||||
interface I {
|
||||
~
|
||||
!!! error TS1206: Decorators are not valid on this declaration type.
|
||||
!!! error TS1206: Decorators are not valid here.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts(4,8): error TS1206: Decorators are not valid on this declaration type.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts(4,8): error TS1206: Decorators are not valid here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts (1 errors) ====
|
||||
@@ -7,6 +7,6 @@ tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts(4,8): er
|
||||
@dec
|
||||
module M {
|
||||
~
|
||||
!!! error TS1206: Decorators are not valid on this declaration type.
|
||||
!!! error TS1206: Decorators are not valid here.
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnTypeAlias.ts(3,1): error TS1206: Decorators are not valid on this declaration type.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnTypeAlias.ts(3,1): error TS1206: Decorators are not valid here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnTypeAlias.ts (1 errors) ====
|
||||
@@ -8,4 +8,4 @@ tests/cases/conformance/decorators/invalid/decoratorOnTypeAlias.ts(3,1): error T
|
||||
~~~~
|
||||
type T = number;
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS1206: Decorators are not valid on this declaration type.
|
||||
!!! error TS1206: Decorators are not valid here.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnVar.ts(3,1): error TS1206: Decorators are not valid on this declaration type.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnVar.ts(3,1): error TS1206: Decorators are not valid here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnVar.ts (1 errors) ====
|
||||
@@ -8,4 +8,4 @@ tests/cases/conformance/decorators/invalid/decoratorOnVar.ts(3,1): error TS1206:
|
||||
~~~~
|
||||
var x: number;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1206: Decorators are not valid on this declaration type.
|
||||
!!! error TS1206: Decorators are not valid here.
|
||||
@@ -1,21 +1,17 @@
|
||||
error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
error TS2318: Cannot find global type 'IArguments'.
|
||||
error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
error TS2318: Cannot find global type 'Boolean'.
|
||||
tests/cases/compiler/noDefaultLib.ts(4,11): error TS2317: Global type 'Array' must have 1 type parameter(s).
|
||||
|
||||
|
||||
!!! error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'IArguments'.
|
||||
!!! error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'Boolean'.
|
||||
==== tests/cases/compiler/noDefaultLib.ts (1 errors) ====
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
@@ -1,33 +1,29 @@
|
||||
error TS2318: Cannot find global type 'Object'.
|
||||
error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
error TS2318: Cannot find global type 'Array'.
|
||||
error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
error TS2318: Cannot find global type 'String'.
|
||||
error TS2318: Cannot find global type 'RegExp'.
|
||||
error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
error TS2318: Cannot find global type 'Boolean'.
|
||||
error TS2318: Cannot find global type 'Number'.
|
||||
error TS2318: Cannot find global type 'IArguments'.
|
||||
error TS2318: Cannot find global type 'Function'.
|
||||
error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
|
||||
|
||||
!!! error TS2318: Cannot find global type 'Object'.
|
||||
!!! error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'Array'.
|
||||
!!! error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'String'.
|
||||
!!! error TS2318: Cannot find global type 'RegExp'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'Boolean'.
|
||||
!!! error TS2318: Cannot find global type 'Number'.
|
||||
!!! error TS2318: Cannot find global type 'IArguments'.
|
||||
!!! error TS2318: Cannot find global type 'Function'.
|
||||
!!! error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509698.ts (0 errors) ====
|
||||
/// <style requireSemi="on" />
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
@@ -1,34 +1,30 @@
|
||||
error TS2318: Cannot find global type 'Object'.
|
||||
error TS2318: Cannot find global type 'Array'.
|
||||
error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
error TS2318: Cannot find global type 'Function'.
|
||||
error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
error TS2318: Cannot find global type 'String'.
|
||||
error TS2318: Cannot find global type 'RegExp'.
|
||||
error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
error TS2318: Cannot find global type 'IArguments'.
|
||||
error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
error TS2318: Cannot find global type 'Function'.
|
||||
error TS2318: Cannot find global type 'Boolean'.
|
||||
error TS2318: Cannot find global type 'Number'.
|
||||
error TS2318: Cannot find global type 'IArguments'.
|
||||
test.ts(3,8): error TS2304: Cannot find name 'Array'.
|
||||
|
||||
|
||||
!!! error TS2318: Cannot find global type 'Object'.
|
||||
!!! error TS2318: Cannot find global type 'Array'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'Function'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
!!! error TS2318: Cannot find global type 'String'.
|
||||
!!! error TS2318: Cannot find global type 'RegExp'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'IArguments'.
|
||||
!!! error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'Function'.
|
||||
!!! error TS2318: Cannot find global type 'Boolean'.
|
||||
!!! error TS2318: Cannot find global type 'Number'.
|
||||
!!! error TS2318: Cannot find global type 'IArguments'.
|
||||
==== test.ts (1 errors) ====
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
@@ -1,34 +1,30 @@
|
||||
error TS2318: Cannot find global type 'Object'.
|
||||
error TS2318: Cannot find global type 'Array'.
|
||||
error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
error TS2318: Cannot find global type 'Function'.
|
||||
error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
error TS2318: Cannot find global type 'String'.
|
||||
error TS2318: Cannot find global type 'RegExp'.
|
||||
error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
error TS2318: Cannot find global type 'IArguments'.
|
||||
error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
error TS2318: Cannot find global type 'Function'.
|
||||
error TS2318: Cannot find global type 'Boolean'.
|
||||
error TS2318: Cannot find global type 'Number'.
|
||||
error TS2318: Cannot find global type 'IArguments'.
|
||||
test.ts(3,8): error TS2304: Cannot find name 'Array'.
|
||||
|
||||
|
||||
!!! error TS2318: Cannot find global type 'Object'.
|
||||
!!! error TS2318: Cannot find global type 'Array'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'Function'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
!!! error TS2318: Cannot find global type 'String'.
|
||||
!!! error TS2318: Cannot find global type 'RegExp'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'IArguments'.
|
||||
!!! error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'Function'.
|
||||
!!! error TS2318: Cannot find global type 'Boolean'.
|
||||
!!! error TS2318: Cannot find global type 'Number'.
|
||||
!!! error TS2318: Cannot find global type 'IArguments'.
|
||||
==== test.ts (1 errors) ====
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
error TS2318: Cannot find global type 'Array'.
|
||||
error TS2318: Cannot find global type 'RegExp'.
|
||||
error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
error TS2318: Cannot find global type 'Array'.
|
||||
error TS2318: Cannot find global type 'String'.
|
||||
error TS2318: Cannot find global type 'Function'.
|
||||
error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
error TS2318: Cannot find global type 'Number'.
|
||||
error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
error TS2318: Cannot find global type 'Object'.
|
||||
error TS2318: Cannot find global type 'IArguments'.
|
||||
error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
error TS2318: Cannot find global type 'IArguments'.
|
||||
error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
error TS2318: Cannot find global type 'Number'.
|
||||
error TS2318: Cannot find global type 'Function'.
|
||||
error TS2318: Cannot find global type 'Boolean'.
|
||||
error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
error TS2318: Cannot find global type 'Object'.
|
||||
tests/cases/compiler/typeCheckTypeArgument.ts(3,19): error TS2304: Cannot find name 'UNKNOWN'.
|
||||
tests/cases/compiler/typeCheckTypeArgument.ts(5,26): error TS2304: Cannot find name 'UNKNOWN'.
|
||||
tests/cases/compiler/typeCheckTypeArgument.ts(7,21): error TS2304: Cannot find name 'UNKNOWN'.
|
||||
@@ -20,20 +18,18 @@ tests/cases/compiler/typeCheckTypeArgument.ts(12,22): error TS2304: Cannot find
|
||||
tests/cases/compiler/typeCheckTypeArgument.ts(15,13): error TS2304: Cannot find name 'UNKNOWN'.
|
||||
|
||||
|
||||
!!! error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'Array'.
|
||||
!!! error TS2318: Cannot find global type 'RegExp'.
|
||||
!!! error TS2318: Cannot find global type 'ClassAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'Array'.
|
||||
!!! error TS2318: Cannot find global type 'String'.
|
||||
!!! error TS2318: Cannot find global type 'Function'.
|
||||
!!! error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
!!! error TS2318: Cannot find global type 'Number'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'Object'.
|
||||
!!! error TS2318: Cannot find global type 'IArguments'.
|
||||
!!! error TS2318: Cannot find global type 'ClassDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'TypedPropertyDescriptor'.
|
||||
!!! error TS2318: Cannot find global type 'IArguments'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'Number'.
|
||||
!!! error TS2318: Cannot find global type 'Function'.
|
||||
!!! error TS2318: Cannot find global type 'Boolean'.
|
||||
!!! error TS2318: Cannot find global type 'ParameterAnnotation'.
|
||||
!!! error TS2318: Cannot find global type 'PropertyDecorator'.
|
||||
!!! error TS2318: Cannot find global type 'Object'.
|
||||
==== tests/cases/compiler/typeCheckTypeArgument.ts (6 errors) ====
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
|
||||
class C {
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
|
||||
class C {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
// @module: commonjs
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
// @module: commonjs
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
declare function dec(): <T>(target: T) => T;
|
||||
|
||||
@dec()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
declare function dec(): <T>(target: T) => T;
|
||||
|
||||
@dec()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
declare function dec(): (target: Function, paramIndex: number) => void;
|
||||
|
||||
@dec()
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// @target:es5
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
|
||||
class C {
|
||||
|
||||
Reference in New Issue
Block a user