Merge branch 'master' of https://github.com/haxetink/tink_macro
This commit is contained in:
59
README.md
59
README.md
@@ -1,4 +1,5 @@
|
||||
# Tinkerbell Macro Library
|
||||
[](https://gitter.im/haxetink/public)
|
||||
|
||||
Explained in current marketing speak, `tink_macro` is *the* macro toolkit ;)
|
||||
|
||||
@@ -12,34 +13,34 @@ As Haxe evolved and some of the functionality has been integrated/reimplemented/
|
||||
|
||||
The library is build on top of the haxe macro API and `tink_core`, having three major parts:
|
||||
|
||||
<!-- START INDEX -->
|
||||
- [Macro API](#macro-api)
|
||||
-
|
||||
- [Expression Tools](#expression-tools)
|
||||
- [Basic Helpers](#basic-helpers)
|
||||
- [Extracting Constants](#extracting-constants)
|
||||
- [Shortcuts](#shortcuts)
|
||||
- [Type Inspection](#type-inspection)
|
||||
- [Advanced Transformations](#advanced-transformations)
|
||||
- [Position Tools](#position-tools)
|
||||
- [Type Tools](#type-tools)
|
||||
- [Function Tools](#function-tools)
|
||||
- [Operation Tools](#operation-tools)
|
||||
- [Metadata Tools](#metadata-tools)
|
||||
- [Build Infrastructure](#build-infrastructure)
|
||||
- [Member](#member)
|
||||
- [ClassBuilder](#classbuilder)
|
||||
- [Constructor](#constructor)
|
||||
- [Creation](#creation)
|
||||
- [Visibility](#visibility)
|
||||
- [Initial Super Call](#initial-super-call)
|
||||
- [Simple Modifications](#simple-modifications)
|
||||
- [Field Initialization](#field-initialization)
|
||||
- [Setter Bypass](#setter-bypass)
|
||||
- [Initialization Options](#initialization-options)
|
||||
- [Expression Level Transformation](#expression-level-transformation)
|
||||
- [TypeMap](#typemap)
|
||||
|
||||
<!-- START INDEX -->
|
||||
- [Macro API](#macro-api)
|
||||
-
|
||||
- [Expression Tools](#expression-tools)
|
||||
- [Basic Helpers](#basic-helpers)
|
||||
- [Extracting Constants](#extracting-constants)
|
||||
- [Shortcuts](#shortcuts)
|
||||
- [Type Inspection](#type-inspection)
|
||||
- [Advanced Transformations](#advanced-transformations)
|
||||
- [Position Tools](#position-tools)
|
||||
- [Type Tools](#type-tools)
|
||||
- [Function Tools](#function-tools)
|
||||
- [Operation Tools](#operation-tools)
|
||||
- [Metadata Tools](#metadata-tools)
|
||||
- [Build Infrastructure](#build-infrastructure)
|
||||
- [Member](#member)
|
||||
- [ClassBuilder](#classbuilder)
|
||||
- [Constructor](#constructor)
|
||||
- [Creation](#creation)
|
||||
- [Visibility](#visibility)
|
||||
- [Initial Super Call](#initial-super-call)
|
||||
- [Simple Modifications](#simple-modifications)
|
||||
- [Field Initialization](#field-initialization)
|
||||
- [Setter Bypass](#setter-bypass)
|
||||
- [Initialization Options](#initialization-options)
|
||||
- [Expression Level Transformation](#expression-level-transformation)
|
||||
- [TypeMap](#typemap)
|
||||
|
||||
<!-- END INDEX -->
|
||||
|
||||
# Macro API
|
||||
@@ -412,4 +413,4 @@ Because the state of a constructor is rather delicate, the API prohibits you to
|
||||
|
||||
# TypeMap
|
||||
|
||||
You can find a type map, i.e. a map where the keys are `haxe.macro.Type`, in `tink.macro.TypeMap`. It's pretty much an ordinary map. Currently, it relies rather strongly on [`haxe.macro.TypeTools.toString()`](http://api.haxe.org/haxe/macro/TypeTools.html#toString) and it remains to be determined whether that is a reliable choice. Please report any issues you might face.
|
||||
You can find a type map, i.e. a map where the keys are `haxe.macro.Type`, in `tink.macro.TypeMap`. It's pretty much an ordinary map. Currently, it relies rather strongly on [`haxe.macro.TypeTools.toString()`](http://api.haxe.org/haxe/macro/TypeTools.html#toString) and it remains to be determined whether that is a reliable choice. Please report any issues you might face.
|
||||
|
||||
@@ -27,10 +27,10 @@ private class Heureka { public function new() {} }
|
||||
class Exprs {
|
||||
|
||||
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)
|
||||
switch e {
|
||||
case { expr: EFunction(_) } if (options != null || options.enterFunctions != true):
|
||||
case { expr: EFunction(_) } if (skipFunctions):
|
||||
case _ if (condition(e)): throw new Heureka();
|
||||
default: haxe.macro.ExprTools.iter(e, seek);
|
||||
}
|
||||
@@ -394,4 +394,4 @@ class Exprs {
|
||||
static inline var NOT_A_STRING = "string constant expected";
|
||||
static inline var NOT_A_NAME = "name expected";
|
||||
static inline var NOT_A_FUNCTION = "function expected";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user