Status: New
Owner: ----

New issue 768 by abyssoft: Literal object Defects in devtools if not assigned
http://code.google.com/p/v8/issues/detail?id=768

{"JANUARY" : 0, "FEBRUARY" : 1, "MARCH" : 2, "APRIL" : 3, "MAY" : 4, "JUNE" : 5, "JULY" : 6, "AUGUST" : 7, "SEPTEMBER" : 8, "OCTOBER" : 9, "NOVEMBER" : 10, "DECEMBER" : 11};

SyntaxError: Unexpected token :

however
var myobject = {"JANUARY" : 0, "FEBRUARY" : 1, "MARCH" : 2, "APRIL" : 3, "MAY" : 4, "JUNE" : 5, "JULY" : 6, "AUGUST" : 7, "SEPTEMBER" : 8, "OCTOBER" : 9, "NOVEMBER" : 10, "DECEMBER" : 11};

works as expected.

Should accept strings, numbers, etc as keys(properties) for literal evaluations.

{a:1}; // results in 1
{a:1, fd:{d:1}}; // throws error listed above
but
var myobject = {a:1, fd:{d:1}}; // performs correctly

however typeof on the first 2 correctly identifies them as object.

var myobject = {{1:2}:3}; //Fails with unexpected token {
however
var myobject = {};
myobject[{1:2}] = 3; //succeeds and can be referenced
myobject[{1:2}] === 3 // true

JSON.stringify(myobject) produces "{"[object Object]":3}"

Something not quite right here.


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to