Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6b8be33832 | ||
![]() |
8b769e5938 | ||
![]() |
0ca2e371d4 | ||
![]() |
472916f2af | ||
![]() |
2471637905 | ||
![]() |
c400f5af51 |
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -13,7 +13,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
haxe-version:
|
||||
- "3.4.7"
|
||||
- stable
|
||||
- nightly
|
||||
target:
|
||||
|
@@ -1,3 +1,3 @@
|
||||
# @install: lix --silent download "gh://github.com/haxetink/tink_core#abee932c4e724517090238b6527eac28874c0354" into tink_core/1.27.1/github/abee932c4e724517090238b6527eac28874c0354
|
||||
-cp ${HAXE_LIBCACHE}/tink_core/1.27.1/github/abee932c4e724517090238b6527eac28874c0354/src
|
||||
-D tink_core=1.27.1
|
||||
# @install: lix --silent download "haxelib:/tink_core#2.1.0" into tink_core/2.1.0/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/tink_core/2.1.0/haxelib/src
|
||||
-D tink_core=2.1.0
|
@@ -9,8 +9,8 @@
|
||||
"contributors": [
|
||||
"back2dos"
|
||||
],
|
||||
"version": "1.0.0",
|
||||
"releasenote": "Let's just commit to the API and move on.",
|
||||
"version": "1.0.2",
|
||||
"releasenote": "Add Member::hasMeta.",
|
||||
"tags": [
|
||||
"tink",
|
||||
"macro",
|
||||
|
@@ -33,15 +33,22 @@ class MacroApi {
|
||||
|
||||
static var MAIN_CANDIDATES = ['-main', '-x', '--run'];
|
||||
static public function getMainClass():Option<String> {
|
||||
var args = Sys.args();
|
||||
|
||||
for (c in MAIN_CANDIDATES)
|
||||
switch args.indexOf(c) {
|
||||
case -1:
|
||||
case v: return Some(args[v+1]);
|
||||
#if (haxe_ver >= 4.3)
|
||||
return switch haxe.macro.Compiler.getConfiguration().mainClass {
|
||||
case null: None;
|
||||
case p: Some(p.pack.concat([p.name]).join('.'));
|
||||
}
|
||||
#else
|
||||
var args = Sys.args();
|
||||
|
||||
return None;
|
||||
for (c in MAIN_CANDIDATES)
|
||||
switch args.indexOf(c) {
|
||||
case -1:
|
||||
case v: return Some(args[v+1]);
|
||||
}
|
||||
|
||||
return None;
|
||||
#end
|
||||
}
|
||||
|
||||
@:persistent static var idCounter = 0;
|
||||
|
@@ -98,6 +98,12 @@ abstract Member(Field) from Field to Field {
|
||||
return
|
||||
if (this.meta == null) [];
|
||||
else [for (tag in this.meta) if (tag.name == name) tag];
|
||||
|
||||
public function hasMeta(name) {
|
||||
for (m in this.meta)
|
||||
if (m.name == name) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public inline function asField():Field return this;
|
||||
public function publish()
|
||||
|
@@ -214,7 +214,7 @@ class Types {
|
||||
static public function deduceCommonType(types:Array<Type>):Outcome<Type, Error> {
|
||||
var exprs = types.map(function(t) {
|
||||
var ct = t.toComplex();
|
||||
return macro (null:$ct);
|
||||
return macro (cast null:$ct);
|
||||
});
|
||||
|
||||
return switch (macro $a{exprs}).typeof() {
|
||||
|
@@ -29,7 +29,9 @@ abstract PhysicalType<T>(Either<Class<T>, Enum<T>>) {
|
||||
}
|
||||
//TODO: this helper should go somewhere
|
||||
class Base extends TestCase {
|
||||
|
||||
function stringCompare<A>(v1:A, v2:A, ?pos)
|
||||
assertEquals(Std.string(v1), Std.string(v2), pos);
|
||||
|
||||
function fail(msg:String, ?c : PosInfos) {
|
||||
currentTest.done = true;
|
||||
currentTest.success = false;
|
||||
|
@@ -21,8 +21,9 @@ class Exprs extends Base {
|
||||
var expr = macro (untyped {foo:[{bar:234},'bar']});
|
||||
var str = Std.string(untyped {foo:[{bar:234},'bar']});
|
||||
assertEquals(Std.string(expr.eval()), Std.string(untyped {foo:[{bar:234},'bar']}));
|
||||
assertEquals(Std.string(Context.typeExpr(expr).eval()), Std.string(untyped {foo:[{bar:234},'bar']}));
|
||||
|
||||
// This doesn't work in Haxe 4.3, which is correct, because typeExpr types an expression into target context, rather than macro context
|
||||
// assertEquals(Std.string(Context.typeExpr(expr).eval()), Std.string(untyped {foo:[{bar:234},'bar']}));
|
||||
}
|
||||
function testGet() {
|
||||
assertEquals('foo', (macro foo).getIdent().sure());
|
||||
|
@@ -6,8 +6,6 @@ import haxe.macro.Expr;
|
||||
using tink.MacroApi;
|
||||
|
||||
class Positions extends Base {
|
||||
function stringCompare<A>(v1:A, v2:A)
|
||||
assertEquals(Std.string(v1), Std.string(v2));
|
||||
|
||||
function testSanitize() {
|
||||
var p:Position = null;
|
||||
@@ -19,6 +17,6 @@ class Positions extends Base {
|
||||
function testBlank() {
|
||||
var p:Position = null;
|
||||
var t = p.makeBlankType();
|
||||
stringCompare('TMono(<mono>)', cast t.toType().sure());
|
||||
stringCompare('TMono(<mono>)', cast t.toType().sure().reduce());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user