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 18class A { 19 x: int 20 y: int 21} 22 23class Test { 24 @memo void_method(): void { 25 } 26 27 @memo a_method_with_implicit_return_type() { 28 } 29 30 @memo void_method_with_arg(arg: string) { 31 } 32 33 @memo void_method_with_return(arg: string) { 34 return 35 } 36 37 @memo static static_method_with_type_parameter<T>(arg: T): void { 38 return 39 } 40 41 @memo obj_arg(arg: A) { 42 43 } 44} 45 46class Use { 47 @memo test() { 48 const test = new Test() 49 50 test.void_method() 51 test.void_method_with_arg("an arg") 52 test.void_method_with_return("a value") 53 Test.static_method_with_type_parameter("I'm static") 54 55 test.obj_arg({ x: 1, y: 2 }) 56 } 57} 58