@@ -113,12 +113,14 @@ public static LuaExpr translate(ImFunctionCall e, LuaTranslator tr) {
113113 LuaExpr arg = e .getArguments ().get (0 ).translateToLua (tr );
114114 ImType argumentType = e .getArguments ().get (0 ).attrTyp ();
115115 ImType resultType = e .attrTyp ();
116- if (tcFunc .equals ("objectToIndex" )
117- || (argumentType instanceof ImClassType && TypesHelper .isIntType (resultType ))) {
116+ if (argumentType instanceof ImClassType && TypesHelper .isIntType (resultType )) {
118117 return LuaAst .LuaExprFunctionCall (tr .classToIndex , LuaAst .LuaExprlist (arg ));
119- } else if (tcFunc .equals ("objectFromIndex" )
120- || (TypesHelper .isIntType (argumentType ) && resultType instanceof ImClassType )) {
118+ } else if (TypesHelper .isIntType (argumentType ) && resultType instanceof ImClassType ) {
121119 return LuaAst .LuaExprFunctionCall (tr .classFromIndex , LuaAst .LuaExprlist (arg ));
120+ } else if (tcFunc .equals ("objectToIndex" )) {
121+ return LuaAst .LuaExprFunctionCall (tr .toIndexFunction , LuaAst .LuaExprlist (arg ));
122+ } else if (tcFunc .equals ("objectFromIndex" )) {
123+ return LuaAst .LuaExprFunctionCall (tr .fromIndexFunction , LuaAst .LuaExprlist (arg ));
122124 } else if (tcFunc .equals ("stringToIndex" )) {
123125 return LuaAst .LuaExprFunctionCall (tr .stringToIndexFunction , LuaAst .LuaExprlist (arg ));
124126 } else if (tcFunc .equals ("stringFromIndex" )) {
@@ -485,14 +487,14 @@ public static LuaExpr translate(ImCast imCast, LuaTranslator tr) {
485487 if (TypesHelper .isStringType (imCast .getExpr ().attrTyp ())) {
486488 return LuaAst .LuaExprFunctionCall (tr .stringToIndexFunction , LuaAst .LuaExprlist (translated ));
487489 }
488- if (imCast .getExpr ().attrTyp () instanceof ImClassType
489- || imCast .getExpr ().attrTyp () instanceof ImAnyType ) {
490+ if (imCast .getExpr ().attrTyp () instanceof ImClassType ) {
490491 return LuaAst .LuaExprFunctionCall (tr .classToIndex , LuaAst .LuaExprlist (translated ));
491492 }
492493 return LuaAst .LuaExprFunctionCall (tr .toIndexFunction , LuaAst .LuaExprlist (translated ));
493- } else if (imCast .getToType () instanceof ImClassType
494- || imCast .getToType () instanceof ImAnyType ) {
494+ } else if (imCast .getToType () instanceof ImClassType ) {
495495 return LuaAst .LuaExprFunctionCall (tr .classFromIndex , LuaAst .LuaExprlist (translated ));
496+ } else if (imCast .getToType () instanceof ImAnyType ) {
497+ return LuaAst .LuaExprFunctionCall (tr .fromIndexFunction , LuaAst .LuaExprlist (translated ));
496498 } else {
497499 return translated ;
498500 }
0 commit comments