|
1 // Any copyright is dedicated to the Public Domain. |
|
2 // http://creativecommons.org/licenses/publicdomain/ |
|
3 |
|
4 var f; |
|
5 try |
|
6 { |
|
7 f = eval("(function literalInside() { return { set 'c d e'(v) { } }; })"); |
|
8 } |
|
9 catch (e) |
|
10 { |
|
11 assertEq(true, false, |
|
12 "string-literal property name in setter in object literal in " + |
|
13 "function statement failed to parse: " + e); |
|
14 } |
|
15 |
|
16 var fstr = "" + f; |
|
17 assertEq(fstr.indexOf("set") < fstr.indexOf("c d e"), true, |
|
18 "should be using new-style syntax with string literal in place of " + |
|
19 "property identifier"); |
|
20 assertEq(fstr.indexOf("setter") < 0, true, "using old-style syntax?"); |
|
21 |
|
22 var o = f(); |
|
23 var ostr = "" + o; |
|
24 assertEq("c d e" in o, true, "missing the property?"); |
|
25 assertEq("set" in Object.getOwnPropertyDescriptor(o, "c d e"), true, |
|
26 "'c d e' property not a setter?"); |
|
27 // disabled because we still generate old-style syntax here (toSource |
|
28 // decompilation is as yet unfixed) |
|
29 // assertEq(ostr.indexOf("set") < ostr.indexOf("c d e"), true, |
|
30 // "should be using new-style syntax when getting the source of a " + |
|
31 // "getter/setter while decompiling an object"); |
|
32 // assertEq(ostr.indexOf("setter") < 0, true, "using old-style syntax?"); |
|
33 |
|
34 reportCompare(true, true); |