mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into destructuring
Conflicts: src/compiler/binder.ts src/compiler/checker.ts src/compiler/emitter.ts src/compiler/parser.ts src/services/services.ts tests/baselines/reference/parserCommaInTypeMemberList2.errors.txt
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "Apache License 2.0",
|
||||
|
||||
@@ -265,7 +265,8 @@ module ts {
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -407,7 +408,8 @@ module ts {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.FunctionScopedVariable, SymbolFlags.FunctionScopedVariableExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Property | ((<PropertyDeclaration>node).questionToken ? SymbolFlags.Optional : 0), SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
@@ -422,7 +424,8 @@ module ts {
|
||||
case SyntaxKind.IndexSignature:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Signature, 0, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
// If this is an ObjectLiteralExpression method, then it sits in the same space
|
||||
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
|
||||
// so that it will conflict with any other object literal members with the same
|
||||
|
||||
+62
-38
@@ -363,7 +363,8 @@ module ts {
|
||||
break loop;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
// TypeScript 1.0 spec (April 2014): 8.4.1
|
||||
// Initializer expressions for instance member variables are evaluated in the scope
|
||||
// of the class constructor body but are not permitted to reference parameters or
|
||||
@@ -393,7 +394,8 @@ module ts {
|
||||
break loop;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -1612,10 +1614,12 @@ module ts {
|
||||
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
|
||||
return isDeclarationVisible(<Declaration>parent);
|
||||
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
if (node.flags & (NodeFlags.Private | NodeFlags.Protected)) {
|
||||
// Private/protected properties/methods are not visible
|
||||
return false;
|
||||
@@ -2670,7 +2674,8 @@ module ts {
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
@@ -3341,7 +3346,7 @@ module ts {
|
||||
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
|
||||
// that is subject to contextual typing.
|
||||
function isContextSensitive(node: Expression | MethodDeclaration | ObjectLiteralElement): boolean {
|
||||
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
|
||||
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
@@ -3358,7 +3363,8 @@ module ts {
|
||||
(isContextSensitive((<BinaryExpression>node).left) || isContextSensitive((<BinaryExpression>node).right));
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
return isContextSensitive((<PropertyAssignment>node).initializer);
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return isContextSensitiveFunctionLikeDeclaration(<MethodDeclaration>node);
|
||||
}
|
||||
|
||||
@@ -4190,7 +4196,8 @@ module ts {
|
||||
function reportImplicitAnyError(declaration: Declaration, type: Type) {
|
||||
var typeAsString = typeToString(getWidenedType(type));
|
||||
switch (declaration.kind) {
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
var diagnostic = Diagnostics.Member_0_implicitly_has_an_1_type;
|
||||
break;
|
||||
case SyntaxKind.Parameter:
|
||||
@@ -4199,7 +4206,8 @@ module ts {
|
||||
Diagnostics.Parameter_0_implicitly_has_an_1_type;
|
||||
break;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
@@ -4647,7 +4655,8 @@ module ts {
|
||||
case SyntaxKind.SourceFile:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.Constructor:
|
||||
@@ -4794,7 +4803,7 @@ module ts {
|
||||
function captureLexicalThis(node: Node, container: Node): void {
|
||||
var classNode = container.parent && container.parent.kind === SyntaxKind.ClassDeclaration ? container.parent : undefined;
|
||||
getNodeLinks(node).flags |= NodeCheckFlags.LexicalThis;
|
||||
if (container.kind === SyntaxKind.Property || container.kind === SyntaxKind.Constructor) {
|
||||
if (container.kind === SyntaxKind.PropertyDeclaration || container.kind === SyntaxKind.Constructor) {
|
||||
getNodeLinks(classNode).flags |= NodeCheckFlags.CaptureThis;
|
||||
}
|
||||
else {
|
||||
@@ -4829,7 +4838,8 @@ module ts {
|
||||
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
if (container.flags & NodeFlags.Static) {
|
||||
error(node, Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
|
||||
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
|
||||
@@ -4857,8 +4867,10 @@ module ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -4916,16 +4928,19 @@ module ts {
|
||||
if (container && container.parent && container.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (container.flags & NodeFlags.Static) {
|
||||
canUseSuperExpression =
|
||||
container.kind === SyntaxKind.Method ||
|
||||
container.kind === SyntaxKind.MethodDeclaration ||
|
||||
container.kind === SyntaxKind.MethodSignature ||
|
||||
container.kind === SyntaxKind.GetAccessor ||
|
||||
container.kind === SyntaxKind.SetAccessor;
|
||||
}
|
||||
else {
|
||||
canUseSuperExpression =
|
||||
container.kind === SyntaxKind.Method ||
|
||||
container.kind === SyntaxKind.MethodDeclaration ||
|
||||
container.kind === SyntaxKind.MethodSignature ||
|
||||
container.kind === SyntaxKind.GetAccessor ||
|
||||
container.kind === SyntaxKind.SetAccessor ||
|
||||
container.kind === SyntaxKind.Property ||
|
||||
container.kind === SyntaxKind.PropertyDeclaration ||
|
||||
container.kind === SyntaxKind.PropertySignature ||
|
||||
container.kind === SyntaxKind.Constructor;
|
||||
}
|
||||
}
|
||||
@@ -5177,7 +5192,8 @@ module ts {
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.BindingElement:
|
||||
return getContextualTypeForInitializerExpression(node);
|
||||
case SyntaxKind.ArrowFunction:
|
||||
@@ -5227,7 +5243,7 @@ module ts {
|
||||
// all identical ignoring their return type, the result is same signature but with return type as
|
||||
// union type of return types from these signatures
|
||||
function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature {
|
||||
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
|
||||
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
|
||||
var type = isObjectLiteralMethod(node)
|
||||
? getContextualTypeForObjectLiteralMethod(<MethodDeclaration>node)
|
||||
: getContextualType(<FunctionExpression>node);
|
||||
@@ -5349,7 +5365,7 @@ module ts {
|
||||
if (memberDecl.kind === SyntaxKind.PropertyAssignment) {
|
||||
var type = checkExpression((<PropertyAssignment>memberDecl).initializer, contextualMapper);
|
||||
}
|
||||
else if (memberDecl.kind === SyntaxKind.Method) {
|
||||
else if (memberDecl.kind === SyntaxKind.MethodDeclaration) {
|
||||
var type = checkObjectLiteralMethod(<MethodDeclaration>memberDecl, contextualMapper);
|
||||
}
|
||||
else {
|
||||
@@ -5417,7 +5433,7 @@ module ts {
|
||||
// If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized
|
||||
// '.prototype' property as well as synthesized tuple index properties.
|
||||
function getDeclarationKindFromSymbol(s: Symbol) {
|
||||
return s.valueDeclaration ? s.valueDeclaration.kind : SyntaxKind.Property;
|
||||
return s.valueDeclaration ? s.valueDeclaration.kind : SyntaxKind.PropertyDeclaration;
|
||||
}
|
||||
|
||||
function getDeclarationFlagsFromSymbol(s: Symbol) {
|
||||
@@ -5495,7 +5511,7 @@ module ts {
|
||||
// - In a static member function or static member accessor
|
||||
// where this references the constructor function object of a derived class,
|
||||
// a super property access is permitted and must specify a public static member function of the base class.
|
||||
if (left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.Method) {
|
||||
if (left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.MethodDeclaration) {
|
||||
error(right, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword);
|
||||
}
|
||||
else {
|
||||
@@ -5516,7 +5532,7 @@ module ts {
|
||||
if (type !== unknownType && type !== anyType) {
|
||||
var prop = getPropertyOfType(getWidenedType(type), propertyName);
|
||||
if (prop && prop.parent && prop.parent.flags & SymbolFlags.Class) {
|
||||
if (left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.Method) {
|
||||
if (left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.MethodDeclaration) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
@@ -6379,7 +6395,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkFunctionExpressionOrObjectLiteralMethod(node: FunctionExpression | MethodDeclaration, contextualMapper?: TypeMapper): Type {
|
||||
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
|
||||
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
|
||||
|
||||
// The identityMapper object is used to indicate that function expressions are wildcards
|
||||
if (contextualMapper === identityMapper) {
|
||||
@@ -6412,7 +6428,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (fullTypeCheck && node.kind !== SyntaxKind.Method) {
|
||||
if (fullTypeCheck && node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) {
|
||||
checkCollisionWithCapturedSuperVariable(node, (<FunctionExpression>node).name);
|
||||
checkCollisionWithCapturedThisVariable(node,(<FunctionExpression>node).name);
|
||||
}
|
||||
@@ -6421,7 +6437,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) {
|
||||
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
|
||||
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
|
||||
if (node.type) {
|
||||
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
|
||||
}
|
||||
@@ -7146,7 +7162,7 @@ module ts {
|
||||
}
|
||||
|
||||
function isInstancePropertyWithInitializer(n: Node): boolean {
|
||||
return n.kind === SyntaxKind.Property &&
|
||||
return n.kind === SyntaxKind.PropertyDeclaration &&
|
||||
!(n.flags & NodeFlags.Static) &&
|
||||
!!(<PropertyDeclaration>n).initializer;
|
||||
}
|
||||
@@ -7401,7 +7417,7 @@ module ts {
|
||||
// TODO(jfreeman): These are methods, so handle computed name case
|
||||
if (node.name && (<FunctionLikeDeclaration>subsequentNode).name && (<Identifier>node.name).text === (<Identifier>(<FunctionLikeDeclaration>subsequentNode).name).text) {
|
||||
// the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members
|
||||
Debug.assert(node.kind === SyntaxKind.Method);
|
||||
Debug.assert(node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature);
|
||||
Debug.assert((node.flags & NodeFlags.Static) !== (subsequentNode.flags & NodeFlags.Static));
|
||||
var diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
|
||||
error(errorNode, diagnostic);
|
||||
@@ -7442,7 +7458,7 @@ module ts {
|
||||
previousDeclaration = undefined;
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.Method || node.kind === SyntaxKind.Constructor) {
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature || node.kind === SyntaxKind.Constructor) {
|
||||
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
|
||||
someNodeFlags |= currentNodeFlags;
|
||||
allNodeFlags &= currentNodeFlags;
|
||||
@@ -7674,8 +7690,10 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.Property ||
|
||||
node.kind === SyntaxKind.Method ||
|
||||
if (node.kind === SyntaxKind.PropertyDeclaration ||
|
||||
node.kind === SyntaxKind.PropertySignature ||
|
||||
node.kind === SyntaxKind.MethodDeclaration ||
|
||||
node.kind === SyntaxKind.MethodSignature ||
|
||||
node.kind === SyntaxKind.GetAccessor ||
|
||||
node.kind === SyntaxKind.SetAccessor) {
|
||||
// it is ok to have member named '_super' or '_this' - member access is always qualified
|
||||
@@ -7880,7 +7898,7 @@ module ts {
|
||||
checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined);
|
||||
}
|
||||
}
|
||||
if (node.kind !== SyntaxKind.Property) {
|
||||
if (node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.PropertySignature) {
|
||||
// We know we don't have a binding pattern or computed name here
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
checkCollisionWithConstDeclarations(node);
|
||||
@@ -8718,7 +8736,8 @@ module ts {
|
||||
return checkTypeParameter(<TypeParameterDeclaration>node);
|
||||
case SyntaxKind.Parameter:
|
||||
return checkParameter(<ParameterDeclaration>node);
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return checkPropertyDeclaration(<PropertyDeclaration>node);
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
@@ -8726,7 +8745,8 @@ module ts {
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
return checkSignatureDeclaration(<SignatureDeclaration>node);
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return checkMethodDeclaration(<MethodDeclaration>node);
|
||||
case SyntaxKind.Constructor:
|
||||
return checkConstructorDeclaration(<ConstructorDeclaration>node);
|
||||
@@ -8817,7 +8837,8 @@ module ts {
|
||||
forEach((<FunctionLikeDeclaration>node).parameters, checkFunctionExpressionBodies);
|
||||
checkFunctionExpressionOrObjectLiteralMethodBody(<FunctionExpression>node);
|
||||
break;
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
forEach((<MethodDeclaration>node).parameters, checkFunctionExpressionBodies);
|
||||
if (isObjectLiteralMethod(node)) {
|
||||
checkFunctionExpressionOrObjectLiteralMethodBody(<MethodDeclaration>node);
|
||||
@@ -8833,7 +8854,8 @@ module ts {
|
||||
checkFunctionExpressionBodies((<WithStatement>node).expression);
|
||||
break;
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
case SyntaxKind.BindingElement:
|
||||
@@ -9093,7 +9115,8 @@ module ts {
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.TypeParameter:
|
||||
return node === (<TypeParameterDeclaration>parent).constraint;
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return node === (<VariableLikeDeclaration>parent).type;
|
||||
@@ -9101,7 +9124,8 @@ module ts {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return node === (<FunctionLikeDeclaration>parent).type;
|
||||
|
||||
+33
-19
@@ -761,6 +761,10 @@ module ts {
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function isPrivateMethodTypeParameter(node: TypeParameterDeclaration) {
|
||||
return node.parent.kind === SyntaxKind.MethodDeclaration && (node.parent.flags & NodeFlags.Private);
|
||||
}
|
||||
|
||||
function emitTypeParameters(typeParameters: TypeParameterDeclaration[]) {
|
||||
function emitTypeParameter(node: TypeParameterDeclaration) {
|
||||
increaseIndent();
|
||||
@@ -768,12 +772,13 @@ module ts {
|
||||
decreaseIndent();
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
// If there is constraint present and this is not a type parameter of the private method emit the constraint
|
||||
if (node.constraint && (node.parent.kind !== SyntaxKind.Method || !(node.parent.flags & NodeFlags.Private))) {
|
||||
if (node.constraint && !isPrivateMethodTypeParameter(node)) {
|
||||
write(" extends ");
|
||||
if (node.parent.kind === SyntaxKind.FunctionType ||
|
||||
node.parent.kind === SyntaxKind.ConstructorType ||
|
||||
(node.parent.parent && node.parent.parent.kind === SyntaxKind.TypeLiteral)) {
|
||||
Debug.assert(node.parent.kind === SyntaxKind.Method ||
|
||||
Debug.assert(node.parent.kind === SyntaxKind.MethodDeclaration ||
|
||||
node.parent.kind === SyntaxKind.MethodSignature ||
|
||||
node.parent.kind === SyntaxKind.FunctionType ||
|
||||
node.parent.kind === SyntaxKind.ConstructorType ||
|
||||
node.parent.kind === SyntaxKind.CallSignature ||
|
||||
@@ -805,7 +810,8 @@ module ts {
|
||||
diagnosticMessage = Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
if (node.parent.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
@@ -944,10 +950,10 @@ module ts {
|
||||
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
// If optional property emit ?
|
||||
if (node.kind === SyntaxKind.Property && hasQuestionToken(node)) {
|
||||
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && hasQuestionToken(node)) {
|
||||
write("?");
|
||||
}
|
||||
if (node.kind === SyntaxKind.Property && node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
emitTypeOfVariableDeclarationFromTypeLiteral(node);
|
||||
}
|
||||
else if (!(node.flags & NodeFlags.Private)) {
|
||||
@@ -965,7 +971,7 @@ module ts {
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
|
||||
else if (node.kind === SyntaxKind.Property) {
|
||||
else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) {
|
||||
// TODO(jfreeman): Deal with computed properties in error reporting.
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
@@ -1113,7 +1119,7 @@ module ts {
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration) {
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
}
|
||||
else if (node.kind === SyntaxKind.Method) {
|
||||
else if (node.kind === SyntaxKind.MethodDeclaration) {
|
||||
emitClassMemberDeclarationFlags(node);
|
||||
}
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration) {
|
||||
@@ -1208,7 +1214,8 @@ module ts {
|
||||
Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
|
||||
break;
|
||||
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
@@ -1301,7 +1308,8 @@ module ts {
|
||||
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
if (node.parent.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
@@ -1348,7 +1356,8 @@ module ts {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return emitFunctionDeclaration(<FunctionLikeDeclaration>node);
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.CallSignature:
|
||||
@@ -1359,7 +1368,8 @@ module ts {
|
||||
return emitAccessorDeclaration(<AccessorDeclaration>node);
|
||||
case SyntaxKind.VariableStatement:
|
||||
return emitVariableStatement(<VariableStatement>node);
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return emitPropertyDeclaration(<PropertyDeclaration>node);
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
return emitInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
@@ -1736,7 +1746,8 @@ module ts {
|
||||
}
|
||||
else if (node.kind === SyntaxKind.FunctionDeclaration ||
|
||||
node.kind === SyntaxKind.FunctionExpression ||
|
||||
node.kind === SyntaxKind.Method ||
|
||||
node.kind === SyntaxKind.MethodDeclaration ||
|
||||
node.kind === SyntaxKind.MethodSignature ||
|
||||
node.kind === SyntaxKind.GetAccessor ||
|
||||
node.kind === SyntaxKind.SetAccessor ||
|
||||
node.kind === SyntaxKind.ModuleDeclaration ||
|
||||
@@ -2151,11 +2162,13 @@ module ts {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -3097,7 +3110,7 @@ module ts {
|
||||
return emitPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
|
||||
if (node.kind !== SyntaxKind.Method) {
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) {
|
||||
// Methods will emit the comments as part of emitting method declaration
|
||||
emitLeadingComments(node);
|
||||
}
|
||||
@@ -3106,7 +3119,7 @@ module ts {
|
||||
emit(node.name);
|
||||
}
|
||||
emitSignatureAndBody(node);
|
||||
if (node.kind !== SyntaxKind.Method) {
|
||||
if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
}
|
||||
@@ -3256,7 +3269,7 @@ module ts {
|
||||
|
||||
function emitMemberAssignments(node: ClassDeclaration, staticFlag: NodeFlags) {
|
||||
forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.Property && (member.flags & NodeFlags.Static) === staticFlag && (<PropertyDeclaration>member).initializer) {
|
||||
if (member.kind === SyntaxKind.PropertyDeclaration && (member.flags & NodeFlags.Static) === staticFlag && (<PropertyDeclaration>member).initializer) {
|
||||
writeLine();
|
||||
emitLeadingComments(member);
|
||||
emitStart(member);
|
||||
@@ -3280,7 +3293,7 @@ module ts {
|
||||
|
||||
function emitMemberFunctions(node: ClassDeclaration) {
|
||||
forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.Method) {
|
||||
if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) {
|
||||
if (!(<MethodDeclaration>member).body) {
|
||||
return emitPinnedOrTripleSlashComments(member);
|
||||
}
|
||||
@@ -3815,7 +3828,8 @@ module ts {
|
||||
return emitIdentifier(<Identifier>node);
|
||||
case SyntaxKind.Parameter:
|
||||
return emitParameter(<ParameterDeclaration>node);
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return emitMethod(<MethodDeclaration>node);
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
|
||||
+134
-93
@@ -44,12 +44,6 @@ module ts {
|
||||
return new (getNodeConstructor(kind))();
|
||||
}
|
||||
|
||||
interface ReferenceComments {
|
||||
referencedFiles: FileReference[];
|
||||
amdDependencies: string[];
|
||||
amdModuleName: string;
|
||||
}
|
||||
|
||||
export function getSourceFileOfNode(node: Node): SourceFile {
|
||||
while (node && node.kind !== SyntaxKind.SourceFile) node = node.parent;
|
||||
return <SourceFile>node;
|
||||
@@ -263,7 +257,8 @@ module ts {
|
||||
return child((<TypeParameterDeclaration>node).name) ||
|
||||
child((<TypeParameterDeclaration>node).constraint);
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
@@ -284,7 +279,8 @@ module ts {
|
||||
children((<SignatureDeclaration>node).typeParameters) ||
|
||||
children((<SignatureDeclaration>node).parameters) ||
|
||||
child((<SignatureDeclaration>node).type);
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -292,6 +288,7 @@ module ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return children(node.modifiers) ||
|
||||
child((<FunctionLikeDeclaration>node).asteriskToken) ||
|
||||
child((<FunctionLikeDeclaration>node).name) ||
|
||||
child((<FunctionLikeDeclaration>node).questionToken) ||
|
||||
children((<FunctionLikeDeclaration>node).typeParameters) ||
|
||||
@@ -347,6 +344,9 @@ module ts {
|
||||
return child((<VoidExpression>node).expression);
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
return child((<PrefixUnaryExpression>node).operand);
|
||||
case SyntaxKind.YieldExpression:
|
||||
return child((<YieldExpression>node).asteriskToken) ||
|
||||
child((<YieldExpression>node).expression);
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
return child((<PostfixUnaryExpression>node).operand);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
@@ -499,8 +499,12 @@ module ts {
|
||||
export function isAnyFunction(node: Node): boolean {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.CallSignature:
|
||||
@@ -523,7 +527,7 @@ module ts {
|
||||
}
|
||||
|
||||
export function isObjectLiteralMethod(node: Node) {
|
||||
return node && node.kind === SyntaxKind.Method && node.parent.kind === SyntaxKind.ObjectLiteralExpression;
|
||||
return node && node.kind === SyntaxKind.MethodDeclaration && node.parent.kind === SyntaxKind.ObjectLiteralExpression;
|
||||
}
|
||||
|
||||
export function getContainingFunction(node: Node): FunctionLikeDeclaration {
|
||||
@@ -550,8 +554,10 @@ module ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -569,8 +575,10 @@ module ts {
|
||||
return undefined;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -635,7 +643,8 @@ module ts {
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.BindingElement:
|
||||
@@ -693,11 +702,13 @@ module ts {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Parameter:
|
||||
return (<ParameterDeclaration>node).questionToken !== undefined;
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return (<MethodDeclaration>node).questionToken !== undefined;
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return (<PropertyDeclaration>node).questionToken !== undefined;
|
||||
}
|
||||
}
|
||||
@@ -739,11 +750,13 @@ module ts {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -1003,7 +1016,6 @@ module ts {
|
||||
}
|
||||
|
||||
export function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, version: string, isOpen: boolean = false): SourceFile {
|
||||
var token: SyntaxKind;
|
||||
var parsingContext: ParsingContext;
|
||||
var identifiers: Map<string> = {};
|
||||
var identifierCount = 0;
|
||||
@@ -1012,8 +1024,7 @@ module ts {
|
||||
|
||||
// Flags that dictate what parsing context we're in. For example:
|
||||
// Whether or not we are in strict parsing mode. All that changes in strict parsing mode is
|
||||
// that some tokens that would be considered identifiers may be considered keywords. When
|
||||
// rewinding, we need to store and restore this as the mode may have changed.
|
||||
// that some tokens that would be considered identifiers may be considered keywords.
|
||||
//
|
||||
// When adding more parser context flags, consider which is the more common case that the
|
||||
// flag will be in. This should be hte 'false' state for that flag. The reason for this is
|
||||
@@ -1088,6 +1099,44 @@ module ts {
|
||||
// attached to the EOF token.
|
||||
var parseErrorBeforeNextFinishedNode = false;
|
||||
|
||||
var sourceFile = <SourceFile>createNode(SyntaxKind.SourceFile, 0);
|
||||
if (fileExtensionIs(filename, ".d.ts")) {
|
||||
sourceFile.flags = NodeFlags.DeclarationFile;
|
||||
}
|
||||
sourceFile.end = sourceText.length;
|
||||
sourceFile.filename = normalizePath(filename);
|
||||
sourceFile.text = sourceText;
|
||||
|
||||
sourceFile.getLineAndCharacterFromPosition = getLineAndCharacterFromSourcePosition;
|
||||
sourceFile.getPositionFromLineAndCharacter = getPositionFromSourceLineAndCharacter;
|
||||
sourceFile.getLineStarts = getLineStarts;
|
||||
sourceFile.getSyntacticDiagnostics = getSyntacticDiagnostics;
|
||||
|
||||
sourceFile.referenceDiagnostics = [];
|
||||
sourceFile.parseDiagnostics = [];
|
||||
sourceFile.grammarDiagnostics = [];
|
||||
sourceFile.semanticDiagnostics = [];
|
||||
|
||||
processReferenceComments();
|
||||
|
||||
// Create and prime the scanner before parsing the source elements.
|
||||
var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError);
|
||||
var token = nextToken();
|
||||
|
||||
sourceFile.statements = parseList(ParsingContext.SourceElements, /*checkForStrictMode*/ true, parseSourceElement);
|
||||
Debug.assert(token === SyntaxKind.EndOfFileToken);
|
||||
sourceFile.endOfFileToken = parseTokenNode();
|
||||
|
||||
sourceFile.externalModuleIndicator = getExternalModuleIndicator();
|
||||
|
||||
sourceFile.nodeCount = nodeCount;
|
||||
sourceFile.identifierCount = identifierCount;
|
||||
sourceFile.version = version;
|
||||
sourceFile.isOpen = isOpen;
|
||||
sourceFile.languageVersion = languageVersion;
|
||||
sourceFile.identifiers = identifiers;
|
||||
return sourceFile;
|
||||
|
||||
function setContextFlag(val: Boolean, flag: ParserContextFlags) {
|
||||
if (val) {
|
||||
contextFlags |= flag;
|
||||
@@ -1346,15 +1395,17 @@ module ts {
|
||||
return token === SyntaxKind.CloseBraceToken || token === SyntaxKind.EndOfFileToken || scanner.hasPrecedingLineBreak();
|
||||
}
|
||||
|
||||
function parseSemicolon(diagnosticMessage?: DiagnosticMessage): void {
|
||||
function parseSemicolon(diagnosticMessage?: DiagnosticMessage): boolean {
|
||||
if (canParseSemicolon()) {
|
||||
if (token === SyntaxKind.SemicolonToken) {
|
||||
// consume the semicolon if it was explicitly provided.
|
||||
nextToken();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.SemicolonToken, diagnosticMessage);
|
||||
return parseExpected(SyntaxKind.SemicolonToken, diagnosticMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2063,13 +2114,27 @@ module ts {
|
||||
return requireCompleteParameterList ? undefined : createMissingList<ParameterDeclaration>();
|
||||
}
|
||||
|
||||
function parseTypeMemberSemicolon() {
|
||||
// Try to parse out an explicit or implicit (ASI) semicolon for a type member. If we
|
||||
// don't have one, then an appropriate error will be reported.
|
||||
if (parseSemicolon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we don't have a semicolon, then the user may have written a comma instead
|
||||
// accidently (pretty easy to do since commas are so prevalent as list separators). So
|
||||
// just consume the comma and keep going. Note: we'll have already reported the error
|
||||
// about the missing semicolon above.
|
||||
parseOptional(SyntaxKind.CommaToken);
|
||||
}
|
||||
|
||||
function parseSignatureMember(kind: SyntaxKind): SignatureDeclaration {
|
||||
var node = <SignatureDeclaration>createNode(kind);
|
||||
if (kind === SyntaxKind.ConstructSignature) {
|
||||
parseExpected(SyntaxKind.NewKeyword);
|
||||
}
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
|
||||
parseSemicolon();
|
||||
parseTypeMemberSemicolon();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -2141,33 +2206,32 @@ module ts {
|
||||
setModifiers(node, modifiers);
|
||||
node.parameters = parseBracketedList(ParsingContext.Parameters, parseParameter, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken);
|
||||
node.type = parseTypeAnnotation();
|
||||
parseSemicolon();
|
||||
parseTypeMemberSemicolon();
|
||||
return finishNode(node)
|
||||
}
|
||||
|
||||
function parsePropertyOrMethod(): Declaration {
|
||||
function parsePropertyOrMethodSignature(): Declaration {
|
||||
var fullStart = scanner.getStartPos();
|
||||
var name = parsePropertyName();
|
||||
var questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
|
||||
|
||||
if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
var method = <MethodDeclaration>createNode(SyntaxKind.Method, fullStart);
|
||||
var method = <MethodDeclaration>createNode(SyntaxKind.MethodSignature, fullStart);
|
||||
method.name = name;
|
||||
method.questionToken = questionToken;
|
||||
|
||||
// Method signatues don't exist in expression contexts. So they have neither
|
||||
// [Yield] nor [GeneratorParameter]
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, method);
|
||||
|
||||
parseSemicolon();
|
||||
parseTypeMemberSemicolon();
|
||||
return finishNode(method);
|
||||
}
|
||||
else {
|
||||
var property = <PropertyDeclaration>createNode(SyntaxKind.Property, fullStart);
|
||||
var property = <PropertyDeclaration>createNode(SyntaxKind.PropertySignature, fullStart);
|
||||
property.name = name;
|
||||
property.questionToken = questionToken;
|
||||
property.type = parseTypeAnnotation();
|
||||
parseSemicolon();
|
||||
parseTypeMemberSemicolon();
|
||||
return finishNode(property);
|
||||
}
|
||||
}
|
||||
@@ -2199,7 +2263,7 @@ module ts {
|
||||
return parseSignatureMember(SyntaxKind.CallSignature);
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
// Indexer or computed property
|
||||
return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*modifiers:*/ undefined) : parsePropertyOrMethod();
|
||||
return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*modifiers:*/ undefined) : parsePropertyOrMethodSignature();
|
||||
case SyntaxKind.NewKeyword:
|
||||
if (lookAhead(isStartOfConstructSignature)) {
|
||||
return parseSignatureMember(SyntaxKind.ConstructSignature);
|
||||
@@ -2207,10 +2271,10 @@ module ts {
|
||||
// fall through.
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.NumericLiteral:
|
||||
return parsePropertyOrMethod();
|
||||
return parsePropertyOrMethodSignature();
|
||||
default:
|
||||
if (isIdentifierOrKeyword()) {
|
||||
return parsePropertyOrMethod();
|
||||
return parsePropertyOrMethodSignature();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2451,6 +2515,14 @@ module ts {
|
||||
// a generator, or in strict mode (or both)) and it started a yield expression.
|
||||
return true;
|
||||
default:
|
||||
// Error tolerance. If we see the start of some binary operator, we consider
|
||||
// that the start of an expression. That way we'll parse out a missing identifier,
|
||||
// give a good message about an identifier being missing, and then consume the
|
||||
// rest of the binary expression.
|
||||
if (isBinaryOperator()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return isIdentifier();
|
||||
}
|
||||
}
|
||||
@@ -2837,7 +2909,7 @@ module ts {
|
||||
// reScanGreaterToken so that we merge token sequences like > and = into >=
|
||||
|
||||
reScanGreaterToken();
|
||||
var newPrecedence = getOperatorPrecedence();
|
||||
var newPrecedence = getBinaryOperatorPrecedence();
|
||||
|
||||
// Check the precedence to see if we should "take" this operator
|
||||
if (newPrecedence <= precedence) {
|
||||
@@ -2856,7 +2928,15 @@ module ts {
|
||||
return leftOperand;
|
||||
}
|
||||
|
||||
function getOperatorPrecedence(): number {
|
||||
function isBinaryOperator() {
|
||||
if (inDisallowInContext() && token === SyntaxKind.InKeyword) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getBinaryOperatorPrecedence() > 0;
|
||||
}
|
||||
|
||||
function getBinaryOperatorPrecedence(): number {
|
||||
switch (token) {
|
||||
case SyntaxKind.BarBarToken:
|
||||
return 1;
|
||||
@@ -3902,7 +3982,7 @@ module ts {
|
||||
}
|
||||
|
||||
function parseMethodDeclaration(fullStart: number, modifiers: ModifiersArray, asteriskToken: Node, name: DeclarationName, questionToken: Node, requireBlock: boolean): MethodDeclaration {
|
||||
var method = <MethodDeclaration>createNode(SyntaxKind.Method, fullStart);
|
||||
var method = <MethodDeclaration>createNode(SyntaxKind.MethodDeclaration, fullStart);
|
||||
setModifiers(method, modifiers);
|
||||
method.asteriskToken = asteriskToken;
|
||||
method.name = name;
|
||||
@@ -3923,7 +4003,7 @@ module ts {
|
||||
return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, /*requireBlock:*/ false);
|
||||
}
|
||||
else {
|
||||
var property = <PropertyDeclaration>createNode(SyntaxKind.Property, fullStart);
|
||||
var property = <PropertyDeclaration>createNode(SyntaxKind.PropertyDeclaration, fullStart);
|
||||
setModifiers(property, modifiers);
|
||||
property.name = name;
|
||||
property.questionToken = questionToken;
|
||||
@@ -4367,7 +4447,7 @@ module ts {
|
||||
: parseStatement();
|
||||
}
|
||||
|
||||
function processReferenceComments(): ReferenceComments {
|
||||
function processReferenceComments(): void {
|
||||
var triviaScanner = createScanner(languageVersion, /*skipTrivia*/false, sourceText);
|
||||
var referencedFiles: FileReference[] = [];
|
||||
var amdDependencies: string[] = [];
|
||||
@@ -4418,11 +4498,9 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
referencedFiles,
|
||||
amdDependencies,
|
||||
amdModuleName
|
||||
};
|
||||
sourceFile.referencedFiles = referencedFiles;
|
||||
sourceFile.amdDependencies = amdDependencies;
|
||||
sourceFile.amdModuleName = amdModuleName;
|
||||
}
|
||||
|
||||
function getExternalModuleIndicator() {
|
||||
@@ -4452,49 +4530,6 @@ module ts {
|
||||
Debug.assert(syntacticDiagnostics !== undefined);
|
||||
return syntacticDiagnostics;
|
||||
}
|
||||
|
||||
|
||||
var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError);
|
||||
var sourceFile = <SourceFile>createNode(SyntaxKind.SourceFile);
|
||||
|
||||
if (fileExtensionIs(filename, ".d.ts")) {
|
||||
sourceFile.flags = NodeFlags.DeclarationFile;
|
||||
}
|
||||
sourceFile.end = sourceText.length;
|
||||
sourceFile.filename = normalizePath(filename);
|
||||
sourceFile.text = sourceText;
|
||||
|
||||
sourceFile.getLineAndCharacterFromPosition = getLineAndCharacterFromSourcePosition;
|
||||
sourceFile.getPositionFromLineAndCharacter = getPositionFromSourceLineAndCharacter;
|
||||
sourceFile.getLineStarts = getLineStarts;
|
||||
sourceFile.getSyntacticDiagnostics = getSyntacticDiagnostics;
|
||||
|
||||
sourceFile.referenceDiagnostics = [];
|
||||
sourceFile.parseDiagnostics = [];
|
||||
sourceFile.grammarDiagnostics = [];
|
||||
sourceFile.semanticDiagnostics = [];
|
||||
|
||||
var referenceComments = processReferenceComments();
|
||||
sourceFile.referencedFiles = referenceComments.referencedFiles;
|
||||
sourceFile.amdDependencies = referenceComments.amdDependencies;
|
||||
sourceFile.amdModuleName = referenceComments.amdModuleName;
|
||||
|
||||
// Prime the scanner before parsing the source elements
|
||||
nextToken();
|
||||
|
||||
sourceFile.statements = parseList(ParsingContext.SourceElements, /*checkForStrictMode*/ true, parseSourceElement);
|
||||
Debug.assert(token === SyntaxKind.EndOfFileToken);
|
||||
sourceFile.endOfFileToken = parseTokenNode();
|
||||
|
||||
sourceFile.externalModuleIndicator = getExternalModuleIndicator();
|
||||
|
||||
sourceFile.nodeCount = nodeCount;
|
||||
sourceFile.identifierCount = identifierCount;
|
||||
sourceFile.version = version;
|
||||
sourceFile.isOpen = isOpen;
|
||||
sourceFile.languageVersion = languageVersion;
|
||||
sourceFile.identifiers = identifiers;
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
function isLeftHandSideExpression(expr: Expression): boolean {
|
||||
@@ -4624,14 +4659,18 @@ module ts {
|
||||
case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.LabeledStatement: return checkLabeledStatement(<LabeledStatement>node);
|
||||
case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(<PropertyAssignment>node);
|
||||
case SyntaxKind.Method: return checkMethod(<MethodDeclaration>node);
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return checkMethod(<MethodDeclaration>node);
|
||||
case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(<ModuleDeclaration>node);
|
||||
case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(<ObjectLiteralExpression>node);
|
||||
case SyntaxKind.NumericLiteral: return checkNumericLiteral(<LiteralExpression>node);
|
||||
case SyntaxKind.Parameter: return checkParameter(<ParameterDeclaration>node);
|
||||
case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(<PostfixUnaryExpression>node);
|
||||
case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(<PrefixUnaryExpression>node);
|
||||
case SyntaxKind.Property: return checkProperty(<PropertyDeclaration>node);
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return checkProperty(<PropertyDeclaration>node);
|
||||
case SyntaxKind.ReturnStatement: return checkReturnStatement(<ReturnStatement>node);
|
||||
case SyntaxKind.SetAccessor: return checkSetAccessor(<MethodDeclaration>node);
|
||||
case SyntaxKind.SourceFile: return checkSourceFile(<SourceFile>node);
|
||||
@@ -5239,7 +5278,7 @@ module ts {
|
||||
var currentKind: number;
|
||||
if (prop.kind === SyntaxKind.PropertyAssignment ||
|
||||
prop.kind === SyntaxKind.ShorthandPropertyAssignment ||
|
||||
prop.kind === SyntaxKind.Method) {
|
||||
prop.kind === SyntaxKind.MethodDeclaration) {
|
||||
currentKind = Property;
|
||||
}
|
||||
else if (prop.kind === SyntaxKind.GetAccessor) {
|
||||
@@ -5293,8 +5332,10 @@ module ts {
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
/// <reference path="commandLineParser.ts"/>
|
||||
|
||||
module ts {
|
||||
var version = "1.3.0.0";
|
||||
var version = "1.4.0.0";
|
||||
|
||||
/**
|
||||
* Checks to see if the locale is in the appropriate format,
|
||||
|
||||
@@ -147,8 +147,10 @@ module ts {
|
||||
TypeParameter,
|
||||
Parameter,
|
||||
// TypeMember
|
||||
Property,
|
||||
Method,
|
||||
PropertySignature,
|
||||
PropertyDeclaration,
|
||||
MethodSignature,
|
||||
MethodDeclaration,
|
||||
Constructor,
|
||||
GetAccessor,
|
||||
SetAccessor,
|
||||
|
||||
+135
-18
@@ -21,15 +21,93 @@ class Test262BaselineRunner extends RunnerBase {
|
||||
return Test262BaselineRunner.basePath + "/" + filename;
|
||||
}
|
||||
|
||||
private static checkInvariants(node: ts.Node, parent: ts.Node): void {
|
||||
if (node) {
|
||||
if (node.pos < 0) {
|
||||
throw new Error("node.pos < 0");
|
||||
}
|
||||
if (node.end < 0) {
|
||||
throw new Error("node.end < 0");
|
||||
}
|
||||
if (node.end < node.pos) {
|
||||
throw new Error("node.end < node.pos");
|
||||
}
|
||||
if (node.parent !== parent) {
|
||||
throw new Error("node.parent !== parent");
|
||||
}
|
||||
if (parent) {
|
||||
// Make sure each child is contained within the parent.
|
||||
if (node.pos < parent.pos) {
|
||||
throw new Error("node.pos < parent.pos");
|
||||
}
|
||||
if (node.end > parent.end) {
|
||||
throw new Error("node.end > parent.end");
|
||||
}
|
||||
}
|
||||
|
||||
ts.forEachChild(node, child => {
|
||||
Test262BaselineRunner.checkInvariants(child, node);
|
||||
});
|
||||
|
||||
// Make sure each of the children is in order.
|
||||
var currentPos = 0;
|
||||
ts.forEachChild(node,
|
||||
child => {
|
||||
if (child.pos < currentPos) {
|
||||
throw new Error("child.pos < currentPos");
|
||||
}
|
||||
currentPos = child.end;
|
||||
},
|
||||
(array: ts.NodeArray<ts.Node>) => {
|
||||
if (array.pos < node.pos) {
|
||||
throw new Error("array.pos < node.pos");
|
||||
}
|
||||
if (array.end > node.end) {
|
||||
throw new Error("array.end > node.end");
|
||||
}
|
||||
|
||||
if (array.pos < currentPos) {
|
||||
throw new Error("array.pos < currentPos");
|
||||
}
|
||||
for (var i = 0, n = array.length; i < n; i++) {
|
||||
if (array[i].pos < currentPos) {
|
||||
throw new Error("array[i].pos < currentPos");
|
||||
}
|
||||
currentPos = array[i].end
|
||||
}
|
||||
|
||||
currentPos = array.end;
|
||||
});
|
||||
|
||||
var childNodesAndArrays: any[] = [];
|
||||
ts.forEachChild(node, child => { childNodesAndArrays.push(child) }, array => { childNodesAndArrays.push(array) });
|
||||
|
||||
for (var childName in node) {
|
||||
if (childName === "parent" || childName === "nextContainer" || childName === "modifiers" || childName === "externalModuleIndicator") {
|
||||
continue;
|
||||
}
|
||||
var child = (<any>node)[childName];
|
||||
if (Test262BaselineRunner.isNodeOrArray(child)) {
|
||||
if (childNodesAndArrays.indexOf(child) < 0) {
|
||||
throw new Error("Child when forEach'ing over node. " + (<any>ts).SyntaxKind[node.kind] + "-" + childName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static serializeSourceFile(file: ts.SourceFile): string {
|
||||
function getKindName(k: number): string {
|
||||
return (<any>ts).SyntaxKind[k]
|
||||
}
|
||||
|
||||
function getFlagName(flags: any, f: number): any {
|
||||
if (f === 0) return 0;
|
||||
if (f === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var result = "";
|
||||
ts.forEach(Object.getOwnPropertyNames(flags),(v: any) => {
|
||||
ts.forEach(Object.getOwnPropertyNames(flags), (v: any) => {
|
||||
if (isFinite(v)) {
|
||||
v = +v;
|
||||
if (f === +v) {
|
||||
@@ -49,51 +127,85 @@ class Test262BaselineRunner extends RunnerBase {
|
||||
|
||||
function getNodeFlagName(f: number) { return getFlagName((<any>ts).NodeFlags, f); }
|
||||
function getParserContextFlagName(f: number) { return getFlagName((<any>ts).ParserContextFlags, f); }
|
||||
function convertDiagnostics(diagnostics: ts.Diagnostic[]) {
|
||||
return diagnostics.map(convertDiagnostic);
|
||||
}
|
||||
|
||||
function convertDiagnostic(diagnostic: ts.Diagnostic): any {
|
||||
return {
|
||||
start: diagnostic.start,
|
||||
length: diagnostic.length,
|
||||
messageText: diagnostic.messageText,
|
||||
category: (<any>ts).DiagnosticCategory[diagnostic.category],
|
||||
code: diagnostic.code
|
||||
};
|
||||
}
|
||||
|
||||
function serializeNode(n: ts.Node): any {
|
||||
var o = { kind: getKindName(n.kind) };
|
||||
ts.forEach(Object.getOwnPropertyNames(n), i => {
|
||||
switch (i) {
|
||||
var o: any = { kind: getKindName(n.kind) };
|
||||
|
||||
ts.forEach(Object.getOwnPropertyNames(n), propertyName => {
|
||||
switch (propertyName) {
|
||||
case "parent":
|
||||
case "symbol":
|
||||
case "locals":
|
||||
case "localSymbol":
|
||||
case "kind":
|
||||
case "semanticDiagnostics":
|
||||
case "parseDiagnostics":
|
||||
case "grammarDiagnostics":
|
||||
return undefined;
|
||||
case "id":
|
||||
case "nodeCount":
|
||||
case "symbolCount":
|
||||
case "identifierCount":
|
||||
// Blacklist of items we never put in the baseline file.
|
||||
break;
|
||||
|
||||
case "flags":
|
||||
(<any>o)[i] = getNodeFlagName(n.flags);
|
||||
return undefined;
|
||||
// Print out flags with their enum names.
|
||||
o[propertyName] = getNodeFlagName(n.flags);
|
||||
break;
|
||||
|
||||
case "parserContextFlags":
|
||||
(<any>o)[i] = getParserContextFlagName(n.parserContextFlags);
|
||||
return undefined;
|
||||
o[propertyName] = getParserContextFlagName(n.parserContextFlags);
|
||||
break;
|
||||
|
||||
case "referenceDiagnostics":
|
||||
case "parseDiagnostics":
|
||||
case "grammarDiagnostics":
|
||||
o[propertyName] = convertDiagnostics((<any>n)[propertyName]);
|
||||
break;
|
||||
|
||||
case "nextContainer":
|
||||
if (n.nextContainer) {
|
||||
(<any>o)[i] = { kind: n.nextContainer.kind, pos: n.nextContainer.pos, end: n.nextContainer.end };
|
||||
return undefined;
|
||||
o[propertyName] = { kind: n.nextContainer.kind, pos: n.nextContainer.pos, end: n.nextContainer.end };
|
||||
}
|
||||
break;
|
||||
|
||||
case "text":
|
||||
if (n.kind === ts.SyntaxKind.SourceFile) return undefined;
|
||||
// Include 'text' field for identifiers/literals, but not for source files.
|
||||
if (n.kind !== ts.SyntaxKind.SourceFile) {
|
||||
o[propertyName] = (<any>n)[propertyName];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
(<any>o)[i] = ((<any>n)[i]);
|
||||
o[propertyName] = (<any>n)[propertyName];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
});
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
return JSON.stringify(file,(k, v) => {
|
||||
return (v && typeof v.pos === "number") ? serializeNode(v) : v;
|
||||
return JSON.stringify(file, (k, v) => {
|
||||
return Test262BaselineRunner.isNodeOrArray(v) ? serializeNode(v) : v;
|
||||
}, " ");
|
||||
}
|
||||
|
||||
private static isNodeOrArray(a: any): boolean {
|
||||
return a !== undefined && typeof a.pos === "number";
|
||||
}
|
||||
|
||||
private runTest(filePath: string) {
|
||||
describe('test262 test for ' + filePath, () => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
@@ -150,6 +262,11 @@ class Test262BaselineRunner extends RunnerBase {
|
||||
}, false, Test262BaselineRunner.baselineOptions);
|
||||
});
|
||||
|
||||
it('satisfies invariants', () => {
|
||||
var sourceFile = testState.checker.getProgram().getSourceFile(Test262BaselineRunner.getTestFilePath(testState.filename));
|
||||
Test262BaselineRunner.checkInvariants(sourceFile, /*parent:*/ undefined);
|
||||
});
|
||||
|
||||
it('has the expected AST',() => {
|
||||
Harness.Baseline.runBaseline('has the expected AST', testState.filename + '.AST.txt',() => {
|
||||
var sourceFile = testState.checker.getProgram().getSourceFile(Test262BaselineRunner.getTestFilePath(testState.filename));
|
||||
|
||||
Vendored
+2
@@ -426,6 +426,8 @@ interface StringConstructor {
|
||||
declare var String: StringConstructor;
|
||||
|
||||
interface Boolean {
|
||||
/** Returns the primitive value of the specified object. */
|
||||
valueOf(): boolean;
|
||||
}
|
||||
|
||||
interface BooleanConstructor {
|
||||
|
||||
@@ -86,14 +86,16 @@ module ts.BreakpointResolver {
|
||||
return spanInVariableDeclaration((<VariableStatement>node).declarations[0]);
|
||||
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return spanInVariableDeclaration(<VariableDeclaration>node);
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
return spanInParameterDeclaration(<ParameterDeclaration>node);
|
||||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.Constructor:
|
||||
@@ -463,7 +465,8 @@ module ts.BreakpointResolver {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.Constructor:
|
||||
|
||||
@@ -911,7 +911,8 @@ module ts.formatting {
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
if ((<FunctionDeclaration>node).typeParameters === list) {
|
||||
return SyntaxKind.LessThanToken;
|
||||
|
||||
@@ -283,7 +283,7 @@ module ts.formatting {
|
||||
this.NoSpaceBeforeComma = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CommaToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
this.SpaceAfterCertainKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.VarKeyword, SyntaxKind.ThrowKeyword, SyntaxKind.NewKeyword, SyntaxKind.DeleteKeyword, SyntaxKind.ReturnKeyword, SyntaxKind.TypeOfKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeOpenParenInFuncCall = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), RuleAction.Delete));
|
||||
this.SpaceAfterFunctionInFuncDecl = new Rule(RuleDescriptor.create3(SyntaxKind.FunctionKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
||||
this.NoSpaceBeforeOpenParenInFuncDecl = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), RuleAction.Delete));
|
||||
this.SpaceAfterVoidOperator = new Rule(RuleDescriptor.create3(SyntaxKind.VoidKeyword, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), RuleAction.Space));
|
||||
@@ -458,7 +458,8 @@ module ts.formatting {
|
||||
// equal in p = 0;
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken;
|
||||
// "in" keyword in for (var x in []) { }
|
||||
case SyntaxKind.ForInStatement:
|
||||
@@ -536,7 +537,8 @@ module ts.formatting {
|
||||
static IsFunctionDeclContext(context: FormattingContext): boolean {
|
||||
switch (context.contextNode.kind) {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
//case SyntaxKind.MemberFunctionDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -625,6 +627,10 @@ module ts.formatting {
|
||||
return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context);
|
||||
}
|
||||
|
||||
static IsPreviousTokenNotComma(context: FormattingContext): boolean {
|
||||
return context.currentTokenSpan.kind !== SyntaxKind.CommaToken;
|
||||
}
|
||||
|
||||
static IsSameLineTokenContext(context: FormattingContext): boolean {
|
||||
return context.TokensAreOnSameLine();
|
||||
}
|
||||
@@ -652,7 +658,8 @@ module ts.formatting {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.CallExpression:
|
||||
|
||||
@@ -232,7 +232,8 @@ module ts.NavigationBar {
|
||||
}
|
||||
return createItem(node, getTextOfNode((<ParameterDeclaration>node).name), ts.ScriptElementKind.memberVariableElement);
|
||||
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return createItem(node, getTextOfNode((<MethodDeclaration>node).name), ts.ScriptElementKind.memberFunctionElement);
|
||||
|
||||
case SyntaxKind.GetAccessor:
|
||||
@@ -253,7 +254,8 @@ module ts.NavigationBar {
|
||||
case SyntaxKind.ConstructSignature:
|
||||
return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement);
|
||||
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return createItem(node, getTextOfNode((<PropertyDeclaration>node).name), ts.ScriptElementKind.memberVariableElement);
|
||||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
|
||||
+35
-18
@@ -766,7 +766,8 @@ module ts {
|
||||
forEachChild(sourceFile, function visit(node: Node): void {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
var functionDeclaration = <FunctionLikeDeclaration>node;
|
||||
|
||||
if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) {
|
||||
@@ -830,7 +831,8 @@ module ts {
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
namedDeclarations.push(<Declaration>node);
|
||||
break;
|
||||
}
|
||||
@@ -1994,10 +1996,12 @@ module ts {
|
||||
function isLiteralNameOfPropertyDeclarationOrIndexAccess(node: Node): boolean {
|
||||
if (node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NumericLiteral) {
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
@@ -2578,7 +2582,8 @@ module ts {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -2609,7 +2614,7 @@ module ts {
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration; // interface a { |
|
||||
|
||||
case SyntaxKind.SemicolonToken:
|
||||
return containingNodeKind === SyntaxKind.Property &&
|
||||
return containingNodeKind === SyntaxKind.PropertySignature &&
|
||||
previousToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration; // interface a { f; |
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
@@ -2739,7 +2744,8 @@ module ts {
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.GetAccessor:
|
||||
@@ -2854,8 +2860,12 @@ module ts {
|
||||
case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement;
|
||||
case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement;
|
||||
case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement;
|
||||
case SyntaxKind.Method: return ScriptElementKind.memberFunctionElement;
|
||||
case SyntaxKind.Property: return ScriptElementKind.memberVariableElement;
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return ScriptElementKind.memberFunctionElement;
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return ScriptElementKind.memberVariableElement;
|
||||
case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement;
|
||||
case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement;
|
||||
case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement;
|
||||
@@ -3265,7 +3275,7 @@ module ts {
|
||||
|
||||
forEach(signatureDeclarations, d => {
|
||||
if ((selectConstructors && d.kind === SyntaxKind.Constructor) ||
|
||||
(!selectConstructors && (d.kind === SyntaxKind.FunctionDeclaration || d.kind === SyntaxKind.Method))) {
|
||||
(!selectConstructors && (d.kind === SyntaxKind.FunctionDeclaration || d.kind === SyntaxKind.MethodDeclaration || d.kind === SyntaxKind.MethodSignature))) {
|
||||
declarations.push(d);
|
||||
if ((<FunctionLikeDeclaration>d).body) definition = d;
|
||||
}
|
||||
@@ -4278,8 +4288,10 @@ module ts {
|
||||
var staticFlag = NodeFlags.Static;
|
||||
|
||||
switch (searchSpaceNode.kind) {
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -4323,12 +4335,14 @@ module ts {
|
||||
var staticFlag = NodeFlags.Static;
|
||||
|
||||
switch (searchSpaceNode.kind) {
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
if (isObjectLiteralMethod(searchSpaceNode)) {
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.Property:
|
||||
// fall through
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
@@ -4381,7 +4395,8 @@ module ts {
|
||||
result.push(getReferenceEntryFromNode(node));
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
if (isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {
|
||||
result.push(getReferenceEntryFromNode(node));
|
||||
}
|
||||
@@ -4739,11 +4754,13 @@ module ts {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
|
||||
@@ -234,7 +234,8 @@ module ts.formatting {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
var start = node.getStart(sourceFile);
|
||||
@@ -358,7 +359,8 @@ module ts.formatting {
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
@@ -414,7 +416,8 @@ module ts.formatting {
|
||||
return nodeEndsWith(n, SyntaxKind.CloseParenToken, sourceFile);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return !(<FunctionLikeDeclaration>n).body || isCompletedNode((<FunctionLikeDeclaration>n).body, sourceFile);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,12): error TS1127: Invalid character.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,14): error TS1129: Statement expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,19): error TS1005: '(' expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(5,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(6,3): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(7,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,14): error TS1109: Expression expected.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,9): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,16): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,16): error TS2304: Cannot find name 'bar'.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(5,12): error TS2304: Cannot find name 'bar'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts (8 errors) ====
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts (5 errors) ====
|
||||
class C {
|
||||
foo() {
|
||||
// Make sure we don't think of *bar as the start of a generator method.
|
||||
@@ -16,19 +13,13 @@ tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration
|
||||
|
||||
!!! error TS1127: Invalid character.
|
||||
~
|
||||
!!! error TS1129: Statement expected.
|
||||
~
|
||||
!!! error TS1005: '(' expected.
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
!!! error TS2304: Cannot find name 'bar'.
|
||||
return bar;
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'bar'.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(14,1): error TS2322: Type 'NotBoolean' is not assignable to type 'Boolean'.
|
||||
Types of property 'valueOf' are incompatible.
|
||||
Type '() => Object' is not assignable to type '() => boolean'.
|
||||
Type 'Object' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(19,1): error TS2322: Type 'Boolean' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(20,1): error TS2322: Type 'NotBoolean' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts (2 errors) ====
|
||||
==== tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts (3 errors) ====
|
||||
interface Boolean {
|
||||
doStuff(): string;
|
||||
}
|
||||
@@ -17,6 +21,11 @@ tests/cases/conformance/types/primitives/boolean/assignFromBooleanInterface2.ts(
|
||||
|
||||
a = x;
|
||||
a = b;
|
||||
~
|
||||
!!! error TS2322: Type 'NotBoolean' is not assignable to type 'Boolean'.
|
||||
!!! error TS2322: Types of property 'valueOf' are incompatible.
|
||||
!!! error TS2322: Type '() => Object' is not assignable to type '() => boolean'.
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'boolean'.
|
||||
|
||||
b = a;
|
||||
b = x;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
tests/cases/compiler/booleanAssignment.ts(2,1): error TS2322: Type 'number' is not assignable to type 'Boolean'.
|
||||
Types of property 'valueOf' are incompatible.
|
||||
Type '() => Object' is not assignable to type '() => boolean'.
|
||||
Type 'Object' is not assignable to type 'boolean'.
|
||||
tests/cases/compiler/booleanAssignment.ts(3,1): error TS2322: Type 'string' is not assignable to type 'Boolean'.
|
||||
Types of property 'valueOf' are incompatible.
|
||||
Type '() => Object' is not assignable to type '() => boolean'.
|
||||
tests/cases/compiler/booleanAssignment.ts(4,1): error TS2322: Type '{}' is not assignable to type 'Boolean'.
|
||||
Types of property 'valueOf' are incompatible.
|
||||
Type '() => Object' is not assignable to type '() => boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/booleanAssignment.ts (3 errors) ====
|
||||
var b = new Boolean();
|
||||
b = 1; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'Boolean'.
|
||||
!!! error TS2322: Types of property 'valueOf' are incompatible.
|
||||
!!! error TS2322: Type '() => Object' is not assignable to type '() => boolean'.
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'boolean'.
|
||||
b = "a"; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'Boolean'.
|
||||
!!! error TS2322: Types of property 'valueOf' are incompatible.
|
||||
!!! error TS2322: Type '() => Object' is not assignable to type '() => boolean'.
|
||||
b = {}; // Error
|
||||
~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'Boolean'.
|
||||
!!! error TS2322: Types of property 'valueOf' are incompatible.
|
||||
!!! error TS2322: Type '() => Object' is not assignable to type '() => boolean'.
|
||||
|
||||
var o = {};
|
||||
o = b; // OK
|
||||
|
||||
b = true; // OK
|
||||
|
||||
var b2:boolean;
|
||||
b = b2; // OK
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [booleanAssignment.ts]
|
||||
var b = new Boolean();
|
||||
b = 1; // Error
|
||||
b = "a"; // Error
|
||||
b = {}; // Error
|
||||
|
||||
var o = {};
|
||||
o = b; // OK
|
||||
|
||||
b = true; // OK
|
||||
|
||||
var b2:boolean;
|
||||
b = b2; // OK
|
||||
|
||||
//// [booleanAssignment.js]
|
||||
var b = new Boolean();
|
||||
b = 1; // Error
|
||||
b = "a"; // Error
|
||||
b = {}; // Error
|
||||
var o = {};
|
||||
o = b; // OK
|
||||
b = true; // OK
|
||||
var b2;
|
||||
b = b2; // OK
|
||||
@@ -3,15 +3,13 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,35): error TS
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(24,28): error TS1005: ':' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(24,29): error TS1005: ',' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,18): error TS1129: Statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,30): error TS1005: ',' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,33): error TS1138: Parameter declaration expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,34): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,36): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(31,18): error TS1129: Statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,30): error TS1005: '=' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(31,18): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,26): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(38,17): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,41): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,45): error TS1002: Unterminated string literal.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(46,13): error TS1005: 'try' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(49,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(58,5): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(69,13): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(72,37): error TS1127: Invalid character.
|
||||
@@ -43,21 +41,19 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error T
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,43): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,60): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1129: Statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,9): error TS1129: Statement expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS1005: ';' expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,35): error TS1109: Expression expected.
|
||||
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(11,1): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,26): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,17): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,17): error TS2304: Cannot find name 'retValue'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,28): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,21): error TS2304: Cannot find name 'retValue'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,17): error TS2304: Cannot find name 'retValue'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,28): error TS2304: Cannot find name 'bfs'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,21): error TS2304: Cannot find name 'retValue'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(47,17): error TS2304: Cannot find name 'console'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(53,13): error TS2304: Cannot find name 'console'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(89,23): error TS2364: Invalid left-hand side of assignment expression.
|
||||
@@ -82,12 +78,13 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,33): error T
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2304: Cannot find name 'Overloads'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,35): error TS2304: Cannot find name 'string'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,52): error TS2304: Cannot find name 'string'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,9): error TS2304: Cannot find name 'public'.
|
||||
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,37): error TS2304: Cannot find name 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (87 errors) ====
|
||||
==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (84 errors) ====
|
||||
declare module "fs" {
|
||||
export class File {
|
||||
constructor(filename: string);
|
||||
@@ -136,30 +133,24 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
!!! error TS2304: Cannot find name 'bfs'.
|
||||
if (retValue != 0) {
|
||||
~~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
!!! error TS1005: '=' expected.
|
||||
|
||||
return 1;
|
||||
^
|
||||
~
|
||||
!!! error TS1129: Statement expected.
|
||||
!!! error TS1109: Expression expected.
|
||||
|
||||
|
||||
retValue = bfs.TYPES();
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'retValue'.
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'bfs'.
|
||||
if (retValue != 0) {
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'retValue'.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'.
|
||||
|
||||
return 1 &&
|
||||
}
|
||||
@@ -171,25 +162,23 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
!!! error TS1002: Unterminated string literal.
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'retValue'.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'bfs'.
|
||||
if (retValue != 0) {
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'retValue'.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'.
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
~~~~~
|
||||
!!! error TS1005: 'try' expected.
|
||||
console.log(e);
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'console'.
|
||||
}
|
||||
finally {
|
||||
~~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
|
||||
}
|
||||
|
||||
@@ -501,7 +490,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1129: Statement expected.
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'Overloads'.
|
||||
~~~~~~
|
||||
@@ -510,12 +499,14 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T
|
||||
!!! error TS2304: Cannot find name 'string'.
|
||||
|
||||
public DefaultValue(value?: string = "Hello") { }
|
||||
~~~~~~
|
||||
!!! error TS1129: Statement expected.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'DefaultValue'.
|
||||
~~~~~
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Expressions/parseIncompleteBinaryExpression1.ts(1,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript5/Expressions/parseIncompleteBinaryExpression1.ts(1,12): error TS2304: Cannot find name 'b'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Expressions/parseIncompleteBinaryExpression1.ts (2 errors) ====
|
||||
var v = || b;
|
||||
~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'b'.
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [parserAmbiguityWithBinaryOperator1.ts]
|
||||
function f1() {
|
||||
var a, b, c;
|
||||
if (a < b || b > (c + 1)) { }
|
||||
}
|
||||
|
||||
//// [parserAmbiguityWithBinaryOperator1.js]
|
||||
function f1() {
|
||||
var a, b, c;
|
||||
if (a < b || b > (c + 1)) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator1.ts ===
|
||||
function f1() {
|
||||
>f1 : () => void
|
||||
|
||||
var a, b, c;
|
||||
>a : any
|
||||
>b : any
|
||||
>c : any
|
||||
|
||||
if (a < b || b > (c + 1)) { }
|
||||
>a < b || b > (c + 1) : boolean
|
||||
>a < b : boolean
|
||||
>a : any
|
||||
>b : any
|
||||
>b > (c + 1) : boolean
|
||||
>b : any
|
||||
>(c + 1) : any
|
||||
>c + 1 : any
|
||||
>c : any
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [parserAmbiguityWithBinaryOperator2.ts]
|
||||
function f() {
|
||||
var a, b, c;
|
||||
if (a < b && b > (c + 1)) { }
|
||||
}
|
||||
|
||||
//// [parserAmbiguityWithBinaryOperator2.js]
|
||||
function f() {
|
||||
var a, b, c;
|
||||
if (a < b && b > (c + 1)) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator2.ts ===
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
var a, b, c;
|
||||
>a : any
|
||||
>b : any
|
||||
>c : any
|
||||
|
||||
if (a < b && b > (c + 1)) { }
|
||||
>a < b && b > (c + 1) : boolean
|
||||
>a < b : boolean
|
||||
>a : any
|
||||
>b : any
|
||||
>b > (c + 1) : boolean
|
||||
>b : any
|
||||
>(c + 1) : any
|
||||
>c + 1 : any
|
||||
>c : any
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [parserAmbiguityWithBinaryOperator3.ts]
|
||||
function f() {
|
||||
var a, b, c;
|
||||
if (a < b && b < (c + 1)) { }
|
||||
}
|
||||
|
||||
|
||||
//// [parserAmbiguityWithBinaryOperator3.js]
|
||||
function f() {
|
||||
var a, b, c;
|
||||
if (a < b && b < (c + 1)) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator3.ts ===
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
var a, b, c;
|
||||
>a : any
|
||||
>b : any
|
||||
>c : any
|
||||
|
||||
if (a < b && b < (c + 1)) { }
|
||||
>a < b && b < (c + 1) : boolean
|
||||
>a < b : boolean
|
||||
>a : any
|
||||
>b : any
|
||||
>b < (c + 1) : boolean
|
||||
>b : any
|
||||
>(c + 1) : any
|
||||
>c + 1 : any
|
||||
>c : any
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator4.ts(3,9): error TS2347: Untyped function calls may not accept type arguments.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Generics/parserAmbiguityWithBinaryOperator4.ts (1 errors) ====
|
||||
function g() {
|
||||
var a, b, c;
|
||||
if (a<b, b>(c + 1)) { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2347: Untyped function calls may not accept type arguments.
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [parserAmbiguityWithBinaryOperator4.ts]
|
||||
function g() {
|
||||
var a, b, c;
|
||||
if (a<b, b>(c + 1)) { }
|
||||
}
|
||||
|
||||
//// [parserAmbiguityWithBinaryOperator4.js]
|
||||
function g() {
|
||||
var a, b, c;
|
||||
if (a(c + 1)) {
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,70): error TS1005: ',' expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,71): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,53): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts(1,9): error TS2304: Cannot find name '$'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserCommaInTypeMemberList2.ts (2 errors) ====
|
||||
var s = $.extend< { workItem: any }, { workItem: any, width: string }>({ workItem: this._workItem }, {});
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name '$'.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block2.ts(2,5): error TS1129: Statement expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block2.ts(2,5): error TS1127: Invalid character.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block2.ts (1 errors) ====
|
||||
function f() {
|
||||
|
|
||||
~
|
||||
!!! error TS1129: Statement expected.
|
||||
#
|
||||
|
||||
!!! error TS1127: Invalid character.
|
||||
return;
|
||||
}
|
||||
@@ -1,19 +1,22 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErrorRecovery_ClassElement3.ts(2,4): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErrorRecovery_ClassElement3.ts(5,4): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErrorRecovery_ClassElement3.ts(2,4): error TS1127: Invalid character.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErrorRecovery_ClassElement3.ts(5,4): error TS1127: Invalid character.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErrorRecovery_ClassElement3.ts(7,4): error TS1127: Invalid character.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErrorRecovery_ClassElement3.ts(7,5): error TS1005: '}' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErrorRecovery_ClassElement3.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErrorRecovery_ClassElement3.ts (4 errors) ====
|
||||
module M {
|
||||
|
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
#
|
||||
|
||||
!!! error TS1127: Invalid character.
|
||||
class C {
|
||||
}
|
||||
|
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@
|
||||
|
||||
!!! error TS1127: Invalid character.
|
||||
enum E {
|
||||
}
|
||||
#
|
||||
|
||||
!!! error TS1127: Invalid character.
|
||||
|
||||
!!! error TS1005: '}' expected.
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ParameterLists/parserErrorRecovery_ParameterList4.ts(1,14): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ParameterLists/parserErrorRecovery_ParameterList4.ts(1,14): error TS1127: Invalid character.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ParameterLists/parserErrorRecovery_ParameterList4.ts (1 errors) ====
|
||||
function f(a,|) {
|
||||
~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
function f(a,#) {
|
||||
|
||||
!!! error TS1127: Invalid character.
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(10,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
|
||||
lib.d.ts(513,11): error TS2300: Duplicate identifier 'TemplateStringsArray'.
|
||||
lib.d.ts(515,11): error TS2300: Duplicate identifier 'TemplateStringsArray'.
|
||||
tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(2,7): error TS2300: Duplicate identifier 'TemplateStringsArray'.
|
||||
tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
lib.d.ts(513,11): error TS2300: Duplicate identifier 'TemplateStringsArray'.
|
||||
lib.d.ts(515,11): error TS2300: Duplicate identifier 'TemplateStringsArray'.
|
||||
tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(2,7): error TS2300: Duplicate identifier 'TemplateStringsArray'.
|
||||
tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
var b = new Boolean();
|
||||
b = 1; // Error
|
||||
b = "a"; // Error
|
||||
b = {}; // Error
|
||||
|
||||
var o = {};
|
||||
o = b; // OK
|
||||
|
||||
b = true; // OK
|
||||
|
||||
var b2:boolean;
|
||||
b = b2; // OK
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
function f() {
|
||||
|
|
||||
#
|
||||
return;
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
module M {
|
||||
|
|
||||
#
|
||||
class C {
|
||||
}
|
||||
|
|
||||
@
|
||||
enum E {
|
||||
}
|
||||
#
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
function f(a,|) {
|
||||
function f(a,#) {
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
var v = || b;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
function f1() {
|
||||
var a, b, c;
|
||||
if (a < b || b > (c + 1)) { }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
function f() {
|
||||
var a, b, c;
|
||||
if (a < b && b > (c + 1)) { }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
function f() {
|
||||
var a, b, c;
|
||||
if (a < b && b < (c + 1)) { }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
function g() {
|
||||
var a, b, c;
|
||||
if (a<b, b>(c + 1)) { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////foo(a,(b))/*1*/
|
||||
////foo(a,(<b>c).d)/*2*/
|
||||
|
||||
goTo.marker("1");
|
||||
edit.insert(";");
|
||||
verify.currentLineContentIs("foo(a, (b));");
|
||||
|
||||
goTo.marker("2");
|
||||
edit.insert(";");
|
||||
verify.currentLineContentIs("foo(a, (<b>c).d);");
|
||||
Reference in New Issue
Block a user