Merge branch 'master' into APISamples

Conflicts:
	tests/baselines/reference/APISample_compile.js
	tests/baselines/reference/APISample_compile.types
	tests/baselines/reference/APISample_linter.js
	tests/baselines/reference/APISample_linter.types
	tests/baselines/reference/APISample_transform.js
	tests/baselines/reference/APISample_transform.types
	tests/baselines/reference/APISample_watcher.js
	tests/baselines/reference/APISample_watcher.types
This commit is contained in:
Mohamed Hegazy 2015-04-06 13:38:16 -07:00
commit 29fe9f560f
102 changed files with 2595 additions and 8733 deletions

View file

@ -126,6 +126,7 @@ module ts {
let stringLiteralTypes: Map<StringLiteralType> = {};
let emitExtends = false;
let emitDecorate = false;
let emitParam = false;
let mergedSymbols: Symbol[] = [];
let symbolLinks: SymbolLinks[] = [];
@ -3000,6 +3001,16 @@ module ts {
return getSignaturesOfObjectOrUnionType(getApparentType(type), kind);
}
function typeHasCallOrConstructSignatures(type: Type): boolean {
let apparentType = getApparentType(type);
if (apparentType.flags & (TypeFlags.ObjectType | TypeFlags.Union)) {
let resolved = resolveObjectOrUnionTypeMembers(<ObjectType>type);
return resolved.callSignatures.length > 0
|| resolved.constructSignatures.length > 0;
}
return false;
}
function getIndexTypeOfObjectOrUnionType(type: Type, kind: IndexKind): Type {
if (type.flags & (TypeFlags.ObjectType | TypeFlags.Union)) {
let resolved = resolveObjectOrUnionTypeMembers(<ObjectType>type);
@ -8727,24 +8738,92 @@ module ts {
}
}
/** Checks a type reference node as an expression. */
function checkTypeNodeAsExpression(node: TypeNode | LiteralExpression) {
// When we are emitting type metadata for decorators, we need to try to check the type
// as if it were an expression so that we can emit the type in a value position when we
// serialize the type metadata.
if (node && node.kind === SyntaxKind.TypeReference) {
let type = getTypeFromTypeNodeOrHeritageClauseElement(node);
let shouldCheckIfUnknownType = type === unknownType && compilerOptions.separateCompilation;
if (!type || (!shouldCheckIfUnknownType && type.flags & (TypeFlags.Intrinsic | TypeFlags.NumberLike | TypeFlags.StringLike))) {
return;
}
if (shouldCheckIfUnknownType || type.symbol.valueDeclaration) {
checkExpressionOrQualifiedName((<TypeReferenceNode>node).typeName);
}
}
}
/**
* Checks the type annotation of an accessor declaration or property declaration as
* an expression if it is a type reference to a type with a value declaration.
*/
function checkTypeAnnotationAsExpression(node: AccessorDeclaration | PropertyDeclaration | ParameterDeclaration | MethodDeclaration) {
switch (node.kind) {
case SyntaxKind.PropertyDeclaration:
checkTypeNodeAsExpression((<PropertyDeclaration>node).type);
break;
case SyntaxKind.Parameter: checkTypeNodeAsExpression((<ParameterDeclaration>node).type);
break;
case SyntaxKind.MethodDeclaration:
checkTypeNodeAsExpression((<MethodDeclaration>node).type);
break;
case SyntaxKind.GetAccessor:
checkTypeNodeAsExpression((<AccessorDeclaration>node).type);
break;
case SyntaxKind.SetAccessor:
checkTypeNodeAsExpression(getSetAccessorTypeAnnotationNode(<AccessorDeclaration>node));
break;
}
}
/** Checks the type annotation of the parameters of a function/method or the constructor of a class as expressions */
function checkParameterTypeAnnotationsAsExpressions(node: FunctionLikeDeclaration) {
// ensure all type annotations with a value declaration are checked as an expression
for (let parameter of node.parameters) {
checkTypeAnnotationAsExpression(parameter);
}
}
/** Check the decorators of a node */
function checkDecorators(node: Node): void {
if (!node.decorators) {
return;
}
}
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.Parameter:
emitDecorate = true;
break;
// skip this check for nodes that cannot have decorators. These should have already had an error reported by
// checkGrammarDecorators.
if (!nodeCanBeDecorated(node)) {
return;
}
default:
return;
if (compilerOptions.emitDecoratorMetadata) {
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
var constructor = getFirstConstructorWithBody(<ClassDeclaration>node);
if (constructor) {
checkParameterTypeAnnotationsAsExpressions(constructor);
}
break;
case SyntaxKind.MethodDeclaration:
checkParameterTypeAnnotationsAsExpressions(<FunctionLikeDeclaration>node);
// fall-through
case SyntaxKind.SetAccessor:
case SyntaxKind.GetAccessor:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.Parameter:
checkTypeAnnotationAsExpression(<PropertyDeclaration | ParameterDeclaration>node);
break;
}
}
emitDecorate = true;
if (node.kind === SyntaxKind.Parameter) {
emitParam = true;
}
forEach(node.decorators, checkDecorator);
@ -10764,6 +10843,10 @@ module ts {
links.flags |= NodeCheckFlags.EmitDecorate;
}
if (emitParam) {
links.flags |= NodeCheckFlags.EmitParam;
}
links.flags |= NodeCheckFlags.TypeChecked;
}
}
@ -11442,6 +11525,201 @@ module ts {
return undefined;
}
/** Serializes an EntityName (with substitutions) to an appropriate JS constructor value. Used by the __metadata decorator. */
function serializeEntityName(node: EntityName, getGeneratedNameForNode: (Node: Node) => string, fallbackPath?: string[]): string {
if (node.kind === SyntaxKind.Identifier) {
var substitution = getExpressionNameSubstitution(<Identifier>node, getGeneratedNameForNode);
var text = substitution || (<Identifier>node).text;
if (fallbackPath) {
fallbackPath.push(text);
}
else {
return text;
}
}
else {
var left = serializeEntityName((<QualifiedName>node).left, getGeneratedNameForNode, fallbackPath);
var right = serializeEntityName((<QualifiedName>node).right, getGeneratedNameForNode, fallbackPath);
if (!fallbackPath) {
return left + "." + right;
}
}
}
/** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */
function serializeTypeReferenceNode(node: TypeReferenceNode, getGeneratedNameForNode: (Node: Node) => string): string | string[] {
// serialization of a TypeReferenceNode uses the following rules:
//
// * The serialized type of a TypeReference that is `void` is "void 0".
// * The serialized type of a TypeReference that is a `boolean` is "Boolean".
// * The serialized type of a TypeReference that is an enum or `number` is "Number".
// * The serialized type of a TypeReference that is a string literal or `string` is "String".
// * The serialized type of a TypeReference that is a tuple is "Array".
// * The serialized type of a TypeReference that is a `symbol` is "Symbol".
// * The serialized type of a TypeReference with a value declaration is its entity name.
// * The serialized type of a TypeReference with a call or construct signature is "Function".
// * The serialized type of any other type is "Object".
let type = getTypeFromTypeReference(node);
if (type.flags & TypeFlags.Void) {
return "void 0";
}
else if (type.flags & TypeFlags.Boolean) {
return "Boolean";
}
else if (type.flags & TypeFlags.NumberLike) {
return "Number";
}
else if (type.flags & TypeFlags.StringLike) {
return "String";
}
else if (type.flags & TypeFlags.Tuple) {
return "Array";
}
else if (type.flags & TypeFlags.ESSymbol) {
return "Symbol";
}
else if (type === unknownType) {
var fallbackPath: string[] = [];
serializeEntityName(node.typeName, getGeneratedNameForNode, fallbackPath);
return fallbackPath;
}
else if (type.symbol && type.symbol.valueDeclaration) {
return serializeEntityName(node.typeName, getGeneratedNameForNode);
}
else if (typeHasCallOrConstructSignatures(type)) {
return "Function";
}
return "Object";
}
/** Serializes a TypeNode to an appropriate JS constructor value. Used by the __metadata decorator. */
function serializeTypeNode(node: TypeNode | LiteralExpression, getGeneratedNameForNode: (Node: Node) => string): string | string[] {
// serialization of a TypeNode uses the following rules:
//
// * The serialized type of `void` is "void 0" (undefined).
// * The serialized type of a parenthesized type is the serialized type of its nested type.
// * The serialized type of a Function or Constructor type is "Function".
// * The serialized type of an Array or Tuple type is "Array".
// * The serialized type of `boolean` is "Boolean".
// * The serialized type of `string` or a string-literal type is "String".
// * The serialized type of a type reference is handled by `serializeTypeReferenceNode`.
// * The serialized type of any other type node is "Object".
if (node) {
switch (node.kind) {
case SyntaxKind.VoidKeyword:
return "void 0";
case SyntaxKind.ParenthesizedType:
return serializeTypeNode((<ParenthesizedTypeNode>node).type, getGeneratedNameForNode);
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructorType:
return "Function";
case SyntaxKind.ArrayType:
case SyntaxKind.TupleType:
return "Array";
case SyntaxKind.BooleanKeyword:
return "Boolean";
case SyntaxKind.StringKeyword:
case SyntaxKind.StringLiteral:
return "String";
case SyntaxKind.NumberKeyword:
return "Number";
case SyntaxKind.TypeReference:
return serializeTypeReferenceNode(<TypeReferenceNode>node, getGeneratedNameForNode);
case SyntaxKind.TypeQuery:
case SyntaxKind.TypeLiteral:
case SyntaxKind.UnionType:
case SyntaxKind.AnyKeyword:
break;
default:
Debug.fail("Cannot serialize unexpected type node.");
break;
}
}
return "Object";
}
/** Serializes the type of a declaration to an appropriate JS constructor value. Used by the __metadata decorator for a class member. */
function serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[] {
// serialization of the type of a declaration uses the following rules:
//
// * The serialized type of a ClassDeclaration is "Function"
// * The serialized type of a ParameterDeclaration is the serialized type of its type annotation.
// * The serialized type of a PropertyDeclaration is the serialized type of its type annotation.
// * The serialized type of an AccessorDeclaration is the serialized type of the return type annotation of its getter or parameter type annotation of its setter.
// * The serialized type of any other FunctionLikeDeclaration is "Function".
// * The serialized type of any other node is "void 0".
//
// For rules on serializing type annotations, see `serializeTypeNode`.
switch (node.kind) {
case SyntaxKind.ClassDeclaration: return "Function";
case SyntaxKind.PropertyDeclaration: return serializeTypeNode((<PropertyDeclaration>node).type, getGeneratedNameForNode);
case SyntaxKind.Parameter: return serializeTypeNode((<ParameterDeclaration>node).type, getGeneratedNameForNode);
case SyntaxKind.GetAccessor: return serializeTypeNode((<AccessorDeclaration>node).type, getGeneratedNameForNode);
case SyntaxKind.SetAccessor: return serializeTypeNode(getSetAccessorTypeAnnotationNode(<AccessorDeclaration>node), getGeneratedNameForNode);
}
if (isFunctionLike(node)) {
return "Function";
}
return "void 0";
}
/** Serializes the parameter types of a function or the constructor of a class. Used by the __metadata decorator for a method or set accessor. */
function serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[] {
// serialization of parameter types uses the following rules:
//
// * If the declaration is a class, the parameters of the first constructor with a body are used.
// * If the declaration is function-like and has a body, the parameters of the function are used.
//
// For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`.
if (node) {
var valueDeclaration: FunctionLikeDeclaration;
if (node.kind === SyntaxKind.ClassDeclaration) {
valueDeclaration = getFirstConstructorWithBody(<ClassDeclaration>node);
}
else if (isFunctionLike(node) && nodeIsPresent((<FunctionLikeDeclaration>node).body)) {
valueDeclaration = <FunctionLikeDeclaration>node;
}
if (valueDeclaration) {
var result: (string | string[])[];
var parameters = valueDeclaration.parameters;
var parameterCount = parameters.length;
if (parameterCount > 0) {
result = new Array<string>(parameterCount);
for (var i = 0; i < parameterCount; i++) {
if (parameters[i].dotDotDotToken) {
var parameterType = parameters[i].type;
if (parameterType.kind === SyntaxKind.ArrayType) {
parameterType = (<ArrayTypeNode>parameterType).elementType;
}
else if (parameterType.kind === SyntaxKind.TypeReference && (<TypeReferenceNode>parameterType).typeArguments && (<TypeReferenceNode>parameterType).typeArguments.length === 1) {
parameterType = (<TypeReferenceNode>parameterType).typeArguments[0];
}
else {
parameterType = undefined;
}
result[i] = serializeTypeNode(parameterType, getGeneratedNameForNode);
}
else {
result[i] = serializeTypeOfNode(parameters[i], getGeneratedNameForNode);
}
}
return result;
}
}
}
return emptyArray;
}
/** Serializes the return type of function. Used by the __metadata decorator for a method. */
function serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[] {
if (node && isFunctionLike(node)) {
return serializeTypeNode((<FunctionLikeDeclaration>node).type, getGeneratedNameForNode);
}
return "void 0";
}
function writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) {
// Get type of the symbol if this is the valid symbol otherwise get type at location
let symbol = getSymbolOfNode(declaration);
@ -11529,6 +11807,9 @@ module ts {
resolvesToSomeValue,
collectLinkedAliases,
getBlockScopedVariableId,
serializeTypeOfNode,
serializeParameterTypesOfNode,
serializeReturnTypeOfNode,
};
}
@ -11593,15 +11874,15 @@ module ts {
return false;
}
if (!nodeCanBeDecorated(node)) {
return grammarErrorOnNode(node, Diagnostics.Decorators_are_not_valid_here);
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
}
else if (languageVersion < ScriptTarget.ES5) {
return grammarErrorOnNode(node, Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher);
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher);
}
else if (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor) {
let accessors = getAllAccessorDeclarations((<ClassDeclaration>node.parent).members, <AccessorDeclaration>node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnNode(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
}
}
return false;
@ -12445,7 +12726,16 @@ module ts {
let identifier = <Identifier>name;
if (contextNode && (contextNode.parserContextFlags & ParserContextFlags.StrictMode) && isEvalOrArgumentsIdentifier(identifier)) {
let nameText = declarationNameToString(identifier);
return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, nameText);
// We are checking if this name is inside class declaration or class expression (which are under class definitions inside ES6 spec.)
// if so, we would like to give more explicit invalid usage error.
// This will be particularly helpful in the case of "arguments" as such case is very common mistake.
if (getAncestor(name, SyntaxKind.ClassDeclaration) || getAncestor(name, SyntaxKind.ClassExpression)) {
return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode, nameText);
}
else {
return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, nameText);
}
}
}
}

