michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * FunctionExpression must be localed in a reacheable fragment of the program michael@0: * michael@0: * @path ch14/14.0/S14_A1.js michael@0: * @description Declaring a function within an "if" Expression michael@0: */ michael@0: michael@0: var THERE = "I'm there"; michael@0: var HERE = "I'm here"; michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#1 michael@0: if ( __func !== undefined) { michael@0: $ERROR('#1: __func === undefined. Actual: __func ==='+ __func ); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: if (true){ michael@0: var __func = function(){return HERE;}; michael@0: } else { michael@0: var __func = function (){return THERE;}; michael@0: }; michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#2 michael@0: if (__func() !== HERE) { michael@0: $ERROR('#2: __func() === HERE. Actual: __func() ==='+ __func() ); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: