Skip to content

Instantly share code, notes, and snippets.

@skial
skial / Macro.hx
Created March 17, 2015 15:02
Change with the output order, but not the execution order of classes using Haxe 3.2.0.rc.1 and node.
package;
import haxe.ds.StringMap;
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.Context;
import haxe.macro.Compiler;
using StringTools;
@skial
skial / Macro.hx
Last active August 29, 2015 14:17
Compiler.exclude and flat js package issue
package;
#if macro
import haxe.macro.Compiler;
import haxe.macro.Context;
import haxe.macro.Expr;
#end
class Macro {
@skial
skial / Macro.hx
Created March 16, 2015 14:57
Abusing macros causes flat js packages mixed with normal dotted packages.
package;
#if macro
import haxe.macro.Compiler;
import haxe.macro.Context;
import haxe.macro.Expr;
#end
class Macro {
package ;
/**
* ...
* @author Skial Bainn
*/
class Main {
public static function main() new Main();
@skial
skial / Macro.hx
Created October 29, 2014 11:35
How to collect values across multiple @:autoBuild macro runs. Using Haxe 3.2.0 (git build development @ 3a255a8).
package ;
import haxe.ds.StringMap;
import haxe.macro.Compiler;
import haxe.macro.Printer;
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.Context;
using StringTools;
@skial
skial / Builder.hx
Last active October 3, 2017 14:47
Code exercise while my internet was down for the safe navigation operator from AS3 started by this Haxe mailing list thread https://groups.google.com/forum/#!topic/haxelang/Rrj9AUbXGuA using Haxe 3.2.0 (git build development @ 3a255a8).
package ;
import haxe.macro.*;
import haxe.macro.Expr.ComplexType;
using haxe.macro.ExprTools;
/**
* ...
* @author Skial Bainn
*/
package ;
import byte.ByteData;
class Main {
public static function main() {
var l = new RandomLexer( ByteData.ofString( '<tag><hello></hello><world></world></tag>' ), 'random-pause' );
var t = [];
try while (true) t.push( l.token( RandomLexer.root ) ) catch (e:Dynamic) trace( e );
@skial
skial / MacroHijacked.hx
Created February 20, 2014 14:10
Initial step towards creating `Hijacked` type's. Probably a more appropriate name for this.
package ;
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.Context;
using haxe.macro.Tools;
class MacroHijacked {
@skial
skial / Main.hx
Created November 8, 2013 15:24
Abstract bug?
package ;
using Lambda;
class Main {
public static function main() {
var a = ['a', 'b', 'c'];
var m:MyArray = a;
@skial
skial / Macro.hx
Last active December 3, 2018 15:23
Get function name in 3 different ways, each in increasing amounts of magic.
package example.methodName;
import haxe.macro.Printer;
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.Context;
/**
* ...
* @author Skial Bainn