Closed vega0 closed 1 year ago
So, i have the code. I need to transpile it to moonscript, what i get, that i have:
<classes>haxe.Log.trace(__moon__("string.sub({arg0}, {arg1},{arg1} + {arg2})", "hello wolrd", 2, 4), {["fileName"]: "Code.hx", ["lineNumber"]: 136, ["className"]: "_Code.Code_Fields_", ["methodName"]: "main"}))! assert type(r) == "nil", "function return type
inline function substr(pos:Int, ?len:Int):String { return untyped __moon__ ("string.sub({arg0}, {arg1},{arg1} + {arg2})", this, pos, len); }
what happens wrong and why its not inlined as raw code line?
compiler init
import reflaxe.ReflectCompiler; class CompilerInit { public static function Start() { ReflectCompiler.AddCompiler(new Compiler(), { fileOutputExtension: ".moon", outputDirDefineName: "moon-output", fileOutputType: FilePerClass, reservedVarNames: reservedNames(), targetCodeInjectionName: "__moon__", smartDCE: true, trackUsedTypes: true }); } static function reservedNames() { return []; }
Are you using BaseCompiler.compileExpression to compile your expressions? This function first checks for __moon__, then calls the "impl" version.
BaseCompiler.compileExpression
__moon__
So, i have the code. I need to transpile it to moonscript, what i get, that i have:
what happens wrong and why its not inlined as raw code line?
compiler init