1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 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 16class F { 17 #f = 1; 18 #fun() { } 19 static #staticF = 2; 20 static #staticMethod() { } 21 check(a: any) { 22 #f in a; // expect F's 'f' WeakMap 23 #fun in a; // expect F's 'instances' WeakSet 24 #staticF in a; // expect F's constructor 25 #staticMethod in a; // expect F's constructor 26 } 27 precedence(a: any) { 28 // '==' and '||' have lower precedence than 'in' 29 // 'in' naturally has same precedence as 'in' 30 // '<<' has higher precedence than 'in' 31 32 a == #f in a || a; // Good precedence: (a == (#f in a)) || a 33 34 #f in a && #f in a; // Good precedence: (#f in a) && (#f in a) 35 } 36} 37 38class Bar { 39 #f = 1; 40 check(a: any) { 41 #f in a; // expect Bar's 'f' WeakMap 42 } 43} 44 45export { }