@@ -772,13 +772,6 @@ export class LuaTranspiler {
772772 if ( ts . isPropertyAccessExpression ( node . expression ) ) {
773773 const expType = this . checker . getTypeAtLocation ( node . expression . expression ) ;
774774
775- // Don't include instance if the type is a namespace
776- if ( expType . symbol && expType . symbol . flags & ts . SymbolFlags . Namespace ) {
777- const callPath = this . transpileExpression ( node . expression ) ;
778- const params = this . transpileArguments ( node . arguments ) ;
779- return `${ callPath } (${ params } )` ;
780- }
781-
782775 if ( expType . symbol && expType . symbol . escapedName == "Math" ) {
783776 const params = this . transpileArguments ( node . arguments ) ;
784777 return this . transpileMathExpression ( node . expression . name ) + `(${ params } )` ;
@@ -798,35 +791,18 @@ export class LuaTranspiler {
798791 return this . transpileArrayCallExpression ( node ) ;
799792 }
800793
801- // Include context parameter if present
802- if ( expType && expType . symbol ) {
803- const funcName = node . expression . name . escapedText ;
804- let funcHolder = tsEx . findMemberHolder ( expType , funcName , this . checker ) ;
805-
806- // ===== EXPERIMENTAL https://github.com/Perryvw/TypescriptToLua/issues/56
807- if ( ts . isParenthesizedExpression ( node . expression . expression )
808- && ( ts . isAsExpression ( node . expression . expression . expression )
809- || ts . isTypeAssertion ( node . expression . expression . expression ) )
810- && ts . isTypeReferenceNode ( node . expression . expression . expression . type ) ) {
811- const castTypeNode = node . expression . expression . expression . type ;
812- if ( this . checker . getTypeFromTypeNode ( castTypeNode ) . symbol . name == funcHolder ) {
813- funcHolder = castTypeNode . getText ( ) ;
814- }
815- }
816- // ===== END EXPERIMENTAL
817-
818- if ( funcHolder === undefined ) {
819- throw new TranspileError ( `Could not find func ${ funcName } on ${ expType . symbol . name } ` , node ) ;
820- }
821-
822- const callPath = `${ funcHolder } .${ funcName } ` ;
823- const params = this . transpileArguments ( node . arguments , node . expression . expression ) ;
794+ if ( expType . symbol && ( ( expType . symbol . flags & ts . SymbolFlags . Interface ) || ( expType . symbol . flags & ts . SymbolFlags . Class ) ) ) {
795+ // Replace . with : here
796+ const callPath = `${ this . transpileExpression ( node . expression . expression ) } :${ node . expression . name . escapedText } ` ;
797+ const params = this . transpileArguments ( node . arguments ) ;
824798 return `${ callPath } (${ params } )` ;
825799 } else {
826800 const callPath = this . transpileExpression ( node . expression ) ;
827- const params = this . transpileArguments ( node . arguments , node . expression . expression ) ;
801+ const params = this . transpileArguments ( node . arguments ) ;
828802 return `${ callPath } (${ params } )` ;
829803 }
804+
805+
830806 }
831807
832808 // Handle super calls properly
0 commit comments