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
| package ; | |
| import tink.core.Future; | |
| using tink.core.Outcome; | |
| import haxe.Timer.*; | |
| class Main { | |
| macro static function benchmark(name:String, makeTrigger, getFuture, watch, trigger) | |
| return macro { | |
| name: $v{name}, |
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
| #if macro | |
| import haxe.macro.Expr; | |
| #else | |
| class Image { | |
| static public function img_tag(rr:RR, image: {path:String, w:Int, h:Int}, target_size):String { | |
| return '<img alt="whoops">'; | |
| } | |
| } | |
| #end | |
| typedef RR = Dynamic; |
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
| package ; | |
| #if macro | |
| import haxe.macro.Expr; | |
| import haxe.macro.Context; | |
| using haxe.macro.ExprTools; | |
| #end | |
| class Foo { | |
| public function new() { |
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
| package ; | |
| class DevTools { | |
| macro static public function measure(e, ?msg:String) { | |
| if (msg == null) | |
| msg = haxe.macro.ExprTools.toString(e); | |
| return macro @:pos(e.pos) { | |
| var start = haxe.Timer.stamp(), | |
| result = [$e];//wrapping in the array skews the result a bit, but avoids issues with Void | |
| var duration = haxe.Timer.stamp() - start; |
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
| typedef CompletionPoint = { | |
| file:String, | |
| offset:Int | |
| } | |
| interface HaxeCompletion { | |
| function field(at:CompletionPoint):Array<haxe.macro.ClassField>; | |
| function usage(at:CompletionPoint):Array<haxe.macro.Position>; | |
| function toplevel(at:CompletionPoint):Array<TopLevel>; | |
| } |
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
| package strict; | |
| import StdTypes.Int in HxInt; | |
| abstract Int(HxInt) from HxInt to HxInt { | |
| @:op(this + b) inline function add(b:Int):Int return this + (b : HxInt); | |
| @:op(this - b) inline function subtract(b:Int):Int return this - (b : HxInt); | |
| @:op(this * b) inline function multiply(b:Int):Int return this * (b : HxInt); | |
| @:op(this >>> b) inline function urshift(b:Int):Int return this >>> (b : HxInt); | |
| @:op(this >> b) inline function rshift(b:Int):Int return this >> (b : HxInt); |
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
| package ; | |
| class Helper { | |
| static public function indexOf<A>(i:Iterable<A>, filter:A->Bool):Int { | |
| var i = 0; | |
| for (x in a) { | |
| i++; | |
| if (filter(x)) return i; | |
| } |
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
| package ; | |
| import haxe.macro.*; | |
| import haxe.macro.Type; | |
| using haxe.macro.Tools; | |
| private typedef Accessor = { | |
| name: String, | |
| read: Bool, |
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
| package flash.events; | |
| extern class EventDispatcher implements IEventDispatcher { | |
| function new(?target:IEventDispatcher) : Void; | |
| function addEventListener<T:Event>(type:EventType<T>, listener: T->Void, useCapture:Bool = false, priority:Int = 0, useWeakReference:Bool = false):Void; | |
| function dispatchEvent(event:Event):Bool; | |
| function hasEventListener(type:String):Bool; | |
| function removeEventListener<T:Event>(type:EventType<T>, listener: T->Void, useCapture:Bool = false):Void; | |
| function toString():String; | |
| function willTrigger(type:String):Bool; |
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
| abstract Flags(Int) { | |
| public inline function new(i = 0) { | |
| this = i; | |
| } | |
| public inline function has( index : Int ) : Bool { | |
| return this & (1 << index) != 0; | |
| } |