Debian Codegraph @

rhino/testsrc/tests/ecma/Statements/12.2-1.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = '12.2-1.js';
7
8 /**
9 File Name: 12.2-1.js
10 ECMA Section: The variable statement
11 Description:
12
13 If the variable statement occurs inside a FunctionDeclaration, the
14 variables are defined with function-local scope in that function, as
15 described in section 10.1.3. Otherwise, they are defined with global
16 scope, that is, they are created as members of the global object, as
17 described in section 0. Variables are created when the execution scope
18 is entered. A Block does not define a new execution scope. Only Program and
19 FunctionDeclaration produce a new scope. Variables are initialized to the
20 undefined value when created. A variable with an Initializer is assigned
21 the value of its AssignmentExpression when the VariableStatement is executed,
22 not when the variable is created.
23
24 Author: [email protected]
25 Date: 12 november 1997
26 */
27
28 var SECTION = "12.2-1";
29 var VERSION = "ECMA_1";
30 startTest();
31 var TITLE = "The variable statement";
32
33 writeHeaderToLog( SECTION +" "+ TITLE);
34
35 new TestCase( "SECTION",
36 "var x = 3; function f() { var a = x; var x = 23; return a; }; f()",
37 void 0,
38 eval("var x = 3; function f() { var a = x; var x = 23; return a; }; f()") );
39
40 test();
41