• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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 C {
17  private p: number;
18
19  p2: number;
20  #p2: string; // not fixable
21
22  private q?: string;
23  private e!: string;
24  private static s = 0;
25  private readonly r = 20;
26  private static readonly sr = 0;
27  private static readonly srq?: string;
28
29  private m(x: number): void { }
30
31  m2(x: number): void {}
32  #m2(x: number): void {} // not fixable
33
34  m3: boolean;
35  #m3(x: number): void {} // not fixable
36
37  private get g1(): number { return 10; }
38  private set s1(x: number) { }
39
40  private static get g2(): number { return 10; }
41  private static set s2(x: number) { }
42
43  test() {
44    console.log(this.p + this.#p2 + this.q + this.e + C.s + this.r + C.sr + C.srq); // '#p2' is not fixable
45    this.m(10);
46    this.#m2(20); // not fixable
47    this.#m3(30); // not fixable
48    let x = this.g1;
49    this.s1 = x;
50    let y = C.g2;
51    C.s2 = y;
52  }
53}
54
55class D extends C {
56  private a: string;
57  #p: number; // not fixable
58
59  #m(): string { return 'foo'; } // not fixable
60
61  private bar(): string { return 'baz'; }
62
63  test() {
64    console.log(this.#p + this.a); // '#p' is not fixable
65    let x = this.#m(); // not fixable
66    let y = this.bar();
67  }
68}
69
70class E {
71  private a: number;
72  #b: string; // not fixable
73
74  public b: number;
75constructor(b: number) {
76    this.b = b;
77}
78}