This file contains 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
/** | |
* Simple wrapper for anonymous structures that are meant to be used as a | |
* keyed collection of objects of the same type (i.e. json object). | |
* | |
* Wraps Reflect calls with nice syntax and static typing without any | |
* runtime overhead. | |
*/ | |
abstract DynamicMap<V>(Dynamic<V>) from Dynamic<V> | |
{ | |
/** |
This file contains 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; | |
import haxe.macro.Type; | |
using haxe.macro.TypeTools; | |
/** | |
* Частичный бекпорт функциональности @:enum abstract из Haxe 3.1 | |
* | |
* @:enum abstract'ы - элегантная замена набору констант с проверкой значений на этапе компиляции. |
This file contains 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; | |
import haxe.macro.Type; | |
import haxe.macro.ComplexTypeTools; | |
class CommandMacro | |
{ | |
public static function build():Array<Field> | |
{ |
This file contains 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 a = ["a", "b", "c"]; | |
for (p in new IndexIter(a)) | |
{ | |
trace(p.idx); | |
trace(p.val); |
This file contains 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
@:genericBuild(ConstMacro.build()) | |
class Const<T> {} |
This file contains 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.ExprTools; | |
class Main | |
{ | |
inline static var QUOTED_FIELD_PREFIX = "@$__hx__"; | |
static function main() |
This file contains 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 ArrayRead<T>(Array<T>) from Array<T> { | |
@:arrayAccess inline function get(i:Int):T return this[i]; | |
public var length(get,never):Int; | |
inline function get_length() return this.length; | |
} |
This file contains 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 extends unityengine.MonoBehaviour | |
{ | |
function Update() | |
{ | |
unityengine.Debug.Log("Hello"); | |
} | |
} |
This file contains 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 EnumAbstractMacro | |
{ | |
public static function build():Array<Field> | |
{ | |
var fields = Context.getBuildFields(); | |
var values = []; |
This file contains 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 TypedFieldMacro; | |
typedef A = {?f:Int} | |
class Main | |
{ | |
static function main() | |
{ | |
var a:A = {f:1}; | |
if (a.f.exists()) trace(a.f); |