@@ -1259,6 +1259,10 @@ export abstract class LuaTranspiler {
12591259 public transpilePropertyAccessExpression ( node : ts . PropertyAccessExpression ) : string {
12601260 const property = node . name . text ;
12611261
1262+ if ( tsHelper . hasGetAccessor ( node , this . checker ) ) {
1263+ return this . transpileGetAccessor ( node ) ;
1264+ }
1265+
12621266 // Check for primitive types to override
12631267 const type = this . checker . getTypeAtLocation ( node . expression ) ;
12641268 switch ( type . flags ) {
@@ -1268,8 +1272,6 @@ export abstract class LuaTranspiler {
12681272 case ts . TypeFlags . Object :
12691273 if ( tsHelper . isArrayType ( type , this . checker ) ) {
12701274 return this . transpileArrayProperty ( node ) ;
1271- } else if ( tsHelper . hasGetAccessor ( node , this . checker ) ) {
1272- return this . transpileGetAccessor ( node ) ;
12731275 }
12741276 }
12751277
@@ -1593,13 +1595,6 @@ export abstract class LuaTranspiler {
15931595
15941596 let result = "" ;
15951597
1596- if ( ! isExtension && ! isMetaExtension ) {
1597- result += this . transpileClassCreationMethods ( node , instanceFields , extendsType ) ;
1598- } else {
1599- // export empty table
1600- this . pushExport ( className , node , true ) ;
1601- }
1602-
16031598 // Overwrite the original className with the class we are overriding for extensions
16041599 if ( isMetaExtension ) {
16051600 if ( ! extendsType ) {
@@ -1619,6 +1614,20 @@ export abstract class LuaTranspiler {
16191614 }
16201615 }
16211616
1617+ if ( ! isExtension && ! isMetaExtension ) {
1618+ result += this . transpileClassCreationMethods ( node , instanceFields , extendsType ) ;
1619+ } else {
1620+ for ( const f of instanceFields ) {
1621+ // Get identifier
1622+ const fieldIdentifier = f . name as ts . Identifier ;
1623+ const fieldName = this . transpileIdentifier ( fieldIdentifier ) ;
1624+
1625+ const value = this . transpileExpression ( f . initializer ) ;
1626+
1627+ result += this . indent + `${ className } .${ fieldName } = ${ value } \n` ;
1628+ }
1629+ }
1630+
16221631 // Add static declarations
16231632 for ( const field of staticFields ) {
16241633 const fieldName = this . transpileIdentifier ( field . name as ts . Identifier ) ;
0 commit comments