profound7 / moon-core

moon-core library for haxe
MIT License
43 stars 7 forks source link

Compilation problems on async example #6

Open IBwWG opened 8 years ago

IBwWG commented 8 years ago

I tried to use moon-core straight out of the box to convert a function of mine to async, so that it could show a loading indicator while loading. I got some compiler errors.

So I tried to just compile the sugared async example, and got the same errors. Maybe my haxe 3.2.1 for win7x64 is the wrong environment? Or am I missing something else?

Here's trying to compile the example from the command line:

C:\HaxeToolkit\haxe\lib\moon-core\1,0,0\test>haxe -lib moon-core -main AsyncSuga
redExamples AsyncSugaredExamples.hx
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:20
: characters 22-42 : Class<haxe.macro.Context> has no field getLocalType
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:58
: characters 22-40 : Class<haxe.macro.Context> has no field currentPos
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:60
: characters 25-47 : Class<haxe.macro.Context> has no field getBuildFields
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:12
5: characters 12-30 : Class<haxe.macro.Context> has no field defineType
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:20
: characters 22-42 : Class<haxe.macro.Context> has no field getLocalType
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncMacroTools.hx
:121: characters 27-41 : Class<haxe.macro.Context> has no field typeof
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:70: characters 29-52 : Class<haxe.macro.Context> has no field getExpectedType
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:79: characters 30-43 : Class<haxe.macro.Context> has no field error
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:90: characters 25-39 : Class<haxe.macro.Context> has no field typeof
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:121: characters 26-39 : Class<haxe.macro.Context> has no field error
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:200: characters 15-37 : Class<haxe.macro.Context> has no field getLocalModule
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:648: characters 34-47 : Class<haxe.macro.Context> has no field error
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:654: characters 30-43 : Class<haxe.macro.Context> has no field error
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1173: characters 32-34 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1273: characters 48-50 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1307: characters 38-40 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1313: characters 36-38 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1339: characters 43-45 : Class<haxe.macro.Context> has no field makeExpr
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:1353: characters 51-53 : Class<haxe.macro.Context> has no field makeExpr

And here's from my project:

C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:20: characters 22-42 : Class<haxe.macro.Context> has no field getLocalType
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:58: characters 22-40 : Class<haxe.macro.Context> has no field currentPos
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:60: characters 25-47 : Class<haxe.macro.Context> has no field getBuildFields
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:125: characters 12-30 : Class<haxe.macro.Context> has no field defineType
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/signal/SignalMacro.hx:20: characters 22-42 : Class<haxe.macro.Context> has no field getLocalType
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncMacroTools.hx:121: characters 27-41 : Class<haxe.macro.Context> has no field typeof
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:70: characters 29-52 : Class<haxe.macro.Context> has no field getExpectedType
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:79: characters 30-43 : Class<haxe.macro.Context> has no field error
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:90: characters 25-39 : Class<haxe.macro.Context> has no field typeof
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:121: characters 26-39 : Class<haxe.macro.Context> has no field error
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:200: characters 15-37 : Class<haxe.macro.Context> has no field getLocalModule
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:648: characters 34-47 : Class<haxe.macro.Context> has no field error
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:654: characters 30-43 : Class<haxe.macro.Context> has no field error
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1173: characters 32-34 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1273: characters 48-50 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1307: characters 38-40 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1313: characters 36-38 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1339: characters 43-45 : Class<haxe.macro.Context> has no field makeExpr
C:/HaxeToolkit/haxe/lib/moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.hx:1353: characters 51-53 : Class<haxe.macro.Context> has no field makeExpr

(...plus a few others specific to my project)

IBwWG commented 8 years ago

In my naive attempt at problem-solving here, I started wrapping anything that was complaining in #if macro blocks. That started working until AsyncTransformer:

C:\HaxeToolkit\haxe\lib\moon-core\1,0,0\test>haxe -lib moon-core AsyncSugaredExa
mples.hx
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Int
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Int
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Bool
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Bool
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Int
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Int
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Bool
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Int
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Bool
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Float
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Float
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Float
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Int
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Int
C:\HaxeToolkit\haxe\lib\moon-core/1,0,0/src/moon/macros/async/AsyncTransformer.h
x:283: characters 38-42 : On static platforms, null can't be used as basic type
Bool
IBwWG commented 8 years ago

If I change the offending line to codes.push(macro var $v:Dynamic = null); it compiles without a platform named...

IBwWG commented 8 years ago

But then compiling it for cpp fails:

