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

Unified Diff: src/objects-inl.h

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
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 0a3c6753e737553e5cb1b81eab89ef4712ef5e07..91c2945f0e6e33f1def67e6ff6de3beb5bb00997 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -6961,8 +6961,7 @@ Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
return JSProxy::HasPropertyWithHandler(proxy, name);
}
Maybe<PropertyAttributes> result = GetPropertyAttributes(object, name);
- if (!result.has_value) return Maybe<bool>();
- return maybe(result.value != ABSENT);
+ return result.has_value ? Just(result.value != ABSENT) : Nothing<bool>();
}
@@ -6973,8 +6972,7 @@ Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object,
return JSProxy::HasPropertyWithHandler(proxy, name);
}
Maybe<PropertyAttributes> result = GetOwnPropertyAttributes(object, name);
- if (!result.has_value) return Maybe<bool>();
- return maybe(result.value != ABSENT);
+ return result.has_value ? Just(result.value != ABSENT) : Nothing<bool>();
}
@@ -7033,8 +7031,7 @@ Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) {
}
Maybe<PropertyAttributes> result = JSObject::GetElementAttributeWithReceiver(
Handle<JSObject>::cast(object), object, index, true);
- if (!result.has_value) return Maybe<bool>();
- return maybe(result.value != ABSENT);
+ return result.has_value ? Just(result.value != ABSENT) : Nothing<bool>();
}
@@ -7046,8 +7043,7 @@ Maybe<bool> JSReceiver::HasOwnElement(Handle<JSReceiver> object,
}
Maybe<PropertyAttributes> result = JSObject::GetElementAttributeWithReceiver(
Handle<JSObject>::cast(object), object, index, false);
- if (!result.has_value) return Maybe<bool>();
- return maybe(result.value != ABSENT);
+ return result.has_value ? Just(result.value != ABSENT) : Nothing<bool>();
}
« include/v8.h ('K') | « src/objects.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698