hxArduino icon indicating copy to clipboard operation
hxArduino copied to clipboard

Generator error with haxe 4.0.0-preview.5

Open tong opened this issue 7 years ago • 20 comments

hxArduino/src/ast2obj/Generator.hx:150: characters 58-67 : Null<haxe.macro.TypedExpr> should be Null<haxe.macro.TConstant>
hxArduino/src/ast2obj/Generator.hx:150: characters 58-67 : For function argument 'c'

Works with haxe 4.0.0-preview.4

tong avatar Dec 11 '18 13:12 tong

Ok, i feel like there are some issues with p5 currently, so hopefully this will be cleared up. I was running p5 and had to downgrade to p4 for a few reasons.

ianharrigan avatar Dec 11 '18 15:12 ianharrigan

Still happening with haxe 4.0.0 rc3

ratkingsminion avatar Aug 22 '19 07:08 ratkingsminion

And with Haxe 4.0.5 - Any fix for this @ianharrigan ? :)

datee avatar Jan 27 '20 15:01 datee

OK, this should be fixed now, thanks for the reminder, id totally forgot about it!

EDIT: ive released haxelib v1.2.0 also....

ianharrigan avatar Jan 27 '20 16:01 ianharrigan

Ok, thanks! :) But ..trying to compile with Haxe 4.0.5 - creating a new class gives an error :

var myClass = new MyClass(); ast2obj/Generator.hx:150: characters 33-42 : Uncaught exception field access on null

This worked fine with the last version on 4.0.0.p4

datee avatar Jan 28 '20 08:01 datee

right... can you paste the entire source / project?

(including myClass, hxmls, etc)

ianharrigan avatar Jan 28 '20 08:01 ianharrigan

Its just the blink-01 example with added a new empty class with an empty function in it. Tested it more and the error seems to be related to having parameters with a function:

OK : public function setSomeValue() { } Creates exception : public function setSomeValue(value:Int) { }

datee avatar Jan 28 '20 08:01 datee

Whoops, yeah... dunno how i didnt catch that... i guess in my dumb tests when i was fixing for haxe4 i only tested with function param defaults (eg: value = 100).. doh

Should be fixed in latest haxelib

ianharrigan avatar Jan 28 '20 08:01 ianharrigan

Great! Now it compiles without error! :)

datee avatar Jan 28 '20 08:01 datee

But trying to run it gives another problem: cmd: haxelib run hxArduino --test Called from hxSerial/Serial.hx line 93 Uncaught exception - load.c(237) : Failed to load library : ./hxSerial.ndll

Where should the ndll be? putting it in the same project or path doesnt help.

datee avatar Jan 28 '20 08:01 datee

im not 100% sure of the internals of hxSerial tbh... not even sure if its haxe4 ready

I dont have an adruino setup to test here myself either...

ianharrigan avatar Jan 28 '20 08:01 ianharrigan

It worked with Haxe 4.0.0.p4 in the previous version when the ndll was in the same folder i think. But havent been able to run it after the update

datee avatar Jan 28 '20 08:01 datee

i guess, thinking about it, i dont need to have a device to try and connect to it... let me have a go

Yeah, i get the same :/

ianharrigan avatar Jan 28 '20 08:01 ianharrigan

ok - so it seems to use it we have to revert back to the previous version with haxe 4.0.0p4 then for now...?

datee avatar Jan 28 '20 11:01 datee

well, hxSerial is just used to send it to the device. the output is in build/hxArduino/out... pretty sure there are other ways to get it to the device

ianharrigan avatar Jan 28 '20 11:01 ianharrigan

https://forum.arduino.cc/index.php?topic=417659.0

ianharrigan avatar Jan 28 '20 11:01 ianharrigan

if i cant get hxSerial to work, and once i have a device up and running, ill probably remove hxSerial and use one of these methods - feels better / safer...

ianharrigan avatar Jan 28 '20 11:01 ianharrigan

actually, looking at the source of the run command it isnt for sending it to the device, its to monitor the serial port for debug traces... so maybe this can be removed? Would defo be a shame though as thats useful

ianharrigan avatar Jan 28 '20 11:01 ianharrigan

Heres the "best" solution ive found so far:

the issue is that neko is 64bit and the hxSerial.dll is 32, ive built a new 64bit hxSerial.ndll, but cant get neko to pick up the correct one (it always seem to be looking in the Windows folder rather than the Windows64 folder), so my advice for now, is drop the attached hxSerial.ndll next to the run.n from this lib, then it should work, ill looking for a better, less manual solution, but at leas this means you can use the run command

hxSerial.zip

ianharrigan avatar Jan 29 '20 09:01 ianharrigan

Nice, it works perfect - even if its a bit manual!

datee avatar Jan 29 '20 15:01 datee