• 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
16import { memo, __memo_context_type, __memo_id_type } from "@ohos.arkui.stateManagement"
17
18@memo function memo_arg_call(
19    arg1: number,
20    arg2: (x: number) => number,
21    @memo arg3: (x: number) => number,
22    arg4?: (x: number) => number,
23    @memo arg5?: (x: number) => number,
24) {
25    arg2(arg1)
26    arg3(arg1)
27    arg4?.(arg1)
28    arg5?.(arg1)
29}
30
31@memo
32function memo_arg_call_with_lowering(
33    arg1: number,
34    arg4?: (x: number) => number,
35    @memo arg5?: (x: number) => number,
36) {
37    {let gensym___1 = arg4;
38      ((gensym___1 == null) ? undefined : gensym___1(arg1))};
39    {let gensym___2 = arg5;
40      ((gensym___2 == null) ? undefined : gensym___2(arg1))};
41}
42
43@memo
44function args_with_default_values(
45    arg1: int = 10,
46    @memo arg2: () => int = () => { return 20 },
47    arg3: int = arg1,
48    arg4?: int
49): void {
50    console.log(arg1, arg2, arg3, arg4)
51    console.log(arg2())
52}
53