Do not reflect uninitialized 'let' and 'const' in scope mirrors.
R=yangguo@chromium.org,aandrey@chromium.org BUG=v8:3743 LOG=N Review URL: https://codereview.chromium.org/758603004 Cr-Commit-Position: refs/heads/master@{#25712}
This commit is contained in:
parent
4ba9e967e9
commit
1954ad8bc1
@ -380,13 +380,14 @@ bool ScopeInfo::CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info,
|
||||
for (int i = 0; i < local_count; ++i) {
|
||||
if (scope_info->LocalIsSynthetic(first_context_var + i)) continue;
|
||||
int context_index = Context::MIN_CONTEXT_SLOTS + i;
|
||||
Handle<Object> value = Handle<Object>(context->get(context_index), isolate);
|
||||
// Do not reflect variables under TDZ in scope object.
|
||||
if (value->IsTheHole()) continue;
|
||||
RETURN_ON_EXCEPTION_VALUE(
|
||||
isolate,
|
||||
Runtime::DefineObjectProperty(
|
||||
scope_object,
|
||||
Handle<String>(String::cast(scope_info->get(i + start))),
|
||||
Handle<Object>(context->get(context_index), isolate),
|
||||
::NONE),
|
||||
isolate, Runtime::DefineObjectProperty(
|
||||
scope_object,
|
||||
Handle<String>(String::cast(scope_info->get(i + start))),
|
||||
value, ::NONE),
|
||||
false);
|
||||
}
|
||||
return true;
|
||||
|
@ -481,3 +481,24 @@ listener_delegate = function(exec_state) {
|
||||
};
|
||||
for_loop_5();
|
||||
EndTest();
|
||||
|
||||
|
||||
// Uninitialized variables
|
||||
BeginTest("Uninitialized 1");
|
||||
|
||||
function uninitialized_1() {
|
||||
{
|
||||
debugger;
|
||||
let x = 1;
|
||||
}
|
||||
}
|
||||
|
||||
listener_delegate = function(exec_state) {
|
||||
CheckScopeChain([debug.ScopeType.Block,
|
||||
debug.ScopeType.Local,
|
||||
debug.ScopeType.Script,
|
||||
debug.ScopeType.Global], exec_state);
|
||||
CheckScopeContent({}, 0, exec_state);
|
||||
};
|
||||
uninitialized_1();
|
||||
EndTest();
|
||||
|
Loading…
Reference in New Issue
Block a user