Skip to content

Instantly share code, notes, and snippets.

@francescoagati
Created June 14, 2016 19:09
Show Gist options
  • Save francescoagati/7db8f5a4216c4f6c1f0c3f93433e4810 to your computer and use it in GitHub Desktop.
Save francescoagati/7db8f5a4216c4f6c1f0c3f93433e4810 to your computer and use it in GitHub Desktop.
haxe nested structInit
@:structInit
class A {
var x:Int;
var y:Int;
}
@:structInit
class B {
var a:A;
var k:Int;
}
class Main {
static function main() {
var b:B = {a:{x:1,y:2},k:3};
}
}
// Generated by Haxe 3.3.0
(function () { "use strict";
var A = function(x,y) {
this.x = x;
this.y = y;
};
var B = function(a,k) {
this.a = a;
this.k = k;
};
var Main = function() { };
Main.main = function() {
new B(new A(1,2),3);
};
Main.main();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment