• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 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
16function intParam(a: int): int {
17    return 0;
18}
19
20function intParam(a: Int): int {
21    return 1;
22}
23
24function objParam(a: Object): int {
25    return 2;
26}
27
28function retRefInt(a: int): Int {
29    return new Int(a);
30}
31
32function retInt(a: Int): int {
33    return a;
34}
35
36function main(): void {
37    let a: int = 1;
38    let b: Int = 2;
39    let c: int = intParam(a);
40    assert c == 0
41    let d: int = intParam(b);
42    assert d == 1
43    let e: Int = intParam(a);
44    assert c == 0
45    let f: Int = intParam(b);
46    assert d == 1
47    let g: int = objParam(a);
48    assert g == 2
49    let h: int = objParam(b);
50    assert h == 2
51    let i: Object = b;
52    let j: int = retInt(retRefInt(5));
53    assert j == 5
54}
55