innogames / ax3

AS3 to Haxe converter
MIT License
43 stars 10 forks source link

No such package #13

Open Shaunmax opened 1 year ago

Shaunmax commented 1 year ago

Hello,

I am getting the following error :

Exception in thread "main" No such package BaseScreenNavigator
    at ax3.TypedTree.getPackage(src/ax3/TypedTree.hx:18)
    at ax3.TypedTree.getDecl(src/ax3/TypedTree.hx:27)
    at ax3.Typer.resolveDotPath(src/ax3/Typer.hx:521)
    at ax3.Typer.resolveType(src/ax3/Typer.hx:509)
    at ax3.Typer$Typer_resolveType.invoke(src/ax3/Typer.hx)
    at ax3.Typer$Typer_resolveType.invoke(src/ax3/Typer.hx)
    at ax3.Typer$Closure_makeTyperContext_3.invoke(src/ax3/Typer.hx:133)
    at ax3.Typer$Closure_makeTyperContext_3.invoke(src/ax3/Typer.hx)
    at ax3.ExprTyper.typeAs(src/ax3/ExprTyper.hx:1114)
    at ax3.ExprTyper.typeExpr(src/ax3/ExprTyper.hx:153)
    at ax3.ExprTyper.typeBinop(src/ax3/ExprTyper.hx:983)
    at ax3.ExprTyper.typeExpr(src/ax3/ExprTyper.hx:149)
    at ax3.ExprTyper.typeBlock(src/ax3/ExprTyper.hx:80)
    at ax3.ExprTyper.typeExpr(src/ax3/ExprTyper.hx:140)
    at ax3.ExprTyper.typeIf(src/ax3/ExprTyper.hx:1238)
    at ax3.ExprTyper.typeExpr(src/ax3/ExprTyper.hx:142)
    at ax3.ExprTyper.typeBlock(src/ax3/ExprTyper.hx:80)
    at ax3.ExprTyper.typeExpr(src/ax3/ExprTyper.hx:140)
    at ax3.ExprTyper.typeForIn(src/ax3/ExprTyper.hx:1136)
    at ax3.ExprTyper.typeExpr(src/ax3/ExprTyper.hx:147)
    at ax3.ExprTyper.typeBlock(src/ax3/ExprTyper.hx:80)
    at ax3.ExprTyper.typeFunctionExpr(src/ax3/ExprTyper.hx:69)
    at ax3.Typer$Closure_typeClassField_0.invoke(src/ax3/Typer.hx:246)
    at ax3.Typer.process(src/ax3/Typer.hx:21)
    at ax3.Main.main(src/ax3/Main.hx:50)
    at ax3.Main.main(src/ax3/Main.hx:1)

@nadako @Neu2o @m0rkeulv Can anyone please help me understand, what exactly could be the issue?

ConfidantCommunications commented 11 months ago

Same problem here.

m0rkeulv commented 11 months ago

I need some more context, to me it looks like an error when some macro or app is executed.

if its when the app is executed it could be some kind of dead code elimination or something else related to how its compiled and for what target.

if its a macro that fails then you may have added a library to your intellij project but forgot to add it to your project setup or build file (hxml/project.xml etc.)

ConfidantCommunications commented 11 months ago

The error is generated when I run java -jar converter.jar config.json. Just the presence of import statements in the .as source file causes it to happen, e.g.: import away3d.cameras.Camera3D;

m0rkeulv commented 11 months ago

I would have to debug to figure out what it gets stuck on, been a long time since I tried this and not sure when I can find the time to do so. While this tool did help me do some conversion of code, I ended up mostly using search and replace with regex to do as3 to hx conversion. Away3d is ported to openFL so it might be better to try to try to use that instead of depending on the as3 version converted to haxe

If i where to guess what might be the problem, i would guessing this way of initializing uints https://github.com/away3d/away3d-core-fp11/blob/master/src/away3d/cameras/Camera3D.as#L99C4-L114

ConfidantCommunications commented 11 months ago

Does it really look for all the Actionscript libraries as it converts? I really just want to convert the local AS3 and then swap out the dependencies for their Haxe versions.

ConfidantCommunications commented 11 months ago

I ended up going back to the AS3toHX library which worked fine, albeit it uses Haxe 3 syntax.

nadako commented 11 months ago

I don't work on this anymore and haven't used it for a couple years, so I can't really give any detailed answer, but to me this looks like a missing swc in the config. The converter needs to know all types, including ones from libraries, so it tries to find them either in the converted codebase or in given SWCs.

nadako commented 11 months ago

Also I'm totally confused by the discussion in this issue. The OP shows the converter "unresolved type" exception and you guys are talking about macros and DCE and away3d camera and uints...

ConfidantCommunications commented 11 months ago

Thanks @nadako — I share some of your thoughts. Recognizing the value of volunteer time, it would be nice to have an option to ignore dependencies and simply convert the code it is given.

nadako commented 11 months ago

it would be nice to have an option to ignore dependencies and simply convert the code it is given.

Well that was not how we wanted to do the conversion when we were working on it. Our intention was to have correct Haxe code that compiles and runs without further manual changes so we can do this automatically and make a smooth transition of a live game between Flash and HTML5. And we wanted to have the code to be clean, Haxe-idiomatic, without boilerplate, unnecessary reflection, etc. Because we had a huge codebase that we wanted to just continue working on after the transition is done, also without pausing the game development.

Without knowing all types it would not be possible, so this is why the converter is so strict. But one could implement some fallbacks to generate something sensible from that. Still, I'd not go this way and just connect all the SWCs.