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

Side by Side Diff: test/mjsunit/harmony/block-scoping.js

Issue 7549008: Preliminary code for block scopes and block contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Next iteration 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
(Empty)
1 // Flags: --allow-natives-syntax --harmony-block-scoping
Kevin Millikin (Chromium) 2011/08/10 11:19:27 The test file needs a copyright notice.
Steven 2011/08/10 12:21:00 Done.
2
3 // Hoisting of var declarations.
4 function f1() {
5 {
6 var x = 1;
7 var y;
8 }
9 assertEquals(1, x)
10 assertEquals(undefined, y)
11 }
12 f1();
13
14 // Dynamic lookup through block scopes.
15 function f2(one) {
16 var x = one + 1;
17 // TODO(keuchel): introduce let
18 // let y = one + 2;
19 if (one == 1) {
20 // Parameter
21 assertEquals(1, eval('one'));
22 // Function local var variable
23 assertEquals(2, eval('x'));
24 // Function local let variable
25 // TODO(keuchel): introduce let
26 // assertEquals(3, eval('y'));
27 }
28 }
29 f2();
30
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698