Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: src/unscopables.h

Issue 384963002: ES6 Unscopables (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Updated to reflect the July 2014 consensus Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef V8_UNSCOPABLES_H_
rossberg 2014/08/06 09:53:02 I don't think it's worth putting this into an extr
arv (Not doing code reviews) 2014/08/06 15:08:28 Agreed. Now that it is only used in one place. I
6 #define V8_UNSCOPABLES_H_
7
8 #include "src/isolate.h"
9 #include "src/lookup.h"
10 #include "src/objects.h"
11 #include "src/prototype.h"
12
13 namespace v8 {
14 namespace internal {
15
16 /**
17 * Lookups a property in an object environment, taking the unscopables into
18 * account. This is used For HasBinding spec algorithms for ObjectEnvironment.
19 */
20 static Maybe<PropertyAttributes> UnscopableLookup(LookupIterator* it) {
21 Isolate* isolate = it->isolate();
22 PropertyAttributes attrs;
23 if (!JSReceiver::GetPropertyAttributes(it).ToValue(&attrs)) {
rossberg 2014/08/06 09:53:02 I think it's clearer and simpler to avoid ToValue
arv (Not doing code reviews) 2014/08/06 15:08:28 Done.
24 DCHECK(isolate->has_pending_exception());
25 return Maybe<PropertyAttributes>();
26 }
27 if (attrs == ABSENT) return maybe(ABSENT);
28
29 Handle<Symbol> unscopables_symbol(
30 isolate->native_context()->unscopables_symbol(), isolate);
31 Handle<Object> receiver = it->GetReceiver();
32 Handle<Object> unscopables;
33 MaybeHandle<Object> maybe_unscopables =
34 Object::GetProperty(receiver, unscopables_symbol);
35 if (!maybe_unscopables.ToHandle(&unscopables)) {
36 return Maybe<PropertyAttributes>();
37 }
38 if (!unscopables->IsSpecObject()) return maybe(attrs);
39 bool blacklist;
40 if (!JSReceiver::HasProperty(Handle<JSReceiver>::cast(unscopables),
41 it->name()).ToValue(&blacklist)) {
42 DCHECK(isolate->has_pending_exception());
43 return Maybe<PropertyAttributes>();
44 }
45 if (blacklist) return maybe(ABSENT);
46 return maybe(attrs);
47 }
48 }
49
50 } // namespace v8::internal
51
52 #endif // V8_UNSCOPABLES_H_
OLDNEW
« include/v8.h ('K') | « src/flag-definitions.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698