elegant-intern-95950
05/24/2023, 3:09 PMhaxe
abstract Ref<T>(haxe.ds.Vector<Null<T>>) {
public var val(get, set) : Null<T>;
inline function new(){
this = new haxe.ds.Vector( 1 );
}
@:to inline function get_val() : Null<T> {
return this[ 0 ];
}
inline function set_val( val : Null<T> ) {
return this[ 0 ] = val;
}
@:from static inline public function fromT<T>( val : Null<T> ) {
trace( "fromT : " + val );
var ref = new Ref();
ref.val = val;
return ref;
}
}
class Test {
static function main() {
var ref : Ref<Int> = null;
var ref2 : Ref<Int> = (null:Int); // Only here I get trace
}
}