Merge branch 'master' of https://github.com/haxetink/tink_macro
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
# Tinkerbell Macro Library
|
# Tinkerbell Macro Library
|
||||||
|
[](https://gitter.im/haxetink/public)
|
||||||
|
|
||||||
Explained in current marketing speak, `tink_macro` is *the* macro toolkit ;)
|
Explained in current marketing speak, `tink_macro` is *the* macro toolkit ;)
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ private class Heureka { public function new() {} }
|
|||||||
class Exprs {
|
class Exprs {
|
||||||
|
|
||||||
static public function has(e:Expr, condition:Expr->Bool, ?options: { ?enterFunctions: Bool }) {
|
static public function has(e:Expr, condition:Expr->Bool, ?options: { ?enterFunctions: Bool }) {
|
||||||
var enterFunctions = options != null && options.enterFunctions;
|
var skipFunctions = options == null || options.enterFunctions != true;
|
||||||
function seek(e:Expr)
|
function seek(e:Expr)
|
||||||
switch e {
|
switch e {
|
||||||
case { expr: EFunction(_) } if (options != null || options.enterFunctions != true):
|
case { expr: EFunction(_) } if (skipFunctions):
|
||||||
case _ if (condition(e)): throw new Heureka();
|
case _ if (condition(e)): throw new Heureka();
|
||||||
default: haxe.macro.ExprTools.iter(e, seek);
|
default: haxe.macro.ExprTools.iter(e, seek);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user