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

Unified Diff: src/contexts.cc

Issue 967243002: Polish Maybe API a bit, removing useless creativity and fixing some signatures. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Simplified friendship. Added check in FromJust. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« include/v8.h ('K') | « src/ast.h ('k') | src/ic/ic-state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index 667a57c4544c90877dc1c9aa3876d92ad26c5ff5..aa50021656049726694074a911c232ad6604807f 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -131,7 +131,7 @@ static Maybe<PropertyAttributes> UnscopableLookup(LookupIterator* it) {
MaybeHandle<Object> maybe_unscopables =
Object::GetProperty(receiver, unscopables_symbol);
if (!maybe_unscopables.ToHandle(&unscopables)) {
- return Maybe<PropertyAttributes>();
+ return Nothing<PropertyAttributes>();
}
if (!unscopables->IsSpecObject()) return attrs;
Handle<Object> blacklist;
@@ -139,10 +139,9 @@ static Maybe<PropertyAttributes> UnscopableLookup(LookupIterator* it) {
Object::GetProperty(unscopables, it->name());
if (!maybe_blacklist.ToHandle(&blacklist)) {
DCHECK(isolate->has_pending_exception());
- return Maybe<PropertyAttributes>();
+ return Nothing<PropertyAttributes>();
}
- if (!blacklist->IsUndefined()) return maybe(ABSENT);
- return attrs;
+ return blacklist->IsUndefined() ? attrs : Just(ABSENT);
}
static void GetAttributesAndBindingFlags(VariableMode mode,
@@ -254,7 +253,7 @@ Handle<Object> Context::Lookup(Handle<String> name,
// Context extension objects needs to behave as if they have no
// prototype. So even if we want to follow prototype chains, we need
// to only do a local lookup for context extension objects.
- Maybe<PropertyAttributes> maybe;
+ Maybe<PropertyAttributes> maybe = Nothing<PropertyAttributes>();
if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 ||
object->IsJSContextExtensionObject()) {
maybe = JSReceiver::GetOwnPropertyAttributes(object, name);
« include/v8.h ('K') | « src/ast.h ('k') | src/ic/ic-state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698