1// Copyright JS Foundation and other contributors, http://js.foundation 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15var d = 1 16function f(a = function () { return d }) 17{ 18 var d = 2 19 assert(d === 2) 20 assert(a() === 1) 21} 22f() 23 24var g = (a = () => d) => { 25 var d = 2 26 assert(d === 2) 27 assert(a() === 1) 28} 29g() 30 31var h = ([{a}] = [{a: function () { return d }}]) => { 32 var d = 2 33 assert(d === 2) 34 assert(a() === 1) 35} 36h() 37 38function i(a = ((eval))("(function () { return d })")) 39{ 40 var d = 2 41 assert(d === 2) 42 assert(a() === 1) 43} 44i() 45 46function j(a = (([1, ((() => d))])[1])) 47{ 48 var d = 2 49 assert(d === 2) 50 assert(a() === 1) 51} 52j() 53 54var m = 0 55function l(a) 56{ 57 m = a 58 return m 59} 60 61function k(a = l(() => d)) 62{ 63 var d = 2 64 assert(d === 2) 65 assert(a() === 1) 66 assert(m() === 1) 67} 68k() 69