daScript icon indicating copy to clipboard operation
daScript copied to clipboard

try to AOT

Open jemoo opened this issue 1 year ago • 0 comments

I'm trying to AOT the following code:

print("{new String("hello!")->to_upper()->utf8()}\n");

got:

builtin_print(das_string_builder(__context__,SimNode_AotInterop<2>(__tinfo_0, cast<char *>::from(das_invoke_function<char *>::invoke<test::String &>(__context__,nullptr,das_invoke_function<test::String & *>::invoke<test::String &>(__context__,nullptr,das_new<test::String>::make_and_init(__context__,[&]() { return das_invoke_function<test::String>::invoke_cmres<char * const >(__context__,nullptr,Func(__context__->fnByMangledName(/*@test::String Cs*/ 12949979443183231949u)),((char *) "hello!")); })->to_upper,das_arg<test::String>::pass(das_cast<test::String const >::cast(das_deref(__context__,das_new<test::String>::make_and_init(__context__,[&]() { return das_invoke_function<test::String>::invoke_cmres<char * const >(__context__,nullptr,Func(__context__->fnByMangledName(/*@test::String Cs*/ 12949979443183231949u)),((char *) "hello!")); })))))->utf8,das_arg<test::String>::pass(das_cast<test::String const >::cast(das_deref(__context__,das_invoke_function<test::String *>::invoke<test::String &>(__context__,nullptr,das_new<test::String>::make_and_init(__context__,[&]() { return das_invoke_function<test::String>::invoke_cmres<char * const >(__context__,nullptr,Func(__context__->fnByMangledName(/*@test::String Cs*/ 12949979443183231949u)),((char *) "hello!")); })->to_upper,das_arg<test::String>::pass(das_cast<test::String const >::cast(das_deref(__context__,das_new<test::String>::make_and_init(__context__,[&]() { return das_invoke_function<test::String>::invoke_cmres<char * const >(__context__,nullptr,Func(__context__->fnByMangledName(/*@test::String Cs*/ 12949979443183231949u)),((char *) "hello!")); })))))))))), cast<char * const >::from(((char *) "\n")))),__context__,((LineInfoArg *)(&LineInfo::g_LineInfoNULL)));

with some compile errors. I noticed a few issues in it,

  1. create a pointer to a reference das_invoke_function<test::String & *>
  2. new String("hello!") appears multiple times? (I'm not quite sure)

jemoo avatar Mar 03 '24 02:03 jemoo