Created
May 27, 2012 03:58
-
-
Save dpeek/2802113 to your computer and use it in GitHub Desktop.
Haxe setter macro?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// haxe -x SetterTest | |
#if macro | |
import haxe.macro.Expr; | |
#end | |
class SetterTest | |
{ | |
public static function main() | |
{ | |
var foo = new SetterTest(); | |
foo.bar = 1; | |
} | |
public function new(){} | |
public var bar(default, set_bar):Int; | |
@:macro function set_bar(ethis:Expr, evalue:Expr) | |
{ | |
var pos = haxe.macro.Context.currentPos(); | |
return {pos:pos, expr:EConst(CInt("10"))} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment