No longer emit trailing comma on object literals.

This was done because trailing commas in object literals are not accepted by ES3.

Fixes #271.
This commit is contained in:
Daniel Rosenwasser 2014-07-28 11:34:30 -07:00
parent fc0004749f
commit fe4c738b01
10 changed files with 18 additions and 18 deletions

View file

@ -2107,7 +2107,7 @@ module ts {
var node = <ObjectLiteral>createNode(SyntaxKind.ObjectLiteral);
parseExpected(SyntaxKind.OpenBraceToken);
if (scanner.hasPrecedingLineBreak()) node.flags |= NodeFlags.MultiLine;
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralMember, TrailingCommaBehavior.Preserve);
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralMember, TrailingCommaBehavior.Allow);
parseExpected(SyntaxKind.CloseBraceToken);
var seen: Map<SymbolFlags> = {};

View file

@ -50,7 +50,7 @@ b3 = {
g: function (s) {
return 0;
},
m: 0,
m: 0
};
b3 = {
f: function (n) {
@ -58,13 +58,13 @@ b3 = {
},
g: function (s) {
return 0;
},
}
};
b3 = {
f: function (n) {
return 0;
},
m: 0,
m: 0
};
b3 = {
f: function (n) {
@ -77,7 +77,7 @@ b3 = {
n: 0,
k: function (a) {
return null;
},
}
};
b3 = {
f: function (n) {
@ -89,5 +89,5 @@ b3 = {
n: 0,
k: function (a) {
return null;
},
}
};

View file

@ -16,5 +16,5 @@ var Person = makeClass(
var Person = makeClass({
initialize: function (name) {
this.name = name;
},
}
});

View file

@ -380,7 +380,7 @@ var bigObject = {
var: 0,
void: 0,
while: 0,
with: 0,
with: 0
};
var bigClass = (function () {
function bigClass() {

View file

@ -21,7 +21,7 @@ var m1;
})(m1 || (m1 = {}));
var d = {
m1: { m: m1 },
m2: { c: m1.c },
m2: { c: m1.c }
};

View file

@ -26,14 +26,14 @@ y = {
var x;
var y;
x = {
s: function (t) { return t * t; },
s: function (t) { return t * t; }
};
x = {
0: function (t) { return t * t; },
0: function (t) { return t * t; }
};
y = {
s: function (t) { return t * t; },
s: function (t) { return t * t; }
};
y = {
0: function (t) { return t * t; },
0: function (t) { return t * t; }
};

View file

@ -25,5 +25,5 @@ var s = $.extend({
dataType: "json",
converters: { "text json": "" },
traditional: true,
timeout: 12,
timeout: 12
}, "");

View file

@ -77,7 +77,7 @@ var r4 = a["~!@#$%^&*()_+{}|:'<>?\/.,`"];
var b = {
" ": 1,
"a b": "",
"~!@#$%^&*()_+{}|:'<>?\/.,`": 1,
"~!@#$%^&*()_+{}|:'<>?\/.,`": 1
};
var r = b[" "];
var r2 = b[" "];

View file

@ -44,5 +44,5 @@ var b = {
foo: function (x) {
},
foo: function (x) {
},
}
};

View file

@ -101,13 +101,13 @@ var A = (function () {
this.prop4 = {
a: function () {
return this;
},
}
};
this.prop5 = function () {
return {
a: function () {
return this;
},
}
};
};
}