• 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
16@Sendable
17class SendableClassA {
18    a: number = 1;
19}
20
21@Sendable
22class SendableClassB {
23    b: SendableClassA = new SendableClassA();
24}
25
26@Sendable
27class SendableClassC {
28    static a: number = 1;
29}
30
31@Sendable
32class SendableClassD {
33    b: number = SendableClassC.a;
34}
35
36@Sendable
37class SendableClassE {
38  static public a: number = 1;
39  f(p: number) {
40    @Sendable
41    class SendableClassF {
42      public b: number = SendableClassE.a;
43    }
44  }
45}
46
47if (true) {
48    @Sendable
49    class SendableClassG {
50        static a: number = 1;
51    }
52
53    @Sendable
54    class SendableClassH {
55        b: SendableClassG = new SendableClassG(); //ERROR
56    }
57}
58
59let a: number = 1
60
61@Sendable
62class SendableClassI {
63    b: number = a; //ERROR
64}
65
66
67@Sendable
68class SendableClassJ {
69    p: number = 1;
70}
71let b:SendableClassJ = new SendableClassJ();
72
73@Sendable
74class SendableClassK {
75    ma: SendableClassJ = b; // ERROR
76}
77
78//
79
80@Sendable
81class SendableLocalClassA {
82
83}
84
85@Sendable
86function sendableFunctionA() {
87
88};
89
90@Sendable
91export class SendableLocalClassB {
92
93}
94
95@Sendable
96export function sendableFunctionB() {
97
98};
99
100@Sendable
101class SendableLocalClassC {
102
103}
104
105@Sendable
106function sendableFunctionC() {
107
108};
109
110@Sendable
111class SendableLocalClassD {
112
113}
114
115@Sendable
116function sendableFunctionD() {
117
118};
119
120@Sendable
121class SendableLocalClassE {
122
123}
124
125@Sendable
126function sendableFunctionE() {
127
128};
129
130export class ExportClassA {
131
132};
133
134export interface ExportInterfaceA {
135
136};
137
138export function exportFooA() {
139
140};
141
142export const exportObj: ExportClassA = new ExportClassA();
143
144@Sendable
145class SendableClass {
146  handle() {
147    new SendableLocalClassA();
148    sendableFunctionA();
149    new SendableLocalClassB();
150    sendableFunctionB();
151    new SendableLocalClassC();
152    sendableFunctionC();
153    new SendableLocalClassD();
154    sendableFunctionD();
155    new SendableLocalClassE();
156    new ExportClassA();
157    exportFooA();
158    exportObj;
159  }
160}
161
162@Sendable
163function sendableFunction() {
164    new SendableLocalClassA();
165    sendableFunctionA();
166    new SendableLocalClassB();
167    sendableFunctionB();
168    new SendableLocalClassC();
169    sendableFunctionC();
170    new SendableLocalClassD();
171    sendableFunctionD();
172    new SendableLocalClassE();
173    new ExportClassA();
174    exportFooA();
175    exportObj;
176}
177
178export { SendableLocalClassC, sendableFunctionC, SendableLocalClassD as Sc42, sendableFunctionD as sf42 };
179
180
181export default SendableLocalClassE;
182