Compare commits

...

9 Commits

Author SHA1 Message Date
Juraj Kirchheim
4fd03ed667 Release 0.17.7 2019-06-29 11:27:39 +02:00
Juraj Kirchheim
4cb5ee4196 Use @:persistent as necessary. 2019-06-22 15:16:04 +02:00
Kevin Leung
888481094a Pin lix version 2019-05-14 11:33:28 +08:00
Kevin Leung
7686fe3e35 Use xenial 2019-05-14 11:10:52 +08:00
Kevin Leung
747d07bfc5 Revert "Better type comparison (closes #25)"
This reverts commit 00640d8328.
2019-05-13 18:53:42 +08:00
Kevin Leung
00640d8328 Better type comparison (closes #25) 2019-05-13 17:01:54 +08:00
Kevin Leung
77973f6007 print metadata 2019-05-13 17:00:54 +08:00
Juraj Kirchheim
0df9c28ace Release 0.17.6 2019-05-07 22:43:21 +02:00
Juraj Kirchheim
d90fb966d2 Add call to find main class. 2019-05-07 22:42:39 +02:00
8 changed files with 46 additions and 17 deletions

View File

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

View File

@@ -1,5 +1,5 @@
sudo: required
dist: trusty
dist: xenial
stages:
- test
@@ -17,7 +17,7 @@ env:
- HAXE_VERSION=edge
install:
- npm i -g lix
- npm i -g lix@15.3.13
- lix install haxe $HAXE_VERSION
- lix download

View File

@@ -1,20 +1,20 @@
{
"name": "tink_macro",
"license": "MIT",
"description": "The macro toolkit ;)",
"classPath": "src",
"dependencies": {
"tink_core": ""
},
"url": "http://haxetink.org/tink_macro",
"contributors": [
"back2dos"
],
"version": "0.17.7",
"releasenote": "Use @:persistent as necessary.",
"tags": [
"tink",
"macro",
"utility"
],
"classPath": "src",
"description": "The macro toolkit ;)",
"contributors": [
"back2dos"
],
"releasenote": "Various fixes",
"version": "0.17.5",
"url": "http://haxetink.org/tink_macro",
"dependencies": {
"tink_core": ""
}
"license": "MIT"
}

View File

@@ -29,7 +29,20 @@ typedef TypeResolution = Ref<Either<String, TypeDefinition>>;
class MacroApi {
static var idCounter = 0;
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]);
}
return None;
}
@:persistent static var idCounter = 0;
@:noUsing static public inline function tempName(?prefix:String = 'tmp'):String
return '__tink_' + prefix + Std.string(idCounter++);

View File

@@ -33,7 +33,7 @@ typedef BuildContext3 = {>BuildContext2,
class BuildCache {
static var cache = new Map();
@:persistent static var cache = new Map();
static public function getType3(name, ?types, ?pos:Position, build:BuildContext3->TypeDefinition) {
if (types == null)

View File

@@ -3,6 +3,7 @@ package tink.macro;
import haxe.macro.Expr;
class Metadatas {
static var printer = new haxe.macro.Printer();
static public function toMap(m:Metadata) {
var ret = new Map<String,Array<Array<Expr>>>();
if (m != null)
@@ -18,4 +19,8 @@ class Metadatas {
return
if (m == null) [];
else [for (meta in m) if (meta.name == name) meta.params];
static public inline function toString(m:MetadataEntry) {
return printer.printMetadata(m);
}
}

10
tests/Misc.hx Normal file
View File

@@ -0,0 +1,10 @@
import tink.MacroApi;
import haxe.unit.TestCase;
using tink.CoreApi;
class Misc extends TestCase {
function testMain() {
assertEquals('Run', MacroApi.getMainClass().force());
}
}

View File

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