@@ -494,24 +494,6 @@ export class LuaTransformer {
494494 }
495495 }
496496
497- // Add static declarations
498- for ( const field of staticFields ) {
499- const fieldName = this . transformPropertyName ( field . name ) ;
500- const value = this . transformExpression ( field . initializer ) ;
501-
502- const classField = tstl . createTableIndexExpression (
503- this . addExportToIdentifier ( tstl . cloneIdentifier ( className ) ) ,
504- fieldName
505- ) ;
506-
507- const fieldAssign = tstl . createAssignmentStatement (
508- classField ,
509- value
510- ) ;
511-
512- result . push ( fieldAssign ) ;
513- }
514-
515497 // Find first constructor with body
516498 if ( ! isExtension && ! isMetaExtension ) {
517499 const constructor = statement . members
@@ -573,6 +555,24 @@ export class LuaTransformer {
573555 result . push ( this . transformMethodDeclaration ( method , className , isExtension || isMetaExtension ) ) ;
574556 } ) ;
575557
558+ // Add static declarations
559+ for ( const field of staticFields ) {
560+ const fieldName = this . transformPropertyName ( field . name ) ;
561+ const value = this . transformExpression ( field . initializer ) ;
562+
563+ const classField = tstl . createTableIndexExpression (
564+ this . addExportToIdentifier ( tstl . cloneIdentifier ( className ) ) ,
565+ fieldName
566+ ) ;
567+
568+ const fieldAssign = tstl . createAssignmentStatement (
569+ classField ,
570+ value
571+ ) ;
572+
573+ result . push ( fieldAssign ) ;
574+ }
575+
576576 this . classStack . pop ( ) ;
577577
578578 return result ;
0 commit comments