tink_onbuild


https://haxetink.github.io/tink_onbuild/

To install, run:

haxelib install tink_onbuild 0.1.0 

See using Haxelib in Haxelib documentation for more information.

README.md

tink_onbuild

This is a helper library to streamline onGenerate/onAfterGenerate passes. It does two things:

  1. Allow different libraries to register their passes in an orderly fashion via tink_priority queues.
  2. Avoid duplicate encoding from compiler to interpreter data structures.

The basic API looks like this:

class OnBuild {
  static public final before:Passes;
  static public final after:Passes;
}
// with this:
private class Passes {
  public final types:Queue<ReadOnlyArray<Type>->Void>;
  public final exprs:Queue<Type->Null<ClassField->Null<TypedExpr->Void>>>;
}

The callback type for expressions is a bit involved.

It is called for every type. If you wish to skip the type, you can return null. Otherwise, it is called with every field on the type. If you wish to skip the field, you can return null. Otherwise the returned callback is run on every subexpression of said field.

To run before/after the expression pass, use tink.OnBuild.EXPR_PASS as ID.

Caution

Because the data structures of the macro APIs are mutable and the data is shared between all callbacks, it is left up to you not to mutate them - otherwise other callbacks may be passed falsified data.

Defines

Cache typed AST -D tink_onbuild.cache_tast

Setting this define will make it so that any field's typed AST is cached. Normally, this in not required. If you do wish to access field expressions from type passes, turning on this flag may improve performance (it will however keep all decoded typed AST in memory).

Contributors
back2dos
Version
0.1.0
Published
5 years ago
Dependencies
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