mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update the name of 'PropertyAssignment' to 'LonghandPropertyAssignment'.
'PropertyAssignment' is now the name of the super interface brand we use for all thigns that can be members of an object literal.
This commit is contained in:
@@ -397,7 +397,7 @@ module ts {
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
|
||||
@@ -1697,7 +1697,7 @@ module ts {
|
||||
if (declaration.initializer) {
|
||||
var type = checkAndMarkExpression(declaration.initializer);
|
||||
// Widening of property assignments is handled by checkObjectLiteral, exclude them here
|
||||
if (declaration.kind !== SyntaxKind.PropertyAssignment) {
|
||||
if (declaration.kind !== SyntaxKind.LonghandPropertyAssignment) {
|
||||
var unwidenedType = type;
|
||||
type = getWidenedType(type);
|
||||
if (type !== unwidenedType) {
|
||||
@@ -3247,7 +3247,7 @@ module ts {
|
||||
return !(<FunctionExpression>node).typeParameters && !forEach((<FunctionExpression>node).parameters, p => p.type);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return forEach((<ObjectLiteralExpression>node).properties, p =>
|
||||
p.kind === SyntaxKind.PropertyAssignment && isContextSensitiveExpression((<PropertyDeclaration>p).initializer));
|
||||
p.kind === SyntaxKind.LonghandPropertyAssignment && isContextSensitiveExpression((<LonghandPropertyAssignment>p).initializer));
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return forEach((<ArrayLiteralExpression>node).elements, e => isContextSensitiveExpression(e));
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
@@ -4949,7 +4949,7 @@ module ts {
|
||||
return getTypeFromTypeNode((<TypeAssertion>parent).type);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return getContextualTypeForBinaryOperand(node);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
return getContextualTypeForPropertyExpression(node);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return getContextualTypeForElementExpression(node);
|
||||
@@ -5085,7 +5085,7 @@ module ts {
|
||||
if (member.flags & SymbolFlags.Property) {
|
||||
var memberDecl = <PropertyDeclaration>member.declarations[0];
|
||||
var type: Type;
|
||||
if (memberDecl.kind === SyntaxKind.PropertyAssignment) {
|
||||
if (memberDecl.kind === SyntaxKind.LonghandPropertyAssignment) {
|
||||
type = checkExpression(memberDecl.initializer, contextualMapper);
|
||||
}
|
||||
else {
|
||||
@@ -8573,7 +8573,7 @@ module ts {
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
@@ -9022,7 +9022,7 @@ module ts {
|
||||
// This is necessary as an identifier in short-hand property assignment can contains two meaning:
|
||||
// property name and property value.
|
||||
if (location && location.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
return resolveEntityName(location, (<ShorthandPropertyDeclaration>location).name, SymbolFlags.Value);
|
||||
return resolveEntityName(location, (<ShorthandPropertyAssignment>location).name, SymbolFlags.Value);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -2122,7 +2122,7 @@ module ts {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Method:
|
||||
@@ -2236,7 +2236,7 @@ module ts {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitDownlevelShorthandPropertyAssignment(node: ShorthandPropertyDeclaration) {
|
||||
function emitDownlevelShorthandPropertyAssignment(node: ShorthandPropertyAssignment) {
|
||||
emitLeadingComments(node);
|
||||
// Emit identifier as an identifier
|
||||
emit(node.name);
|
||||
@@ -2247,7 +2247,7 @@ module ts {
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
function emitShorthandPropertyAssignment(node: ShorthandPropertyDeclaration) {
|
||||
function emitShorthandPropertyAssignment(node: ShorthandPropertyAssignment) {
|
||||
// If short-hand property has a prefix, then regardless of the target version, we will emit it as normal property assignment. For example:
|
||||
// module m {
|
||||
// export var y;
|
||||
@@ -3525,7 +3525,7 @@ module ts {
|
||||
return emitArrayLiteral(<ArrayLiteralExpression>node);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return emitObjectLiteral(<ObjectLiteralExpression>node);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
return emitPropertyAssignment(<PropertyDeclaration>node);
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return emitComputedPropertyName(<ComputedPropertyName>node);
|
||||
@@ -3628,7 +3628,7 @@ module ts {
|
||||
// Emit node down-level
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return emitDownlevelShorthandPropertyAssignment(<ShorthandPropertyDeclaration>node);
|
||||
return emitDownlevelShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -3636,7 +3636,7 @@ module ts {
|
||||
Debug.assert(compilerOptions.target >= ScriptTarget.ES6, "Invalid ScriptTarget. We should emit as ES6 or above");
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return emitShorthandPropertyAssignment(<ShorthandPropertyDeclaration>node);
|
||||
return emitShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-29
@@ -223,7 +223,7 @@ module ts {
|
||||
child((<ParameterDeclaration>node).type) ||
|
||||
child((<ParameterDeclaration>node).initializer);
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return children(node.modifiers) ||
|
||||
child((<PropertyDeclaration>node).name) ||
|
||||
@@ -583,7 +583,7 @@ module ts {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
return (<VariableDeclaration>parent).initializer === node;
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
case SyntaxKind.IfStatement:
|
||||
@@ -641,7 +641,7 @@ module ts {
|
||||
case SyntaxKind.Method:
|
||||
return (<MethodDeclaration>node).questionToken !== undefined;
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
case SyntaxKind.Property:
|
||||
return (<PropertyDeclaration>node).questionToken !== undefined;
|
||||
}
|
||||
@@ -680,7 +680,7 @@ module ts {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Method:
|
||||
@@ -3166,16 +3166,16 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parsePropertyAssignment(): Declaration {
|
||||
function parseShortOrLonghandPropertyAssignment(): PropertyAssignment {
|
||||
var nodePos = scanner.getStartPos();
|
||||
|
||||
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
var tokenIsIdentifier = isIdentifier();
|
||||
var nameToken = token;
|
||||
var propertyName = parsePropertyName();
|
||||
var node: Declaration;
|
||||
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
node = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
|
||||
node.name = propertyName;
|
||||
var longhandDeclaration = <LonghandPropertyAssignment>createNode(SyntaxKind.LonghandPropertyAssignment, nodePos);
|
||||
longhandDeclaration.name = propertyName;
|
||||
var sig = parseSignature(/*yieldAndGeneratorParameterContext:*/ !!asteriskToken);
|
||||
|
||||
var body = parseFunctionBlock(!!asteriskToken, /* ignoreMissingOpenBrace */ false);
|
||||
@@ -3184,8 +3184,8 @@ module ts {
|
||||
// var x = 1;
|
||||
// var y = { x() { } }
|
||||
// otherwise this will bring y.x into the scope of x which is incorrect
|
||||
(<PropertyDeclaration>node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, asteriskToken, undefined, sig, body);
|
||||
return finishNode(node);
|
||||
longhandDeclaration.initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, longhandDeclaration.pos, asteriskToken, undefined, sig, body);
|
||||
return finishNode(longhandDeclaration);
|
||||
}
|
||||
|
||||
// Disallowing of optional property assignments happens in the grammar checker.
|
||||
@@ -3193,29 +3193,29 @@ module ts {
|
||||
|
||||
// Parse to check if it is short-hand property assignment or normal property assignment
|
||||
if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && tokenIsIdentifier) {
|
||||
var shorthandDeclaration = <ShorthandPropertyDeclaration>createNode(SyntaxKind.ShorthandPropertyAssignment, nodePos);
|
||||
var shorthandDeclaration = <ShorthandPropertyAssignment>createNode(SyntaxKind.ShorthandPropertyAssignment, nodePos);
|
||||
shorthandDeclaration.name = <Identifier>propertyName;
|
||||
shorthandDeclaration.questionToken = questionToken;
|
||||
return finishNode(shorthandDeclaration);
|
||||
}
|
||||
else {
|
||||
var propertyDeclaration = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
|
||||
propertyDeclaration.name = propertyName;
|
||||
propertyDeclaration.questionToken = questionToken;
|
||||
var longhandDeclaration = <LonghandPropertyAssignment>createNode(SyntaxKind.LonghandPropertyAssignment, nodePos);
|
||||
longhandDeclaration.name = propertyName;
|
||||
longhandDeclaration.questionToken = questionToken;
|
||||
parseExpected(SyntaxKind.ColonToken);
|
||||
propertyDeclaration.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
||||
return finishNode(propertyDeclaration);
|
||||
longhandDeclaration.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
||||
return finishNode(longhandDeclaration);
|
||||
}
|
||||
}
|
||||
|
||||
function parseObjectLiteralMember(): Declaration {
|
||||
function parsePropertyAssignment(): PropertyAssignment {
|
||||
var initialPos = getNodePos();
|
||||
var initialToken = token;
|
||||
if (parseContextualModifier(SyntaxKind.GetKeyword) || parseContextualModifier(SyntaxKind.SetKeyword)) {
|
||||
var kind = initialToken === SyntaxKind.GetKeyword ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor;
|
||||
return parseMemberAccessorDeclaration(kind, initialPos, /*modifiers*/ undefined);
|
||||
return parseAccessorDeclaration(kind, initialPos, /*modifiers*/ undefined);
|
||||
}
|
||||
return parsePropertyAssignment();
|
||||
return parseShortOrLonghandPropertyAssignment();
|
||||
}
|
||||
|
||||
function parseObjectLiteralExpression(): ObjectLiteralExpression {
|
||||
@@ -3225,7 +3225,7 @@ module ts {
|
||||
node.flags |= NodeFlags.MultiLine;
|
||||
}
|
||||
|
||||
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralMember);
|
||||
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parsePropertyAssignment);
|
||||
parseExpected(SyntaxKind.CloseBraceToken);
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -3772,8 +3772,8 @@ module ts {
|
||||
return parseInitializer(/*inParameter*/ false);
|
||||
}
|
||||
|
||||
function parseMemberAccessorDeclaration(kind: SyntaxKind, fullStart: number, modifiers: ModifiersArray): MethodDeclaration {
|
||||
var node = <MethodDeclaration>createNode(kind, fullStart);
|
||||
function parseAccessorDeclaration(kind: SyntaxKind, fullStart: number, modifiers: ModifiersArray): AccessorDeclaration {
|
||||
var node = <AccessorDeclaration>createNode(kind, fullStart);
|
||||
setModifiers(node, modifiers);
|
||||
node.name = parsePropertyName();
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, node);
|
||||
@@ -3864,10 +3864,10 @@ module ts {
|
||||
var fullStart = getNodePos();
|
||||
var modifiers = parseModifiers();
|
||||
if (parseContextualModifier(SyntaxKind.GetKeyword)) {
|
||||
return parseMemberAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, modifiers);
|
||||
return parseAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, modifiers);
|
||||
}
|
||||
if (parseContextualModifier(SyntaxKind.SetKeyword)) {
|
||||
return parseMemberAccessorDeclaration(SyntaxKind.SetAccessor, fullStart, modifiers);
|
||||
return parseAccessorDeclaration(SyntaxKind.SetAccessor, fullStart, modifiers);
|
||||
}
|
||||
if (token === SyntaxKind.ConstructorKeyword) {
|
||||
return parseConstructorDeclaration(fullStart, modifiers);
|
||||
@@ -4435,6 +4435,7 @@ module ts {
|
||||
case SyntaxKind.IndexSignature: return checkIndexSignature(<SignatureDeclaration>node);
|
||||
case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(<InterfaceDeclaration>node);
|
||||
case SyntaxKind.LabeledStatement: return checkLabeledStatement(<LabeledStatement>node);
|
||||
case SyntaxKind.LonghandPropertyAssignment: return checkLonghandPropertyAssignment(<LonghandPropertyAssignment>node);
|
||||
case SyntaxKind.Method: return checkMethod(<MethodDeclaration>node);
|
||||
case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(<ModuleDeclaration>node);
|
||||
case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(<ObjectLiteralExpression>node);
|
||||
@@ -4443,11 +4444,10 @@ module ts {
|
||||
case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(<PostfixUnaryExpression>node);
|
||||
case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(<PrefixUnaryExpression>node);
|
||||
case SyntaxKind.Property: return checkProperty(<PropertyDeclaration>node);
|
||||
case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(<PropertyDeclaration>node);
|
||||
case SyntaxKind.ReturnStatement: return checkReturnStatement(<ReturnStatement>node);
|
||||
case SyntaxKind.SetAccessor: return checkSetAccessor(<MethodDeclaration>node);
|
||||
case SyntaxKind.SourceFile: return checkSourceFile(<SourceFile>node);
|
||||
case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(<ShorthandPropertyDeclaration>node);
|
||||
case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
|
||||
case SyntaxKind.SwitchStatement: return checkSwitchStatement(<SwitchStatement>node);
|
||||
case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(<TaggedTemplateExpression>node);
|
||||
case SyntaxKind.ThrowStatement: return checkThrowStatement(<ThrowStatement>node);
|
||||
@@ -5060,7 +5060,7 @@ module ts {
|
||||
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
|
||||
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
|
||||
var currentKind: number;
|
||||
if (prop.kind === SyntaxKind.PropertyAssignment) {
|
||||
if (prop.kind === SyntaxKind.LonghandPropertyAssignment) {
|
||||
currentKind = Property;
|
||||
}
|
||||
else if (prop.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
@@ -5364,7 +5364,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkPropertyAssignment(node: PropertyDeclaration) {
|
||||
function checkLonghandPropertyAssignment(node: LonghandPropertyAssignment) {
|
||||
return checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
|
||||
}
|
||||
|
||||
@@ -5464,7 +5464,7 @@ module ts {
|
||||
return grammarErrorOnFirstToken(node, Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
|
||||
}
|
||||
|
||||
function checkShorthandPropertyAssignment(node: ShorthandPropertyDeclaration): boolean {
|
||||
function checkShorthandPropertyAssignment(node: ShorthandPropertyAssignment): boolean {
|
||||
return checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
|
||||
}
|
||||
|
||||
|
||||
+19
-5
@@ -232,8 +232,9 @@ module ts {
|
||||
CatchClause,
|
||||
|
||||
// Property assignments
|
||||
PropertyAssignment,
|
||||
LonghandPropertyAssignment,
|
||||
ShorthandPropertyAssignment,
|
||||
|
||||
// Enum
|
||||
EnumMember,
|
||||
// Top-level nodes
|
||||
@@ -378,6 +379,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface PropertyDeclaration extends Declaration, ClassElement {
|
||||
_propertyDeclarationBrand: any;
|
||||
questionToken?: Node;
|
||||
type?: TypeNode;
|
||||
initializer?: Expression;
|
||||
@@ -386,11 +388,22 @@ module ts {
|
||||
export type VariableOrParameterDeclaration = VariableDeclaration | ParameterDeclaration;
|
||||
export type VariableOrParameterOrPropertyDeclaration = VariableOrParameterDeclaration | PropertyDeclaration;
|
||||
|
||||
export interface ShorthandPropertyDeclaration extends Declaration {
|
||||
export interface PropertyAssignment extends Declaration {
|
||||
_propertyAssignmentBrand: any;
|
||||
}
|
||||
|
||||
export interface ShorthandPropertyAssignment extends PropertyAssignment {
|
||||
name: Identifier;
|
||||
questionToken?: Node;
|
||||
}
|
||||
|
||||
export interface LonghandPropertyAssignment extends PropertyAssignment {
|
||||
_longhandPropertyAssignmentBrand: any;
|
||||
name: DeclarationName;
|
||||
questionToken?: Node;
|
||||
initializer: Expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* Several node kinds share function-like features such as a signature,
|
||||
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
|
||||
@@ -420,8 +433,9 @@ module ts {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
body?: Block;
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, PropertyAssignment {
|
||||
_accessorDeclarationBrand: any;
|
||||
body: Block;
|
||||
}
|
||||
|
||||
export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement {
|
||||
@@ -576,7 +590,7 @@ module ts {
|
||||
|
||||
// An ObjectLiteralExpression is the declaration node for an anonymous symbol.
|
||||
export interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
|
||||
properties: NodeArray<Declaration>;
|
||||
properties: NodeArray<PropertyAssignment>;
|
||||
}
|
||||
|
||||
export interface PropertyAccessExpression extends MemberExpression {
|
||||
|
||||
@@ -239,7 +239,7 @@ module ts.BreakpointResolver {
|
||||
|
||||
default:
|
||||
// If this is name of property assignment, set breakpoint in the initializer
|
||||
if (node.parent.kind === SyntaxKind.PropertyAssignment && (<PropertyDeclaration>node.parent).name === node) {
|
||||
if (node.parent.kind === SyntaxKind.LonghandPropertyAssignment && (<PropertyDeclaration>node.parent).name === node) {
|
||||
return spanInNode((<PropertyDeclaration>node.parent).initializer);
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ module ts.BreakpointResolver {
|
||||
|
||||
function spanInColonToken(node: Node): TextSpan {
|
||||
// Is this : specifying return annotation of the function declaration
|
||||
if (isAnyFunction(node.parent) || node.parent.kind === SyntaxKind.PropertyAssignment) {
|
||||
if (isAnyFunction(node.parent) || node.parent.kind === SyntaxKind.LonghandPropertyAssignment) {
|
||||
return spanInPreviousNode(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -1968,14 +1968,14 @@ module ts {
|
||||
/** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */
|
||||
function isNameOfPropertyAssignment(node: Node): boolean {
|
||||
return (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NumericLiteral) &&
|
||||
(node.parent.kind === SyntaxKind.PropertyAssignment || node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) && (<PropertyDeclaration>node.parent).name === node;
|
||||
(node.parent.kind === SyntaxKind.LonghandPropertyAssignment || node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) && (<PropertyDeclaration>node.parent).name === node;
|
||||
}
|
||||
|
||||
function isLiteralNameOfPropertyDeclarationOrIndexAccess(node: Node): boolean {
|
||||
if (node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NumericLiteral) {
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Method:
|
||||
case SyntaxKind.GetAccessor:
|
||||
@@ -2642,7 +2642,7 @@ module ts {
|
||||
|
||||
var existingMemberNames: Map<boolean> = {};
|
||||
forEach(existingMembers, m => {
|
||||
if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment) {
|
||||
if (m.kind !== SyntaxKind.LonghandPropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment) {
|
||||
// Ignore omitted expressions for missing members in the object literal
|
||||
return;
|
||||
}
|
||||
@@ -4703,7 +4703,7 @@ module ts {
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.LonghandPropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.Method:
|
||||
|
||||
Reference in New Issue
Block a user