Don't emit accessors multiple times.

This commit is contained in:
Daniel Rosenwasser 2015-02-19 17:04:32 -08:00
parent ce85b14589
commit 0fd783f3ef
3 changed files with 5 additions and 18 deletions

View file

@ -2545,6 +2545,9 @@ module ts {
if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) {
// TODO (drosen): Reconcile with 'emitMemberFunctions'.
var accessors = getAllAccessorDeclarations(node.properties, <AccessorDeclaration>property);
if (property !== accessors.firstAccessor) {
continue;
}
write("Object.defineProperty(");
emit(tempVar);
write(", ");

View file

@ -60,15 +60,7 @@ var x = (_a = {
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "foo", {
get: function () {
if (1 == 1) {
return 10;
}
},
enumerable: true,
configurable: true
}),
,
_a.p2 = 20,
_a
);

View file

@ -56,15 +56,7 @@ var x = (_a = {
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "foo", {
get: function () {
if (1 == 1) {
return 10;
}
},
enumerable: true,
configurable: true
}),
,
_a.p2 = 20,
_a
);