2011-08-11 16:29:28 +00:00
|
|
|
// Copyright 2011 the V8 project authors. All rights reserved.
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following
|
|
|
|
// disclaimer in the documentation and/or other materials provided
|
|
|
|
// with the distribution.
|
|
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived
|
|
|
|
// from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2016-11-29 12:26:54 +00:00
|
|
|
// Flags: --expose-debug-as debug --allow-natives-syntax --noanalyze-environment-liveness
|
2011-08-11 16:29:28 +00:00
|
|
|
// The functions used for testing backtraces. They are at the top to make the
|
|
|
|
// testing of source line/column easier.
|
|
|
|
|
2011-11-24 15:17:04 +00:00
|
|
|
"use strict";
|
2011-08-11 16:29:28 +00:00
|
|
|
|
|
|
|
// Get the Debug object exposed from the debug context global object.
|
2011-11-24 15:17:04 +00:00
|
|
|
var Debug = debug.Debug;
|
2011-08-11 16:29:28 +00:00
|
|
|
|
|
|
|
var test_name;
|
|
|
|
var listener_delegate;
|
|
|
|
var listener_called;
|
|
|
|
var exception;
|
|
|
|
var begin_test_count = 0;
|
|
|
|
var end_test_count = 0;
|
|
|
|
var break_count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// Debug event listener which delegates.
|
|
|
|
function listener(event, exec_state, event_data, data) {
|
|
|
|
try {
|
|
|
|
if (event == Debug.DebugEvent.Break) {
|
|
|
|
break_count++;
|
|
|
|
listener_called = true;
|
|
|
|
listener_delegate(exec_state);
|
|
|
|
}
|
|
|
|
} catch (e) {
|
2016-04-22 10:46:42 +00:00
|
|
|
print(e, e.stack);
|
2011-08-11 16:29:28 +00:00
|
|
|
exception = e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add the debug event listener.
|
|
|
|
Debug.setListener(listener);
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize for a new test.
|
|
|
|
function BeginTest(name) {
|
|
|
|
test_name = name;
|
|
|
|
listener_delegate = null;
|
|
|
|
listener_called = false;
|
|
|
|
exception = null;
|
|
|
|
begin_test_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check result of a test.
|
|
|
|
function EndTest() {
|
|
|
|
assertTrue(listener_called, "listerner not called for " + test_name);
|
2014-11-17 17:57:56 +00:00
|
|
|
assertNull(exception, test_name, exception);
|
2011-08-11 16:29:28 +00:00
|
|
|
end_test_count++;
|
|
|
|
}
|
|
|
|
|
2011-11-24 15:17:04 +00:00
|
|
|
var global_object = this;
|
2011-08-11 16:29:28 +00:00
|
|
|
|
|
|
|
// Check that the scope chain contains the expected types of scopes.
|
|
|
|
function CheckScopeChain(scopes, exec_state) {
|
|
|
|
assertEquals(scopes.length, exec_state.frame().scopeCount());
|
|
|
|
for (var i = 0; i < scopes.length; i++) {
|
|
|
|
var scope = exec_state.frame().scope(i);
|
|
|
|
assertTrue(scope.isScope());
|
|
|
|
assertEquals(scopes[i], scope.scopeType());
|
|
|
|
|
|
|
|
// Check the global object when hitting the global scope.
|
|
|
|
if (scopes[i] == debug.ScopeType.Global) {
|
|
|
|
// Objects don't have same class (one is "global", other is "Object",
|
|
|
|
// so just check the properties directly.
|
2011-11-24 15:17:04 +00:00
|
|
|
assertPropertiesEqual(global_object, scope.scopeObject().value());
|
2011-08-11 16:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that the content of the scope is as expected. For functions just check
|
|
|
|
// that there is a function.
|
|
|
|
function CheckScopeContent(content, number, exec_state) {
|
|
|
|
var scope = exec_state.frame().scope(number);
|
|
|
|
var count = 0;
|
|
|
|
for (var p in content) {
|
|
|
|
var property_mirror = scope.scopeObject().property(p);
|
|
|
|
if (property_mirror.isUndefined()) {
|
|
|
|
print('property ' + p + ' not found in scope');
|
|
|
|
}
|
2016-11-28 12:01:17 +00:00
|
|
|
assertFalse(property_mirror.isUndefined(),
|
|
|
|
'property ' + p + ' not found in scope');
|
2011-08-11 16:29:28 +00:00
|
|
|
if (typeof(content[p]) === 'function') {
|
|
|
|
assertTrue(property_mirror.value().isFunction());
|
|
|
|
} else {
|
2016-11-28 12:01:17 +00:00
|
|
|
assertEquals(content[p], property_mirror.value().value(),
|
|
|
|
'property ' + p + ' has unexpected value');
|
2011-08-11 16:29:28 +00:00
|
|
|
}
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 'arguments' and might be exposed in the local and closure scope. Just
|
|
|
|
// ignore this.
|
|
|
|
var scope_size = scope.scopeObject().properties().length;
|
|
|
|
if (!scope.scopeObject().property('arguments').isUndefined()) {
|
|
|
|
scope_size--;
|
|
|
|
}
|
2016-04-27 04:47:52 +00:00
|
|
|
// Temporary variables introduced by the parser have not been materialized.
|
|
|
|
assertTrue(scope.scopeObject().property('').isUndefined());
|
2011-08-11 16:29:28 +00:00
|
|
|
|
|
|
|
if (count != scope_size) {
|
|
|
|
print('Names found in scope:');
|
|
|
|
var names = scope.scopeObject().propertyNames();
|
|
|
|
for (var i = 0; i < names.length; i++) {
|
|
|
|
print(names[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assertEquals(count, scope_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-20 08:53:22 +00:00
|
|
|
function assertEqualsUnlessOptimized(expected, value, f) {
|
|
|
|
try {
|
|
|
|
assertEquals(expected, value);
|
|
|
|
} catch (e) {
|
|
|
|
assertOptimized(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-11 16:29:28 +00:00
|
|
|
// Simple empty block scope in local scope.
|
|
|
|
BeginTest("Local block 1");
|
|
|
|
|
|
|
|
function local_block_1() {
|
|
|
|
{
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
2011-09-02 12:43:28 +00:00
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-08-11 16:29:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({}, 0, exec_state);
|
|
|
|
};
|
|
|
|
local_block_1();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2011-09-02 12:43:28 +00:00
|
|
|
// Simple empty block scope in local scope with a parameter.
|
2011-08-11 16:29:28 +00:00
|
|
|
BeginTest("Local 2");
|
|
|
|
|
|
|
|
function local_2(a) {
|
|
|
|
{
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
2011-09-02 12:43:28 +00:00
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-08-11 16:29:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
2011-09-02 12:43:28 +00:00
|
|
|
CheckScopeContent({a:1}, 0, exec_state);
|
2011-08-11 16:29:28 +00:00
|
|
|
};
|
|
|
|
local_2(1);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Local scope with a parameter and a local variable.
|
|
|
|
BeginTest("Local 3");
|
|
|
|
|
|
|
|
function local_3(a) {
|
2011-08-16 14:24:12 +00:00
|
|
|
let x = 3;
|
2011-08-11 16:29:28 +00:00
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-08-11 16:29:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1,x:3}, 0, exec_state);
|
|
|
|
};
|
|
|
|
local_3(1);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Local scope with parameters and local variables.
|
|
|
|
BeginTest("Local 4");
|
|
|
|
|
|
|
|
function local_4(a, b) {
|
2011-08-16 14:24:12 +00:00
|
|
|
let x = 3;
|
|
|
|
let y = 4;
|
2011-08-11 16:29:28 +00:00
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-08-11 16:29:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({a:1,b:2,x:3,y:4}, 0, exec_state);
|
|
|
|
};
|
|
|
|
local_4(1, 2);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2011-09-02 12:43:28 +00:00
|
|
|
// Single variable in a block scope.
|
|
|
|
BeginTest("Local 5");
|
|
|
|
|
|
|
|
function local_5(a) {
|
|
|
|
{
|
|
|
|
let x = 5;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-09-02 12:43:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x:5}, 0, exec_state);
|
|
|
|
CheckScopeContent({a:1}, 1, exec_state);
|
|
|
|
};
|
|
|
|
local_5(1);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Two variables in a block scope.
|
|
|
|
BeginTest("Local 6");
|
|
|
|
|
|
|
|
function local_6(a) {
|
|
|
|
{
|
|
|
|
let x = 6;
|
|
|
|
let y = 7;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-09-02 12:43:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x:6,y:7}, 0, exec_state);
|
|
|
|
CheckScopeContent({a:1}, 1, exec_state);
|
|
|
|
};
|
|
|
|
local_6(1);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Two variables in a block scope.
|
|
|
|
BeginTest("Local 7");
|
|
|
|
|
|
|
|
function local_7(a) {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let x = 8;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-09-02 12:43:28 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x:8}, 0, exec_state);
|
|
|
|
CheckScopeContent({a:1}, 1, exec_state);
|
|
|
|
};
|
|
|
|
local_7(1);
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
2011-08-11 16:29:28 +00:00
|
|
|
// Simple closure formed by returning an inner function referering to an outer
|
|
|
|
// block local variable and an outer function's parameter.
|
2011-08-16 14:24:12 +00:00
|
|
|
BeginTest("Closure 1");
|
|
|
|
|
|
|
|
function closure_1(a) {
|
|
|
|
var x = 2;
|
|
|
|
let y = 3;
|
|
|
|
if (true) {
|
|
|
|
let z = 4;
|
|
|
|
function f() {
|
|
|
|
debugger;
|
|
|
|
return a + x + y + z;
|
|
|
|
};
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Local,
|
|
|
|
debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Closure,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-08-16 14:24:12 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({}, 0, exec_state);
|
|
|
|
CheckScopeContent({a:1,x:2,y:3}, 2, exec_state);
|
|
|
|
};
|
|
|
|
closure_1(1)();
|
|
|
|
EndTest();
|
2011-10-17 12:19:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Simple for-in loop over the keys of an object.
|
|
|
|
BeginTest("For loop 1");
|
|
|
|
|
|
|
|
function for_loop_1() {
|
|
|
|
for (let x in {y:undefined}) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-10-17 12:19:06 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x:'y'}, 0, exec_state);
|
2014-04-23 08:58:41 +00:00
|
|
|
// The function scope contains a temporary iteration variable, but it is
|
|
|
|
// hidden to the debugger.
|
2011-10-17 12:19:06 +00:00
|
|
|
};
|
|
|
|
for_loop_1();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// For-in loop over the keys of an object with a block scoped let variable
|
|
|
|
// shadowing the iteration variable.
|
|
|
|
BeginTest("For loop 2");
|
|
|
|
|
|
|
|
function for_loop_2() {
|
|
|
|
for (let x in {y:undefined}) {
|
|
|
|
let x = 3;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-10-17 12:19:06 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x:3}, 0, exec_state);
|
|
|
|
CheckScopeContent({x:'y'}, 1, exec_state);
|
2014-04-23 08:58:41 +00:00
|
|
|
// The function scope contains a temporary iteration variable, hidden to the
|
|
|
|
// debugger.
|
2011-10-17 12:19:06 +00:00
|
|
|
};
|
|
|
|
for_loop_2();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Simple for loop.
|
|
|
|
BeginTest("For loop 3");
|
|
|
|
|
|
|
|
function for_loop_3() {
|
|
|
|
for (let x = 3; x < 4; ++x) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-10-17 12:19:06 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x:3}, 0, exec_state);
|
2016-04-22 10:46:42 +00:00
|
|
|
CheckScopeContent({}, 1, exec_state);
|
2011-10-17 12:19:06 +00:00
|
|
|
};
|
|
|
|
for_loop_3();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// For loop with a block scoped let variable shadowing the iteration variable.
|
|
|
|
BeginTest("For loop 4");
|
|
|
|
|
|
|
|
function for_loop_4() {
|
|
|
|
for (let x = 3; x < 4; ++x) {
|
|
|
|
let x = 5;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-10-17 12:19:06 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x:5}, 0, exec_state);
|
|
|
|
CheckScopeContent({x:3}, 1, exec_state);
|
2016-04-22 10:46:42 +00:00
|
|
|
CheckScopeContent({}, 2, exec_state);
|
2011-10-17 12:19:06 +00:00
|
|
|
};
|
|
|
|
for_loop_4();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// For loop with two variable declarations.
|
|
|
|
BeginTest("For loop 5");
|
|
|
|
|
|
|
|
function for_loop_5() {
|
|
|
|
for (let x = 3, y = 5; x < 4; ++x) {
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function(exec_state) {
|
|
|
|
CheckScopeChain([debug.ScopeType.Block,
|
|
|
|
debug.ScopeType.Local,
|
2014-11-17 17:57:56 +00:00
|
|
|
debug.ScopeType.Script,
|
2011-10-17 12:19:06 +00:00
|
|
|
debug.ScopeType.Global], exec_state);
|
|
|
|
CheckScopeContent({x:3,y:5}, 0, exec_state);
|
2016-04-22 10:46:42 +00:00
|
|
|
CheckScopeContent({}, 1, exec_state);
|
2011-10-17 12:19:06 +00:00
|
|
|
};
|
|
|
|
for_loop_5();
|
|
|
|
EndTest();
|
2014-12-08 14:59:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
// 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);
|
2015-04-22 13:22:37 +00:00
|
|
|
CheckScopeContent({x:undefined}, 0, exec_state);
|
2014-12-08 14:59:10 +00:00
|
|
|
};
|
|
|
|
uninitialized_1();
|
|
|
|
EndTest();
|
2015-04-22 13:22:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Block scopes shadowing
|
|
|
|
BeginTest("Block scopes shadowing 1");
|
|
|
|
function shadowing_1() {
|
|
|
|
let i = 0;
|
|
|
|
{
|
|
|
|
let i = 5;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
assertEquals(0, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function (exec_state) {
|
2015-12-15 09:53:55 +00:00
|
|
|
assertEqualsUnlessOptimized(5, exec_state.frame(0).evaluate("i").value());
|
2015-04-22 13:22:37 +00:00
|
|
|
}
|
|
|
|
shadowing_1();
|
|
|
|
EndTest();
|
|
|
|
|
|
|
|
|
|
|
|
// Block scopes shadowing
|
|
|
|
BeginTest("Block scopes shadowing 2");
|
|
|
|
function shadowing_2() {
|
|
|
|
let i = 0;
|
|
|
|
{
|
|
|
|
let j = 5;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
listener_delegate = function (exec_state) {
|
2015-12-15 09:53:55 +00:00
|
|
|
assertEqualsUnlessOptimized(0, exec_state.frame(0).evaluate("i").value());
|
|
|
|
assertEqualsUnlessOptimized(5, exec_state.frame(0).evaluate("j").value());
|
2015-04-22 13:22:37 +00:00
|
|
|
}
|
|
|
|
shadowing_2();
|
|
|
|
EndTest();
|