• 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
16declare function print(str: number):string;
17
18function isin_test1(): boolean {
19    var A = {a:1, b:2};
20    return 'a' in A;
21}
22
23let ret = isin_test1();
24ArkTools.jitCompileAsync(isin_test1);
25let res = ArkTools.waitJitCompileFinish(isin_test1);
26print(res);
27ret = isin_test1();
28print(ret);
29
30
31function isin_test2(): boolean {
32    let obj2 = {"5": 5};
33    let obj = Object.create(obj2);
34    obj[1] = 1;
35    obj.abc = 2;
36
37    return 5 in obj;
38}
39
40ret = isin_test2();
41ArkTools.jitCompileAsync(isin_test2);
42res = ArkTools.waitJitCompileFinish(isin_test2);
43print(res);
44ret = isin_test2();
45print(ret);
46
47
48function isin_test3(): boolean {
49    let obj2 = {"5": 5};
50    let obj = Object.create(obj2);
51    obj[1] = 1;
52    obj.abc = 2;
53
54    return "abc" in obj;
55}
56
57ret = isin_test3();
58ArkTools.jitCompileAsync(isin_test3);
59res = ArkTools.waitJitCompileFinish(isin_test3);
60print(res);
61ret = isin_test3();
62print(ret);
63
64
65function isin_test4(): boolean {
66    var str = new String("hello world");
67    return '1' in str;
68}
69
70ret = isin_test4();
71ArkTools.jitCompileAsync(isin_test4);
72res = ArkTools.waitJitCompileFinish(isin_test4);
73print(res);
74ret = isin_test4();
75print(ret);
76
77function isin_test5(): boolean {
78    var str = new String("hello world");
79    return '11' in str;
80}
81
82ret = isin_test5();
83ArkTools.jitCompileAsync(isin_test5);
84res = ArkTools.waitJitCompileFinish(isin_test5);
85print(res);
86ret = isin_test5();
87print(ret);
88
89