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#newcode75
test/mjsunit/harmony/symbols.js:75: assertSame(Function.prototype,
Symbol.prototype)
On 2014/01/08 18:13:43, sof wrote:
On 2014/01/08 17:52:25, rossberg wrote:
> That seems wrong. Symbol.prototype is an ordinary object.
https://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-properties-of-the-symbol-constructor
says it's Function.prototype.
Don't confuse .prototype and .[[Prototype]] (a.k.a. __proto__). As Arv
says, that spec section says that Symbol.__proto__ ===
Function.prototype.
Symbol.prototype is specified elsewhere:
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-symbol-prototype-object
https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js#newcode81
test/mjsunit/harmony/symbols.js:81: assertSame(Function.prototype,
(Symbol()).__proto__)
On 2014/01/08 18:13:43, sof wrote:
On 2014/01/08 17:52:25, rossberg wrote:
> And Symbol().__proto__ should be Symbol.prototype
Definitely not.
See above.
https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js#newcode82
test/mjsunit/harmony/symbols.js:82: assertTrue(typeof
((Symbol()).prototype) === "undefined")
On 2014/01/08 18:13:43, sof wrote:
On 2014/01/08 17:52:25, rossberg wrote:
> Not sure why this test is necessary.
Just testing that typeof over this .prototype is behaving like it does
for other
primitive values.
Well, it just tests that the symbol wrapper object does not have a
property named 'prototype'. It's not wrong to assert this, but I don't
see a particular reason to do so -- that property name is only special
for function objects. For others, it's no more relevant than testing
that 'xyz' is undefined.
https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js#newcode91
test/mjsunit/harmony/symbols.js:91: assertFalse(Object ===
Symbol.prototype.constructor)
On 2014/01/08 18:54:44, arv wrote:
On 2014/01/08 18:13:43, sof wrote:
> On 2014/01/08 17:52:25, rossberg wrote:
> > This should be true now.
>
> No, I believe this is correct.
Looks correct to me too:
assertSame(Symbol.prototype.constructor, Symbol);
just like for all other wrappers.
However, using assertSame would be better.
Oops, you are both right, sorry.
https://codereview.chromium.org/118553003/diff/1/test/mjsunit/harmony/symbols.js#newcode93
test/mjsunit/harmony/symbols.js:93: assertSame(Function,
Symbol.prototype.constructor)
On 2014/01/08 18:54:44, arv wrote:
On 2014/01/08 18:13:43, sof wrote:
> On 2014/01/08 17:52:25, rossberg wrote:
> > This should be Object, not Function
>
> Same; are we reading the same draft version of the spec?
This should be
assertSame(Symbol.prototype.constructor, Symbol);
https://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-symbol.prototype.constructor
Arv is correct.
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/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.
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.