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: * FunctionDeclaration cannot be localed inside an Expression michael@0: * michael@0: * @path ch14/14.0/S14_A2.js michael@0: * @description Declaring a function within an "if" Expression michael@0: */ michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#1 michael@0: if (typeof f !== 'undefined') { michael@0: $ERROR('#1: typeof f === \'undefined\'. Actual: typeof f ==='+ typeof f ); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#2 michael@0: if (function f(arg){ michael@0: if (arg===0) michael@0: return 1; michael@0: else michael@0: return f(arg-1)*arg; michael@0: }(3)!==6) { michael@0: $ERROR('#2: FunctionDeclaration cannot be localed inside an Expression'); michael@0: }; michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: