1/* 2 * Copyright (c) 2022 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 16 17const computed1: unique symbol = Symbol("symbol1"); 18 19class A { 20 constructor() { 21 this.prop = "final_str1"; 22 this["str_prop"] = "final_str3"; 23 this[3] = "final_s_str6"; 24 } 25 prop = "str1"; 26 1 = "str2"; 27 "str_prop" = "str3"; 28 [computed1] = "str4"; 29 ["computed2"] = "str5"; 30 [2] = "str6"; 31 static sprop = "s_str1"; 32 static 1 = "s_str2"; 33 static "s_str_prop" = "s_str3"; 34 static [computed1] = "s_str4"; 35 static ["computed3"] = "s_str5"; 36 static [3] = "s_str6"; 37 static "str_prop" = "s_str7"; 38} 39 40var obj = new A(); 41print(obj.prop); 42print(obj[1]); 43print(obj["str_prop"]); 44print(obj[computed1]); 45print(obj["computed2"]); 46print(obj[2]); 47print(obj[3]); 48 49print(A.sprop); 50print(A[1]); 51print(A["s_str_prop"]); 52print(A[computed1]); 53print(A["computed3"]); 54print(A[3]); 55print(A["str_prop"]); 56