• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 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
16
17function classDec() {
18    print("classDec");
19    return function (func: Function) { print("inner-classDec"); }
20}
21
22function propDec(p: any) {
23    print("propDec-", p);
24    return function (target: any, propName: any) { print("inner-propDec-", propName); }
25}
26
27function methodDec(p: any) {
28    print("methodDec-", p);
29    return function (target: any, methodName: any, desc: any) { print("inner-methodDec-", methodName); }
30}
31
32function paramDec(value: any) {
33    print("paramDec-", value);
34    return function (target: any, methodName: any, idx: any) { print("inner-paramDec-idx=", idx); }
35}
36
37@classDec()
38class A {
39    @propDec("prop1")
40    prop1 = 1;
41
42    constructor(@paramDec('start3') start: number, @paramDec('end3') end: number) { }
43
44    @propDec("prop2")
45    static prop2 = 2;
46
47    @propDec("prop3")
48    prop3 = 3;
49
50    @methodDec("classMethod1")
51    static classMethod1(@paramDec('start1') start: number, @paramDec('end1') end: number) {
52        return {};
53    }
54
55    @methodDec("classMethod2")
56    @methodDec("classMethod22")
57    classMethod2(@paramDec('start2') @paramDec('start22') start: number, @paramDec('end2') end: number) {
58        return {};
59    }
60}
61