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 House = | |
| { | |
| ?numTennants:OptionalField<Int> | |
| } | |
| class Main | |
| { | |
| static function main() | |
| { | |
| var house:House = {}; |
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 Reverse.reverse; | |
| class Main | |
| { | |
| static function main() | |
| { | |
| var a = [1,2,3]; | |
| for (v in reverse(a)) | |
| { | |
| trace(v); |
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
| local Anon_mt = { | |
| __newindex = function(self, key, value) | |
| if value ~= nil then | |
| rawset(self, key, value) | |
| else | |
| self._nils[key] = true | |
| end | |
| end, | |
| __tostring = function(self) |
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.Context; | |
| import haxe.macro.Expr; | |
| using haxe.macro.Tools; | |
| @:enum abstract MyEnum(Int) { | |
| var A = 1; | |
| var B = 2; | |
| var C = 3; | |
| } |
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
| using StringTools; | |
| typedef Build = { | |
| target:Target, | |
| output:String, | |
| classPaths:Array<String>, | |
| main:String, | |
| debug:Bool, | |
| libs:Array<String>, | |
| defines:Map<String, String>, |
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
| using Unpack; | |
| class Main { | |
| static function main() { | |
| f().unpackInto( [ v1, { a: { length: v2 } }, { a: [ v3, _, v4 ] } ] ); | |
| trace(v1); // { a: [ 1 ] } | |
| trace(v2); // 2 | |
| trace(v3); // 4 | |
| trace(v4); // 5 |
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.Context; | |
| import haxe.macro.Expr; | |
| class AbstractCompare | |
| { | |
| public static function build():Array<Field> | |
| { | |
| var ab = switch (Context.getLocalType()) | |
| { | |
| case TInst(_.get() => {kind: KAbstractImpl(a)}, _): |
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.Context; | |
| import haxe.macro.Expr; | |
| using haxe.macro.Tools; | |
| #end | |
| @:enum abstract MyEnum<T>(T) {} | |
| typedef A = MyEnum<Float>; | |
| typedef B = Array<{a:Int, ?b:Array<{?a:String}>}>; | |
| typedef C = Dynamic<Int>; |
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.Context; | |
| import haxe.macro.Type; | |
| using haxe.macro.Tools; | |
| class CheckMutating { | |
| static var metaToRemove:Array<MetaAccess>; | |
| static function use() { | |
| Context.onGenerate(function(types) { |
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 Main { | |
| static function main() { | |
| var signal = new Signal<Int,String>(); | |
| var conn = signal.connect(function(a, b) { | |
| trace('Well done $a $b'); | |
| }); | |
| signal.dispatch(10, "lol"); | |
| } | |
| } |