diff options
Diffstat (limited to 'tests/examplefiles/example.hx')
-rw-r--r-- | tests/examplefiles/example.hx | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/tests/examplefiles/example.hx b/tests/examplefiles/example.hx index fd93bb49..76749c0a 100644 --- a/tests/examplefiles/example.hx +++ b/tests/examplefiles/example.hx @@ -139,4 +139,47 @@ typedef Pt2 = { y:Float, ?z:Float, //optional z add : Point -> Void, -}
\ No newline at end of file +} + + +//top-level class members +public function test(); +private var attr(get, set) = 1; + + +//pre-proc number +public static inline function indexOf<T>(arr:Array<T>, v:T) : Int +{ + #if (haxe_ver >= 3.1) + return arr.indexOf(v); + #else + #if (flash || js) + return untyped arr.indexOf(v); + #else + return std.Lambda.indexOf(arr, v); + #end + #end +} + +//macro reification +var e = macro var $myVar = 0; +var e = macro ${v}.toLowerCase(); +var e = macro o.$myField; +var e = macro { $myField : 0 }; +var e = macro $i{varName}++; +var e = macro $v{myStr}; +var args = [macro "sub", macro 3]; +var e = macro "Hello".toLowerCase($a{args}); +(macro $i{tmp}.addAtom($v{name}, $atom)).finalize(op.pos); + +var c = macro class MyClass { + public function new() { } + public function $funcName() { + trace($v{funcName} + " was called"); + } +} + +var c = macro interface IClass {} + +//ECheckType +var f = (123:Float);
\ No newline at end of file |