diff options
author | Andy Li <andy@onthewings.net> | 2014-05-13 15:08:44 +0800 |
---|---|---|
committer | Andy Li <andy@onthewings.net> | 2014-05-13 15:08:44 +0800 |
commit | 91142d31f1d82eb94e19990766c20e648854efa3 (patch) | |
tree | cb86cd4b0d8218141ea1c7a668718278c13ce518 /tests/examplefiles/example.hx | |
parent | 16b39eea26af87813151b03992f2ed4738057eaa (diff) | |
download | pygments-91142d31f1d82eb94e19990766c20e648854efa3.tar.gz |
Haxe: fixed top-level class members, number in preproc, macro reification, ECheckType expression.
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 |