Build cache works better with compiler server.

This commit is contained in:
back2dos
2017-03-06 17:58:07 +01:00
parent dbebd0d70d
commit bd4b8c436f

View File

@@ -5,6 +5,7 @@ import haxe.macro.Expr;
import haxe.macro.Type; import haxe.macro.Type;
import tink.macro.TypeMap; import tink.macro.TypeMap;
using tink.MacroApi;
using haxe.macro.Tools; using haxe.macro.Tools;
typedef BuildContextN = { typedef BuildContextN = {
@@ -104,7 +105,7 @@ class BuildCache {
usings: ctx.usings usings: ctx.usings
})); }));
} }
static public function getType(name, ?type, ?pos:Position, build:BuildContext->TypeDefinition) { static public function getType(name, ?type, ?pos:Position, build:BuildContext->TypeDefinition) {
if (pos == null) if (pos == null)
@@ -156,18 +157,29 @@ private class Group {
usings: usings, usings: usings,
name: path.split('.').pop() name: path.split('.').pop()
}); });
Context.defineModule(path, [def], usings);
entries.set(type, { name: path } ); entries.set(type, { name: path } );
Context.defineModule(path, [def], usings);
return Context.getType(path); return Context.getType(path);
} }
function doMake()
while (true)
switch '$name${counter++}' {
case _.definedType() => Some(_):
case v:
return make(v);
}
return return
switch entries.get(type) { switch entries.get(type) {
case null: case null:
make('$name${counter++}'); doMake();
case v: case v:
Context.getType(v.name); switch v.name.definedType() {
case Some(v): v;
default: doMake();
}
} }
} }
} }