haxetink / tink_macro

The macro toolkit
MIT License
57 stars 18 forks source link

Exprs.eval and stored typed expressions does not work for Haxe 4.3 + #37

Open back2dos opened 3 years ago

back2dos commented 3 years ago

See tests.

PaulPatat commented 11 months ago

Is this why my build macro is giving 'build failure' in Haxe 4.3?

import haxe.macro.Context;
import haxe.macro.Expr;

using StringTools;

class EnumBuilder {
        macro static public function build(types:ExprOf<Map<Int, String>>):Array<Field> {
                var t:Map<Int, String> = tink.macro.Exprs.eval(types);
                var fields = Context.getBuildFields()
                for (i => name in t) {
                        fields.push({
                                name: name,
                                doc: null,
                                meta: [],
                                access: [APublic],
                                kind: FVar(null, macro $v{i}),
                                pos: Context.currentPos(),
                        });
                }
                return fields;
        }
back2dos commented 10 months ago

Hard to know for sure without more context, but yes, it's a possible cause.