Thanks Andreas.

I added a src/unscopables.js that conditionally adds the Symbol.unscopables.
Would you prefer that Symbol.unscopables is always defined no matter if
--harmony-unscopables is turned on or not?

This also adds Array.prototype[Symbol.unscopables] with tests.


https://codereview.chromium.org/384963002/diff/280001/include/v8.h
File include/v8.h (right):

https://codereview.chromium.org/384963002/diff/280001/include/v8.h#newcode892
include/v8.h:892: bool ToValue(T* t) {
On 2014/08/06 09:53:02, rossberg wrote:
Can we not introduce this? Maybe intentionally is a simple struct,
using this
method actually makes code more verbose and less readable.

Reverted this.

https://codereview.chromium.org/384963002/diff/280001/src/unscopables.h
File src/unscopables.h (right):

https://codereview.chromium.org/384963002/diff/280001/src/unscopables.h#newcode5
src/unscopables.h:5: #ifndef V8_UNSCOPABLES_H_
On 2014/08/06 09:53:02, rossberg wrote:
I don't think it's worth putting this into an extra file anymore. I'd
even
prefer just inlining the function into Context::Lookup directly.

Agreed. Now that it is only used in one place.

I moved it to contexts.cc but I decided to keep it as a function for
readability's sake.

https://codereview.chromium.org/384963002/diff/280001/src/unscopables.h#newcode23
src/unscopables.h:23: if
(!JSReceiver::GetPropertyAttributes(it).ToValue(&attrs)) {
On 2014/08/06 09:53:02, rossberg wrote:
I think it's clearer and simpler to avoid ToValue and write this e.g.
as

   Maybe<PropertyAttributes> attrs =
JSReceiver::GetPropertyAttributes(it);
   DCHECK(isolate->has_pending_exception() || attrs.has_value());
   if (!attrs.has_value() || attrs.value == ABSENT) return attrs;

You then can simply return attrs below.

Done.

https://codereview.chromium.org/384963002/

--
--
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/d/optout.

Reply via email to