View file

@ -156,6 +156,11 @@ module ts {
shortName: "w",
type: "boolean",
description: Diagnostics.Watch_input_files,
},
{
name: "emitDecoratorMetadata",
type: "boolean",
experimental: true
}
];

View file

@ -167,7 +167,8 @@ module ts {
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." },
Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." },
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1210, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." },
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
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." },

View file

@ -659,9 +659,13 @@
"category": "Error",
"code": 1209
},
"Invalid use of '{0}'. Class definitions are automatically in strict mode.": {
"category": "Error",
"code": 1210
},
"A class declaration without the 'default' modifier must have a name": {
"category": "Error",
"code": 1210
"code": 1211
},
"Duplicate identifier '{0}'.": {
"category": "Error",

View file

@ -23,6 +23,33 @@ module ts {
// @internal
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult {
// emit output for the __extends helper function
const extendsHelper = `
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};`;
// emit output for the __decorate helper function
const decorateHelper = `
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};`;
// emit output for the __metadata helper function
const metadataHelper = `
var __metadata = this.__metadata || (typeof Reflect === "object" && Reflect.metadata) || function () { };`;
// emit output for the __param helper function
const paramHelper = `
var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };`;
let compilerOptions = host.getCompilerOptions();
let languageVersion = compilerOptions.target || ScriptTarget.ES3;
let sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap ? [] : undefined;
@ -98,6 +125,7 @@ module ts {
let extendsEmitted = false;
let decorateEmitted = false;
let paramEmitted = false;
let tempFlags = 0;
let tempVariables: Identifier[];
let tempParameters: Identifier[];
@ -769,27 +797,34 @@ module ts {
}
}
function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) {
function emitList<TNode extends Node>(nodes: TNode[], start: number, count: number, multiLine: boolean, trailingComma: boolean, leadingComma?: boolean, noTrailingNewLine?: boolean, emitNode?: (node: TNode) => void): number {
if (!emitNode) {
emitNode = emit;
}
for (let i = 0; i < count; i++) {
if (multiLine) {
if (i) {
if (i || leadingComma) {
write(",");
}
writeLine();
}
else {
if (i) {
if (i || leadingComma) {
write(", ");
}
}
emit(nodes[start + i]);
emitNode(nodes[start + i]);
leadingComma = true;
}
if (trailingComma) {
write(",");
}
if (multiLine) {
if (multiLine && !noTrailingNewLine) {
writeLine();
}
return count;
}
function emitCommaList(nodes: Node[]) {
@ -1109,9 +1144,7 @@ module ts {
return;
}
let generatedVariable = createTempVariable(TempFlags.Auto);
generatedName = generatedVariable.text;
recordTempDeclaration(generatedVariable);
generatedName = createAndRecordTempVariable(TempFlags.Auto).text;
computedPropertyNamesToGeneratedNames[node.id] = generatedName;
write(generatedName);
write(" = ");
@ -3199,28 +3232,49 @@ module ts {
}
}
function emitMemberAssignments(node: ClassLikeDeclaration, staticFlag: NodeFlags) {
forEach(node.members, member => {
if (member.kind === SyntaxKind.PropertyDeclaration && (member.flags & NodeFlags.Static) === staticFlag && (<PropertyDeclaration>member).initializer) {
writeLine();
emitLeadingComments(member);
emitStart(member);
emitStart((<PropertyDeclaration>member).name);
if (staticFlag) {
emitDeclarationName(node);
}
else {
write("this");
}
emitMemberAccessForPropertyName((<PropertyDeclaration>member).name);
emitEnd((<PropertyDeclaration>member).name);
write(" = ");
emit((<PropertyDeclaration>member).initializer);
write(";");
emitEnd(member);
emitTrailingComments(member);
function getInitializedProperties(node: ClassLikeDeclaration, static: boolean) {
let properties: PropertyDeclaration[] = [];
for (let member of node.members) {
if (member.kind === SyntaxKind.PropertyDeclaration && static === ((member.flags & NodeFlags.Static) !== 0) && (<PropertyDeclaration>member).initializer) {
properties.push(<PropertyDeclaration>member);
}
});
}
return properties;
}
function emitPropertyDeclarations(node: ClassLikeDeclaration, properties: PropertyDeclaration[]) {
for (let property of properties) {
emitPropertyDeclaration(node, property);
}
}
function emitPropertyDeclaration(node: ClassLikeDeclaration, property: PropertyDeclaration, receiver?: Identifier, isExpression?: boolean) {
writeLine();
emitLeadingComments(property);
emitStart(property);
emitStart(property.name);
if (receiver) {
emit(receiver);
}
else {
if (property.flags & NodeFlags.Static) {
emitDeclarationName(node);
}
else {
write("this");
}
}
emitMemberAccessForPropertyName(property.name);
emitEnd(property.name);
write(" = ");
emit(property.initializer);
if (!isExpression) {
write(";");
}
emitEnd(property);
emitTrailingComments(property);
}
function emitMemberFunctionsForES5AndLower(node: ClassLikeDeclaration) {
@ -3338,6 +3392,14 @@ module ts {
tempVariables = undefined;
tempParameters = undefined;
emitConstructorWorker(node, baseTypeElement);
tempFlags = saveTempFlags;
tempVariables = saveTempVariables;
tempParameters = saveTempParameters;
}
function emitConstructorWorker(node: ClassLikeDeclaration, baseTypeElement: HeritageClauseElement) {
// Check if we have property assignment inside class declaration.
// If there is property assignment, we need to emit constructor whether users define it or not
// If there is no property assignment, we can omit constructor if users do not define it
@ -3425,7 +3487,7 @@ module ts {
emitEnd(baseTypeElement);
}
}
emitMemberAssignments(node, /*staticFlag*/0);
emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false));
if (ctor) {
var statements: Node[] = (<Block>ctor.body).statements;
if (superCall) {
@ -3445,10 +3507,6 @@ module ts {
if (ctor) {
emitTrailingComments(ctor);
}
tempFlags = saveTempFlags;
tempVariables = saveTempVariables;
tempParameters = saveTempParameters;
}
function emitClassExpression(node: ClassExpression) {
@ -3540,6 +3598,29 @@ module ts {
}
}
// If the class has static properties, and it's a class expression, then we'll need
// to specialize the emit a bit. for a class expression of the form:
//
// class C { static a = 1; static b = 2; ... }
//
// We'll emit:
//
// (_temp = class C { ... }, _temp.a = 1, _temp.b = 2, _temp)
//
// This keeps the expression as an expression, while ensuring that the static parts
// of it have been initialized by the time it is used.
let staticProperties = getInitializedProperties(node, /*static:*/ true);
let isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === SyntaxKind.ClassExpression;
let tempVariable: Identifier;
if (isClassExpressionWithStaticProperties) {
tempVariable = createAndRecordTempVariable(TempFlags.Auto);
write("(");
increaseIndent();
emit(tempVariable);
write(" = ")
}
write("class");
// check if this is an "export default class" as it may not have a name. Do not emit the name if the class is decorated.
@ -3590,9 +3671,24 @@ module ts {
// From ES6 specification:
// HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using
// a lexical declaration such as a LexicalDeclaration or a ClassDeclaration.
writeLine();
emitMemberAssignments(node, NodeFlags.Static);
emitDecoratorsOfClass(node);
if (isClassExpressionWithStaticProperties) {
for (var property of staticProperties) {
write(",");
writeLine();
emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true);
}
write(",");
writeLine();
emit(tempVariable);
decreaseIndent();
write(")");
}
else {
writeLine();
emitPropertyDeclarations(node, staticProperties);
emitDecoratorsOfClass(node);
}
// If this is an exported class, but not on the top level (i.e. on an internal
// module), export it
@ -3648,7 +3744,7 @@ module ts {
writeLine();
emitConstructor(node, baseTypeNode);
emitMemberFunctionsForES5AndLower(node);
emitMemberAssignments(node, NodeFlags.Static);
emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true));
writeLine();
emitDecoratorsOfClass(node);
writeLine();
@ -3700,12 +3796,12 @@ module ts {
}
function emitDecoratorsOfConstructor(node: ClassLikeDeclaration) {
let decorators = node.decorators;
let constructor = getFirstConstructorWithBody(node);
if (constructor) {
emitDecoratorsOfParameters(node, constructor);
}
let hasDecoratedParameters = constructor && forEach(constructor.parameters, nodeIsDecorated);
if (!nodeIsDecorated(node)) {
// skip decoration of the constructor if neither it nor its parameters are decorated
if (!decorators && !hasDecoratedParameters) {
return;
}
@ -3723,8 +3819,23 @@ module ts {
writeLine();
emitStart(node);
emitDeclarationName(node);
write(" = ");
emitDecorateStart(node.decorators);
write(" = __decorate([");
increaseIndent();
writeLine();
let decoratorCount = decorators ? decorators.length : 0;
let argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, decorator => {
emitStart(decorator);
emit(decorator.expression);
emitEnd(decorator);
});
argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0);
emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0);
decreaseIndent();
writeLine();
write("], ");
emitDeclarationName(node);
write(");");
emitEnd(node);
@ -3732,72 +3843,80 @@ module ts {
}
function emitDecoratorsOfMembers(node: ClassLikeDeclaration, staticFlag: NodeFlags) {
forEach(node.members, member => {
for (let member of node.members) {
// only emit members in the correct group
if ((member.flags & NodeFlags.Static) !== staticFlag) {
return;
continue;
}
// skip members that cannot be decorated (such as the constructor)
if (!nodeCanBeDecorated(member)) {
continue;
}
// skip a member if it or any of its parameters are not decorated
if (!nodeOrChildIsDecorated(member)) {
continue;
}
// skip an accessor declaration if it is not the first accessor
let decorators: NodeArray<Decorator>;
switch (member.kind) {
case SyntaxKind.MethodDeclaration:
// emit decorators of the method's parameters
emitDecoratorsOfParameters(node, <MethodDeclaration>member);
decorators = member.decorators;
break;
let functionLikeMember: FunctionLikeDeclaration;
if (isAccessor(member)) {
let accessors = getAllAccessorDeclarations(node.members, <AccessorDeclaration>member);
if (member !== accessors.firstAccessor) {
continue;
}
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
let accessors = getAllAccessorDeclarations(node.members, <AccessorDeclaration>member);
if (member !== accessors.firstAccessor) {
// skip the second accessor as we processed it with the first.
return;
}
// get the decorators from the first accessor with decorators
decorators = accessors.firstAccessor.decorators;
if (!decorators && accessors.secondAccessor) {
decorators = accessors.secondAccessor.decorators;
}
if (accessors.setAccessor) {
// emit decorators of the set accessor parameter
emitDecoratorsOfParameters(node, <AccessorDeclaration>accessors.setAccessor);
}
// get the decorators from the first decorated accessor.
decorators = accessors.firstAccessor.decorators;
if (!decorators && accessors.secondAccessor) {
decorators = accessors.secondAccessor.decorators;
}
break;
case SyntaxKind.PropertyDeclaration:
decorators = member.decorators;
break;
default:
// Constructor cannot be decorated, and its parameters are handled in emitDecoratorsOfConstructor
// Other members (i.e. IndexSignature) cannot be decorated.
return;
// we only decorate parameters of the set accessor
functionLikeMember = accessors.setAccessor;
}
else {
decorators = member.decorators;
if (!decorators) {
return;
// we only decorate the parameters here if this is a method
if (member.kind === SyntaxKind.MethodDeclaration) {
functionLikeMember = <MethodDeclaration>member;
}
}
// Emit the call to __decorate. Given the following:
//
// class C {
// @dec method() {}
// @dec method(@dec2 x) {}
// @dec get accessor() {}
// @dec prop;
// }
//
// The emit for a method is:
//
// Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
// Object.defineProperty(C.prototype, "method",
// __decorate([
// dec,
// __param(0, dec2),
// __metadata("design:type", Function),
// __metadata("design:paramtypes", [Object]),
// __metadata("design:returntype", void 0)
// ], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
//
// The emit for an accessor is:
//
// Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
// Object.defineProperty(C.prototype, "accessor",
// __decorate([
// dec
// ], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
//
// The emit for a property is:
//
// __decorate([dec], C.prototype, "prop");
// __decorate([
// dec
// ], C.prototype, "prop");
//
writeLine();
@ -3809,10 +3928,28 @@ module ts {
write(", ");
emitExpressionForPropertyName(member.name);
emitEnd(member.name);
write(", ");
write(",");
increaseIndent();
writeLine();
}
emitDecorateStart(decorators);
write("__decorate([");
increaseIndent();
writeLine();
let decoratorCount = decorators ? decorators.length : 0;
let argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, decorator => {
emitStart(decorator);
emit(decorator.expression);
emitEnd(decorator);
});
argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0);
emitSerializedTypeMetadata(member, argumentsWritten > 0);
decreaseIndent();
writeLine();
write("], ");
emitStart(member.name);
emitClassMemberPrefix(node, member);
write(", ");
@ -3827,78 +3964,150 @@ module ts {
emitExpressionForPropertyName(member.name);
emitEnd(member.name);
write("))");
decreaseIndent();
}
write(");");
emitEnd(member);
writeLine();
});
}
function emitDecoratorsOfParameters(node: ClassLikeDeclaration, member: FunctionLikeDeclaration) {
forEach(member.parameters, (parameter, parameterIndex) => {
if (!nodeIsDecorated(parameter)) {
return;
}
// Emit the decorators for a parameter. Given the following:
//
// class C {
// constructor(@dec p) { }
// method(@dec p) { }
// set accessor(@dec value) { }
// }
//
// The emit for a constructor is:
//
// __decorate([dec], C, void 0, 0);
//
// The emit for a parameter is:
//
// __decorate([dec], C.prototype, "method", 0);
//
// The emit for an accessor is:
//
// __decorate([dec], C.prototype, "accessor", 0);
//
writeLine();
emitStart(parameter);
emitDecorateStart(parameter.decorators);
emitStart(parameter.name);
if (member.kind === SyntaxKind.Constructor) {
emitDeclarationName(node);
write(", void 0");
}
else {
emitClassMemberPrefix(node, member);
write(", ");
emitExpressionForPropertyName(member.name);
}
write(", ");
write(String(parameterIndex));
emitEnd(parameter.name);
write(");");
emitEnd(parameter);
writeLine();
});
}
function emitDecorateStart(decorators: Decorator[]): void {
write("__decorate([");
let decoratorCount = decorators.length;
for (let i = 0; i < decoratorCount; i++) {
if (i > 0) {
write(", ");
}
let decorator = decorators[i];
emitStart(decorator);
emit(decorator.expression);
emitEnd(decorator);
}
write("], ");
}
function emitDecoratorsOfParameters(node: FunctionLikeDeclaration, leadingComma: boolean): number {
let argumentsWritten = 0;
if (node) {
let parameterIndex = 0;
for (let parameter of node.parameters) {
if (nodeIsDecorated(parameter)) {
let decorators = parameter.decorators;
argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, decorator => {
emitStart(decorator);
write(`__param(${parameterIndex}, `);
emit(decorator.expression);
write(")");
emitEnd(decorator);
});
leadingComma = true;
}
++parameterIndex;
}
}
return argumentsWritten;
}
function shouldEmitTypeMetadata(node: Declaration): boolean {
// This method determines whether to emit the "design:type" metadata based on the node's kind.
// The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata
// compiler option is set.
switch (node.kind) {
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.PropertyDeclaration:
return true;
}
return false;
}
function shouldEmitReturnTypeMetadata(node: Declaration): boolean {
// This method determines whether to emit the "design:returntype" metadata based on the node's kind.
// The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata
// compiler option is set.
switch (node.kind) {
case SyntaxKind.MethodDeclaration:
return true;
}
return false;
}
function shouldEmitParamTypesMetadata(node: Declaration): boolean {
// This method determines whether to emit the "design:paramtypes" metadata based on the node's kind.
// The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata
// compiler option is set.
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.SetAccessor:
return true;
}
return false;
}
function emitSerializedTypeMetadata(node: Declaration, writeComma: boolean): number {
// This method emits the serialized type metadata for a decorator target.
// The caller should have already tested whether the node has decorators.
let argumentsWritten = 0;
if (compilerOptions.emitDecoratorMetadata) {
if (shouldEmitTypeMetadata(node)) {
var serializedType = resolver.serializeTypeOfNode(node, getGeneratedNameForNode);
if (serializedType) {
if (writeComma) {
write(", ");
}
writeLine();
write("__metadata('design:type', ");
emitSerializedType(node, serializedType);
write(")");
argumentsWritten++;
}
}
if (shouldEmitParamTypesMetadata(node)) {
var serializedTypes = resolver.serializeParameterTypesOfNode(node, getGeneratedNameForNode);
if (serializedTypes) {
if (writeComma || argumentsWritten) {
write(", ");
}
writeLine();
write("__metadata('design:paramtypes', [");
for (var i = 0; i < serializedTypes.length; ++i) {
if (i > 0) {
write(", ");
}
emitSerializedType(node, serializedTypes[i]);
}
write("])");
argumentsWritten++;
}
}
if (shouldEmitReturnTypeMetadata(node)) {
var serializedType = resolver.serializeReturnTypeOfNode(node, getGeneratedNameForNode);
if (serializedType) {
if (writeComma || argumentsWritten) {
write(", ");
}
writeLine();
write("__metadata('design:returntype', ");
emitSerializedType(node, serializedType);
write(")");
argumentsWritten++;
}
}
}
return argumentsWritten;
}
function serializeTypeNameSegment(location: Node, path: string[], index: number): string {
switch (index) {
case 0:
return `typeof ${path[index]} !== 'undefined' && ${path[index]}`;
case 1:
return `${serializeTypeNameSegment(location, path, index - 1) }.${path[index]}`;
default:
let temp = createAndRecordTempVariable(TempFlags.Auto).text;
return `(${temp} = ${serializeTypeNameSegment(location, path, index - 1) }) && ${temp}.${path[index]}`;
}
}
function emitSerializedType(location: Node, name: string | string[]): void {
if (typeof name === "string") {
write(name);
return;
}
else {
Debug.assert(name.length > 0, "Invalid serialized type name");
write(`(${serializeTypeNameSegment(location, name, name.length - 1) }) || Object`);
}
}
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
@ -4531,7 +4740,7 @@ module ts {
return statements.length;
}
function writeHelper(text: string): void {
function writeLines(text: string): void {
let lines = text.split(/\r\n|\r|\n/g);
for (let i = 0; i < lines.length; ++i) {
let line = lines[i];
@ -4550,41 +4759,25 @@ module ts {
// emit prologue directives prior to __extends
var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false);
// Only Emit __extends function when target ES5.
// For target ES6 and above, we can emit classDeclaration as if.
// For target ES6 and above, we can emit classDeclaration as is.
if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitExtends)) {
writeLine();
write("var __extends = this.__extends || function (d, b) {");
increaseIndent();
writeLine();
write("for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];");
writeLine();
write("function __() { this.constructor = d; }");
writeLine();
write("__.prototype = b.prototype;");
writeLine();
write("d.prototype = new __();");
decreaseIndent();
writeLine();
write("};");
writeLines(extendsHelper);
extendsEmitted = true;
}
if (!decorateEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitDecorate) {
writeHelper(`
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
}
return value;
};`);
writeLines(decorateHelper);
if (compilerOptions.emitDecoratorMetadata) {
writeLines(metadataHelper);
}
decorateEmitted = true;
}
if (!paramEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitParam) {
writeLines(paramHelper);
paramEmitted = true;
}
if (isExternalModule(node)) {
if (languageVersion >= ScriptTarget.ES6) {
emitES6Module(node, startIndex);

View file

@ -4756,9 +4756,7 @@ module ts {
function parseClassDeclarationOrExpression(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, kind: SyntaxKind): ClassLikeDeclaration {
// In ES6 specification, All parts of a ClassDeclaration or a ClassExpression are strict mode code
let savedStrictModeContext = inStrictModeContext();
if (languageVersion >= ScriptTarget.ES6) {
setStrictModeContext(true);
}
setStrictModeContext(true);
var node = <ClassLikeDeclaration>createNode(kind, fullStart);
node.decorators = decorators;

View file

@ -1255,6 +1255,9 @@ module ts {
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
}
export const enum SymbolFlags {
@ -1380,6 +1383,7 @@ module ts {
EnumValuesComputed = 0x00000080,
BlockScopedBindingInLoop = 0x00000100,
EmitDecorate = 0x00000200, // Emit __decorate
EmitParam = 0x00000400, // Emit __param helper for decorators
}
export interface NodeLinks {
@ -1605,6 +1609,7 @@ module ts {
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
emitDecoratorMetadata?: boolean;
/* @internal */ stripInternal?: boolean;
[option: string]: string | number | boolean;
}

View file

@ -449,6 +449,18 @@ module ts {
return false;
}
export function isAccessor(node: Node): boolean {
if (node) {
switch (node.kind) {
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return true;
}
}
return false;
}
export function isFunctionLike(node: Node): boolean {
if (node) {
switch (node.kind) {

2
src/lib/core.d.ts vendored
View file

@ -1168,4 +1168,4 @@ interface TypedPropertyDescriptor<T> {
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;

36
src/lib/es6.d.ts vendored
View file

@ -3513,27 +3513,27 @@ interface ProxyHandler<T> {
interface ProxyConstructor {
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
new <T>(target: T, handeler: ProxyHandler<T>): T
new <T>(target: T, handler: ProxyHandler<T>): T
}
declare var Proxy: ProxyConstructor;
declare var Reflect: {
apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
construct(target: Function, argumentsList: ArrayLike<any>): any;
defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
deleteProperty(target: any, propertyKey: PropertyKey): boolean;
enumerate(target: any): IterableIterator<any>;
get(target: any, propertyKey: PropertyKey, receiver?: any): any;
getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
getPrototypeOf(target: any): any;
has(target: any, propertyKey: string): boolean;
has(target: any, propertyKey: symbol): boolean;
isExtensible(target: any): boolean;
ownKeys(target: any): Array<PropertyKey>;
preventExtensions(target: any): boolean;
set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
setPrototypeOf(target: any, proto: any): boolean;
};
declare module Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
function construct(target: Function, argumentsList: ArrayLike<any>): any;
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
function enumerate(target: any): IterableIterator<any>;
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
function getPrototypeOf(target: any): any;
function has(target: any, propertyKey: string): boolean;
function has(target: any, propertyKey: symbol): boolean;
function isExtensible(target: any): boolean;
function ownKeys(target: any): Array<PropertyKey>;
function preventExtensions(target: any): boolean;
function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
function setPrototypeOf(target: any, proto: any): boolean;
}
/**
* Represents the completion of an asynchronous operation

View file

@ -68,12 +68,12 @@ module ts.server {
};
}
private processRequest<T extends protocol.Request>(command: string, arguments?: any): T {
private processRequest<T extends protocol.Request>(command: string, args?: any): T {
var request: protocol.Request = {
seq: this.sequence++,
type: "request",
command: command,
arguments: arguments
arguments: args,
command
};
this.writeMessage(JSON.stringify(request));

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,10 @@
tests/cases/compiler/classExpressionWithDecorator1.ts(1,9): error TS1109: Expression expected.
tests/cases/compiler/classExpressionWithDecorator1.ts(1,10): error TS2304: Cannot find name 'decorate'.
==== tests/cases/compiler/classExpressionWithDecorator1.ts (2 errors) ====
var v = @decorate class C { static p = 1 };
~
!!! error TS1109: Expression expected.
~~~~~~~~
!!! error TS2304: Cannot find name 'decorate'.

View file

@ -0,0 +1,22 @@
//// [classExpressionWithDecorator1.ts]
var v = @decorate class C { static p = 1 };
//// [classExpressionWithDecorator1.js]
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var v = ;
var C = (function () {
function C() {
}
C.p = 1;
C = __decorate([
decorate
], C);
return C;
})();
;

View file

@ -0,0 +1,7 @@
tests/cases/compiler/classExpressionWithStaticProperties1.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticProperties1.ts (1 errors) ====
var v = class C { static a = 1; static b = 2 };
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,11 @@
//// [classExpressionWithStaticProperties1.ts]
var v = class C { static a = 1; static b = 2 };
//// [classExpressionWithStaticProperties1.js]
var v = (function () {
function C() {
}
C.a = 1;
C.b = 2;
return C;
})();

View file

@ -0,0 +1,7 @@
tests/cases/compiler/classExpressionWithStaticProperties2.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticProperties2.ts (1 errors) ====
var v = class C { static a = 1; static b };
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,10 @@
//// [classExpressionWithStaticProperties2.ts]
var v = class C { static a = 1; static b };
//// [classExpressionWithStaticProperties2.js]
var v = (function () {
function C() {
}
C.a = 1;
return C;
})();

View file

@ -0,0 +1,7 @@
tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts (1 errors) ====
var v = class C { static a = 1; static b = 2 };
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,10 @@
//// [classExpressionWithStaticPropertiesES61.ts]
var v = class C { static a = 1; static b = 2 };
//// [classExpressionWithStaticPropertiesES61.js]
var v = (_a = class C {
},
_a.a = 1,
_a.b = 2,
_a);
var _a;

View file

@ -0,0 +1,7 @@
tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts (1 errors) ====
var v = class C { static a = 1; static b };
~
!!! error TS9003: 'class' expressions are not currently supported.

View file

@ -0,0 +1,9 @@
//// [classExpressionWithStaticPropertiesES62.ts]
var v = class C { static a = 1; static b };
//// [classExpressionWithStaticPropertiesES62.js]
var v = (_a = class C {
},
_a.a = 1,
_a);
var _a;

View file

@ -1,40 +1,89 @@
tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,28): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(3,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(4,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(8,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(9,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(13,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(14,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(20,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(25,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(30,24): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(31,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(35,24): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(36,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(41,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(44,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(47,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(51,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(52,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,25): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(53,28): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(54,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(59,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(60,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(62,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(67,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(68,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(69,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(70,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(75,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(76,31): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(79,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(80,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(84,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassConstructor.ts(85,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
==== tests/cases/compiler/collisionArgumentsClassConstructor.ts (5 errors) ====
==== tests/cases/compiler/collisionArgumentsClassConstructor.ts (38 errors) ====
// Constructors
class c1 {
constructor(i: number, ...arguments) { // error
~~~~~~~~~~~~
!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments: any[]; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
class c12 {
constructor(arguments: number, ...rest) { // error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
~~~~~~~~~~~~~~~~~
!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
class c1NoError {
constructor(arguments: number) { // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
class c2 {
constructor(...restParameters) {
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
class c2NoError {
constructor() {
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
@ -42,63 +91,113 @@ tests/cases/compiler/collisionArgumentsClassConstructor.ts(61,17): error TS2396:
constructor(public arguments: number, ...restParameters) { //arguments is error
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
class c3NoError {
constructor(public arguments: number) { // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
declare class c4 {
constructor(i: number, ...arguments); // No error - no code gen
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
declare class c42 {
constructor(arguments: number, ...rest); // No error - no code gen
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
declare class c4NoError {
constructor(arguments: number); // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
class c5 {
constructor(i: number, ...arguments); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
constructor(i: string, ...arguments); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
constructor(i: any, ...arguments) { // error
~~~~~~~~~~~~
!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments: any[]; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
class c52 {
constructor(arguments: number, ...rest); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
constructor(arguments: string, ...rest); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
constructor(arguments: any, ...rest) { // error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
~~~~~~~~~~~~~~
!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
var arguments: any; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
class c5NoError {
constructor(arguments: number); // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
constructor(arguments: string); // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
constructor(arguments: any) { // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments: any; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
declare class c6 {
constructor(i: number, ...arguments); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
constructor(i: string, ...arguments); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
declare class c62 {
constructor(arguments: number, ...rest); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
constructor(arguments: string, ...rest); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
declare class c6NoError {
constructor(arguments: number); // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
constructor(arguments: string); // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}

View file

@ -1,63 +1,150 @@
tests/cases/compiler/collisionArgumentsClassMethod.ts(2,27): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
tests/cases/compiler/collisionArgumentsClassMethod.ts(2,30): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(3,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(5,17): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
tests/cases/compiler/collisionArgumentsClassMethod.ts(6,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(8,23): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(9,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(11,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(12,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(13,23): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
tests/cases/compiler/collisionArgumentsClassMethod.ts(13,26): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(14,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(16,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(17,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(18,16): error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
tests/cases/compiler/collisionArgumentsClassMethod.ts(19,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(21,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(22,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(23,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(24,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(29,30): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(30,17): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(31,23): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(33,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(34,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(35,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(36,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(37,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(38,22): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(43,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/compiler/collisionArgumentsClassMethod.ts(46,13): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
==== tests/cases/compiler/collisionArgumentsClassMethod.ts (4 errors) ====
==== tests/cases/compiler/collisionArgumentsClassMethod.ts (33 errors) ====
class c1 {
public foo(i: number, ...arguments) { //arguments is error
~~~~~~~~~~~~
!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments: any[]; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
public foo1(arguments: number, ...rest) { //arguments is error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
~~~~~~~~~~~~~~~~~
!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
public fooNoError(arguments: number) { // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
public f4(i: number, ...arguments); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f4(i: string, ...arguments); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f4(i: any, ...arguments) { // error
~~~~~~~~~~~~
!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments: any[]; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
public f41(arguments: number, ...rest); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f41(arguments: string, ...rest); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f41(arguments: any, ...rest) { // error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
~~~~~~~~~~~~~~
!!! error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.
var arguments: any; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
public f4NoError(arguments: number); // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f4NoError(arguments: string); // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f4NoError(arguments: any) { // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
var arguments: any; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}
declare class c2 {
public foo(i: number, ...arguments); // No error - no code gen
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public foo1(arguments: number, ...rest); // No error - no code gen
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public fooNoError(arguments: number); // No error - no code gen
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f4(i: number, ...arguments); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f4(i: string, ...arguments); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f41(arguments: number, ...rest); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f41(arguments: string, ...rest); // no codegen no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f4NoError(arguments: number); // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
public f4NoError(arguments: string); // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
class c3 {
public foo(...restParameters) {
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
public fooNoError() {
var arguments = 10; // no error
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
}
}

View file

@ -1,12 +1,13 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (6 errors) ====
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (7 errors) ====
var id;
class C {
[0 + 1]() { }
@ -18,6 +19,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,1
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
~~
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
set [[0, 1]](v) { }
~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.

View file

@ -0,0 +1,12 @@
tests/cases/compiler/constructorStaticParamName.ts(4,18): error TS1003: Identifier expected.
==== tests/cases/compiler/constructorStaticParamName.ts (1 errors) ====
// static as constructor parameter name should only give error if 'use strict'
class test {
constructor (static) { }
~~~~~~
!!! error TS1003: Identifier expected.
}

View file

@ -9,7 +9,7 @@ class test {
//// [constructorStaticParamName.js]
// static as constructor parameter name should only give error if 'use strict'
var test = (function () {
function test(static) {
function test() {
}
return test;
})();

View file

@ -1,10 +0,0 @@
=== tests/cases/compiler/constructorStaticParamName.ts ===
// static as constructor parameter name should only give error if 'use strict'
class test {
>test : test
constructor (static) { }
>static : any
}

View file

@ -21,27 +21,47 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(47,17): error TS
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(49,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(53,13): error TS2304: Cannot find name 'console'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(58,5): error TS1128: Declaration or statement expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(65,29): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(69,13): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(72,37): error TS1127: Invalid character.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(81,13): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(89,23): error TS2364: Invalid left-hand side of assignment expression.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(90,13): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(94,17): error TS1134: Variable declaration expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(95,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(105,29): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(106,13): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2304: Cannot find name 'any'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,30): error TS2304: Cannot find name 'bool'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,37): error TS2304: Cannot find name 'declare'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,47): error TS2304: Cannot find name 'constructor'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,61): error TS2304: Cannot find name 'get'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,67): error TS2304: Cannot find name 'implements'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(111,9): error TS1128: Declaration or statement expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(118,9): error TS2304: Cannot find name 'STATEMENTS'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(118,21): error TS1005: ',' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(118,30): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(118,39): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(138,13): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(141,32): error TS1005: '{' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(143,13): error TS1005: 'try' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(155,9): error TS1128: Declaration or statement expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(155,16): error TS2304: Cannot find name 'TYPES'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(155,23): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(155,32): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,24): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,30): error TS1005: '(' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,31): error TS2304: Cannot find name 'Property'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(166,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(176,9): error TS1128: Declaration or statement expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(176,16): error TS2304: Cannot find name 'OPERATOR'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(176,26): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(176,35): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(205,28): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(210,5): error TS1128: Declaration or statement expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(213,16): error TS2304: Cannot find name 'bool'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,29): error TS2304: Cannot find name 'yield'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,36): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(223,23): error TS2304: Cannot find name 'bool'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(227,13): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(234,14): error TS1005: '{' expected.
@ -49,7 +69,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,9): error TS
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,16): error TS2304: Cannot find name 'method1'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,24): error TS2304: Cannot find name 'val'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,27): error TS1005: ',' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,28): error TS2304: Cannot find name 'number'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,16): error TS2304: Cannot find name 'method2'.
@ -64,27 +83,23 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,16): error TS2304: Cannot find name 'Overloads'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,26): error TS2304: Cannot find name 'value'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,31): error TS1005: ',' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,33): error TS2304: Cannot find name 'string'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2304: Cannot find name 'Overloads'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error TS1135: Argument expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,35): error TS2304: Cannot find name 'string'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,43): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,52): error TS2304: Cannot find name 'string'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,60): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,9): error TS2304: Cannot find name 'public'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS2304: Cannot find name 'DefaultValue'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,29): error TS2304: Cannot find name 'value'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,35): error TS1109: Expression expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2304: Cannot find name 'string'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2322: Type 'string' is not assignable to type 'boolean'.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error TS1005: ';' expected.
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected.
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (84 errors) ====
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (99 errors) ====
declare module "fs" {
export class File {
constructor(filename: string);
@ -199,6 +214,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
/// </summary>
/// <returns></returns>
public VARIABLES(): number {
~~~~~~
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
var local = Number.MAX_VALUE;
var min = Number.MIN_VALUE;
var inf = Number.NEGATIVE_INFINITY -
@ -238,7 +255,11 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
var constructor = 0;
var get = 0;
var implements = 0;
~~~~~~~~~~
!!! error TS1134: Variable declaration expected.
var interface = 0;
~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
var let = 0;
var module = 0;
var number = 0;
@ -256,11 +277,23 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
!!! error TS1109: Expression expected.
var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
~~~
!!! error TS2304: Cannot find name 'any'.
~~~~
!!! error TS2304: Cannot find name 'bool'.
~~~~~~~
!!! error TS2304: Cannot find name 'declare'.
~~~~~~~~~~~
!!! error TS2304: Cannot find name 'constructor'.
~~~
!!! error TS2304: Cannot find name 'get'.
~~~~~~~~~~
!!! error TS2304: Cannot find name 'implements'.
return 0;
}
~
!!! error TS1128: Declaration or statement expected.
/// <summary>
/// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally
@ -268,6 +301,14 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
/// <param name="i"></param>
/// <returns></returns>
STATEMENTS(i: number): number {
~~~~~~~~~~
!!! error TS2304: Cannot find name 'STATEMENTS'.
~
!!! error TS1005: ',' expected.
~
!!! error TS1005: ';' expected.
~
!!! error TS1005: ';' expected.
var retVal = 0;
if (i == 1)
retVal = 1;
@ -311,6 +352,14 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
/// </summary>
/// <returns></returns>
public TYPES(): number {
~~~~~~
!!! error TS1128: Declaration or statement expected.
~~~~~
!!! error TS2304: Cannot find name 'TYPES'.
~
!!! error TS1005: ';' expected.
~
!!! error TS1005: ';' expected.
var retVal = 0;
var c = new CLASS();
var xx: IF = c;
@ -340,6 +389,14 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
///// </summary>
///// <returns></returns>
public OPERATOR(): number {
~~~~~~
!!! error TS1128: Declaration or statement expected.
~~~~~~~~
!!! error TS2304: Cannot find name 'OPERATOR'.
~
!!! error TS1005: ';' expected.
~
!!! error TS1005: ';' expected.
var a: number[] = [1, 2, 3, 4, 5, ];/*[] bug*/ // YES []
var i = a[1];/*[]*/
i = i + i - i * i / i % i & i | i ^ i;/*+ - * / % & | ^*/
@ -378,6 +435,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
}
}
~
!!! error TS1128: Declaration or statement expected.
interface IF {
Foo(): bool;
@ -390,10 +449,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
case d = () => { yield 0; };
~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
~
!!! error TS1005: ';' expected.
public get Property() { return 0; }
public Member() {
return 0;
@ -425,8 +480,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
!!! error TS2304: Cannot find name 'val'.
~
!!! error TS1005: ',' expected.
~~~~~~
!!! error TS2304: Cannot find name 'number'.
~
!!! error TS1005: ';' expected.
return val;
@ -476,8 +529,6 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
!!! error TS2304: Cannot find name 'value'.
~
!!! error TS1005: ',' expected.
~~~~~~
!!! error TS2304: Cannot find name 'string'.
public Overloads( while : string, ...rest: string[]) { &
~~~~~~
!!! error TS1128: Declaration or statement expected.
@ -487,20 +538,14 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
!!! error TS1135: Argument expression expected.
~
!!! error TS1005: '(' expected.
~~~~~~
!!! error TS2304: Cannot find name 'string'.
~~~
!!! error TS1109: Expression expected.
~~~~~~
!!! error TS2304: Cannot find name 'string'.
~
!!! error TS1005: ';' expected.
~
!!! error TS1109: Expression expected.
public DefaultValue(value?: string = "Hello") { }
~~~~~~
!!! error TS2304: Cannot find name 'public'.
~~~~~~~~~~~~
!!! error TS1005: ';' expected.
~~~~~~~~~~~~
@ -510,7 +555,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS
~
!!! error TS1109: Expression expected.
~~~~~~
!!! error TS2304: Cannot find name 'string'.
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
~
!!! error TS1005: ';' expected.
}

View file

@ -342,6 +342,7 @@ var TypeScriptAllInOne;
})(TypeScriptAllInOne || (TypeScriptAllInOne = {}));
var BasicFeatures = (function () {
function BasicFeatures() {
this.implements = 0;
}
/// <summary>
/// Test various of variables. Including nullable,key world as variable,special format
@ -374,120 +375,118 @@ var BasicFeatures = (function () {
var declare = 0;
var constructor = 0;
var get = 0;
var implements = 0;
var interface = 0;
var let = 0;
var module = 0;
var number = 0;
var package = 0;
var private = 0;
var protected = 0;
var public = 0;
var set = 0;
var static = 0;
var string = 0 / >
;
var yield = 0;
var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield;
return 0;
};
/// <summary>
/// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally
/// </summary>
/// <param name="i"></param>
/// <returns></returns>
BasicFeatures.prototype.STATEMENTS = function (i) {
var retVal = 0;
if (i == 1)
retVal = 1;
else
retVal = 0;
switch (i) {
case 2:
retVal = 1;
break;
case 3:
retVal = 1;
break;
default:
break;
}
for (var x in { x: 0, y: 1 }) {
!;
try {
throw null;
}
catch (Exception) { }
}
try {
}
finally {
try { }
catch (Exception) { }
}
return retVal;
};
/// <summary>
/// Test types in ts language. Including class,struct,interface,delegate,anonymous type
/// </summary>
/// <returns></returns>
BasicFeatures.prototype.TYPES = function () {
var retVal = 0;
var c = new CLASS();
var xx = c;
retVal += ;
try { }
catch () { }
Property;
retVal += c.Member();
retVal += xx.Foo() ? 0 : 1;
//anonymous type
var anony = { a: new CLASS() };
retVal += anony.a.d();
return retVal;
};
///// <summary>
///// Test different operators
///// </summary>
///// <returns></returns>
BasicFeatures.prototype.OPERATOR = function () {
var a = [1, 2, 3, 4, 5,]; /*[] bug*/ // YES []
var i = a[1]; /*[]*/
i = i + i - i * i / i % i & i | i ^ i; /*+ - * / % & | ^*/
var b = true && false || true ^ false; /*& | ^*/
b = !b; /*!*/
i = ~i; /*~i*/
b = i < (i - 1) && (i + 1) > i; /*< && >*/
var f = true ? 1 : 0; /*? :*/ // YES :
i++; /*++*/
i--; /*--*/
b = true && false || true; /*&& ||*/
i = i << 5; /*<<*/
i = i >> 5; /*>>*/
var j = i;
b = i == j && i != j && i <= j && i >= j; /*= == && != <= >=*/
i += 5.0; /*+=*/
i -= i; /*-=*/
i *= i; /**=*/
if (i == 0)
i++;
i /= i; /*/=*/
i %= i; /*%=*/
i &= i; /*&=*/
i |= i; /*|=*/
i ^= i; /*^=*/
i <<= i; /*<<=*/
i >>= i; /*>>=*/
if (i == 0 && != b && f == 1)
return 0;
else
return 1;
var ;
};
return BasicFeatures;
})();
var interface = 0;
var let = 0;
var module = 0;
var number = 0;
var package = 0;
var private = 0;
var protected = 0;
var public = 0;
var set = 0;
var static = 0;
var string = 0 / >
;
var yield = 0;
var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield;
return 0;
/// <summary>
/// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally
/// </summary>
/// <param name="i"></param>
/// <returns></returns>
STATEMENTS(i, number);
number;
{
var retVal = 0;
if (i == 1)
retVal = 1;
else
retVal = 0;
switch (i) {
case 2:
retVal = 1;
break;
case 3:
retVal = 1;
break;
default:
break;
}
for (var x in { x: 0, y: 1 }) {
!;
try {
throw null;
}
catch (Exception) { }
}
try {
}
finally {
try { }
catch (Exception) { }
}
return retVal;
}
TYPES();
number;
{
var retVal = 0;
var c = new CLASS();
var xx = c;
retVal += ;
try { }
catch () { }
Property;
retVal += c.Member();
retVal += xx.Foo() ? 0 : 1;
//anonymous type
var anony = { a: new CLASS() };
retVal += anony.a.d();
return retVal;
}
OPERATOR();
number;
{
var a = [1, 2, 3, 4, 5,]; /*[] bug*/ // YES []
var i = a[1]; /*[]*/
i = i + i - i * i / i % i & i | i ^ i; /*+ - * / % & | ^*/
var b = true && false || true ^ false; /*& | ^*/
b = !b; /*!*/
i = ~i; /*~i*/
b = i < (i - 1) && (i + 1) > i; /*< && >*/
var f = true ? 1 : 0; /*? :*/ // YES :
i++; /*++*/
i--; /*--*/
b = true && false || true; /*&& ||*/
i = i << 5; /*<<*/
i = i >> 5; /*>>*/
var j = i;
b = i == j && i != j && i <= j && i >= j; /*= == && != <= >=*/
i += 5.0; /*+=*/
i -= i; /*-=*/
i *= i; /**=*/
if (i == 0)
i++;
i /= i; /*/=*/
i %= i; /*%=*/
i &= i; /*&=*/
i |= i; /*|=*/
i ^= i; /*^=*/
i <<= i; /*<<=*/
i >>= i; /*>>=*/
if (i == 0 && != b && f == 1)
return 0;
else
return 1;
}
var CLASS = (function () {
function CLASS() {
this.d = function () { yield; 0; };
this.d = function () { ; };
}
Object.defineProperty(CLASS.prototype, "Property", {
get: function () { return 0; },

View file

@ -0,0 +1,353 @@
tests/cases/compiler/convertKeywordsYes.ts(293,11): error TS1005: '{' expected.
tests/cases/compiler/convertKeywordsYes.ts(293,21): error TS1005: ';' expected.
tests/cases/compiler/convertKeywordsYes.ts(294,11): error TS1005: '{' expected.
tests/cases/compiler/convertKeywordsYes.ts(296,11): error TS1005: '{' expected.
tests/cases/compiler/convertKeywordsYes.ts(296,19): error TS1005: ';' expected.
tests/cases/compiler/convertKeywordsYes.ts(297,11): error TS1005: '{' expected.
tests/cases/compiler/convertKeywordsYes.ts(297,19): error TS1005: ';' expected.
tests/cases/compiler/convertKeywordsYes.ts(298,11): error TS1005: '{' expected.
tests/cases/compiler/convertKeywordsYes.ts(298,21): error TS1005: ';' expected.
tests/cases/compiler/convertKeywordsYes.ts(299,11): error TS1005: '{' expected.
tests/cases/compiler/convertKeywordsYes.ts(299,18): error TS1005: ';' expected.
tests/cases/compiler/convertKeywordsYes.ts(301,11): error TS1005: '{' expected.
tests/cases/compiler/convertKeywordsYes.ts(301,18): error TS1005: ';' expected.
tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1005: '{' expected.
tests/cases/compiler/convertKeywordsYes.ts(303,17): error TS1005: ';' expected.
==== tests/cases/compiler/convertKeywordsYes.ts (15 errors) ====
// reserved ES5 future in strict mode
var constructor = 0;
var any = 0;
var boolean = 0;
var implements = 0;
var interface = 0;
var let = 0;
var module = 0;
var number = 0;
var package = 0;
var private = 0;
var protected = 0;
var public = 0;
var set = 0;
var static = 0;
var string = 0;
var get = 0;
var yield = 0;
var declare = 0;
function bigGeneric<
constructor,
implements ,
interface ,
let,
module ,
package,
private ,
protected,
public ,
set ,
static ,
get ,
yield,
declare
>(c: constructor,
a: any,
b2: boolean,
i: implements ,
i2: interface ,
l: let,
m: module ,
n: number,
p: package,
p2: private ,
p3: protected,
p4: public ,
s: set ,
s2: static ,
s3: string,
g: get ,
y: yield,
d: declare ) { }
var bigObject = {
constructor: 0,
any: 0,
boolean: 0,
implements: 0,
interface: 0,
let: 0,
module: 0,
number: 0,
package: 0,
private: 0,
protected: 0,
public: 0,
set: 0,
static: 0,
string: 0,
get: 0,
yield: 0,
break: 0,
case: 0,
catch: 0,
class: 0,
continue: 0,
const: 0,
debugger: 0,
declare: 0,
default: 0,
delete: 0,
do: 0,
else: 0,
enum: 0,
export: 0,
extends: 0,
false: 0,
finally: 0,
for: 0,
function: 0,
if: 0,
import: 0,
in: 0,
instanceof: 0,
new: 0,
null: 0,
return: 0,
super: 0,
switch: 0,
this: 0,
throw: 0,
true: 0,
try: 0,
typeof: 0,
var: 0,
void: 0,
while: 0,
with: 0,
};
interface bigInterface {
constructor;
any;
boolean;
implements;
interface;
let;
module;
number;
package;
private;
protected;
public;
set;
static;
string;
get;
yield;
break;
case;
catch;
class;
continue;
const;
debugger;
declare;
default;
delete;
do;
else;
enum;
export;
extends;
false;
finally;
for;
function;
if;
import;
in;
instanceof;
new;
null;
return;
super;
switch;
this;
throw;
true;
try;
typeof;
var;
void;
while;
with;
}
class bigClass {
public "constructor" = 0;
public any = 0;
public boolean = 0;
public implements = 0;
public interface = 0;
public let = 0;
public module = 0;
public number = 0;
public package = 0;
public private = 0;
public protected = 0;
public public = 0;
public set = 0;
public static = 0;
public string = 0;
public get = 0;
public yield = 0;
public break = 0;
public case = 0;
public catch = 0;
public class = 0;
public continue = 0;
public const = 0;
public debugger = 0;
public declare = 0;
public default = 0;
public delete = 0;
public do = 0;
public else = 0;
public enum = 0;
public export = 0;
public extends = 0;
public false = 0;
public finally = 0;
public for = 0;
public function = 0;
public if = 0;
public import = 0;
public in = 0;
public instanceof = 0;
public new = 0;
public null = 0;
public return = 0;
public super = 0;
public switch = 0;
public this = 0;
public throw = 0;
public true = 0;
public try = 0;
public typeof = 0;
public var = 0;
public void = 0;
public while = 0;
public with = 0;
}
enum bigEnum {
constructor,
any,
boolean,
implements,
interface,
let,
module,
number,
package,
private,
protected,
public,
set,
static,
string,
get,
yield,
break,
case,
catch,
class,
continue,
const,
debugger,
declare,
default,
delete,
do,
else,
enum,
export,
extends,
false,
finally,
for,
function,
if,
import,
in,
instanceof,
new,
null,
return,
super,
switch,
this,
throw,
true,
try,
typeof,
var,
void,
while,
with,
}
module bigModule {
class constructor { }
class implements { }
class interface { }
~~~~~~~~~
!!! error TS1005: '{' expected.
~
!!! error TS1005: ';' expected.
class let { }
~~~
!!! error TS1005: '{' expected.
class module { }
class package { }
~~~~~~~
!!! error TS1005: '{' expected.
~
!!! error TS1005: ';' expected.
class private { }
~~~~~~~
!!! error TS1005: '{' expected.
~
!!! error TS1005: ';' expected.
class protected { }
~~~~~~~~~
!!! error TS1005: '{' expected.
~
!!! error TS1005: ';' expected.
class public { }
~~~~~~
!!! error TS1005: '{' expected.
~
!!! error TS1005: ';' expected.
class set { }
class static { }
~~~~~~
!!! error TS1005: '{' expected.
~
!!! error TS1005: ';' expected.
class get { }
class yield { }
~~~~~
!!! error TS1005: '{' expected.
~
!!! error TS1005: ';' expected.
class declare { }
}

View file

@ -505,66 +505,81 @@ var bigModule;
}
return constructor;
})();
var implements = (function () {
function implements() {
var default_1 = (function () {
function default_1() {
}
return implements;
return default_1;
})();
var interface = (function () {
function interface() {
var default_2 = (function () {
function default_2() {
}
return interface;
return default_2;
})();
var let = (function () {
function let() {
interface;
{ }
var default_3 = (function () {
function default_3() {
}
return let;
return default_3;
})();
var _a = void 0;
var module = (function () {
function module() {
}
return module;
})();
var package = (function () {
function package() {
var default_4 = (function () {
function default_4() {
}
return package;
return default_4;
})();
var private = (function () {
function private() {
package;
{ }
var default_5 = (function () {
function default_5() {
}
return private;
return default_5;
})();
var protected = (function () {
function protected() {
private;
{ }
var default_6 = (function () {
function default_6() {
}
return protected;
return default_6;
})();
var public = (function () {
function public() {
protected;
{ }
var default_7 = (function () {
function default_7() {
}
return public;
return default_7;
})();
public;
{ }
var set = (function () {
function set() {
}
return set;
})();
var static = (function () {
function static() {
var default_8 = (function () {
function default_8() {
}
return static;
return default_8;
})();
static;
{ }
var get = (function () {
function get() {
}
return get;
})();
var yield = (function () {
function yield() {
var default_9 = (function () {
function default_9() {
}
return yield;
return default_9;
})();
yield;
{ }
var declare = (function () {
function declare() {
}

View file

@ -1,879 +0,0 @@
=== tests/cases/compiler/convertKeywordsYes.ts ===
// reserved ES5 future in strict mode
var constructor = 0;
>constructor : number
var any = 0;
>any : number
var boolean = 0;
>boolean : number
var implements = 0;
>implements : number
var interface = 0;
>interface : number
var let = 0;
>let : number
var module = 0;
>module : number
var number = 0;
>number : number
var package = 0;
>package : number
var private = 0;
>private : number
var protected = 0;
>protected : number
var public = 0;
>public : number
var set = 0;
>set : number
var static = 0;
>static : number
var string = 0;
>string : number
var get = 0;
>get : number
var yield = 0;
>yield : number
var declare = 0;
>declare : number
function bigGeneric<
>bigGeneric : <constructor, implements, interface, let, module, package, private, protected, public, set, static, get, yield, declare>(c: constructor, a: any, b2: boolean, i: implements, i2: interface, l: let, m: module, n: number, p: package, p2: private, p3: protected, p4: public, s: set, s2: static, s3: string, g: get, y: yield, d: declare) => void
constructor,
>constructor : constructor
implements ,
>implements : implements
interface ,
>interface : interface
let,
>let : let
module ,
>module : module
package,
>package : package
private ,
>private : private
protected,
>protected : protected
public ,
>public : public
set ,
>set : set
static ,
>static : static
get ,
>get : get
yield,
>yield : yield
declare
>declare : declare
>(c: constructor,
>c : constructor
>constructor : constructor
a: any,
>a : any
b2: boolean,
>b2 : boolean
i: implements ,
>i : implements
>implements : implements
i2: interface ,
>i2 : interface
>interface : interface
l: let,
>l : let
>let : let
m: module ,
>m : module
>module : module
n: number,
>n : number
p: package,
>p : package
>package : package
p2: private ,
>p2 : private
>private : private
p3: protected,
>p3 : protected
>protected : protected
p4: public ,
>p4 : public
>public : public
s: set ,
>s : set
>set : set
s2: static ,
>s2 : static
>static : static
s3: string,
>s3 : string
g: get ,
>g : get
>get : get
y: yield,
>y : yield
>yield : yield
d: declare ) { }
>d : declare
>declare : declare
var bigObject = {
>bigObject : { constructor: number; any: number; boolean: number; implements: number; interface: number; let: number; module: number; number: number; package: number; private: number; protected: number; public: number; set: number; static: number; string: number; get: number; yield: number; break: number; case: number; catch: number; class: number; continue: number; const: number; debugger: number; declare: number; default: number; delete: number; do: number; else: number; enum: number; export: number; extends: number; false: number; finally: number; for: number; function: number; if: number; import: number; in: number; instanceof: number; new: number; null: number; return: number; super: number; switch: number; this: number; throw: number; true: number; try: number; typeof: number; var: number; void: number; while: number; with: number; }
>{ constructor: 0, any: 0, boolean: 0, implements: 0, interface: 0, let: 0, module: 0, number: 0, package: 0, private: 0, protected: 0, public: 0, set: 0, static: 0, string: 0, get: 0, yield: 0, break: 0, case: 0, catch: 0, class: 0, continue: 0, const: 0, debugger: 0, declare: 0, default: 0, delete: 0, do: 0, else: 0, enum: 0, export: 0, extends: 0, false: 0, finally: 0, for: 0, function: 0, if: 0, import: 0, in: 0, instanceof: 0, new: 0, null: 0, return: 0, super: 0, switch: 0, this: 0, throw: 0, true: 0, try: 0, typeof: 0, var: 0, void: 0, while: 0, with: 0,} : { constructor: number; any: number; boolean: number; implements: number; interface: number; let: number; module: number; number: number; package: number; private: number; protected: number; public: number; set: number; static: number; string: number; get: number; yield: number; break: number; case: number; catch: number; class: number; continue: number; const: number; debugger: number; declare: number; default: number; delete: number; do: number; else: number; enum: number; export: number; extends: number; false: number; finally: number; for: number; function: number; if: number; import: number; in: number; instanceof: number; new: number; null: number; return: number; super: number; switch: number; this: number; throw: number; true: number; try: number; typeof: number; var: number; void: number; while: number; with: number; }
constructor: 0,
>constructor : number
any: 0,
>any : number
boolean: 0,
>boolean : number
implements: 0,
>implements : number
interface: 0,
>interface : number
let: 0,
>let : number
module: 0,
>module : number
number: 0,
>number : number
package: 0,
>package : number
private: 0,
>private : number
protected: 0,
>protected : number
public: 0,
>public : number
set: 0,
>set : number
static: 0,
>static : number
string: 0,
>string : number
get: 0,
>get : number
yield: 0,
>yield : number
break: 0,
>break : number
case: 0,
>case : number
catch: 0,
>catch : number
class: 0,
>class : number
continue: 0,
>continue : number
const: 0,
>const : number
debugger: 0,
>debugger : number
declare: 0,
>declare : number
default: 0,
>default : number
delete: 0,
>delete : number
do: 0,
>do : number
else: 0,
>else : number
enum: 0,
>enum : number
export: 0,
>export : number
extends: 0,
>extends : number
false: 0,
>false : number
finally: 0,
>finally : number
for: 0,
>for : number
function: 0,
>function : number
if: 0,
>if : number
import: 0,
>import : number
in: 0,
>in : number
instanceof: 0,
>instanceof : number
new: 0,
>new : number
null: 0,
>null : number
return: 0,
>return : number
super: 0,
>super : number
switch: 0,
>switch : number
this: 0,
>this : number
throw: 0,
>throw : number
true: 0,
>true : number
try: 0,
>try : number
typeof: 0,
>typeof : number
var: 0,
>var : number
void: 0,
>void : number
while: 0,
>while : number
with: 0,
>with : number
};
interface bigInterface {
>bigInterface : bigInterface
constructor;
>constructor : any
any;
>any : any
boolean;
>boolean : any
implements;
>implements : any
interface;
>interface : any
let;
>let : any
module;
>module : any
number;
>number : any
package;
>package : any
private;
>private : any
protected;
>protected : any
public;
>public : any
set;
>set : any
static;
>static : any
string;
>string : any
get;
>get : any
yield;
>yield : any
break;
>break : any
case;
>case : any
catch;
>catch : any
class;
>class : any
continue;
>continue : any
const;
>const : any
debugger;
>debugger : any
declare;
>declare : any
default;
>default : any
delete;
>delete : any
do;
>do : any
else;
>else : any
enum;
>enum : any
export;
>export : any
extends;
>extends : any
false;
>false : any
finally;
>finally : any
for;
>for : any
function;
>function : any
if;
>if : any
import;
>import : any
in;
>in : any
instanceof;
>instanceof : any
new;
>new : any
null;
>null : any
return;
>return : any
super;
>super : any
switch;
>switch : any
this;
>this : any
throw;
>throw : any
true;
>true : any
try;
>try : any
typeof;
>typeof : any
var;
>var : any
void;
>void : any
while;
>while : any
with;
>with : any
}
class bigClass {
>bigClass : bigClass
public "constructor" = 0;
public any = 0;
>any : number
public boolean = 0;
>boolean : number
public implements = 0;
>implements : number
public interface = 0;
>interface : number
public let = 0;
>let : number
public module = 0;
>module : number
public number = 0;
>number : number
public package = 0;
>package : number
public private = 0;
>private : number
public protected = 0;
>protected : number
public public = 0;
>public : number
public set = 0;
>set : number
public static = 0;
>static : number
public string = 0;
>string : number
public get = 0;
>get : number
public yield = 0;
>yield : number
public break = 0;
>break : number
public case = 0;
>case : number
public catch = 0;
>catch : number
public class = 0;
>class : number
public continue = 0;
>continue : number
public const = 0;
>const : number
public debugger = 0;
>debugger : number
public declare = 0;
>declare : number
public default = 0;
>default : number
public delete = 0;
>delete : number
public do = 0;
>do : number
public else = 0;
>else : number
public enum = 0;
>enum : number
public export = 0;
>export : number
public extends = 0;
>extends : number
public false = 0;
>false : number
public finally = 0;
>finally : number
public for = 0;
>for : number
public function = 0;
>function : number
public if = 0;
>if : number
public import = 0;
>import : number
public in = 0;
>in : number
public instanceof = 0;
>instanceof : number
public new = 0;
>new : number
public null = 0;
>null : number
public return = 0;
>return : number
public super = 0;
>super : number
public switch = 0;
>switch : number
public this = 0;
>this : number
public throw = 0;
>throw : number
public true = 0;
>true : number
public try = 0;
>try : number
public typeof = 0;
>typeof : number
public var = 0;
>var : number
public void = 0;
>void : number
public while = 0;
>while : number
public with = 0;
>with : number
}
enum bigEnum {
>bigEnum : bigEnum
constructor,
>constructor : bigEnum
any,
>any : bigEnum
boolean,
>boolean : bigEnum
implements,
>implements : bigEnum
interface,
>interface : bigEnum
let,
>let : bigEnum
module,
>module : bigEnum
number,
>number : bigEnum
package,
>package : bigEnum
private,
>private : bigEnum
protected,
>protected : bigEnum
public,
>public : bigEnum
set,
>set : bigEnum
static,
>static : bigEnum
string,
>string : bigEnum
get,
>get : bigEnum
yield,
>yield : bigEnum
break,
>break : bigEnum
case,
>case : bigEnum
catch,
>catch : bigEnum
class,
>class : bigEnum
continue,
>continue : bigEnum
const,
>const : bigEnum
debugger,
>debugger : bigEnum
declare,
>declare : bigEnum
default,
>default : bigEnum
delete,
>delete : bigEnum
do,
>do : bigEnum
else,
>else : bigEnum
enum,
>enum : bigEnum
export,
>export : bigEnum
extends,
>extends : bigEnum
false,
>false : bigEnum
finally,
>finally : bigEnum
for,
>for : bigEnum
function,
>function : bigEnum
if,
>if : bigEnum
import,
>import : bigEnum
in,
>in : bigEnum
instanceof,
>instanceof : bigEnum
new,
>new : bigEnum
null,
>null : bigEnum
return,
>return : bigEnum
super,
>super : bigEnum
switch,
>switch : bigEnum
this,
>this : bigEnum
throw,
>throw : bigEnum
true,
>true : bigEnum
try,
>try : bigEnum
typeof,
>typeof : bigEnum
var,
>var : bigEnum
void,
>void : bigEnum
while,
>while : bigEnum
with,
>with : bigEnum
}
module bigModule {
>bigModule : typeof bigModule
class constructor { }
>constructor : constructor
class implements { }
>implements : implements
class interface { }
>interface : interface
class let { }
>let : let
class module { }
>module : module
class package { }
>package : package
class private { }
>private : private
class protected { }
>protected : protected
class public { }
>public : public
class set { }
>set : set
class static { }
>static : static
class get { }
>get : get
class yield { }
>yield : yield
class declare { }
>declare : declare
}

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClass1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec], C);
C = __decorate([
dec
], C);
return C;
})();

View file

@ -6,23 +6,19 @@ export class C {
}
//// [decoratorOnClass2.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec], C);
C = __decorate([
dec
], C);
return C;
})();
exports.C = C;

View file

@ -7,22 +7,18 @@ class C {
}
//// [decoratorOnClass3.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec], C);
C = __decorate([
dec
], C);
return C;
})();

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClass4.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec()], C);
C = __decorate([
dec()
], C);
return C;
})();

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClass5.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec()], C);
C = __decorate([
dec()
], C);
return C;
})();

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClass8.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C = __decorate([dec()], C);
C = __decorate([
dec()
], C);
return C;
})();

View file

@ -6,18 +6,12 @@ class C {
}
//// [decoratorOnClassAccessor1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
@ -27,6 +21,9 @@ var C = (function () {
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
Object.defineProperty(C.prototype, "accessor",
__decorate([
dec
], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();

View file

@ -6,18 +6,12 @@ class C {
}
//// [decoratorOnClassAccessor2.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
@ -27,6 +21,9 @@ var C = (function () {
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
Object.defineProperty(C.prototype, "accessor",
__decorate([
dec
], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();

View file

@ -1,35 +1,11 @@
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) ====
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts (1 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.
}

View file

@ -6,14 +6,24 @@ class C {
}
//// [decoratorOnClassAccessor3.js]
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "accessor", {
get: function () { return 1; },
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor",
__decorate([
dec
], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();
public;
get;
accessor();
{
return 1;
}

View file

@ -6,18 +6,12 @@ class C {
}
//// [decoratorOnClassAccessor4.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
@ -27,6 +21,9 @@ var C = (function () {
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
Object.defineProperty(C.prototype, "accessor",
__decorate([
dec
], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();

View file

@ -6,18 +6,12 @@ class C {
}
//// [decoratorOnClassAccessor5.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
@ -27,6 +21,9 @@ var C = (function () {
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor", __decorate([dec], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
Object.defineProperty(C.prototype, "accessor",
__decorate([
dec
], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();

View file

@ -1,44 +1,11 @@
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) ====
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts (1 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.
}

View file

@ -6,12 +6,24 @@ class C {
}
//// [decoratorOnClassAccessor6.js]
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "accessor", {
set: function (value) { },
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "accessor",
__decorate([
dec
], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
return C;
})();
public;
set;
accessor(value, number);
{ }

View file

@ -6,6 +6,6 @@ tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor
class C {
@dec constructor() {}
~~~~~~~~~~~~~~~~~~~~~
~
!!! error TS1206: Decorators are not valid here.
}

View file

@ -6,22 +6,19 @@ class C {
}
//// [decoratorOnClassConstructorParameter1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };
var C = (function () {
function C(p) {
}
__decorate([dec], C, void 0, 0);
C = __decorate([
__param(0, dec)
], C);
return C;
})();

View file

@ -1,11 +1,14 @@
tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts(4,17): error TS1003: Identifier expected.
tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts(4,24): error TS1005: ',' expected.
==== tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts (1 errors) ====
==== tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts (2 errors) ====
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
class C {
constructor(public @dec p: number) {}
~~~~~~
!!! error TS1003: Identifier expected.
~
!!! error TS1005: ',' expected.
}

View file

@ -6,22 +6,19 @@ class C {
}
//// [decoratorOnClassConstructorParameter4.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };
var C = (function () {
function C(public, p) {
function C(, p) {
}
__decorate([dec], C, void 0, 1);
C = __decorate([
__param(1, dec)
], C);
return C;
})();

View file

@ -6,23 +6,20 @@ class C {
}
//// [decoratorOnClassMethod1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
Object.defineProperty(C.prototype, "method",
__decorate([
dec
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();

View file

@ -6,23 +6,20 @@ class C {
}
//// [decoratorOnClassMethod10.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
Object.defineProperty(C.prototype, "method",
__decorate([
dec
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();

View file

@ -6,23 +6,20 @@ class C {
}
//// [decoratorOnClassMethod2.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
Object.defineProperty(C.prototype, "method",
__decorate([
dec
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();

View file

@ -1,29 +1,11 @@
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) ====
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts (1 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.
}

View file

@ -6,11 +6,20 @@ class C {
}
//// [decoratorOnClassMethod3.js]
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
Object.defineProperty(C.prototype, "method",
__decorate([
dec
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();
public;
method();
{ }

View file

@ -6,21 +6,18 @@ class C {
}
//// [decoratorOnClassMethod4.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
class C {
[_a = "method"]() { }
}
Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
Object.defineProperty(C.prototype, _a,
__decorate([
dec
], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
var _a;

View file

@ -6,21 +6,18 @@ class C {
}
//// [decoratorOnClassMethod5.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
class C {
[_a = "method"]() { }
}
Object.defineProperty(C.prototype, _a, __decorate([dec()], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
Object.defineProperty(C.prototype, _a,
__decorate([
dec()
], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
var _a;

View file

@ -6,21 +6,18 @@ class C {
}
//// [decoratorOnClassMethod6.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
class C {
[_a = "method"]() { }
}
Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
Object.defineProperty(C.prototype, _a,
__decorate([
dec
], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
var _a;

View file

@ -6,21 +6,18 @@ class C {
}
//// [decoratorOnClassMethod7.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
class C {
[_a = "method"]() { }
}
Object.defineProperty(C.prototype, _a, __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
Object.defineProperty(C.prototype, _a,
__decorate([
dec
], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
var _a;

View file

@ -6,23 +6,20 @@ class C {
}
//// [decoratorOnClassMethod8.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
C.prototype.method = function () { };
Object.defineProperty(C.prototype, "method", __decorate([dec], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
Object.defineProperty(C.prototype, "method",
__decorate([
dec
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();

View file

@ -6,23 +6,21 @@ class C {
}
//// [decoratorOnClassMethodParameter1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };
var C = (function () {
function C() {
}
C.prototype.method = function (p) { };
__decorate([dec], C.prototype, "method", 0);
Object.defineProperty(C.prototype, "method",
__decorate([
__param(0, dec)
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClassProperty1.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
__decorate([
dec
], C.prototype, "prop");
return C;
})();

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClassProperty10.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec()], C.prototype, "prop");
__decorate([
dec()
], C.prototype, "prop");
return C;
})();

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClassProperty11.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
__decorate([
dec
], C.prototype, "prop");
return C;
})();

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClassProperty2.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
__decorate([
dec
], C.prototype, "prop");
return C;
})();

View file

@ -1,26 +1,11 @@
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) ====
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts (1 errors) ====
declare function dec(target: any, propertyKey: string): void;
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.
}

View file

@ -6,10 +6,18 @@ class C {
}
//// [decoratorOnClassProperty3.js]
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var C = (function () {
function C() {
}
__decorate([
dec
], C.prototype, "prop");
return C;
})();
public;
prop;

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClassProperty6.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
__decorate([
dec
], C.prototype, "prop");
return C;
})();

View file

@ -6,22 +6,18 @@ class C {
}
//// [decoratorOnClassProperty7.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var C = (function () {
function C() {
}
__decorate([dec], C.prototype, "prop");
__decorate([
dec
], C.prototype, "prop");
return C;
})();

View file

@ -1,11 +1,11 @@
tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts(4,6): error TS1206: Decorators are not valid here.
tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts(3,1): error TS1206: Decorators are not valid here.
==== tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts (1 errors) ====
declare function dec<T>(target: T): T;
@dec
enum E {
~
~
!!! error TS1206: Decorators are not valid here.
enum E {
}

View file

@ -1,11 +1,11 @@
tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts(4,10): error TS1206: Decorators are not valid here.
tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts(3,1): error TS1206: Decorators are not valid here.
==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts (1 errors) ====
declare function dec<T>(target: T): T;
@dec
function F() {
~
~
!!! error TS1206: Decorators are not valid here.
function F() {
}

View file

@ -10,8 +10,7 @@ tests/cases/conformance/decorators/invalid/decoratorOnImportEquals1.ts(8,5): err
module M2 {
@dec
~~~~
import X = M1.X;
~~~~~~~~~~~~~~~~~~~~
~
!!! error TS1206: Decorators are not valid here.
import X = M1.X;
}

View file

@ -3,10 +3,9 @@ tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts(1,1): e
==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts (1 errors) ====
@dec
~~~~
import lib = require('./decoratorOnImportEquals2_0');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
!!! error TS1206: Decorators are not valid here.
import lib = require('./decoratorOnImportEquals2_0');
declare function dec<T>(target: T): T;
==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_0.ts (0 errors) ====

View file

@ -1,11 +1,11 @@
tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts(4,11): error TS1206: Decorators are not valid here.
tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts(3,1): error TS1206: Decorators are not valid here.
==== tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts (1 errors) ====
declare function dec<T>(target: T): T;
@dec
interface I {
~
~
!!! error TS1206: Decorators are not valid here.
interface I {
}

View file

@ -1,12 +1,12 @@
tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts(4,8): error TS1206: Decorators are not valid here.
tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts(3,1): error TS1206: Decorators are not valid here.
==== tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts (1 errors) ====
declare function dec<T>(target: T): T;
@dec
module M {
~
~
!!! error TS1206: Decorators are not valid here.
module M {
}

View file

@ -5,7 +5,6 @@ tests/cases/conformance/decorators/invalid/decoratorOnTypeAlias.ts(3,1): error T
declare function dec<T>(target: T): T;
@dec
~~~~
type T = number;
~~~~~~~~~~~~~~~~
!!! error TS1206: Decorators are not valid here.
~
!!! error TS1206: Decorators are not valid here.
type T = number;

View file

@ -5,7 +5,6 @@ tests/cases/conformance/decorators/invalid/decoratorOnVar.ts(3,1): error TS1206:
declare function dec<T>(target: T): T;
@dec
~~~~
var x: number;
~~~~~~~~~~~~~~
!!! error TS1206: Decorators are not valid here.
~
!!! error TS1206: Decorators are not valid here.
var x: number;

View file

@ -1,6 +1,6 @@
tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(4,16): error TS1100: Invalid use of 'arguments' in strict mode.
tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(5,17): error TS1100: Invalid use of 'eval' in strict mode.
tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS1100: Invalid use of 'arguments' in strict mode.
tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(4,16): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(5,17): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode.
tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts(6,9): error TS2322: Type 'string' is not assignable to type 'IArguments'.
Property 'callee' is missing in type 'String'.
@ -11,13 +11,13 @@ tests/cases/conformance/es6/classDeclaration/parseClassDeclarationInStrictModeBy
public implements() { }
public foo(arguments: any) { }
~~~~~~~~~
!!! error TS1100: Invalid use of 'arguments' in strict mode.
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
private bar(eval:any) {
~~~~
!!! error TS1100: Invalid use of 'eval' in strict mode.
!!! error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode.
arguments = "hello";
~~~~~~~~~
!!! error TS1100: Invalid use of 'arguments' in strict mode.
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
~~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'IArguments'.
!!! error TS2322: Property 'callee' is missing in type 'String'.

View file

@ -1,10 +1,13 @@
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts(3,16): error TS1003: Identifier expected.
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts(3,23): error TS1005: ',' expected.
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509668.ts (2 errors) ====
class Foo3 {
// Doesn't work, but should
constructor (public ...args: string[]) { }
~~~~~~
!!! error TS1003: Identifier expected.
~~~
!!! error TS1005: ',' expected.
}

View file

@ -7,7 +7,7 @@ class Foo3 {
//// [parser509668.js]
var Foo3 = (function () {
// Doesn't work, but should
function Foo3(public) {
function Foo3() {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];

View file

@ -1,4 +1,4 @@
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS2304: Cannot find name 'public'.
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS1110: Type expected.
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts (1 errors) ====
@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21)
constructor() { }
public banana (x: public) { }
~~~~~~
!!! error TS2304: Cannot find name 'public'.
!!! error TS1110: Type expected.
}
class Bar {

View file

@ -12,7 +12,7 @@ class Bar {
var Foo = (function () {
function Foo() {
}
Foo.prototype.banana = function (x) { };
Foo.prototype.banana = function (x, ) { };
return Foo;
})();
var Bar = (function () {

View file

@ -0,0 +1,10 @@
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts(2,18): error TS1003: Identifier expected.
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts (1 errors) ====
class test {
constructor (static) { }
~~~~~~
!!! error TS1003: Identifier expected.
}

View file

@ -6,7 +6,7 @@ class test {
//// [parser642331.js]
var test = (function () {
function test(static) {
function test() {
}
return test;
})();

View file

@ -1,8 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts ===
class test {
>test : test
constructor (static) { }
>static : any
}

View file

@ -115,6 +115,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(504,58): error
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(506,22): error TS2304: Cannot find name 'NodeType'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(507,58): error TS2304: Cannot find name 'TokenID'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(518,32): error TS2304: Cannot find name 'NodeType'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(520,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(525,27): error TS2304: Cannot find name 'Signature'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(527,36): error TS2304: Cannot find name 'TypeFlow'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(528,34): error TS2304: Cannot find name 'NodeType'.
@ -246,6 +247,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(963,27): error
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(969,31): error TS2304: Cannot find name 'Symbol'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(977,32): error TS2304: Cannot find name 'Symbol'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(981,27): error TS2304: Cannot find name 'Type'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(985,29): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,44): error TS2304: Cannot find name 'hasFlag'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,67): error TS2304: Cannot find name 'FncFlags'.
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1005,57): error TS2304: Cannot find name 'FncFlags'.
@ -515,7 +517,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,30): error
tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error TS2304: Cannot find name 'TokenID'.
==== tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts (515 errors) ====
==== tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts (517 errors) ====
// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
// See LICENSE.txt in the project root for complete license information.
@ -1270,6 +1272,8 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error
!!! error TS2304: Cannot find name 'NodeType'.
public target: AST,
public arguments: ASTList) {
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
super(nodeType);
this.minChar = this.target.minChar;
}
@ -1997,6 +2001,8 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(2356,48): error
constructor (public name: Identifier, public bod: ASTList, public isConstructor: boolean,
public arguments: ASTList, public vars: ASTList, public scopes: ASTList, public statics: ASTList,
~~~~~~~~~
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
nodeType: number) {
super(nodeType);

View file

@ -55,19 +55,14 @@ class Greeter {
}
//// [sourceMapValidationDecorators.js]
var __decorate = this.__decorate || function (decorators, target, key, value) {
var kind = typeof (arguments.length == 2 ? value = target : value);
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
switch (kind) {
case "function": value = decorator(value) || value; break;
case "number": decorator(target, key, value); break;
case "undefined": decorator(target, key); break;
case "object": value = decorator(target, key, value) || value; break;
}
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
return value;
};
var __param = this.__param || function(index, decorator) { return function (target, key) { decorator(target, key, index); } };
var Greeter = (function () {
function Greeter(greeting) {
var b = [];
@ -93,15 +88,39 @@ var Greeter = (function () {
configurable: true
});
Greeter.x1 = 10;
Object.defineProperty(Greeter.prototype, "greet", __decorate([PropertyDecorator1, PropertyDecorator2(40)], Greeter.prototype, "greet", Object.getOwnPropertyDescriptor(Greeter.prototype, "greet")));
__decorate([PropertyDecorator1, PropertyDecorator2(50)], Greeter.prototype, "x");
__decorate([ParameterDecorator1, ParameterDecorator2(70)], Greeter.prototype, "fn", 0);
__decorate([ParameterDecorator1, ParameterDecorator2(90)], Greeter.prototype, "greetings", 0);
Object.defineProperty(Greeter.prototype, "greetings", __decorate([PropertyDecorator1, PropertyDecorator2(80)], Greeter.prototype, "greetings", Object.getOwnPropertyDescriptor(Greeter.prototype, "greetings")));
__decorate([PropertyDecorator1, PropertyDecorator2(60)], Greeter, "x1");
__decorate([ParameterDecorator1, ParameterDecorator2(20)], Greeter, void 0, 0);
__decorate([ParameterDecorator1, ParameterDecorator2(30)], Greeter, void 0, 1);
Greeter = __decorate([ClassDecorator1, ClassDecorator2(10)], Greeter);
Object.defineProperty(Greeter.prototype, "greet",
__decorate([
PropertyDecorator1,
PropertyDecorator2(40)
], Greeter.prototype, "greet", Object.getOwnPropertyDescriptor(Greeter.prototype, "greet")));
__decorate([
PropertyDecorator1,
PropertyDecorator2(50)
], Greeter.prototype, "x");
Object.defineProperty(Greeter.prototype, "fn",
__decorate([
__param(0, ParameterDecorator1),
__param(0, ParameterDecorator2(70))
], Greeter.prototype, "fn", Object.getOwnPropertyDescriptor(Greeter.prototype, "fn")));
Object.defineProperty(Greeter.prototype, "greetings",
__decorate([
PropertyDecorator1,
PropertyDecorator2(80),
__param(0, ParameterDecorator1),
__param(0, ParameterDecorator2(90))
], Greeter.prototype, "greetings", Object.getOwnPropertyDescriptor(Greeter.prototype, "greetings")));
__decorate([
PropertyDecorator1,
PropertyDecorator2(60)
], Greeter, "x1");
Greeter = __decorate([
ClassDecorator1,
ClassDecorator2(10),
__param(0, ParameterDecorator1),
__param(0, ParameterDecorator2(20)),
__param(1, ParameterDecorator1),
__param(1, ParameterDecorator2(30))
], Greeter);
return Greeter;
})();
//# sourceMappingURL=sourceMapValidationDecorators.js.map

View file

@ -1,2 +1,2 @@
//// [sourceMapValidationDecorators.js.map]
{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":["Greeter","Greeter.constructor","Greeter.greet","Greeter.fn","Greeter.greetings"],"mappings":";;;;;;;;;;;;;AAOA;IAGIA,iBAGSA,QAAgBA;QAEvBC,WAEcA;aAFdA,WAEcA,CAFdA,sBAEcA,CAFdA,IAEcA;YAFdA,0BAEcA;;QAJPA,aAAQA,GAARA,QAAQA,CAAQA;IAKzBA,CAACA;IAIDD,uBAAKA,GAFLA;QAGIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;IAC5CA,CAACA;IAUOF,oBAAEA,GAAVA,UAGEA,CAASA;QACPG,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;IACzBA,CAACA;IAEDH,sBAEIA,8BAASA;aAFbA;YAGII,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;QACzBA,CAACA;aAEDJ,UAGEA,SAAiBA;YACfI,IAAIA,CAACA,QAAQA,GAAGA,SAASA,CAACA;QAC9BA,CAACA;;;OAPAJ;IAbcA,UAAEA,GAAWA,EAAEA,CAACA;IAZ/BA,sBAEAA,0BAAKA,cAFJA,kBAAkBA,EAClBA,kBAAkBA,CAACA,EAAEA,CAACA,GACvBA,0BAAKA,kCAALA,0BAAKA,IAEJA;IAEDA,YAACA,kBAAkBA,EAClBA,kBAAkBA,CAACA,EAAEA,CAACA,GACfA,sBAACA,EAASA;IAOhBA,YAACA,mBAAmBA,EACnBA,mBAAmBA,CAACA,EAAEA,CAACA,GACxBA,0BAACA,EAAQA;IAWTA,YAACA,mBAAmBA,EACnBA,mBAAmBA,CAACA,EAAEA,CAACA,GACxBA,iCAASA,EAAQA;IATnBA,sBAEIA,8BAASA,cAFZA,kBAAkBA,EAClBA,kBAAkBA,CAACA,EAAEA,CAACA,GACnBA,8BAASA,kCAATA,8BAASA,IAEZA;IAfDA,YAACA,kBAAkBA,EAClBA,kBAAkBA,CAACA,EAAEA,CAACA,GACRA,aAAEA,EAAcA;IArB7BA,YAACA,mBAAmBA,EACnBA,mBAAmBA,CAACA,EAAEA,CAACA,GACjBA,kBAAQA,EAAQA;IAEvBA,YAACA,mBAAmBA,EACnBA,mBAAmBA,CAACA,EAAEA,CAACA,GACrBA,kBAACA,EAAUA;IAVpBA,sBAACA,eAAeA,EACfA,eAAeA,CAACA,EAAEA,CAACA,YA6CnBA;IAADA,cAACA;AAADA,CAACA,AA9CD,IA8CC"}
{"version":3,"file":"sourceMapValidationDecorators.js","sourceRoot":"","sources":["sourceMapValidationDecorators.ts"],"names":["Greeter","Greeter.constructor","Greeter.greet","Greeter.fn","Greeter.greetings"],"mappings":";;;;;;;;AAOA;IAGIA,iBAGSA,QAAgBA;QAEvBC,WAEcA;aAFdA,WAEcA,CAFdA,sBAEcA,CAFdA,IAEcA;YAFdA,0BAEcA;;QAJPA,aAAQA,GAARA,QAAQA,CAAQA;IAKzBA,CAACA;IAIDD,uBAAKA,GAFLA;QAGIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;IAC5CA,CAACA;IAUOF,oBAAEA,GAAVA,UAGEA,CAASA;QACPG,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;IACzBA,CAACA;IAEDH,sBAEIA,8BAASA;aAFbA;YAGII,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;QACzBA,CAACA;aAEDJ,UAGEA,SAAiBA;YACfI,IAAIA,CAACA,QAAQA,GAAGA,SAASA,CAACA;QAC9BA,CAACA;;;OAPAJ;IAbcA,UAAEA,GAAWA,EAAEA,CAACA;IAZ/BA,sBAEAA,0BAAKA;;YAFJA,kBAAkBA;YAClBA,kBAAkBA,CAACA,EAAEA,CAACA;WACvBA,0BAAKA,kCAALA,0BAAKA,IAEJA;IAEDA;QAACA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACfA,sBAACA,EAASA;IAMlBA,sBAAQA,uBAAEA;;YACRA,WAACA,mBAAmBA,CAAAA;YACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;WAFlBA,uBAAEA,kCAAFA,uBAAEA,IAKTA;IAEDA,sBAEIA,8BAASA;;YAFZA,kBAAkBA;YAClBA,kBAAkBA,CAACA,EAAEA,CAACA;YAMrBA,WAACA,mBAAmBA,CAAAA;YACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;WANtBA,8BAASA,kCAATA,8BAASA,IAEZA;IAfDA;QAACA,kBAAkBA;QAClBA,kBAAkBA,CAACA,EAAEA,CAACA;OACRA,aAAEA,EAAcA;IAzBnCA;QAACA,eAAeA;QACfA,eAAeA,CAACA,EAAEA,CAACA;QAGdA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;QAGxBA,WAACA,mBAAmBA,CAAAA;QACpBA,WAACA,mBAAmBA,CAACA,EAAEA,CAACA,CAAAA;gBAqC7BA;IAADA,cAACA;AAADA,CAACA,AA9CD,IA8CC"}

View file

@ -1,7 +1,8 @@
tests/cases/compiler/superCallsInConstructor.ts(12,9): error TS1101: 'with' statements are not allowed in strict mode.
tests/cases/compiler/superCallsInConstructor.ts(12,14): error TS2410: All symbols within a 'with' block will be resolved to 'any'.
==== tests/cases/compiler/superCallsInConstructor.ts (1 errors) ====
==== tests/cases/compiler/superCallsInConstructor.ts (2 errors) ====
class C {
foo() {}
bar() {}
@ -14,6 +15,8 @@ tests/cases/compiler/superCallsInConstructor.ts(12,14): error TS2410: All symbol
class Derived extends Base {
constructor() {
with(new C()) {
~~~~
!!! error TS1101: 'with' statements are not allowed in strict mode.
~~~~~~~
!!! error TS2410: All symbols within a 'with' block will be resolved to 'any'.
foo();

View file

@ -1,7 +1,8 @@
tests/cases/compiler/varArgConstructorMemberParameter.ts(10,18): error TS1003: Identifier expected.
tests/cases/compiler/varArgConstructorMemberParameter.ts(10,25): error TS1005: ',' expected.
==== tests/cases/compiler/varArgConstructorMemberParameter.ts (1 errors) ====
==== tests/cases/compiler/varArgConstructorMemberParameter.ts (2 errors) ====
class Foo1 {
constructor (...args: string[]) { }
}
@ -12,6 +13,8 @@ tests/cases/compiler/varArgConstructorMemberParameter.ts(10,25): error TS1005: '
class Foo3 {
constructor (public ...args: string[]) { }
~~~~~~
!!! error TS1003: Identifier expected.
~~~
!!! error TS1005: ',' expected.
}

View file

@ -29,7 +29,7 @@ var Foo2 = (function () {
return Foo2;
})();
var Foo3 = (function () {
function Foo3(public) {
function Foo3() {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];

View file

@ -0,0 +1 @@
var v = @decorate class C { static p = 1 };

View file

@ -0,0 +1 @@
var v = class C { static a = 1; static b = 2 };

View file

@ -0,0 +1 @@
var v = class C { static a = 1; static b };

View file

@ -0,0 +1,2 @@
//@target: es6
var v = class C { static a = 1; static b = 2 };

View file

@ -0,0 +1,2 @@
//@target: es6
var v = class C { static a = 1; static b };

View file

@ -44,7 +44,6 @@
//// protected prot1;
////
//// protected constructor(public public, protected protected, private private) {
//// public = private = protected;
//// }
//// }
//// }

View file

@ -48,7 +48,6 @@
//// protected prot1;
////
//// protected constructor(public public, protected protected, private private) {
//// public = private = protected;
//// }
//// }
//// }

Some files were not shown because too many files have changed in this diff Show more