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

Side by Side Diff: test/mjsunit/harmony/debug-blockscopes.js

Issue 7631020: Version 3.5.6. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 // Skip property with empty name. 151 // Skip property with empty name.
152 if (!scope.scopeObject().property('').isUndefined()) { 152 if (!scope.scopeObject().property('').isUndefined()) {
153 scope_size--; 153 scope_size--;
154 } 154 }
155 // Also ignore synthetic variable from block scopes. 155 // Also ignore synthetic variable from block scopes.
156 if (!scope.scopeObject().property('.block').isUndefined()) { 156 if (!scope.scopeObject().property('.block').isUndefined()) {
157 scope_size--; 157 scope_size--;
158 } 158 }
159 159
160 // TODO(keuchel): print('count' + count + ' scopesize' + scope_size);
161 if (count != scope_size) { 160 if (count != scope_size) {
162 print('Names found in scope:'); 161 print('Names found in scope:');
163 var names = scope.scopeObject().propertyNames(); 162 var names = scope.scopeObject().propertyNames();
164 for (var i = 0; i < names.length; i++) { 163 for (var i = 0; i < names.length; i++) {
165 print(names[i]); 164 print(names[i]);
166 } 165 }
167 } 166 }
168 assertEquals(count, scope_size); 167 assertEquals(count, scope_size);
169 168
170 // Get the debug command processor. 169 // Get the debug command processor.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 CheckScopeContent({a:1}, 1, exec_state); 228 CheckScopeContent({a:1}, 1, exec_state);
230 }; 229 };
231 local_2(1); 230 local_2(1);
232 EndTest(); 231 EndTest();
233 232
234 233
235 // Local scope with a parameter and a local variable. 234 // Local scope with a parameter and a local variable.
236 BeginTest("Local 3"); 235 BeginTest("Local 3");
237 236
238 function local_3(a) { 237 function local_3(a) {
239 var x = 3; 238 let x = 3;
240 debugger; 239 debugger;
241 } 240 }
242 241
243 listener_delegate = function(exec_state) { 242 listener_delegate = function(exec_state) {
244 CheckScopeChain([debug.ScopeType.Local, 243 CheckScopeChain([debug.ScopeType.Local,
245 debug.ScopeType.Global], exec_state); 244 debug.ScopeType.Global], exec_state);
246 CheckScopeContent({a:1,x:3}, 0, exec_state); 245 CheckScopeContent({a:1,x:3}, 0, exec_state);
247 }; 246 };
248 local_3(1); 247 local_3(1);
249 EndTest(); 248 EndTest();
250 249
251 250
252 // Local scope with parameters and local variables. 251 // Local scope with parameters and local variables.
253 BeginTest("Local 4"); 252 BeginTest("Local 4");
254 253
255 function local_4(a, b) { 254 function local_4(a, b) {
256 var x = 3; 255 let x = 3;
257 var y = 4; 256 let y = 4;
258 debugger; 257 debugger;
259 } 258 }
260 259
261 listener_delegate = function(exec_state) { 260 listener_delegate = function(exec_state) {
262 CheckScopeChain([debug.ScopeType.Local, 261 CheckScopeChain([debug.ScopeType.Local,
263 debug.ScopeType.Global], exec_state); 262 debug.ScopeType.Global], exec_state);
264 CheckScopeContent({a:1,b:2,x:3,y:4}, 0, exec_state); 263 CheckScopeContent({a:1,b:2,x:3,y:4}, 0, exec_state);
265 }; 264 };
266 local_4(1, 2); 265 local_4(1, 2);
267 EndTest(); 266 EndTest();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 debug.ScopeType.With, 353 debug.ScopeType.With,
355 debug.ScopeType.Local, 354 debug.ScopeType.Local,
356 debug.ScopeType.Global], exec_state); 355 debug.ScopeType.Global], exec_state);
357 CheckScopeContent({a:2,b:1}, 1, exec_state); 356 CheckScopeContent({a:2,b:1}, 1, exec_state);
358 CheckScopeContent({a:1,b:2}, 3, exec_state); 357 CheckScopeContent({a:1,b:2}, 3, exec_state);
359 }; 358 };
360 with_block_4(); 359 with_block_4();
361 EndTest(); 360 EndTest();
362 361
363 362
364 // TODO(keuchel):
365 // Simple closure formed by returning an inner function referering to an outer 363 // Simple closure formed by returning an inner function referering to an outer
366 // block local variable and an outer function's parameter. 364 // block local variable and an outer function's parameter.
367 // BeginTest("Closure 1"); 365 BeginTest("Closure 1");
368 // 366
369 // function closure_1(a) { 367 function closure_1(a) {
370 // { 368 var x = 2;
371 // let x = 3; 369 let y = 3;
372 // function f() { 370 if (true) {
373 // debugger; 371 let z = 4;
374 // return a + x; 372 function f() {
375 // }; 373 debugger;
376 // } 374 return a + x + y + z;
377 // return f; 375 };
378 // } 376 return f;
379 // 377 }
380 // listener_delegate = function(exec_state) { 378 }
381 // CheckScopeChain([debug.ScopeType.Local, 379
382 // debug.ScopeType.Closure, 380 listener_delegate = function(exec_state) {
383 // debug.ScopeType.Global], exec_state); 381 CheckScopeChain([debug.ScopeType.Local,
384 // // CheckScopeContent({}, 0, exec_state); 382 debug.ScopeType.Block,
385 // // CheckScopeContent({}, 1, exec_state); 383 debug.ScopeType.Closure,
386 // // CheckScopeContent({a:1}, 2, exec_state); 384 debug.ScopeType.Global], exec_state);
387 // }; 385 CheckScopeContent({}, 0, exec_state);
388 // closure_1(1)(); 386 CheckScopeContent({a:1,x:2,y:3}, 2, exec_state);
389 // EndTest(); 387 };
388 closure_1(1)();
389 EndTest();
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/block-scoping.js ('k') | test/mjsunit/harmony/debug-evaluate-blockscopes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698