Compare commits

..

13 Commits

Author SHA1 Message Date
Juraj Kirchheim
08249260f9 Bump version. 2024-11-27 08:40:44 +01:00
Juraj Kirchheim
e24941880a Get travix from haxelib. 2024-11-27 08:35:08 +01:00
Juraj Kirchheim
bdf78197db Merge pull request #40 from kLabz/fix_weird_partial_resolution
Fix weird partial module resolution
2024-11-27 07:17:44 +01:00
k
635e64ebf1 Fix weird partial module resolution
See https://github.com/HaxeFoundation/haxe/pull/11338
2024-11-26 16:09:56 +01:00
Juraj Kirchheim
990096cfd5 Release 1.0.3 2023-11-09 07:34:56 +01:00
Juraj Kirchheim
1df0dd6d6c Make Member::hasMeta null safe. 2023-11-09 07:33:17 +01:00
Juraj Kirchheim
6b8be33832 Release 1.0.2 2023-11-09 06:35:53 +01:00
Juraj Kirchheim
8b769e5938 Add Member::hasMeta. 2023-11-09 06:32:57 +01:00
Juraj Kirchheim
0ca2e371d4 Remove 3.4.7 from CI. 2023-04-06 06:44:26 +00:00
Juraj Kirchheim
472916f2af Release 1.0.1 2023-04-06 06:42:09 +00:00
Juraj Kirchheim
2471637905 Fix tests for 4.3 and make use of getConfiguration. 2023-04-06 06:41:28 +00:00
Juraj Kirchheim
c400f5af51 Comment out test failing on nightly. 2021-07-07 09:09:40 +02:00
Juraj Kirchheim
32d711cd71 Release 1.0.0 2021-07-06 19:31:17 +02:00
11 changed files with 42 additions and 26 deletions

View File

@@ -13,7 +13,6 @@ jobs:
strategy: strategy:
matrix: matrix:
haxe-version: haxe-version:
- "3.4.7"
- stable - stable
- nightly - nightly
target: target:

View File

@@ -1,3 +1,3 @@
# @install: lix --silent download "gh://github.com/haxetink/tink_core#abee932c4e724517090238b6527eac28874c0354" into tink_core/1.27.1/github/abee932c4e724517090238b6527eac28874c0354 # @install: lix --silent download "haxelib:/tink_core#2.1.0" into tink_core/2.1.0/haxelib
-cp ${HAXE_LIBCACHE}/tink_core/1.27.1/github/abee932c4e724517090238b6527eac28874c0354/src -cp ${HAXE_LIBCACHE}/tink_core/2.1.0/haxelib/src
-D tink_core=1.27.1 -D tink_core=2.1.0

View File

@@ -1,7 +1,7 @@
# @install: lix --silent download "gh://github.com/back2dos/travix#354c2b2a82cc3b03e2f87cc1b6f0ddc0a6a5c133" into travix/0.15.0/github/354c2b2a82cc3b03e2f87cc1b6f0ddc0a6a5c133 # @install: lix --silent download "haxelib:/travix#0.15.3" into travix/0.15.3/haxelib
# @post-install: cd ${HAXE_LIBCACHE}/travix/0.15.0/github/354c2b2a82cc3b03e2f87cc1b6f0ddc0a6a5c133 && haxe -cp src --run travix.PostDownload # @post-install: cd ${HAXE_LIBCACHE}/travix/0.15.3/haxelib && haxe -cp src --run travix.PostDownload
# @run: haxelib run-dir travix ${HAXE_LIBCACHE}/travix/0.15.0/github/354c2b2a82cc3b03e2f87cc1b6f0ddc0a6a5c133 # @run: haxelib run-dir travix "${HAXE_LIBCACHE}/travix/0.15.3/haxelib"
-lib tink_cli -lib tink_cli
-cp ${HAXE_LIBCACHE}/travix/0.15.0/github/354c2b2a82cc3b03e2f87cc1b6f0ddc0a6a5c133/src -cp ${HAXE_LIBCACHE}/travix/0.15.3/haxelib/src
-D travix=0.15.0 -D travix=0.15.3
--macro travix.Macro.setup() --macro travix.Macro.setup()

View File

