michael@0: // Any copyright is dedicated to the Public Domain. michael@0: // http://creativecommons.org/licenses/publicdomain/ michael@0: michael@0: var f; michael@0: try michael@0: { michael@0: f = eval("(function literalInside() { return { set 'c d e'(v) { } }; })"); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(true, false, michael@0: "string-literal property name in setter in object literal in " + michael@0: "function statement failed to parse: " + e); michael@0: } michael@0: michael@0: var fstr = "" + f; michael@0: assertEq(fstr.indexOf("set") < fstr.indexOf("c d e"), true, michael@0: "should be using new-style syntax with string literal in place of " + michael@0: "property identifier"); michael@0: assertEq(fstr.indexOf("setter") < 0, true, "using old-style syntax?"); michael@0: michael@0: var o = f(); michael@0: var ostr = "" + o; michael@0: assertEq("c d e" in o, true, "missing the property?"); michael@0: assertEq("set" in Object.getOwnPropertyDescriptor(o, "c d e"), true, michael@0: "'c d e' property not a setter?"); michael@0: // disabled because we still generate old-style syntax here (toSource michael@0: // decompilation is as yet unfixed) michael@0: // assertEq(ostr.indexOf("set") < ostr.indexOf("c d e"), true, michael@0: // "should be using new-style syntax when getting the source of a " + michael@0: // "getter/setter while decompiling an object"); michael@0: // assertEq(ostr.indexOf("setter") < 0, true, "using old-style syntax?"); michael@0: michael@0: reportCompare(true, true);