首页 > 解决方案 > 使用重构将 Javascript 转换为 Haxe

问题描述

我想将一个 javascript 类转换为 Haxe。(这是 Nakama 后端JS 客户端,nakama-js.umd.js)为了做到这一点,我尝试使用重构工具。这是安装重构后的haxelib工具,我执行了以下命令:

haxelib run refactor js_to_haxe nakama-js.umd.js

但我收到以下错误:

Called from ? line 1
Called from Main.hx line 72
Called from hant/Process.hx line 196
Called from hant/Process.hx line 99
Called from a C function
Called from hant/Process.hx line 174
Called from hant/Process.hx line 173
Called from a C function
Called from C:\MyProg\_tools\motion-twin\haxe\std/neko/Lib.hx line 42
Uncaught exception - load.c(237) : Failed to load library : hant.ndll
Stack trace:
        Called from a C function
        Called from hant/Process.hx line 10
        Called from a C function
        Called from hant/Process.hx line 10
        Called from hant/Process.hx line 174
        Called from a C function
        Called from hant/Process.hx line 99
        Called from hant/Process.hx line 196
        Called from Main.hx line 72
        Called from ? line 1

我也尝试安装hant lib。没有改变。

标签: haxeconvertershaxelib

解决方案


$ haxelib run refactor convertFile input.js Output.hx js_to_haxe.rules

这似乎在 haxe 4 中执行(文档中描述的调用适用于 3.x)。
不过,输出似乎并没有真正在 Haxe 中转换。


推荐阅读