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 ; | |
| abstract Animals(ExampleData) from ExampleData { | |
| public var dog(get, never):Animal; | |
| inline function get_dog():Animal return this.dog; | |
| public var cat(get, never):Animal; | |
| inline function get_cat():Animal return this.cat; | |
| public var cow(get, never):Animal; |
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.rtti.Meta; | |
| typedef BuildInfo = { | |
| date: Date, | |
| } | |
| class Build { | |
| static public var info(get, null):BuildInfo; | |
| static function get_info() { |
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 ; | |
| abstract MyAbstract(Int) { | |
| public function new(v:Int) this = v; | |
| @:from static function fromString(s:String) return new MyAbstract(Std.parseInt(s)); | |
| } | |
| class Main { | |
| #if !macro | |
| static function main() { | |
| var d:Dynamic = test(); |
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 Manual { | |
| static var pool = []; | |
| static var check = new Map<Manual, Manual>(); | |
| var count:Int = 0; | |
| function new() {} | |
| function init() {/*set up*/} | |
| function free() {/*clean up*/} |
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 ; | |
| abstract Abstract<T>(T->Void) from (T->Void) { | |
| function new(f:T->Void) | |
| this = f; | |
| } | |
| class Example { | |
| static function testAbstract(c:Abstract<haxe.ds.Option<Bool>>) { } | |
| static function testFunction(c:haxe.ds.Option<Bool>->Void) { } |
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.Expr; | |
| import haxe.macro.Context; | |
| class Interp { | |
| static function error(pos:Position, ?msg = 'Constant value expected'):Dynamic | |
| return Context.error(msg, pos); | |
| static function const(c:Constant, pos):Dynamic | |
| return |
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 haxe.macro.Expr; | |
| import haxe.macro.Context; | |
| class Build { | |
| static public function types() { | |
| var pos = Context.currentPos(); | |
| function mkPath(name:String):TypePath { | |
| var parts = name.split('.'); | |
| return { | |
| sub: null, |
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 ; | |
| abstract JsonMap<T>({ }) from {} { | |
| public function new() this = {}; | |
| public function exists(key:String) return Reflect.hasField(this, key); | |
| @:arrayAccess public function get(key:String) return Reflect.field(this, key); | |
| @:arrayAccess public function set(key:String, value:T):T { | |
| Reflect.setField(this, key, value); | |
| return value; | |
| } |
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 A { | |
| public var i(get, null):Int; | |
| public function new() i = 0 | |
| function get_i() return i-- | |
| } | |
| class Main { | |
| static function main() | |
| switch (new A()) { | |
| case a if (a.i < 0): trace('negative'); | |
| case a if (a.i == 0): trace('zero'); |
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 ; | |
| @:build(MetaCheck.build()) | |
| class Main { | |
| static function main() { | |
| trace(Meta.getStatics(Main).main.AngularSupport); | |
| } | |
| @AngularSupport({ inject:["$scope", '$http'], scope:'$scope' }) | |
| function foo() {} | |
| @AngularSupport({ inject:["$scope", '$http'], scfope:'$scope' })//will cause an error |