cl.exe -Iinclude -nologo -O2 /WX- /fp:precise -DHX_WINDOWS -D_USING_V140_SDK71_
-GR -FS -Oy- -c -EHs -GS- -arch:SSE -IC:/HaxeToolkit/haxe/lib/hxcpp/3,2,205/incl
ude -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=321 -D_CRT_SECURE_NO_DEPRECATE -D_ALL
OW_MSC_VER_MISMATCH -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH -wd4996 -MT ./src/__r
esources__.cpp -FoC:/HaxeToolkit/haxe/lib/moon-core/1,0,0/test/export/obj/msvc19
xp/501f6158___resources__.obj
AsyncSugaredExamples.cpp
./src/AsyncSugaredExamples.cpp(233): error C2365: 'AsyncSugaredExamples_obj::cus
tomIterator::_Function_2_1::__run': redefinition; previous definition was 'data
member'
./src/AsyncSugaredExamples.cpp(200): note: see declaration of 'AsyncSugaredExamp
les_obj::customIterator::_Function_2_1::__run'
./src/AsyncSugaredExamples.cpp(414): error C2365: 'AsyncSugaredExamples_obj::sim
pleExample::_Function_1_1::run::_Function_3_1::__run': redefinition; previous de
finition was 'data member'
./src/AsyncSugaredExamples.cpp(381): note: see declaration of 'AsyncSugaredExamp
les_obj::simpleExample::_Function_1_1::run::_Function_3_1::__run'
./src/AsyncSugaredExamples.cpp(792): error C2365: 'AsyncSugaredExamples_obj::per
mutationsExample::_Function_2_1::run::_Function_4_1::__run': redefinition; previ
ous definition was 'data member'
./src/AsyncSugaredExamples.cpp(763): note: see declaration of 'AsyncSugaredExamp
les_obj::permutationsExample::_Function_2_1::run::_Function_4_1::__run'
./src/AsyncSugaredExamples.cpp(1027): error C2365: 'AsyncSugaredExamples_obj::ne
stedExample::_Function_1_1::run::_Function_3_1::__run': redefinition; previous d
efinition was 'data member'
./src/AsyncSugaredExamples.cpp(994): note: see declaration of 'AsyncSugaredExamp
les_obj::nestedExample::_Function_1_1::run::_Function_3_1::__run'
./src/AsyncSugaredExamples.cpp(1295): error C2365: 'AsyncSugaredExamples_obj::fi
bonacciExample::_Function_1_1::run::_Function_3_1::__run': redefinition; previou
s definition was 'data member'
./src/AsyncSugaredExamples.cpp(1262): note: see declaration of 'AsyncSugaredExam
ples_obj::fibonacciExample::_Function_1_1::run::_Function_3_1::__run'
./src/AsyncSugaredExamples.cpp(1628): error C2365: 'AsyncSugaredExamples_obj::se
ndExample::_Function_1_1::run::_Function_3_1::__run': redefinition; previous def
inition was 'data member'
./src/AsyncSugaredExamples.cpp(1595): note: see declaration of 'AsyncSugaredExam
ples_obj::sendExample::_Function_1_1::run::_Function_3_1::__run'
./src/AsyncSugaredExamples.cpp(1927): error C2365: 'AsyncSugaredExamples_obj::an
otherSendExample::_Function_1_1::run::_Function_3_1::__run': redefinition; previ
ous definition was 'data member'
./src/AsyncSugaredExamples.cpp(1894): note: see declaration of 'AsyncSugaredExam
ples_obj::anotherSendExample::_Function_1_1::run::_Function_3_1::__run'
./src/AsyncSugaredExamples.cpp(2212): error C2365: 'AsyncSugaredExamples_obj::fi
berExample::_Function_1_1::run::_Function_3_1::__run': redefinition; previous de
finition was 'data member'
./src/AsyncSugaredExamples.cpp(2179): note: see declaration of 'AsyncSugaredExam
ples_obj::fiberExample::_Function_1_1::run::_Function_3_1::__run'
./src/AsyncSugaredExamples.cpp(2500): error C2365: 'AsyncSugaredExamples_obj::fi
berFutureExample::_Function_1_1::run::_Function_3_1::__run': redefinition; previ
ous definition was 'data member'
./src/AsyncSugaredExamples.cpp(2467): note: see declaration of 'AsyncSugaredExam
ples_obj::fiberFutureExample::_Function_1_1::run::_Function_3_1::__run'
./src/AsyncSugaredExamples.cpp(2761): error C2365: 'AsyncSugaredExamples_obj::fi
berDurationExample::_Function_1_1::run::_Function_3_1::__run': redefinition; pre
vious definition was 'data member'
./src/AsyncSugaredExamples.cpp(2728): note: see declaration of 'AsyncSugaredExam
ples_obj::fiberDurationExample::_Function_1_1::run::_Function_3_1::__run'

__files__.cpp
__boot__.cpp
__resources__.cpp
Error: Build failed
profound7 commented 8 years ago

Yikes. So far I've mostly tested it on neko and javascript. I haven't really tried it on static platforms. I'll try to get this working on static targets for the next release.