Fixed case where property should not be emitted.

This commit is contained in:
Daniel Rosenwasser 2015-02-20 18:36:31 -08:00
parent bebdd73e13
commit 4138fed1d7

View File

@ -2586,12 +2586,12 @@ module ts {
// (e.g. a 'get' accessor which has already been emitted along with its 'set' accessor).
function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression {
var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name);
var rightHandSide = getRightHandSideOfPatchingPropertyAssignment(objectLiteral, property);
var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property);
return createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, rightHandSide);
return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide);
}
function getRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) {
function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) {
switch (property.kind) {
case SyntaxKind.PropertyAssignment:
return (<PropertyAssignment>property).initializer;