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 { | |
var arg1:Int; | |
var arg2:String; | |
var arg3:Bool; | |
function new(arg1 = 0, arg2 = "foo", arg3 = false) { | |
MyMacro.initLocals(); | |
} | |
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 { | |
function new() { } | |
static function main() { | |
var intMap = [1 => "foo", 2 => "bar"]; | |
var stringMap = ["foo" => 1, "bar" => 2]; | |
var m1 = new Main(); | |
var m2 = new Main(); | |
var objMap = [m1 => "foo", m2 => "bar"]; |
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.Tools; | |
using Lambda; | |
class DeprecationMacro { | |
/** |
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 hxparse.Ruleset; | |
import hxparse.State; | |
import dot.Graph; | |
import dot.Node; | |
import dot.Attribute; | |
using Lambda; | |
class LexerGraph<T> { | |
var graph:Graph; |
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.Expr; | |
using haxe.macro.Tools; | |
abstract Fast(Xml) from Xml to Xml { | |
@:noCompletion public inline function new(xml:Xml) this = xml; | |
public var name(get,never):String; | |
inline function get_name() return this.nodeName; | |
public var elements(get,never):FastIterator; |
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
enum E<T> { | |
BoolLit(b:Bool):E<Bool>; | |
IntLit(i:Int):E<Int>; | |
} | |
class Main { | |
static function main() { } | |
static function sameType<S>(o1:E<S>, o2:E<S>):Bool { | |
return switch [o1, o2] { // Unmatched patterns: [_,IntLit] |
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 { | |
public static function main () { | |
var cfgString = "{ | |
'someValue': ::(values.width-305)/2 + values.height::, | |
'constantValue': 13 | |
}"; | |
var template = new templo.Template(new haxe.io.StringInput(cfgString)); | |
var values = { | |
width: 500, |
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() { | |
trace("Hello world"); | |
} | |
} |
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(MyMacro.buildTuple()) | |
class Tuple<Const> { } | |
class Main { | |
static public function main() { | |
var t = new Tuple<3>(1, "foo", true); | |
trace(t.v0); | |
trace(t.v1); | |
trace(t.v2); | |
} |
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 var fields = MyMacro.buildFieldsArray(); | |
static function main() { | |
trace(fields); // [x,y,test,fields,main] | |
} | |
var x:Int; | |
var y:String; | |
function test() { |