• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * Copyright (c) 2019-2024 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
16import { getRetObj }
17    from "/plugins/ets/tests/interop_js/tests/checked/obj_call/obj_call.js"
18
19class EtsClass {
20    intValue: int;
21    constructor(value: int) {
22        this.intValue = value;
23    }
24}
25class $jscall {
26    static Init = JSRuntime.__initJSCallClass();
27
28    native static getRetObj(top: JSValue, qname: JSValue, obj:EtsClass): EtsClass;
29};
30
31
32//! CHECKER      test
33//! RUN          force_jit: true, entry: "test", options: "--compiler-regex=ETSGLOBAL::test"
34
35function test() : int {
36    let obj: EtsClass = new EtsClass(0);
37    obj = $jscall.getRetObj(getRetObj, JSRuntime.getUndefined(), obj);
38    if (obj.intValue != 5) {
39       return 1;
40    }
41    return 0;
42}
43