@@ -15,6 +15,8 @@ import reflaxe.data.ClassFuncData;
1515import reflaxe .data .EnumOptionData ;
1616
1717import reflaxe .DirectToStringCompiler ;
18+ import reflaxe .preprocessors .implementations .RemoveSingleExpressionBlocksImpl ;
19+ import reflaxe .preprocessors .implementations .RemoveTemporaryVariablesImpl ;
1820import reflaxe .preprocessors .implementations .everything_is_expr .EverythingIsExprSanitizer ;
1921
2022import gdcompiler .config .Define ;
@@ -357,6 +359,11 @@ ${exitTreeLines.length > 0 ? exitTreeLines.join("\n").tab() : "\tpass"}
357359 } else {
358360 final e = field .expr () ?? v .findDefaultExpr ();
359361 if (e != null ) {
362+ // Do quick and dirty optimizations for "block-like" variable assignments.
363+ // TODO: Incorporate as feature in Reflaxe.
364+ final tvr = new RemoveTemporaryVariablesImpl (AllVariables , e , new Map ());
365+ final e = RemoveSingleExpressionBlocksImpl .process (tvr .fixTemporaries ());
366+
360367 compileClassVarExpr (e );
361368 } else {
362369 " " ;
@@ -382,7 +389,7 @@ ${exitTreeLines.length > 0 ? exitTreeLines.join("\n").tab() : "\tpass"}
382389 declBuffer .add (name );
383390
384391 #if !gdscript_untyped
385- final compiledType = TComp .compileType (v .field .type , v .field .pos );
392+ final compiledType = TComp .compileType (v .field .type , v .field .pos , v . field . hasMeta ( " :export " ) );
386393 if (compiledType != null ) {
387394 declBuffer .addMulti (" : " , compiledType .trustMe ());
388395 }
@@ -468,6 +475,7 @@ ${exitTreeLines.length > 0 ? exitTreeLines.join("\n").tab() : "\tpass"}
468475 funcDeclaration .add (" ," );
469476 }
470477 }
478+
471479 funcDeclaration .add (args .map (a -> compileFunctionArgument (a , field .pos )).join (" , " ));
472480 funcDeclaration .add (" )" );
473481
0 commit comments