Index: src/scopeinfo.cc |
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc |
index f91df650800cb432abdef22d98cc3b29d6b2e1a1..b819b172c4ad1db78926b0d59dc253d9841de94f 100644 |
--- a/src/scopeinfo.cc |
+++ b/src/scopeinfo.cc |
@@ -505,12 +505,12 @@ |
} |
-void ScopeInfo::CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info, |
+bool ScopeInfo::CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info, |
Handle<Context> context, |
Handle<JSObject> scope_object) { |
Isolate* isolate = scope_info->GetIsolate(); |
int local_count = scope_info->ContextLocalCount(); |
- if (local_count == 0) return; |
+ if (local_count == 0) return true; |
// Fill all context locals to the context extension. |
int first_context_var = scope_info->StackLocalCount(); |
int start = scope_info->ContextLocalNameEntriesIndex(); |
@@ -520,12 +520,14 @@ |
Handle<Object> value = Handle<Object>(context->get(context_index), isolate); |
// Reflect variables under TDZ as undefined in scope object. |
if (value->IsTheHole()) continue; |
- // This should always succeed. |
- // TODO(verwaest): Use AddDataProperty instead. |
- JSObject::SetOwnPropertyIgnoreAttributes( |
- scope_object, handle(String::cast(scope_info->get(i + start))), value, |
- ::NONE).Check(); |
- } |
+ RETURN_ON_EXCEPTION_VALUE( |
+ isolate, Runtime::DefineObjectProperty( |
+ scope_object, |
+ Handle<String>(String::cast(scope_info->get(i + start))), |
+ value, ::NONE), |
+ false); |
+ } |
+ return true; |
} |