• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    prop = "str1";
21    1 = "str2";
22    "str_prop" = "str3";
23    [computed1] = "str4";
24    ["computed2"] = "str5";
25    [2] = "str6";
26    static sprop = "s_str1";
27    static 1 = "s_str2";
28    static "s_str_prop" = "s_str3";
29    static [computed1] = "s_str4";
30    static ["computed3"] = "s_str5";
31    static [3] = "s_str6";
32    static "str_prop" = "s_str7";
33}
34
35var obj = new A();
36print(obj.prop);
37print(obj[1]);
38print(obj["str_prop"]);
39print(obj[computed1]);
40print(obj["computed2"]);
41print(obj[2]);
42
43print(A.sprop);
44print(A[1]);
45print(A["s_str_prop"]);
46print(A[computed1]);
47print(A["computed3"]);
48print(A[3]);
49print(A["str_prop"]);
50