On 2014/01/10 10:53:52, sof wrote:
https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js
File test/mjsunit/harmony/symbols.js (right):
https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js#newcode205
test/mjsunit/harmony/symbols.js:205: assertEquals(symbols[i],
Object(symbols[i]).valueOf())
On 2014/01/09 10:35:53, rossberg wrote:
> On 2014/01/08 18:13:43, sof wrote:
> > On 2014/01/08 17:52:25, rossberg wrote:
> > > Why is Object() needed?
> >
> > To test that the wrapper object's valueOf() returns the same symbol
value.
>
> But the wrapper is supposed to be created implicitly when you project
from a
> primitive, you don't need to invoke Object() explicitly.
Where is that requirement given? Symbol.prototype.valueOf() states that if
there's no [[SymbolData]] on its incoming 'this' (== not a wrapper
object), it
should throw.
Implicitly creating wrapper objects is the generic semantics of property
access
on primitive values in JavaScript. See the definition of GetValue:
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-getvalue
which is invoked whenever a "reference" is forced, such as the one returned
by
property access:
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-property-accessors-runtime-semantics-evaluation
Common patterns like string.length or number.toString() rely on this
mechanism.
https://codereview.chromium.org/118553003/
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.