@@ -9,8 +9,8 @@
"contributors": [ "contributors": [
"back2dos" "back2dos"
], ],
"version": "0.24.0", "version": "1.0.4",
"releasenote": "Add eval to Expr/TypedExpr.", "releasenote": "Haxe 5 compat",
"tags": [ "tags": [
"tink", "tink",
"macro", "macro",

View File

@@ -21,7 +21,7 @@ typedef TypeMap<T> = tink.macro.TypeMap<T>;
//TODO: consider adding stuff from haxe.macro.Expr here //TODO: consider adding stuff from haxe.macro.Expr here
typedef MacroOutcome<D, F> = tink.core.Outcome<D, F>; typedef MacroOutcome<D, F> = tink.core.Outcome<D, F>;
typedef MacroOutcomeTools = tink.OutcomeTools; typedef MacroOutcomeTools = tink.core.Outcome.OutcomeTools;
typedef Member = tink.macro.Member; typedef Member = tink.macro.Member;
typedef Constructor = tink.macro.Constructor; typedef Constructor = tink.macro.Constructor;
@@ -33,15 +33,22 @@ class MacroApi {
static var MAIN_CANDIDATES = ['-main', '-x', '--run']; static var MAIN_CANDIDATES = ['-main', '-x', '--run'];
static public function getMainClass():Option<String> { static public function getMainClass():Option<String> {
var args = Sys.args(); #if (haxe_ver >= 4.3)
return switch haxe.macro.Compiler.getConfiguration().mainClass {
for (c in MAIN_CANDIDATES) case null: None;
switch args.indexOf(c) { case p: Some(p.pack.concat([p.name]).join('.'));
case -1:
case v: return Some(args[v+1]);
} }
#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; @:persistent static var idCounter = 0;

View File

@@ -357,7 +357,7 @@ class Exprs {
expr = [EVars(locals).at(expr.pos), expr].toMBlock(expr.pos); expr = [EVars(locals).at(expr.pos), expr].toMBlock(expr.pos);
Success(Context.typeof(expr)); Success(Context.typeof(expr));
} }
catch (e:haxe.macro.Error) { catch (e:haxe.macro.Expr.Error) {
e.pos.makeFailure(e.message); e.pos.makeFailure(e.message);
} }
catch (e:Dynamic) { catch (e:Dynamic) {

View File

@@ -98,6 +98,15 @@ abstract Member(Field) from Field to Field {
return return
if (this.meta == null) []; if (this.meta == null) [];
else [for (tag in this.meta) if (tag.name == name) tag]; else [for (tag in this.meta) if (tag.name == name) tag];
public function hasMeta(name)
return switch this.meta {
case null | []: false;
case meta:
for (m in meta)
if (m.name == name) return true;
false;
}
public inline function asField():Field return this; public inline function asField():Field return this;
public function publish() public function publish()

View File

@@ -214,7 +214,7 @@ class Types {
static public function deduceCommonType(types:Array<Type>):Outcome<Type, Error> { static public function deduceCommonType(types:Array<Type>):Outcome<Type, Error> {
var exprs = types.map(function(t) { var exprs = types.map(function(t) {
var ct = t.toComplex(); var ct = t.toComplex();
return macro (null:$ct); return macro (cast null:$ct);
}); });
return switch (macro $a{exprs}).typeof() { return switch (macro $a{exprs}).typeof() {

View File

@@ -29,7 +29,9 @@ abstract PhysicalType<T>(Either<Class<T>, Enum<T>>) {
} }
//TODO: this helper should go somewhere //TODO: this helper should go somewhere
class Base extends TestCase { 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) { function fail(msg:String, ?c : PosInfos) {
currentTest.done = true; currentTest.done = true;
currentTest.success = false; currentTest.success = false;

View File

@@ -21,8 +21,9 @@ class Exprs extends Base {
var expr = macro (untyped {foo:[{bar:234},'bar']}); var expr = macro (untyped {foo:[{bar:234},'bar']});
var str = Std.string(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(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() { function testGet() {
assertEquals('foo', (macro foo).getIdent().sure()); assertEquals('foo', (macro foo).getIdent().sure());

View File

@@ -6,8 +6,6 @@ import haxe.macro.Expr;
using tink.MacroApi; using tink.MacroApi;
class Positions extends Base { class Positions extends Base {
function stringCompare<A>(v1:A, v2:A)
assertEquals(Std.string(v1), Std.string(v2));
function testSanitize() { function testSanitize() {
var p:Position = null; var p:Position = null;
@@ -19,6 +17,6 @@ class Positions extends Base {
function testBlank() { function testBlank() {
var p:Position = null; var p:Position = null;
var t = p.makeBlankType(); var t = p.makeBlankType();
stringCompare('TMono(<mono>)', cast t.toType().sure()); stringCompare('TMono(<mono>)', cast t.toType().sure().reduce());
} }
} }