| 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
| 2 | * |
| 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 6 | |
| 7 | var gTestfile = '10.1.3.js'; |
| 8 | |
| 9 | /** |
| 10 | ECMA Section: 10.1.3: Variable Instantiation |
| 11 | FunctionDeclarations are processed before VariableDeclarations, and |
| 12 | VariableDeclarations don't replace existing values with undefined |
| 13 | */ |
| 14 | |
| 15 | test(); |
| 16 | |
| 17 | function f() |
| 18 | { |
| 19 | var x; |
| 20 | |
| 21 | return typeof x; |
| 22 | |
| 23 | function x() |
| 24 | { |
| 25 | return 7; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | function test() |
| 30 | { |
| 31 | enterFunc ("test"); |
| 32 | |
| 33 | printStatus ("ECMA Section: 10.1.3: Variable Instantiation."); |
| 34 | printBugNumber (17290); |
| 35 | |
| 36 | reportCompare ("function", f(), "Declaration precedence test"); |
| 37 | |
| 38 | exitFunc("test"); |
| 39 | } |