• 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 A {
17    a: number;
18    b: number;
19    c: string;
20    constructor() {
21        'use sendable';
22        this.a = 1;
23        this.b = 2;
24        this.c = "a";
25    }
26}
27class B extends A {
28    d: number;
29    e: number;
30    f: string;
31    constructor() {
32        'use sendable';
33        super();
34        this.d = 3;
35        this.e = 4;
36        this.f = "b";
37    }
38}
39let num = 0;
40function Test(obj) {
41    num++;
42    print(`------ Test ${num} Start ------`);
43    for (let num = 0; num < 3; num ++) {
44        for (let i in obj) {
45            print(i);
46        }
47        print(Object.keys(obj))
48        print(JSON.stringify(obj, null, 2));
49    }
50    print(`------ Test ${num} finish ------`);
51}
52let a = new A();
53Test(a);
54let b = new B();
55Test(b);