@@ -43,15 +43,11 @@ export function transformMethodDeclaration(
4343 ) ;
4444}
4545
46- export function createMethodDecoratingExpression (
46+ export function getParameterDecorators (
4747 context : TransformationContext ,
48- node : ts . MethodDeclaration ,
49- className : lua . Identifier
50- ) : lua . Statement | undefined {
51- const methodTable = transformMemberExpressionOwnerName ( node , className ) ;
52- const methodName = transformMethodName ( context , node ) ;
53-
54- const parameterDecorators = node . parameters
48+ node : ts . FunctionLikeDeclarationBase
49+ ) : lua . CallExpression [ ] {
50+ return node . parameters
5551 . flatMap ( ( parameter , index ) =>
5652 ts
5753 . getDecorators ( parameter )
@@ -66,7 +62,30 @@ export function createMethodDecoratingExpression(
6662 )
6763 )
6864 . filter ( isNonNull ) ;
65+ }
66+
67+ export function createConstructorDecoratingExpression (
68+ context : TransformationContext ,
69+ node : ts . ConstructorDeclaration ,
70+ className : lua . Identifier
71+ ) : lua . Statement | undefined {
72+ const parameterDecorators = getParameterDecorators ( context , node ) ;
73+
74+ if ( parameterDecorators . length > 0 ) {
75+ const decorateMethod = createDecoratingExpression ( context , node . kind , parameterDecorators , className ) ;
76+ return lua . createExpressionStatement ( decorateMethod ) ;
77+ }
78+ }
79+
80+ export function createMethodDecoratingExpression (
81+ context : TransformationContext ,
82+ node : ts . MethodDeclaration ,
83+ className : lua . Identifier
84+ ) : lua . Statement | undefined {
85+ const methodTable = transformMemberExpressionOwnerName ( node , className ) ;
86+ const methodName = transformMethodName ( context , node ) ;
6987
88+ const parameterDecorators = getParameterDecorators ( context , node ) ;
7089 const methodDecorators = ts . getDecorators ( node ) ?. map ( d => transformDecoratorExpression ( context , d ) ) ?? [ ] ;
7190
7291 if ( methodDecorators . length > 0 || parameterDecorators . length > 0 ) {
0 commit comments