mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
merging with master
This commit is contained in:
+420
-82
@@ -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[] = [];
|
||||
@@ -928,7 +929,7 @@ module ts {
|
||||
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
|
||||
// module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error.
|
||||
function visit(symbol: Symbol) {
|
||||
if (symbol.flags & SymbolFlags.HasExports && !contains(visitedSymbols, symbol)) {
|
||||
if (symbol && symbol.flags & SymbolFlags.HasExports && !contains(visitedSymbols, symbol)) {
|
||||
visitedSymbols.push(symbol);
|
||||
if (symbol !== moduleSymbol) {
|
||||
if (!result) {
|
||||
@@ -2077,15 +2078,20 @@ module ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// For an array binding element the specified or inferred type of the parent must be an array-like type
|
||||
if (!isArrayLikeType(parentType)) {
|
||||
error(pattern, Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType));
|
||||
return unknownType;
|
||||
}
|
||||
// This elementType will be used if the specific property corresponding to this index is not
|
||||
// present (aka the tuple element property). This call also checks that the parentType is in
|
||||
// fact an iterable or array (depending on target language).
|
||||
let elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false);
|
||||
if (!declaration.dotDotDotToken) {
|
||||
if (elementType.flags & TypeFlags.Any) {
|
||||
return elementType;
|
||||
}
|
||||
|
||||
// Use specific property type when parent is a tuple or numeric index type when parent is an array
|
||||
let propName = "" + indexOf(pattern.elements, declaration);
|
||||
type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, IndexKind.Number);
|
||||
type = isTupleLikeType(parentType)
|
||||
? getTypeOfPropertyOfType(parentType, propName)
|
||||
: elementType;
|
||||
if (!type) {
|
||||
if (isTupleType(parentType)) {
|
||||
error(declaration, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), (<TupleType>parentType).elementTypes.length, pattern.elements.length);
|
||||
@@ -2098,7 +2104,7 @@ module ts {
|
||||
}
|
||||
else {
|
||||
// Rest element has an array type with the same element type as the parent type
|
||||
type = createArrayType(getIndexTypeOfType(parentType, IndexKind.Number));
|
||||
type = createArrayType(elementType);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
@@ -2187,7 +2193,34 @@ module ts {
|
||||
hasSpreadElement = true;
|
||||
}
|
||||
});
|
||||
return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes);
|
||||
if (!elementTypes.length) {
|
||||
return languageVersion >= ScriptTarget.ES6 ? createIterableType(anyType) : anyArrayType;
|
||||
}
|
||||
else if (hasSpreadElement) {
|
||||
let unionOfElements = getUnionType(elementTypes);
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
// If the user has something like:
|
||||
//
|
||||
// function fun(...[a, ...b]) { }
|
||||
//
|
||||
// Normally, in ES6, the implied type of an array binding pattern with a rest element is
|
||||
// an iterable. However, there is a requirement in our type system that all rest
|
||||
// parameters be array types. To satisfy this, we have an exception to the rule that
|
||||
// says the type of an array binding pattern with a rest element is an array type
|
||||
// if it is *itself* in a rest parameter. It will still be compatible with a spreaded
|
||||
// iterable argument, but within the function it will be an array.
|
||||
let parent = pattern.parent;
|
||||
let isRestParameter = parent.kind === SyntaxKind.Parameter &&
|
||||
pattern === (<ParameterDeclaration>parent).name &&
|
||||
(<ParameterDeclaration>parent).dotDotDotToken !== undefined;
|
||||
return isRestParameter ? createArrayType(unionOfElements) : createIterableType(unionOfElements);
|
||||
}
|
||||
|
||||
return createArrayType(unionOfElements);
|
||||
}
|
||||
|
||||
// If the pattern has at least one element, and no rest element, then it should imply a tuple type.
|
||||
return createTupleType(elementTypes);
|
||||
}
|
||||
|
||||
// Return the type implied by a binding pattern. This is the type implied purely by the binding pattern itself
|
||||
@@ -3000,6 +3033,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);
|
||||
@@ -3450,6 +3493,10 @@ module ts {
|
||||
return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"));
|
||||
}
|
||||
|
||||
function createIterableType(elementType: Type): Type {
|
||||
return globalIterableType !== emptyObjectType ? createTypeReference(<GenericType>globalIterableType, [elementType]) : emptyObjectType;
|
||||
}
|
||||
|
||||
function createArrayType(elementType: Type): Type {
|
||||
// globalArrayType will be undefined if we get here during creation of the Array type. This for example happens if
|
||||
// user code augments the Array type with call or construct signatures that have an array type as the return type.
|
||||
@@ -5589,7 +5636,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (container.kind === SyntaxKind.ComputedPropertyName) {
|
||||
if (container && container.kind === SyntaxKind.ComputedPropertyName) {
|
||||
error(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
|
||||
}
|
||||
else if (isCallExpression) {
|
||||
@@ -5957,12 +6004,14 @@ module ts {
|
||||
}
|
||||
|
||||
function checkSpreadElementExpression(node: SpreadElementExpression, contextualMapper?: TypeMapper): Type {
|
||||
let type = checkExpressionCached(node.expression, contextualMapper);
|
||||
if (!isArrayLikeType(type)) {
|
||||
error(node.expression, Diagnostics.Type_0_is_not_an_array_type, typeToString(type));
|
||||
return unknownType;
|
||||
}
|
||||
return type;
|
||||
// It is usually not safe to call checkExpressionCached if we can be contextually typing.
|
||||
// You can tell that we are contextually typing because of the contextualMapper parameter.
|
||||
// While it is true that a spread element can have a contextual type, it does not do anything
|
||||
// with this type. It is neither affected by it, nor does it propagate it to its operand.
|
||||
// So the fact that contextualMapper is passed is not important, because the operand of a spread
|
||||
// element is not contextually typed.
|
||||
let arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper);
|
||||
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false);
|
||||
}
|
||||
|
||||
function checkArrayLiteral(node: ArrayLiteralExpression, contextualMapper?: TypeMapper): Type {
|
||||
@@ -5970,18 +6019,13 @@ module ts {
|
||||
if (!elements.length) {
|
||||
return createArrayType(undefinedType);
|
||||
}
|
||||
let hasSpreadElement: boolean = false;
|
||||
let hasSpreadElement = false;
|
||||
let elementTypes: Type[] = [];
|
||||
forEach(elements, e => {
|
||||
for (let e of elements) {
|
||||
let type = checkExpression(e, contextualMapper);
|
||||
if (e.kind === SyntaxKind.SpreadElementExpression) {
|
||||
elementTypes.push(getIndexTypeOfType(type, IndexKind.Number) || anyType);
|
||||
hasSpreadElement = true;
|
||||
}
|
||||
else {
|
||||
elementTypes.push(type);
|
||||
}
|
||||
});
|
||||
elementTypes.push(type);
|
||||
hasSpreadElement = hasSpreadElement || e.kind === SyntaxKind.SpreadElementExpression;
|
||||
}
|
||||
if (!hasSpreadElement) {
|
||||
let contextualType = getContextualType(node);
|
||||
if (contextualType && contextualTypeIsTupleLikeType(contextualType) || isAssignmentTarget(node)) {
|
||||
@@ -6604,7 +6648,7 @@ module ts {
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
let arg = args[i];
|
||||
if (arg.kind !== SyntaxKind.OmittedExpression) {
|
||||
let paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i);
|
||||
let paramType = getTypeAtPosition(signature, i);
|
||||
let argType: Type;
|
||||
if (i === 0 && args[i].parent.kind === SyntaxKind.TaggedTemplateExpression) {
|
||||
argType = globalTemplateStringsArrayType;
|
||||
@@ -6627,7 +6671,7 @@ module ts {
|
||||
// No need to check for omitted args and template expressions, their exlusion value is always undefined
|
||||
if (excludeArgument[i] === false) {
|
||||
let arg = args[i];
|
||||
let paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i);
|
||||
let paramType = getTypeAtPosition(signature, i);
|
||||
inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType);
|
||||
}
|
||||
}
|
||||
@@ -6660,7 +6704,7 @@ module ts {
|
||||
let arg = args[i];
|
||||
if (arg.kind !== SyntaxKind.OmittedExpression) {
|
||||
// Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter)
|
||||
let paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i);
|
||||
let paramType = getTypeAtPosition(signature, i);
|
||||
// A tagged template expression provides a special first argument, and string literals get string literal types
|
||||
// unless we're reporting errors
|
||||
let argType = i === 0 && node.kind === SyntaxKind.TaggedTemplateExpression ? globalTemplateStringsArrayType :
|
||||
@@ -7134,14 +7178,9 @@ module ts {
|
||||
}
|
||||
|
||||
function getTypeAtPosition(signature: Signature, pos: number): Type {
|
||||
if (pos >= 0) {
|
||||
return signature.hasRestParameter ?
|
||||
pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) :
|
||||
pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType;
|
||||
}
|
||||
return signature.hasRestParameter ?
|
||||
getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) :
|
||||
anyArrayType;
|
||||
pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) :
|
||||
pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType;
|
||||
}
|
||||
|
||||
function assignContextualParameterTypes(signature: Signature, context: Signature, mapper: TypeMapper) {
|
||||
@@ -7577,11 +7616,10 @@ module ts {
|
||||
}
|
||||
|
||||
function checkArrayLiteralAssignment(node: ArrayLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type {
|
||||
// TODOO(andersh): Allow iterable source type in ES6
|
||||
if (!isArrayLikeType(sourceType)) {
|
||||
error(node, Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType));
|
||||
return sourceType;
|
||||
}
|
||||
// This elementType will be used if the specific property corresponding to this index is not
|
||||
// present (aka the tuple element property). This call also checks that the parentType is in
|
||||
// fact an iterable or array (depending on target language).
|
||||
let elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false);
|
||||
let elements = node.elements;
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
let e = elements[i];
|
||||
@@ -7589,8 +7627,9 @@ module ts {
|
||||
if (e.kind !== SyntaxKind.SpreadElementExpression) {
|
||||
let propName = "" + i;
|
||||
let type = sourceType.flags & TypeFlags.Any ? sourceType :
|
||||
isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) :
|
||||
getIndexTypeOfType(sourceType, IndexKind.Number);
|
||||
isTupleLikeType(sourceType)
|
||||
? getTypeOfPropertyOfType(sourceType, propName)
|
||||
: elementType;
|
||||
if (type) {
|
||||
checkDestructuringAssignment(e, type, contextualMapper);
|
||||
}
|
||||
@@ -7605,7 +7644,7 @@ module ts {
|
||||
}
|
||||
else {
|
||||
if (i === elements.length - 1) {
|
||||
checkReferenceAssignment((<SpreadElementExpression>e).expression, sourceType, contextualMapper);
|
||||
checkReferenceAssignment((<SpreadElementExpression>e).expression, createArrayType(elementType), contextualMapper);
|
||||
}
|
||||
else {
|
||||
error(e, Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
|
||||
@@ -8727,24 +8766,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);
|
||||
@@ -9294,29 +9401,41 @@ module ts {
|
||||
|
||||
function checkRightHandSideOfForOf(rhsExpression: Expression): Type {
|
||||
let expressionType = getTypeOfExpression(rhsExpression);
|
||||
return languageVersion >= ScriptTarget.ES6
|
||||
? checkIteratedType(expressionType, rhsExpression)
|
||||
: checkElementTypeOfArrayOrString(expressionType, rhsExpression);
|
||||
return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true);
|
||||
}
|
||||
|
||||
function checkIteratedTypeOrElementType(inputType: Type, errorNode: Node, allowStringInput: boolean): Type {
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
return checkIteratedType(inputType, errorNode) || anyType;
|
||||
}
|
||||
|
||||
if (allowStringInput) {
|
||||
return checkElementTypeOfArrayOrString(inputType, errorNode);
|
||||
}
|
||||
|
||||
if (isArrayLikeType(inputType)) {
|
||||
return getIndexTypeOfType(inputType, IndexKind.Number);
|
||||
}
|
||||
|
||||
error(errorNode, Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType));
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
/**
|
||||
* When expressionForError is undefined, it means we should not report any errors.
|
||||
* When errorNode is undefined, it means we should not report any errors.
|
||||
*/
|
||||
function checkIteratedType(iterable: Type, expressionForError: Expression): Type {
|
||||
function checkIteratedType(iterable: Type, errorNode: Node): Type {
|
||||
Debug.assert(languageVersion >= ScriptTarget.ES6);
|
||||
let iteratedType = getIteratedType(iterable, expressionForError);
|
||||
let iteratedType = getIteratedType(iterable, errorNode);
|
||||
// Now even though we have extracted the iteratedType, we will have to validate that the type
|
||||
// passed in is actually an Iterable.
|
||||
if (expressionForError && iteratedType) {
|
||||
let completeIterableType = globalIterableType !== emptyObjectType
|
||||
? createTypeReference(<GenericType>globalIterableType, [iteratedType])
|
||||
: emptyObjectType;
|
||||
checkTypeAssignableTo(iterable, completeIterableType, expressionForError);
|
||||
if (errorNode && iteratedType) {
|
||||
checkTypeAssignableTo(iterable, createIterableType(iteratedType), errorNode);
|
||||
}
|
||||
|
||||
return iteratedType;
|
||||
|
||||
function getIteratedType(iterable: Type, expressionForError: Expression) {
|
||||
function getIteratedType(iterable: Type, errorNode: Node) {
|
||||
// We want to treat type as an iterable, and get the type it is an iterable of. The iterable
|
||||
// must have the following structure (annotated with the names of the variables below):
|
||||
//
|
||||
@@ -9347,6 +9466,12 @@ module ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// As an optimization, if the type is instantiated directly using the globalIterableType (Iterable<number>),
|
||||
// then just grab its type argument.
|
||||
if ((iterable.flags & TypeFlags.Reference) && (<GenericType>iterable).target === globalIterableType) {
|
||||
return (<GenericType>iterable).typeArguments[0];
|
||||
}
|
||||
|
||||
let iteratorFunction = getTypeOfPropertyOfType(iterable, getPropertyNameForKnownSymbolName("iterator"));
|
||||
if (iteratorFunction && allConstituentTypesHaveKind(iteratorFunction, TypeFlags.Any)) {
|
||||
return undefined;
|
||||
@@ -9354,8 +9479,8 @@ module ts {
|
||||
|
||||
let iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, SignatureKind.Call) : emptyArray;
|
||||
if (iteratorFunctionSignatures.length === 0) {
|
||||
if (expressionForError) {
|
||||
error(expressionForError, Diagnostics.The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator);
|
||||
if (errorNode) {
|
||||
error(errorNode, Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -9372,8 +9497,8 @@ module ts {
|
||||
|
||||
let iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, SignatureKind.Call) : emptyArray;
|
||||
if (iteratorNextFunctionSignatures.length === 0) {
|
||||
if (expressionForError) {
|
||||
error(expressionForError, Diagnostics.The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method);
|
||||
if (errorNode) {
|
||||
error(errorNode, Diagnostics.An_iterator_must_have_a_next_method);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -9385,8 +9510,8 @@ module ts {
|
||||
|
||||
let iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value");
|
||||
if (!iteratorNextValue) {
|
||||
if (expressionForError) {
|
||||
error(expressionForError, Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property);
|
||||
if (errorNode) {
|
||||
error(errorNode, Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -9412,7 +9537,7 @@ module ts {
|
||||
* 1. Some constituent is neither a string nor an array.
|
||||
* 2. Some constituent is a string and target is less than ES5 (because in ES3 string is not indexable).
|
||||
*/
|
||||
function checkElementTypeOfArrayOrString(arrayOrStringType: Type, expressionForError: Expression): Type {
|
||||
function checkElementTypeOfArrayOrString(arrayOrStringType: Type, errorNode: Node): Type {
|
||||
Debug.assert(languageVersion < ScriptTarget.ES6);
|
||||
|
||||
// After we remove all types that are StringLike, we will know if there was a string constituent
|
||||
@@ -9423,7 +9548,7 @@ module ts {
|
||||
let reportedError = false;
|
||||
if (hasStringConstituent) {
|
||||
if (languageVersion < ScriptTarget.ES5) {
|
||||
error(expressionForError, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);
|
||||
error(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher);
|
||||
reportedError = true;
|
||||
}
|
||||
|
||||
@@ -9443,7 +9568,7 @@ module ts {
|
||||
let diagnostic = hasStringConstituent
|
||||
? Diagnostics.Type_0_is_not_an_array_type
|
||||
: Diagnostics.Type_0_is_not_an_array_type_or_a_string_type;
|
||||
error(expressionForError, diagnostic, typeToString(arrayType));
|
||||
error(errorNode, diagnostic, typeToString(arrayType));
|
||||
}
|
||||
return hasStringConstituent ? stringType : unknownType;
|
||||
}
|
||||
@@ -10764,6 +10889,10 @@ module ts {
|
||||
links.flags |= NodeCheckFlags.EmitDecorate;
|
||||
}
|
||||
|
||||
if (emitParam) {
|
||||
links.flags |= NodeCheckFlags.EmitParam;
|
||||
}
|
||||
|
||||
links.flags |= NodeCheckFlags.TypeChecked;
|
||||
}
|
||||
}
|
||||
@@ -11442,6 +11571,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 +11853,9 @@ module ts {
|
||||
resolvesToSomeValue,
|
||||
collectLinkedAliases,
|
||||
getBlockScopedVariableId,
|
||||
serializeTypeOfNode,
|
||||
serializeParameterTypesOfNode,
|
||||
serializeReturnTypeOfNode,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11593,15 +11920,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;
|
||||
@@ -12315,7 +12642,9 @@ module ts {
|
||||
else {
|
||||
let elements = (<BindingPattern>name).elements;
|
||||
for (let element of elements) {
|
||||
checkGrammarNameInLetOrConstDeclarations(element.name);
|
||||
if (element.kind !== SyntaxKind.OmittedExpression) {
|
||||
checkGrammarNameInLetOrConstDeclarations(element.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12445,7 +12774,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +156,11 @@ module ts {
|
||||
shortName: "w",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Watch_input_files,
|
||||
},
|
||||
{
|
||||
name: "emitDecoratorMetadata",
|
||||
type: "boolean",
|
||||
experimental: true
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ module ts {
|
||||
return path.replace(/\\/g, "/");
|
||||
}
|
||||
|
||||
// Returns length of path root (i.e. length of "/", "x:/", "//server/share/")
|
||||
// Returns length of path root (i.e. length of "/", "x:/", "//server/share/, file:///user/files")
|
||||
export function getRootLength(path: string): number {
|
||||
if (path.charCodeAt(0) === CharacterCodes.slash) {
|
||||
if (path.charCodeAt(1) !== CharacterCodes.slash) return 1;
|
||||
@@ -448,6 +448,8 @@ module ts {
|
||||
if (path.charCodeAt(2) === CharacterCodes.slash) return 3;
|
||||
return 2;
|
||||
}
|
||||
let idx = path.indexOf('://');
|
||||
if (idx !== -1) return idx + 3
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -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." },
|
||||
@@ -343,8 +344,8 @@ module ts {
|
||||
The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." },
|
||||
The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." },
|
||||
Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: DiagnosticCategory.Error, key: "Invalid left-hand side in 'for...of' statement." },
|
||||
The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: DiagnosticCategory.Error, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." },
|
||||
The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: DiagnosticCategory.Error, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." },
|
||||
Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: DiagnosticCategory.Error, key: "Type must have a '[Symbol.iterator]()' method that returns an iterator." },
|
||||
An_iterator_must_have_a_next_method: { code: 2489, category: DiagnosticCategory.Error, key: "An iterator must have a 'next()' method." },
|
||||
The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: DiagnosticCategory.Error, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." },
|
||||
The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." },
|
||||
Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: DiagnosticCategory.Error, key: "Cannot redeclare identifier '{0}' in catch clause" },
|
||||
|
||||
@@ -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",
|
||||
@@ -1363,11 +1367,11 @@
|
||||
"category": "Error",
|
||||
"code": 2487
|
||||
},
|
||||
"The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator.": {
|
||||
"Type must have a '[Symbol.iterator]()' method that returns an iterator.": {
|
||||
"category": "Error",
|
||||
"code": 2488
|
||||
},
|
||||
"The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method.": {
|
||||
"An iterator must have a 'next()' method.": {
|
||||
"category": "Error",
|
||||
"code": 2489
|
||||
},
|
||||
|
||||
+540
-375
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
@@ -1256,6 +1256,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 {
|
||||
@@ -1381,6 +1384,7 @@ module ts {
|
||||
EnumValuesComputed = 0x00000080,
|
||||
BlockScopedBindingInLoop = 0x00000100,
|
||||
EmitDecorate = 0x00000200, // Emit __decorate
|
||||
EmitParam = 0x00000400, // Emit __param helper for decorators
|
||||
}
|
||||
|
||||
export interface NodeLinks {
|
||||
@@ -1606,6 +1610,7 @@ module ts {
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
@@ -514,6 +526,19 @@ module ts {
|
||||
// the *body* of the container.
|
||||
node = node.parent;
|
||||
break;
|
||||
case SyntaxKind.Decorator:
|
||||
// Decorators are always applied outside of the body of a class or method.
|
||||
if (node.parent.kind === SyntaxKind.Parameter && isClassElement(node.parent.parent)) {
|
||||
// If the decorator's parent is a Parameter, we resolve the this container from
|
||||
// the grandparent class declaration.
|
||||
node = node.parent.parent;
|
||||
}
|
||||
else if (isClassElement(node.parent)) {
|
||||
// If the decorator's parent is a class element, we resolve the 'this' container
|
||||
// from the parent class declaration.
|
||||
node = node.parent;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ArrowFunction:
|
||||
if (!includeArrowFunctions) {
|
||||
continue;
|
||||
@@ -556,6 +581,19 @@ module ts {
|
||||
// the *body* of the container.
|
||||
node = node.parent;
|
||||
break;
|
||||
case SyntaxKind.Decorator:
|
||||
// Decorators are always applied outside of the body of a class or method.
|
||||
if (node.parent.kind === SyntaxKind.Parameter && isClassElement(node.parent.parent)) {
|
||||
// If the decorator's parent is a Parameter, we resolve the this container from
|
||||
// the grandparent class declaration.
|
||||
node = node.parent.parent;
|
||||
}
|
||||
else if (isClassElement(node.parent)) {
|
||||
// If the decorator's parent is a class element, we resolve the 'this' container
|
||||
// from the parent class declaration.
|
||||
node = node.parent;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
@@ -907,6 +945,7 @@ module ts {
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
return true;
|
||||
default:
|
||||
|
||||
+15
-6
@@ -781,7 +781,7 @@ module Harness {
|
||||
|
||||
public reset() { this.fileCollection = {}; }
|
||||
|
||||
public toArray(): { fileName: string; file: WriterAggregator; }[] {
|
||||
public toArray(): { fileName: string; file: WriterAggregator; }[]{
|
||||
var result: { fileName: string; file: WriterAggregator; }[] = [];
|
||||
for (var p in this.fileCollection) {
|
||||
if (this.fileCollection.hasOwnProperty(p)) {
|
||||
@@ -944,6 +944,10 @@ module Harness {
|
||||
|
||||
var newLine = '\r\n';
|
||||
|
||||
// Files from built\local that are requested by test "@includeBuiltFiles" to be in the context.
|
||||
// Treat them as library files, so include them in build, but not in baselines.
|
||||
var includeBuiltFiles: { unitName: string; content: string }[] = [];
|
||||
|
||||
var useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames;
|
||||
this.settings.forEach(setting => {
|
||||
switch (setting.flag.toLowerCase()) {
|
||||
@@ -1061,18 +1065,19 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'includebuiltfile':
|
||||
inputFiles.push({ unitName: setting.value, content: normalizeLineEndings(IO.readFile(libFolder + setting.value), newLine) });
|
||||
let builtFileName = libFolder + setting.value;
|
||||
includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) });
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error('Unsupported compiler setting ' + setting.flag);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var fileOutputs: GeneratedFile[] = [];
|
||||
|
||||
var programFiles = inputFiles.map(file => file.unitName);
|
||||
var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(otherFiles),
|
||||
var programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
|
||||
var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(includeBuiltFiles).concat(otherFiles),
|
||||
(fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }),
|
||||
options.target, useCaseSensitiveFileNames, currentDirectory));
|
||||
|
||||
@@ -1295,7 +1300,7 @@ module Harness {
|
||||
});
|
||||
|
||||
var numLibraryDiagnostics = ts.countWhere(diagnostics, diagnostic => {
|
||||
return diagnostic.fileName && isLibraryFile(diagnostic.fileName);
|
||||
return diagnostic.fileName && (isLibraryFile(diagnostic.fileName) || isBuiltFile(diagnostic.fileName));
|
||||
});
|
||||
|
||||
var numTest262HarnessDiagnostics = ts.countWhere(diagnostics, diagnostic => {
|
||||
@@ -1698,6 +1703,10 @@ module Harness {
|
||||
return (Path.getFileName(filePath) === 'lib.d.ts') || (Path.getFileName(filePath) === 'lib.core.d.ts');
|
||||
}
|
||||
|
||||
export function isBuiltFile(filePath: string): boolean {
|
||||
return filePath.indexOf(Harness.libFolder) === 0;
|
||||
}
|
||||
|
||||
export function getDefaultLibraryFile(): { unitName: string, content: string } {
|
||||
var libFile = Harness.userSpecifiedroot + Harness.libFolder + "/" + "lib.d.ts";
|
||||
return {
|
||||
|
||||
@@ -52,6 +52,7 @@ class TypeWriterWalker {
|
||||
case ts.SyntaxKind.PostfixUnaryExpression:
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
case ts.SyntaxKind.ConditionalExpression:
|
||||
case ts.SyntaxKind.SpreadElementExpression:
|
||||
this.log(node, this.getTypeOfNode(node));
|
||||
break;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
|
||||
Vendored
+18
-18
@@ -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
|
||||
|
||||
+25
-5
@@ -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));
|
||||
@@ -104,7 +104,7 @@ module ts.server {
|
||||
var response: T = JSON.parse(responseBody);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error("Malformed response: Failed to parse server response: " + lastMessage + ". \r\n Error detailes: " + e.message);
|
||||
throw new Error("Malformed response: Failed to parse server response: " + lastMessage + ". \r\n Error details: " + e.message);
|
||||
}
|
||||
|
||||
// verify the sequence numbers
|
||||
@@ -446,6 +446,7 @@ module ts.server {
|
||||
if (!response.body) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var helpItems: protocol.SignatureHelpItems = response.body;
|
||||
var span = helpItems.applicableSpan;
|
||||
var start = this.lineOffsetToPosition(fileName, span.start);
|
||||
@@ -465,7 +466,26 @@ module ts.server {
|
||||
}
|
||||
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
|
||||
throw new Error("Not Implemented Yet.");
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.FileLocationRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
};
|
||||
|
||||
var request = this.processRequest<protocol.OccurrencesRequest>(CommandNames.Occurrences, args);
|
||||
var response = this.processResponse<protocol.OccurrencesResponse>(request);
|
||||
|
||||
return response.body.map(entry => {
|
||||
var fileName = entry.file;
|
||||
var start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
var end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
return {
|
||||
fileName,
|
||||
textSpan: ts.createTextSpanFromBounds(start, end),
|
||||
isWriteAccess: entry.isWriteAccess,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
getOutliningSpans(fileName: string): OutliningSpan[] {
|
||||
|
||||
@@ -458,7 +458,7 @@ module ts.server {
|
||||
var info = this.filenameToScriptInfo[args.file];
|
||||
if (info) {
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
this.log("Host configuration update for file " + args.file);
|
||||
this.log("Host configuration update for file " + args.file, "Info");
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -823,7 +823,6 @@ module ts.server {
|
||||
*/
|
||||
|
||||
closeClientFile(filename: string) {
|
||||
// TODO: tsconfig check
|
||||
var info = ts.lookUp(this.filenameToScriptInfo, filename);
|
||||
if (info) {
|
||||
this.closeOpenFile(info);
|
||||
@@ -856,6 +855,9 @@ module ts.server {
|
||||
}
|
||||
|
||||
printProjects() {
|
||||
if (!this.psLogger.isVerbose()) {
|
||||
return;
|
||||
}
|
||||
this.psLogger.startGroup();
|
||||
for (var i = 0, len = this.inferredProjects.length; i < len; i++) {
|
||||
var project = this.inferredProjects[i];
|
||||
|
||||
Vendored
+26
@@ -165,6 +165,25 @@ declare module ts.server.protocol {
|
||||
body?: FileSpan[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get occurrences request; value of command field is
|
||||
* "occurrences". Return response giving spans that are relevant
|
||||
* in the file at a given line and column.
|
||||
*/
|
||||
export interface OccurrencesRequest extends FileLocationRequest {
|
||||
}
|
||||
|
||||
export interface OccurrencesResponseItem extends FileSpan {
|
||||
/**
|
||||
* True if the occurrence is a write location, false otherwise.
|
||||
*/
|
||||
isWriteAccess: boolean;
|
||||
}
|
||||
|
||||
export interface OccurrencesResponse extends Response {
|
||||
body?: OccurrencesResponseItem[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Find references request; value of command field is
|
||||
* "references". Return response giving the file locations that
|
||||
@@ -405,6 +424,13 @@ declare module ts.server.protocol {
|
||||
arguments: OpenRequestArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit request; value of command field is "exit". Ask the server process
|
||||
* to exit.
|
||||
*/
|
||||
export interface ExitRequest extends Request {
|
||||
}
|
||||
|
||||
/**
|
||||
* Close request; value of command field is "close". Notify the
|
||||
* server that the client has closed a previously open file. If
|
||||
|
||||
@@ -177,6 +177,12 @@ module ts.server {
|
||||
super(host, logger);
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.projectService.log("Exiting...","Info");
|
||||
this.projectService.closeLog();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
listen() {
|
||||
rl.on('line',(input: string) => {
|
||||
var message = input.trim();
|
||||
@@ -184,9 +190,7 @@ module ts.server {
|
||||
});
|
||||
|
||||
rl.on('close',() => {
|
||||
this.projectService.log("Exiting...");
|
||||
this.projectService.closeLog();
|
||||
process.exit(0);
|
||||
this.exit();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+90
-69
@@ -76,25 +76,27 @@ module ts.server {
|
||||
}
|
||||
|
||||
export module CommandNames {
|
||||
export var Brace = "brace";
|
||||
export var Change = "change";
|
||||
export var Close = "close";
|
||||
export var Completions = "completions";
|
||||
export var CompletionDetails = "completionEntryDetails";
|
||||
export var SignatureHelp = "signatureHelp";
|
||||
export var Configure = "configure";
|
||||
export var Definition = "definition";
|
||||
export var Exit = "exit";
|
||||
export var Format = "format";
|
||||
export var Formatonkey = "formatonkey";
|
||||
export var Geterr = "geterr";
|
||||
export var NavBar = "navbar";
|
||||
export var Navto = "navto";
|
||||
export var Occurrences = "occurrences";
|
||||
export var Open = "open";
|
||||
export var Quickinfo = "quickinfo";
|
||||
export var References = "references";
|
||||
export var Reload = "reload";
|
||||
export var Rename = "rename";
|
||||
export var Saveto = "saveto";
|
||||
export var Brace = "brace";
|
||||
export var SignatureHelp = "signatureHelp";
|
||||
export var Unknown = "unknown";
|
||||
}
|
||||
|
||||
@@ -116,7 +118,7 @@ module ts.server {
|
||||
|
||||
constructor(private host: ServerHost, private logger: Logger) {
|
||||
this.projectService =
|
||||
new ProjectService(host, logger, (eventName,project,fileName) => {
|
||||
new ProjectService(host, logger, (eventName, project, fileName) => {
|
||||
this.handleEvent(eventName, project, fileName);
|
||||
});
|
||||
}
|
||||
@@ -261,7 +263,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
getDefinition(line: number, offset: number, fileName: string): protocol.FileSpan[] {
|
||||
getDefinition({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.FileSpan[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -283,7 +285,37 @@ module ts.server {
|
||||
}));
|
||||
}
|
||||
|
||||
getRenameLocations(line: number, offset: number, fileName: string,findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody {
|
||||
getOccurrences({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.OccurrencesResponseItem[] {
|
||||
fileName = ts.normalizePath(fileName);
|
||||
let project = this.projectService.getProjectForFile(fileName);
|
||||
|
||||
if (!project) {
|
||||
throw Errors.NoProject;
|
||||
}
|
||||
|
||||
let { compilerService } = project;
|
||||
let position = compilerService.host.lineOffsetToPosition(fileName, line, offset);
|
||||
|
||||
let occurrences = compilerService.languageService.getOccurrencesAtPosition(fileName, position);
|
||||
|
||||
if (!occurrences) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return occurrences.map(occurrence => {
|
||||
let { fileName, isWriteAccess, textSpan } = occurrence;
|
||||
let start = compilerService.host.positionToLineOffset(fileName, textSpan.start);
|
||||
let end = compilerService.host.positionToLineOffset(fileName, ts.textSpanEnd(textSpan));
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
file: fileName,
|
||||
isWriteAccess
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getRenameLocations({line, offset, file: fileName, findInComments, findInStrings }: protocol.RenameRequestArgs): protocol.RenameResponseBody {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -351,7 +383,7 @@ module ts.server {
|
||||
return { info: renameInfo, locs: bakedRenameLocs };
|
||||
}
|
||||
|
||||
getReferences(line: number, offset: number, fileName: string): protocol.ReferencesResponseBody {
|
||||
getReferences({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.ReferencesResponseBody {
|
||||
// TODO: get all projects for this file; report refs for all projects deleting duplicates
|
||||
// can avoid duplicates by eliminating same ref file from subsequent projects
|
||||
var file = ts.normalizePath(fileName);
|
||||
@@ -377,7 +409,7 @@ module ts.server {
|
||||
var nameSpan = nameInfo.textSpan;
|
||||
var nameColStart = compilerService.host.positionToLineOffset(file, nameSpan.start).offset;
|
||||
var nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan));
|
||||
var bakedRefs: protocol.ReferencesResponseItem[] = references.map((ref) => {
|
||||
var bakedRefs: protocol.ReferencesResponseItem[] = references.map(ref => {
|
||||
var start = compilerService.host.positionToLineOffset(ref.fileName, ref.textSpan.start);
|
||||
var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1);
|
||||
var snap = compilerService.host.getScriptSnapshot(ref.fileName);
|
||||
@@ -398,12 +430,12 @@ module ts.server {
|
||||
};
|
||||
}
|
||||
|
||||
openClientFile(fileName: string) {
|
||||
openClientFile({ file: fileName }: protocol.OpenRequestArgs) {
|
||||
var file = ts.normalizePath(fileName);
|
||||
this.projectService.openClientFile(file);
|
||||
}
|
||||
|
||||
getQuickInfo(line: number, offset: number, fileName: string): protocol.QuickInfoResponseBody {
|
||||
getQuickInfo({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.QuickInfoResponseBody {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -429,7 +461,7 @@ module ts.server {
|
||||
};
|
||||
}
|
||||
|
||||
getFormattingEditsForRange(line: number, offset: number, endLine: number, endOffset: number, fileName: string): protocol.CodeEdit[] {
|
||||
getFormattingEditsForRange({line, offset, endLine, endOffset, file: fileName}: protocol.FormatRequestArgs): protocol.CodeEdit[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -456,7 +488,7 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getFormattingEditsAfterKeystroke(line: number, offset: number, key: string, fileName: string): protocol.CodeEdit[] {
|
||||
getFormattingEditsAfterKeystroke({line, offset, key, file: fileName}: protocol.FormatOnKeyRequestArgs): protocol.CodeEdit[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -529,7 +561,7 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getCompletions(line: number, offset: number, prefix: string, fileName: string): protocol.CompletionEntry[] {
|
||||
getCompletions({ line, offset, prefix, file: fileName}: protocol.CompletionsRequestArgs): protocol.CompletionEntry[] {
|
||||
if (!prefix) {
|
||||
prefix = "";
|
||||
}
|
||||
@@ -555,8 +587,7 @@ module ts.server {
|
||||
}, []).sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
getCompletionEntryDetails(line: number, offset: number,
|
||||
entryNames: string[], fileName: string): protocol.CompletionEntryDetails[] {
|
||||
getCompletionEntryDetails({ line, offset, entryNames, file: fileName}: protocol.CompletionDetailsRequestArgs): protocol.CompletionEntryDetails[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -575,20 +606,20 @@ module ts.server {
|
||||
}, []);
|
||||
}
|
||||
|
||||
getSignatureHelpItems(line: number, offset: number, fileName: string): protocol.SignatureHelpItems {
|
||||
getSignatureHelpItems({ line, offset, file: fileName }: protocol.SignatureHelpRequestArgs): protocol.SignatureHelpItems {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
throw Errors.NoProject;
|
||||
}
|
||||
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
var helpItems = compilerService.languageService.getSignatureHelpItems(file, position);
|
||||
if (!helpItems) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
var span = helpItems.applicableSpan;
|
||||
var result: protocol.SignatureHelpItems = {
|
||||
items: helpItems.items,
|
||||
@@ -600,11 +631,11 @@ module ts.server {
|
||||
argumentIndex: helpItems.argumentIndex,
|
||||
argumentCount: helpItems.argumentCount,
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
getDiagnostics(delay: number, fileNames: string[]) {
|
||||
|
||||
getDiagnostics({ delay, files: fileNames }: protocol.GeterrRequestArgs): void {
|
||||
var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => {
|
||||
fileName = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(fileName);
|
||||
@@ -615,11 +646,11 @@ module ts.server {
|
||||
}, []);
|
||||
|
||||
if (checkList.length > 0) {
|
||||
this.updateErrorCheck(checkList, this.changeSeq,(n) => n == this.changeSeq, delay)
|
||||
this.updateErrorCheck(checkList, this.changeSeq, (n) => n == this.changeSeq, delay)
|
||||
}
|
||||
}
|
||||
|
||||
change(line: number, offset: number, endLine: number, endOffset: number, insertString: string, fileName: string) {
|
||||
change({ line, offset, endLine, endOffset, insertString, file: fileName }: protocol.ChangeRequestArgs): void {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (project) {
|
||||
@@ -634,7 +665,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
reload(fileName: string, tempFileName: string, reqSeq = 0) {
|
||||
reload({ file: fileName, tmpfile: tempFileName }: protocol.ReloadRequestArgs, reqSeq = 0): void {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var tmpfile = ts.normalizePath(tempFileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -647,7 +678,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
saveToTmp(fileName: string, tempFileName: string) {
|
||||
saveToTmp({ file: fileName, tmpfile: tempFileName }: protocol.SavetoRequestArgs): void {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var tmpfile = ts.normalizePath(tempFileName);
|
||||
|
||||
@@ -657,7 +688,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
closeClientFile(fileName: string) {
|
||||
closeClientFile({ file: fileName }: protocol.FileRequestArgs) {
|
||||
var file = ts.normalizePath(fileName);
|
||||
this.projectService.closeClientFile(file);
|
||||
}
|
||||
@@ -681,7 +712,7 @@ module ts.server {
|
||||
}));
|
||||
}
|
||||
|
||||
getNavigationBarItems(fileName: string): protocol.NavigationBarItem[] {
|
||||
getNavigationBarItems({ file: fileName }: protocol.FileRequestArgs): protocol.NavigationBarItem[]{
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -697,7 +728,7 @@ module ts.server {
|
||||
return this.decorateNavigationBarItem(project, fileName, items);
|
||||
}
|
||||
|
||||
getNavigateToItems(searchValue: string, fileName: string, maxResultCount?: number): protocol.NavtoItem[] {
|
||||
getNavigateToItems({ searchValue, file: fileName, maxResultCount }: protocol.NavtoRequestArgs): protocol.NavtoItem[]{
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -736,7 +767,7 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getBraceMatching(line: number, offset: number, fileName: string): protocol.TextSpan[] {
|
||||
getBraceMatching({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.TextSpan[]{
|
||||
var file = ts.normalizePath(fileName);
|
||||
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -758,6 +789,9 @@ module ts.server {
|
||||
}));
|
||||
}
|
||||
|
||||
exit() {
|
||||
}
|
||||
|
||||
onMessage(message: string) {
|
||||
if (this.logger.isVerbose()) {
|
||||
this.logger.info("request: " + message);
|
||||
@@ -769,110 +803,97 @@ module ts.server {
|
||||
var errorMessage: string;
|
||||
var responseRequired = true;
|
||||
switch (request.command) {
|
||||
case CommandNames.Exit: {
|
||||
this.exit();
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Definition: {
|
||||
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getDefinition(defArgs.line, defArgs.offset, defArgs.file);
|
||||
response = this.getDefinition(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.References: {
|
||||
var refArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getReferences(refArgs.line, refArgs.offset, refArgs.file);
|
||||
response = this.getReferences(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Rename: {
|
||||
var renameArgs = <protocol.RenameRequestArgs>request.arguments;
|
||||
response = this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings);
|
||||
response = this.getRenameLocations(<protocol.RenameRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Open: {
|
||||
var openArgs = <protocol.OpenRequestArgs>request.arguments;
|
||||
this.openClientFile(openArgs.file);
|
||||
this.openClientFile(<protocol.OpenRequestArgs>request.arguments);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Quickinfo: {
|
||||
var quickinfoArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file);
|
||||
response = this.getQuickInfo(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Format: {
|
||||
var formatArgs = <protocol.FormatRequestArgs>request.arguments;
|
||||
response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file);
|
||||
response = this.getFormattingEditsForRange(<protocol.FormatRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Formatonkey: {
|
||||
var formatOnKeyArgs = <protocol.FormatOnKeyRequestArgs>request.arguments;
|
||||
response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file);
|
||||
response = this.getFormattingEditsAfterKeystroke(<protocol.FormatOnKeyRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Completions: {
|
||||
var completionsArgs = <protocol.CompletionsRequestArgs>request.arguments;
|
||||
response = this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file);
|
||||
response = this.getCompletions(<protocol.CompletionsRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.CompletionDetails: {
|
||||
var completionDetailsArgs = <protocol.CompletionDetailsRequestArgs>request.arguments;
|
||||
response =
|
||||
this.getCompletionEntryDetails(completionDetailsArgs.line,completionDetailsArgs.offset,
|
||||
completionDetailsArgs.entryNames,completionDetailsArgs.file);
|
||||
response = this.getCompletionEntryDetails(<protocol.CompletionDetailsRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.SignatureHelp: {
|
||||
var signatureHelpArgs = <protocol.SignatureHelpRequestArgs>request.arguments;
|
||||
response = this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file);
|
||||
response = this.getSignatureHelpItems(<protocol.SignatureHelpRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Geterr: {
|
||||
var geterrArgs = <protocol.GeterrRequestArgs>request.arguments;
|
||||
response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files);
|
||||
this.getDiagnostics(<protocol.GeterrRequestArgs>request.arguments);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Change: {
|
||||
var changeArgs = <protocol.ChangeRequestArgs>request.arguments;
|
||||
this.change(changeArgs.line, changeArgs.offset, changeArgs.endLine, changeArgs.endOffset,
|
||||
changeArgs.insertString, changeArgs.file);
|
||||
this.change(<protocol.ChangeRequestArgs>request.arguments);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Configure: {
|
||||
var configureArgs = <protocol.ConfigureRequestArguments>request.arguments;
|
||||
this.projectService.setHostConfiguration(configureArgs);
|
||||
this.projectService.setHostConfiguration(<protocol.ConfigureRequestArguments>request.arguments);
|
||||
this.output(undefined, CommandNames.Configure, request.seq);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Reload: {
|
||||
var reloadArgs = <protocol.ReloadRequestArgs>request.arguments;
|
||||
this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq);
|
||||
this.reload(<protocol.ReloadRequestArgs>request.arguments);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Saveto: {
|
||||
var savetoArgs = <protocol.SavetoRequestArgs>request.arguments;
|
||||
this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
|
||||
this.saveToTmp(<protocol.SavetoRequestArgs>request.arguments);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Close: {
|
||||
var closeArgs = <protocol.FileRequestArgs>request.arguments;
|
||||
this.closeClientFile(closeArgs.file);
|
||||
this.closeClientFile(<protocol.FileRequestArgs>request.arguments);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Navto: {
|
||||
var navtoArgs = <protocol.NavtoRequestArgs>request.arguments;
|
||||
response = this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount);
|
||||
response = this.getNavigateToItems(<protocol.NavtoRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Brace: {
|
||||
var braceArguments = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file);
|
||||
response = this.getBraceMatching(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.NavBar: {
|
||||
var navBarArgs = <protocol.FileRequestArgs>request.arguments;
|
||||
response = this.getNavigationBarItems(navBarArgs.file);
|
||||
response = this.getNavigationBarItems(<protocol.FileRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Occurrences: {
|
||||
response = this.getOccurrences(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
@@ -1680,7 +1680,7 @@ module ts {
|
||||
useCaseSensitiveFileNames: () => false,
|
||||
getCanonicalFileName: fileName => fileName,
|
||||
getCurrentDirectory: () => "",
|
||||
getNewLine: () => "\r\n"
|
||||
getNewLine: () => (sys && sys.newLine) || "\r\n"
|
||||
};
|
||||
|
||||
var program = createProgram([inputFileName], options, compilerHost);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,18 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'string | number' is not an array type.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts (1 errors) ====
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts (3 errors) ====
|
||||
var a: string, b: number;
|
||||
var tuple: [number, string] = [2, "3"];
|
||||
for ([a = 1, b = ""] of tuple) {
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2461: Type 'string | number' is not an array type.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
a;
|
||||
b;
|
||||
}
|
||||
@@ -14,6 +14,7 @@ obj[Symbol.foo];
|
||||
var Symbol;
|
||||
var obj = (_a = {},
|
||||
_a[Symbol.foo] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
obj[Symbol.foo];
|
||||
var _a;
|
||||
|
||||
@@ -2,7 +2,5 @@
|
||||
var v = { [yield]: foo }
|
||||
|
||||
//// [FunctionDeclaration8_es6.js]
|
||||
var v = (_a = {},
|
||||
_a[yield] = foo,
|
||||
_a);
|
||||
var v = (_a = {}, _a[yield] = foo, _a);
|
||||
var _a;
|
||||
|
||||
@@ -5,8 +5,6 @@ function * foo() {
|
||||
|
||||
//// [FunctionDeclaration9_es6.js]
|
||||
function foo() {
|
||||
var v = (_a = {},
|
||||
_a[] = foo,
|
||||
_a);
|
||||
var v = (_a = {}, _a[] = foo, _a);
|
||||
var _a;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,5 @@
|
||||
var v = { *[foo()]() { } }
|
||||
|
||||
//// [FunctionPropertyAssignments5_es6.js]
|
||||
var v = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a);
|
||||
var v = (_a = {}, _a[foo()] = function () { }, _a);
|
||||
var _a;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [arrayBindingPatternOmittedExpressions.ts]
|
||||
|
||||
var results: string[];
|
||||
|
||||
{
|
||||
let [, b, , a] = results;
|
||||
let x = {
|
||||
a,
|
||||
b
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function f([, a, , b, , , , s, , , ] = results) {
|
||||
a = s[1];
|
||||
b = s[2];
|
||||
}
|
||||
|
||||
//// [arrayBindingPatternOmittedExpressions.js]
|
||||
var results;
|
||||
{
|
||||
let [, b, , a] = results;
|
||||
let x = {
|
||||
a,
|
||||
b
|
||||
};
|
||||
}
|
||||
function f([, a, , b, , , , s, , ,] = results) {
|
||||
a = s[1];
|
||||
b = s[2];
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
=== tests/cases/compiler/arrayBindingPatternOmittedExpressions.ts ===
|
||||
|
||||
var results: string[];
|
||||
>results : string[]
|
||||
|
||||
{
|
||||
let [, b, , a] = results;
|
||||
>b : string
|
||||
>a : string
|
||||
>results : string[]
|
||||
|
||||
let x = {
|
||||
>x : { a: string; b: string; }
|
||||
>{ a, b } : { a: string; b: string; }
|
||||
|
||||
a,
|
||||
>a : string
|
||||
|
||||
b
|
||||
>b : string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function f([, a, , b, , , , s, , , ] = results) {
|
||||
>f : ([, a, , b, , , , s, , , ]?: string[]) => void
|
||||
>a : string
|
||||
>b : string
|
||||
>s : string
|
||||
>results : string[]
|
||||
|
||||
a = s[1];
|
||||
>a = s[1] : string
|
||||
>a : string
|
||||
>s[1] : string
|
||||
>s : string
|
||||
|
||||
b = s[2];
|
||||
>b = s[2] : string
|
||||
>b : string
|
||||
>s[2] : string
|
||||
>s : string
|
||||
}
|
||||
@@ -9,44 +9,55 @@ function f0() {
|
||||
var a1 = [...a];
|
||||
>a1 : number[]
|
||||
>[...a] : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
|
||||
var a2 = [1, ...a];
|
||||
>a2 : number[]
|
||||
>[1, ...a] : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
|
||||
var a3 = [1, 2, ...a];
|
||||
>a3 : number[]
|
||||
>[1, 2, ...a] : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
|
||||
var a4 = [...a, 1];
|
||||
>a4 : number[]
|
||||
>[...a, 1] : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
|
||||
var a5 = [...a, 1, 2];
|
||||
>a5 : number[]
|
||||
>[...a, 1, 2] : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
|
||||
var a6 = [1, 2, ...a, 1, 2];
|
||||
>a6 : number[]
|
||||
>[1, 2, ...a, 1, 2] : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
|
||||
var a7 = [1, ...a, 2, ...a];
|
||||
>a7 : number[]
|
||||
>[1, ...a, 2, ...a] : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
|
||||
var a8 = [...a, ...a, ...a];
|
||||
>a8 : number[]
|
||||
>[...a, ...a, ...a] : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
}
|
||||
|
||||
@@ -60,6 +71,7 @@ function f1() {
|
||||
var b = ["hello", ...a, true];
|
||||
>b : (string | number | boolean)[]
|
||||
>["hello", ...a, true] : (string | number | boolean)[]
|
||||
>...a : number
|
||||
>a : number[]
|
||||
|
||||
var b: (string | number | boolean)[];
|
||||
@@ -72,19 +84,29 @@ function f2() {
|
||||
var a = [...[...[...[...[...[]]]]]];
|
||||
>a : any[]
|
||||
>[...[...[...[...[...[]]]]]] : undefined[]
|
||||
>...[...[...[...[...[]]]]] : undefined
|
||||
>[...[...[...[...[]]]]] : undefined[]
|
||||
>...[...[...[...[]]]] : undefined
|
||||
>[...[...[...[]]]] : undefined[]
|
||||
>...[...[...[]]] : undefined
|
||||
>[...[...[]]] : undefined[]
|
||||
>...[...[]] : undefined
|
||||
>[...[]] : undefined[]
|
||||
>...[] : undefined
|
||||
>[] : undefined[]
|
||||
|
||||
var b = [...[...[...[...[...[5]]]]]];
|
||||
>b : number[]
|
||||
>[...[...[...[...[...[5]]]]]] : number[]
|
||||
>...[...[...[...[...[5]]]]] : number
|
||||
>[...[...[...[...[5]]]]] : number[]
|
||||
>...[...[...[...[5]]]] : number
|
||||
>[...[...[...[5]]]] : number[]
|
||||
>...[...[...[5]]] : number
|
||||
>[...[...[5]]] : number[]
|
||||
>...[...[5]] : number
|
||||
>[...[5]] : number[]
|
||||
>...[5] : number
|
||||
>[5] : number[]
|
||||
}
|
||||
|
||||
|
||||
@@ -38,11 +38,13 @@ foo(1, 2, "abc");
|
||||
foo(1, 2, ...a);
|
||||
>foo(1, 2, ...a) : void
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
foo(1, 2, ...a, "abc");
|
||||
>foo(1, 2, ...a, "abc") : void
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
obj.foo(1, 2, "abc");
|
||||
@@ -56,6 +58,7 @@ obj.foo(1, 2, ...a);
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
obj.foo(1, 2, ...a, "abc");
|
||||
@@ -63,6 +66,7 @@ obj.foo(1, 2, ...a, "abc");
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
(obj.foo)(1, 2, "abc");
|
||||
@@ -78,6 +82,7 @@ obj.foo(1, 2, ...a, "abc");
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
(obj.foo)(1, 2, ...a, "abc");
|
||||
@@ -86,6 +91,7 @@ obj.foo(1, 2, ...a, "abc");
|
||||
>obj.foo : (x: number, y: number, ...z: string[]) => any
|
||||
>obj : X
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
xa[1].foo(1, 2, "abc");
|
||||
@@ -101,6 +107,7 @@ xa[1].foo(1, 2, ...a);
|
||||
>xa[1] : X
|
||||
>xa : X[]
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
xa[1].foo(1, 2, ...a, "abc");
|
||||
@@ -109,6 +116,7 @@ xa[1].foo(1, 2, ...a, "abc");
|
||||
>xa[1] : X
|
||||
>xa : X[]
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
(<Function>xa[1].foo)(...[1, 2, "abc"]);
|
||||
@@ -120,6 +128,7 @@ xa[1].foo(1, 2, ...a, "abc");
|
||||
>xa[1] : X
|
||||
>xa : X[]
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...[1, 2, "abc"] : string | number
|
||||
>[1, 2, "abc"] : (string | number)[]
|
||||
|
||||
class C {
|
||||
@@ -145,6 +154,7 @@ class C {
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>x : number
|
||||
>y : number
|
||||
>...z : string
|
||||
>z : string[]
|
||||
}
|
||||
foo(x: number, y: number, ...z: string[]) {
|
||||
@@ -167,6 +177,7 @@ class D extends C {
|
||||
super(1, 2, ...a);
|
||||
>super(1, 2, ...a) : void
|
||||
>super : typeof C
|
||||
>...a : string
|
||||
>a : string[]
|
||||
}
|
||||
foo() {
|
||||
@@ -183,6 +194,7 @@ class D extends C {
|
||||
>super.foo : (x: number, y: number, ...z: string[]) => void
|
||||
>super : C
|
||||
>foo : (x: number, y: number, ...z: string[]) => void
|
||||
>...a : string
|
||||
>a : string[]
|
||||
}
|
||||
}
|
||||
@@ -192,5 +204,6 @@ var c = new C(1, 2, ...a);
|
||||
>c : C
|
||||
>new C(1, 2, ...a) : C
|
||||
>C : typeof C
|
||||
>...a : string
|
||||
>a : string[]
|
||||
|
||||
|
||||
@@ -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'.
|
||||
@@ -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;
|
||||
})();
|
||||
;
|
||||
@@ -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.
|
||||
@@ -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;
|
||||
})();
|
||||
@@ -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.
|
||||
@@ -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;
|
||||
})();
|
||||
@@ -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.
|
||||
@@ -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;
|
||||
@@ -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.
|
||||
@@ -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;
|
||||
@@ -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.
|
||||
}
|
||||
@@ -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.
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,6 @@ var v = (_a = {},
|
||||
_a[true] = function () { },
|
||||
_a["hello bye"] = function () { },
|
||||
_a["hello " + a + " bye"] = function () { },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -21,16 +21,61 @@ var s;
|
||||
var n;
|
||||
var a;
|
||||
var v = (_a = {},
|
||||
_a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
|
||||
_a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
|
||||
_a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
|
||||
_a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
|
||||
_a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
|
||||
_a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
|
||||
_a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
|
||||
_a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
|
||||
_a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
|
||||
_a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
|
||||
_a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
|
||||
_a);
|
||||
Object.defineProperty(_a, s, {
|
||||
get: function () { return 0; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, n, {
|
||||
set: function (v) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, s + s, {
|
||||
get: function () { return 0; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, s + n, {
|
||||
set: function (v) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, +s, {
|
||||
get: function () { return 0; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, "", {
|
||||
set: function (v) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, 0, {
|
||||
get: function () { return 0; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, a, {
|
||||
set: function (v) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, true, {
|
||||
get: function () { return 0; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, "hello bye", {
|
||||
set: function (v) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, "hello " + a + " bye", {
|
||||
get: function () { return 0; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -9,6 +9,7 @@ function foo() {
|
||||
function foo() {
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ var M;
|
||||
(function (M) {
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
})(M || (M = {}));
|
||||
|
||||
@@ -6,7 +6,17 @@ var v = {
|
||||
|
||||
//// [computedPropertyNames1_ES5.js]
|
||||
var v = (_a = {},
|
||||
_a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
|
||||
_a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
|
||||
_a);
|
||||
Object.defineProperty(_a, 0 + 1, {
|
||||
get: function () { return 0; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, 0 + 1, {
|
||||
set: function (v) { } //No error
|
||||
,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -6,5 +6,6 @@ var obj = {
|
||||
//// [computedPropertyNames20_ES5.js]
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -15,7 +15,8 @@ var C = (function () {
|
||||
C.prototype.bar = function () {
|
||||
var obj = (_a = {},
|
||||
_a[this.bar()] = function () { },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
||||
@@ -15,9 +15,7 @@ var C = (function () {
|
||||
C.prototype.bar = function () {
|
||||
return 0;
|
||||
};
|
||||
C.prototype[(_a = {},
|
||||
_a[this.bar()] = 1,
|
||||
_a)[0]] = function () { };
|
||||
C.prototype[(_a = {}, _a[this.bar()] = 1, _a)[0]] = function () { };
|
||||
return C;
|
||||
var _a;
|
||||
})();
|
||||
|
||||
@@ -36,7 +36,8 @@ var C = (function (_super) {
|
||||
C.prototype.foo = function () {
|
||||
var obj = (_a = {},
|
||||
_a[_super.prototype.bar.call(this)] = function () { },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
||||
@@ -30,9 +30,7 @@ var C = (function (_super) {
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C.prototype[(_a = {},
|
||||
_a[_super.bar.call(this)] = 1,
|
||||
_a)[0]] = function () { };
|
||||
C.prototype[(_a = {}, _a[_super.bar.call(this)] = 1, _a)[0]] = function () { };
|
||||
return C;
|
||||
var _a;
|
||||
})(Base);
|
||||
|
||||
@@ -28,7 +28,8 @@ var C = (function (_super) {
|
||||
_super.call(this);
|
||||
var obj = (_a = {},
|
||||
_a[(_super.call(this), "prop")] = function () { },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
}
|
||||
return C;
|
||||
|
||||
@@ -19,7 +19,8 @@ var C = (function () {
|
||||
(function () {
|
||||
var obj = (_a = {},
|
||||
_a[_this.bar()] = function () { },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
});
|
||||
return 0;
|
||||
|
||||
@@ -33,8 +33,12 @@ var C = (function (_super) {
|
||||
_super.call(this);
|
||||
(function () {
|
||||
var obj = (_a = {},
|
||||
// Ideally, we would capture this. But the reference is
|
||||
// illegal, and not capturing this is consistent with
|
||||
//treatment of other similar violations.
|
||||
_a[(_super.call(this), "prop")] = function () { },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ var C = (function (_super) {
|
||||
(function () {
|
||||
var obj = (_a = {},
|
||||
_a[_super.prototype.bar.call(_this)] = function () { },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
});
|
||||
return 0;
|
||||
|
||||
@@ -17,7 +17,8 @@ var C = (function () {
|
||||
C.prototype.bar = function () {
|
||||
var obj = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
||||
@@ -17,7 +17,8 @@ var C = (function () {
|
||||
C.bar = function () {
|
||||
var obj = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
||||
@@ -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'.
|
||||
|
||||
@@ -6,5 +6,6 @@ var o = {
|
||||
//// [computedPropertyNames46_ES5.js]
|
||||
var o = (_a = {},
|
||||
_a["" || 0] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -16,5 +16,6 @@ var E2;
|
||||
})(E2 || (E2 = {}));
|
||||
var o = (_a = {},
|
||||
_a[E1.x || E2.x] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -25,11 +25,14 @@ var E;
|
||||
var a;
|
||||
extractIndexer((_a = {},
|
||||
_a[a] = "",
|
||||
_a)); // Should return string
|
||||
_a
|
||||
)); // Should return string
|
||||
extractIndexer((_b = {},
|
||||
_b[E.x] = "",
|
||||
_b)); // Should return string
|
||||
_b
|
||||
)); // Should return string
|
||||
extractIndexer((_c = {},
|
||||
_c["" || 0] = "",
|
||||
_c)); // Should return any (widened form of undefined)
|
||||
_c
|
||||
)); // Should return any (widened form of undefined)
|
||||
var _a, _b, _c;
|
||||
|
||||
@@ -27,24 +27,41 @@ var x = {
|
||||
|
||||
//// [computedPropertyNames49_ES5.js]
|
||||
var x = (_a = {
|
||||
p1: 10
|
||||
},
|
||||
_a.p1 = 10,
|
||||
_a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
p1: 10
|
||||
},
|
||||
Object.defineProperty(_a, 1 + 1, {
|
||||
get: function () {
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, 1 + 1, {
|
||||
get: function () {
|
||||
return 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ set: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, 1 + 1, {
|
||||
set: function () {
|
||||
// just throw
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a.foo = Object.defineProperty({ get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, "foo", {
|
||||
get: function () {
|
||||
if (1 == 1) {
|
||||
return 10;
|
||||
}
|
||||
}, enumerable: true, configurable: true }),
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
,
|
||||
_a.p2 = 20,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -32,5 +32,6 @@ var v = (_a = {},
|
||||
_a[true] = 0,
|
||||
_a["hello bye"] = 0,
|
||||
_a["hello " + a + " bye"] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -27,29 +27,37 @@ var x = {
|
||||
|
||||
//// [computedPropertyNames50_ES5.js]
|
||||
var x = (_a = {
|
||||
p1: 10,
|
||||
get foo() {
|
||||
if (1 == 1) {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
},
|
||||
_a.p1 = 10,
|
||||
_a.foo = Object.defineProperty({ get: function () {
|
||||
p1: 10,
|
||||
get foo() {
|
||||
if (1 == 1) {
|
||||
return 10;
|
||||
}
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
}
|
||||
},
|
||||
Object.defineProperty(_a, 1 + 1, {
|
||||
get: function () {
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ set: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, 1 + 1, {
|
||||
set: function () {
|
||||
// just throw
|
||||
throw 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
_a[1 + 1] = Object.defineProperty({ get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, 1 + 1, {
|
||||
get: function () {
|
||||
return 10;
|
||||
}, enumerable: true, configurable: true }),
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
,
|
||||
_a.p2 = 20,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -18,5 +18,6 @@ var v = (_a = {},
|
||||
_a[{}] = 0,
|
||||
_a[undefined] = undefined,
|
||||
_a[null] = null,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -16,5 +16,6 @@ var v = (_a = {},
|
||||
_a[p1] = 0,
|
||||
_a[p2] = 1,
|
||||
_a[p3] = 2,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -13,5 +13,6 @@ var E;
|
||||
})(E || (E = {}));
|
||||
var v = (_a = {},
|
||||
_a[E.member] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -15,6 +15,7 @@ function f() {
|
||||
var v = (_a = {},
|
||||
_a[t] = 0,
|
||||
_a[u] = 1,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
}
|
||||
|
||||
@@ -16,5 +16,6 @@ var v = (_a = {},
|
||||
_a[f("")] = 0,
|
||||
_a[f(0)] = 0,
|
||||
_a[f(true)] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -12,5 +12,6 @@ var o: I = {
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -13,5 +13,6 @@ var o: I = {
|
||||
var o = (_a = {},
|
||||
_a["" + 0] = function (y) { return y.length; },
|
||||
_a["" + 1] = function (y) { return y.length; },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -13,5 +13,6 @@ var o: I = {
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = function (y) { return y.length; },
|
||||
_a[+"bar"] = function (y) { return y.length; },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -12,5 +12,6 @@ var o: I = {
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = function (y) { return y.length; },
|
||||
_a[+"bar"] = function (y) { return y.length; },
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -13,5 +13,6 @@ var o: I = {
|
||||
var o = (_a = {},
|
||||
_a["" + "foo"] = "",
|
||||
_a["" + "bar"] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -13,5 +13,6 @@ var o: I = {
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -15,13 +15,12 @@ foo({
|
||||
|
||||
//// [computedPropertyNamesContextualType6_ES5.js]
|
||||
foo((_a = {
|
||||
p: "",
|
||||
0: function () { }
|
||||
},
|
||||
_a.p = "",
|
||||
_a[0] = function () { },
|
||||
p: "",
|
||||
0: function () { }
|
||||
},
|
||||
_a["hi" + "bye"] = true,
|
||||
_a[0 + 1] = 0,
|
||||
_a[+"hi"] = [0],
|
||||
_a));
|
||||
_a
|
||||
));
|
||||
var _a;
|
||||
|
||||
@@ -15,13 +15,12 @@ foo({
|
||||
|
||||
//// [computedPropertyNamesContextualType7_ES5.js]
|
||||
foo((_a = {
|
||||
p: "",
|
||||
0: function () { }
|
||||
},
|
||||
_a.p = "",
|
||||
_a[0] = function () { },
|
||||
p: "",
|
||||
0: function () { }
|
||||
},
|
||||
_a["hi" + "bye"] = true,
|
||||
_a[0 + 1] = 0,
|
||||
_a[+"hi"] = [0],
|
||||
_a));
|
||||
_a
|
||||
));
|
||||
var _a;
|
||||
|
||||
@@ -13,5 +13,6 @@ var o: I = {
|
||||
var o = (_a = {},
|
||||
_a["" + "foo"] = "",
|
||||
_a["" + "bar"] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -13,5 +13,6 @@ var o: I = {
|
||||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
@@ -10,9 +10,18 @@ var v = {
|
||||
var v = (_a = {},
|
||||
_a["" + ""] = 0,
|
||||
_a["" + ""] = function () { },
|
||||
_a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
|
||||
_a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }),
|
||||
_a);
|
||||
Object.defineProperty(_a, "" + "", {
|
||||
get: function () { return 0; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
Object.defineProperty(_a, "" + "", {
|
||||
set: function (x) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ var v = (_a = {},
|
||||
_a["hello"] = function () {
|
||||
debugger;
|
||||
},
|
||||
_a);
|
||||
_a
|
||||
);
|
||||
var _a;
|
||||
//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [computedPropertyNamesSourceMap2_ES5.js.map]
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;OACH,OAAO;QACJ,QAAQ,CAAC;IACb,CAAC;OACJ,CAAA"}
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;;CACJ,CAAA"}
|
||||
@@ -24,45 +24,53 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
|
||||
4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0)
|
||||
---
|
||||
>>> _a["hello"] = function () {
|
||||
1->^^^^^^^
|
||||
2 > ^^^^^^^
|
||||
3 > ^^^^->
|
||||
1->^^^^
|
||||
2 > ^^^
|
||||
3 > ^^^^^^^
|
||||
4 > ^
|
||||
5 > ^^^->
|
||||
1->{
|
||||
> [
|
||||
2 > "hello"
|
||||
1->Emitted(2, 8) Source(2, 6) + SourceIndex(0)
|
||||
2 >Emitted(2, 15) Source(2, 13) + SourceIndex(0)
|
||||
>
|
||||
2 > [
|
||||
3 > "hello"
|
||||
4 > ]
|
||||
1->Emitted(2, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(2, 8) Source(2, 6) + SourceIndex(0)
|
||||
3 >Emitted(2, 15) Source(2, 13) + SourceIndex(0)
|
||||
4 >Emitted(2, 16) Source(2, 14) + SourceIndex(0)
|
||||
---
|
||||
>>> debugger;
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^^^
|
||||
3 > ^
|
||||
1->]() {
|
||||
1->() {
|
||||
>
|
||||
2 > debugger
|
||||
3 > ;
|
||||
1->Emitted(3, 9) Source(3, 9) + SourceIndex(0)
|
||||
2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0)
|
||||
3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0)
|
||||
1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"])
|
||||
2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"])
|
||||
3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"])
|
||||
---
|
||||
>>> },
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^->
|
||||
3 > ^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0)
|
||||
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0)
|
||||
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"])
|
||||
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"])
|
||||
---
|
||||
>>> _a);
|
||||
1->^^^^^^^
|
||||
2 > ^
|
||||
>>> _a
|
||||
>>>);
|
||||
1->^
|
||||
2 > ^
|
||||
3 > ^^^^^^->
|
||||
1->
|
||||
>}
|
||||
2 >
|
||||
1->Emitted(5, 8) Source(5, 2) + SourceIndex(0)
|
||||
2 >Emitted(5, 9) Source(5, 2) + SourceIndex(0)
|
||||
2 >
|
||||
1->Emitted(6, 2) Source(5, 2) + SourceIndex(0)
|
||||
2 >Emitted(6, 3) Source(5, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>var _a;
|
||||
>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map
|
||||
@@ -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.
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
})();
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
}
|
||||
|
||||
@@ -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; },
|
||||
|
||||
@@ -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 { }
|
||||
}
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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;
|
||||
})();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user