Created
September 14, 2012 17:11
-
-
Save waneck/3723305 to your computer and use it in GitHub Desktop.
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
class LimitMinMax implements haxe.rtti.Meta | |
{ | |
public var max:Float; | |
public var min:Float; | |
public function new(max, min) | |
{ | |
this.max = max; | |
this.min = min; | |
} | |
} |
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
import LimitMinMax; | |
class Test | |
{ | |
@LimitMinMax public var field2:Float; //error: limitMinMax takes two arguments | |
@LimitMinMax(10, 0) public var field3:Float; //alright! -> if you want to exclude this, do a verification step with macros | |
@LimitMinMax(0, 10) public var field3:Float; //alright! | |
@mylib.Limit.LimitMinMax(0, 10) public var field3:Float; //alright, with fully qualified name! | |
public static function main() | |
{ | |
new B(); | |
var metas = haxe.rtti.Meta.getFields(Test); | |
trace(Std.is(metas.field3, LimitMinMax)); //true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried to follow through and think about all the different use cases:
The issues to resolve: