Index: src/parsing/parse-info.cc |
diff --git a/src/parsing/parse-info.cc b/src/parsing/parse-info.cc |
index 5b9b5e4ef0635ad9fa59380fc3e082f86d2007e6..927dea86165ab96e2710aadb7a194bed3b7bd458 100644 |
--- a/src/parsing/parse-info.cc |
+++ b/src/parsing/parse-info.cc |
@@ -32,11 +32,7 @@ ParseInfo::ParseInfo(Zone* zone) |
literal_(nullptr) {} |
ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function) |
- : ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) { |
- if (!function->context()->IsNativeContext()) { |
- set_outer_scope_info(handle(function->context()->scope_info())); |
- } |
-} |
+ : ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) {} |
ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared) |
: ParseInfo(zone) { |
@@ -59,6 +55,12 @@ ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared) |
if (!script.is_null() && script->type() == Script::TYPE_NATIVE) { |
set_native(); |
} |
+ |
+ Handle<HeapObject> scope_info(shared->outer_scope_info()); |
+ if (!scope_info->IsTheHole(isolate()) && |
+ Handle<ScopeInfo>::cast(scope_info)->length() > 0) { |
+ set_outer_scope_info(Handle<ScopeInfo>::cast(scope_info)); |
+ } |
} |
ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) { |