Update to newest haxe version.

This commit is contained in:
Juraj Kirchheim
2019-09-13 09:39:24 +02:00
parent 4fd03ed667
commit 3356172b7f
5 changed files with 27 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
{
"version": "4.0.0-rc.3",
"version": "e552bdc",
"resolveLibs": "scoped"
}

View File

@@ -1,3 +1,3 @@
# @install: lix --silent download "haxelib:tink_core#1.16.1" into tink_core/1.16.1/haxelib
-D tink_core=1.16.1
-cp ${HAXESHIM_LIBCACHE}/tink_core/1.16.1/haxelib/src
-D tink_core=1.24.0
# @install: lix --silent download "haxelib:/tink_core#1.24.0" into tink_core/1.24.0/haxelib
-cp ${HAXE_LIBCACHE}/tink_core/1.24.0/haxelib/src

View File

@@ -4,9 +4,18 @@ import haxe.macro.Expr;
using tink.macro.Exprs;
#if haxe4
private abstract Kind(FunctionKind) from FunctionKind to FunctionKind {
@:from static function ofString(s:String):Kind
return FNamed(s);
}
#else
private typedef Kind = String;
#end
class Functions {
static public inline function asExpr(f:Function, ?name, ?pos)
return EFunction(name, f).at(pos);
static public inline function asExpr(f:Function, ?kind:Kind, ?pos)
return EFunction(kind, f).at(pos);
static public inline function toArg(name:String, ?t, ?opt = false, ?value = null):FunctionArg {
return {

11
tests/Functions.hx Normal file
View File

@@ -0,0 +1,11 @@
import haxe.macro.Context;
import haxe.macro.Expr;
using tink.MacroApi;
class Functions extends Base {
function test() {
var f:Function = (macro function () {}).getFunction().sure();
f.asExpr('foo');
assertTrue(true);
}
}

View File

@@ -12,6 +12,7 @@ class Run {
new Types(),
new Positions(),
new TypeMapTest(),
new Functions(),
new Misc(),
];
#end