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

Unified Diff: src/contexts.cc

Issue 418383002: Change Has* and Get*Attributes to return Maybe<*>, indicating possible exceptions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
« no previous file with comments | « src/api.cc ('k') | src/i18n.cc » ('j') | src/objects-inl.h » ('J')
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 cb5e852d7d669c07c8d8b950016defff1572f49c..60cf93f8d35dce48439c70b035d27cc24b2fed95 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -106,15 +106,18 @@ 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;
if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 ||
object->IsJSContextExtensionObject()) {
- *attributes = JSReceiver::GetOwnPropertyAttributes(object, name);
+ maybe = JSReceiver::GetOwnPropertyAttributes(object, name);
} else {
- *attributes = JSReceiver::GetPropertyAttributes(object, name);
+ maybe = JSReceiver::GetPropertyAttributes(object, name);
}
- if (isolate->has_pending_exception()) return Handle<Object>();
+ if (!maybe.has_value) return Handle<Object>();
+ ASSERT(!isolate->has_pending_exception());
+ *attributes = maybe.value;
- if (*attributes != ABSENT) {
+ if (maybe.value != ABSENT) {
if (FLAG_trace_contexts) {
PrintF("=> found property in context object %p\n",
reinterpret_cast<void*>(*object));
« no previous file with comments | « src/api.cc ('k') | src/i18n.cc » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698