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 15{ 16 try { 17 f() 18 assert(false) 19 } catch (e) { 20 assert(e instanceof ReferenceError) 21 } 22 23 let a = 1; 24 25 try { 26 f() 27 assert(false) 28 } catch (e) { 29 assert(e instanceof ReferenceError) 30 } 31 32 let [b] = [2]; 33 34 try { 35 f() 36 assert(false) 37 } catch (e) { 38 assert(e instanceof ReferenceError) 39 } 40 41 const {c} = { c:3 }; 42 43 f(); 44 function f() { assert(a + b + c === 6) } 45} 46 47{ 48 let a = 3; 49 let [b] = [4]; 50 const {c} = { c:5 }; 51 52 let f = (function () { assert(a + b + c === 12) }) 53 f(); 54 55 { 56 function g() { assert(a + b + c === 12) } 57 g(); 58 } 59} 60 61{ 62 class C {} 63 64 assert(function () { return C } () === C); 65} 66