Rename facade and update code to deal with that.
This commit is contained in:
@@ -13,9 +13,9 @@ typedef Outcome<D, F> = tink.core.Outcome<D, F>;
|
|||||||
typedef OutcomeTools = tink.core.Outcome.OutcomeTools;
|
typedef OutcomeTools = tink.core.Outcome.OutcomeTools;
|
||||||
//TODO: consider adding stuff from haxe.macro.Expr here
|
//TODO: consider adding stuff from haxe.macro.Expr here
|
||||||
|
|
||||||
class Macro {
|
class MacroApi {
|
||||||
static var idCounter = 0;
|
static var idCounter = 0;
|
||||||
static public inline function tempName(c:Class<String>, ?prefix = '__tinkTmp'):String
|
static public inline function tempName(?prefix = '__tinkTmp'):String
|
||||||
return prefix + Std.string(idCounter++);
|
return prefix + Std.string(idCounter++);
|
||||||
static public function pos() return haxe.macro.Context.currentPos();
|
static public function pos() return haxe.macro.Context.currentPos();
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import haxe.macro.Type;
|
|||||||
import haxe.macro.Context;
|
import haxe.macro.Context;
|
||||||
import haxe.macro.Printer;
|
import haxe.macro.Printer;
|
||||||
|
|
||||||
using tink.Macro;
|
using tink.MacroApi;
|
||||||
using Lambda;
|
using Lambda;
|
||||||
|
|
||||||
class ClassBuilder {
|
class ClassBuilder {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package tink.macro;
|
|||||||
|
|
||||||
import haxe.macro.Expr;
|
import haxe.macro.Expr;
|
||||||
|
|
||||||
using tink.Macro;
|
using tink.MacroApi;
|
||||||
|
|
||||||
class Constructor {
|
class Constructor {
|
||||||
var oldStatements:Array<Expr>;
|
var oldStatements:Array<Expr>;
|
||||||
@@ -18,7 +18,7 @@ class Constructor {
|
|||||||
public function new(f:Function, ?isPublic:Null<Bool> = null, ?pos:Position) {
|
public function new(f:Function, ?isPublic:Null<Bool> = null, ?pos:Position) {
|
||||||
this.nuStatements = [];
|
this.nuStatements = [];
|
||||||
this.isPublic = isPublic;
|
this.isPublic = isPublic;
|
||||||
this.pos = pos.getPos();
|
this.pos = pos.sanitize();
|
||||||
|
|
||||||
this.onGenerateHooks = [];
|
this.onGenerateHooks = [];
|
||||||
this.args = [];
|
this.args = [];
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class Exprs {
|
|||||||
if (Reflect.hasField(rules, s))
|
if (Reflect.hasField(rules, s))
|
||||||
Reflect.field(rules, s)
|
Reflect.field(rules, s)
|
||||||
else if (s.startsWith('tmp')) {
|
else if (s.startsWith('tmp')) {
|
||||||
Reflect.setField(rules, s, Macro.tempName(String, '__tink' + s.substr(3)));
|
Reflect.setField(rules, s, MacroApi.tempName('__tink' + s.substr(3)));
|
||||||
replace(s);
|
replace(s);
|
||||||
}
|
}
|
||||||
else s;
|
else s;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package tink.macro;
|
package tink.macro;
|
||||||
|
|
||||||
import haxe.macro.Expr;
|
import haxe.macro.Expr;
|
||||||
using tink.Macro;
|
using tink.MacroApi;
|
||||||
|
|
||||||
abstract Member(Field) from Field to Field {
|
abstract Member(Field) from Field to Field {
|
||||||
static public function prop(name:String, t:ComplexType, pos, ?noread = false, ?nowrite = false):Member {
|
static public function prop(name:String, t:ComplexType, pos, ?noread = false, ?nowrite = false):Member {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package tink.macro;
|
|||||||
|
|
||||||
import haxe.macro.Expr;
|
import haxe.macro.Expr;
|
||||||
|
|
||||||
using tink.Macro;
|
using tink.MacroApi;
|
||||||
|
|
||||||
class Binary {
|
class Binary {
|
||||||
static public function get(o:Binop, e:Expr)
|
static public function get(o:Binop, e:Expr)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package ;
|
package ;
|
||||||
|
|
||||||
import haxe.macro.Expr;
|
import haxe.macro.Expr;
|
||||||
using tink.Macro;
|
using tink.MacroApi;
|
||||||
|
|
||||||
class Exprs extends Base {
|
class Exprs extends Base {
|
||||||
function exprEq(e1:Expr, e2:Expr) {
|
function exprEq(e1:Expr, e2:Expr) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package ;
|
|||||||
import haxe.macro.Context;
|
import haxe.macro.Context;
|
||||||
import haxe.macro.Expr;
|
import haxe.macro.Expr;
|
||||||
|
|
||||||
using tink.Macro;
|
using tink.MacroApi;
|
||||||
|
|
||||||
class Positions extends Base {
|
class Positions extends Base {
|
||||||
function stringCompare<A>(v1:A, v2:A)
|
function stringCompare<A>(v1:A, v2:A)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package ;
|
|||||||
import haxe.macro.Expr;
|
import haxe.macro.Expr;
|
||||||
import haxe.macro.Context;
|
import haxe.macro.Context;
|
||||||
|
|
||||||
using tink.Macro;
|
using tink.MacroApi;
|
||||||
|
|
||||||
class Types extends Base {
|
class Types extends Base {
|
||||||
function type(c:ComplexType)
|
function type(c:ComplexType)
|
||||||
@@ -35,12 +35,12 @@ class Types extends Base {
|
|||||||
assertSuccess((macro : Int).toType());
|
assertSuccess((macro : Int).toType());
|
||||||
assertFailure((macro : Tni).toType());
|
assertFailure((macro : Tni).toType());
|
||||||
function blank()
|
function blank()
|
||||||
return type(Macro.pos().makeBlankType());
|
return type(MacroApi.pos().makeBlankType());
|
||||||
|
|
||||||
var bool = type(macro : Bool);
|
var bool = type(macro : Bool);
|
||||||
assertTrue(blank().isSubTypeOf(bool).isSuccess());
|
assertTrue(blank().isSubTypeOf(bool).isSuccess());
|
||||||
assertTrue(bool.isSubTypeOf(blank()).isSuccess());
|
assertTrue(bool.isSubTypeOf(blank()).isSuccess());
|
||||||
|
|
||||||
Macro.pos().makeBlankType().toString();
|
MacroApi.pos().makeBlankType().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user