Compare commits
19 Commits
kevinresol
...
0.13.4
Author | SHA1 | Date | |
---|---|---|---|
![]() |
73e9da8435 | ||
![]() |
bf23337923 | ||
![]() |
02bd3bf69d | ||
![]() |
82a3417b97 | ||
![]() |
1f986c3732 | ||
![]() |
20e998fd12 | ||
![]() |
0f9c0d1e97 | ||
![]() |
2ae13d534e | ||
![]() |
65d341f1e1 | ||
![]() |
68fa50c7c3 | ||
![]() |
32aa2d6570 | ||
![]() |
d81642e733 | ||
![]() |
d5f4987ddb | ||
![]() |
671f1bc995 | ||
![]() |
b1012937fc | ||
![]() |
bd4b8c436f | ||
![]() |
dbebd0d70d | ||
![]() |
4c523e02a5 | ||
![]() |
f39fc3b296 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/bin
|
26
.travis.yml
26
.travis.yml
@@ -2,18 +2,26 @@ sudo: required
|
||||
dist: trusty
|
||||
|
||||
language: haxe
|
||||
|
||||
haxe:
|
||||
- "3.2.1"
|
||||
- development
|
||||
|
||||
- 3.2.1
|
||||
- development
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- haxe: development
|
||||
|
||||
- haxe: development
|
||||
|
||||
install:
|
||||
- haxelib install travix
|
||||
- haxelib run travix install
|
||||
- haxelib install travix
|
||||
- haxelib run travix install
|
||||
|
||||
script:
|
||||
- haxelib run travix node
|
||||
- haxelib run travix node
|
||||
|
||||
env:
|
||||
secure: T4SCtY5qmEsK1ARWPevJmqLm23tv4CobLrbPOQV3FsoQno7FCP1S/+9GmuoJKzeTjWMzdTeDsp8TVwZ6AyGjvhl2nZNjhU+QTsir4tfbYYRyvsz/QK6pveFbPQVv7OsnnaB4wbZtqGZ8mzFeQf7Ol4tsNe7iUFJb/iVc+4/lUxo=
|
||||
|
||||
deploy:
|
||||
provider: script
|
||||
script: haxe && haxelib run travix release
|
||||
on:
|
||||
tags: true
|
||||
|
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"haxe.displayConfigurations": [
|
||||
["tests.hxml"]
|
||||
]
|
||||
}
|
6
.vscode/tasks.json
vendored
Normal file
6
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "haxelib",
|
||||
"args": ["run", "travix", "node"],
|
||||
"problemMatcher": "$haxe"
|
||||
}
|
1
bin/.gitignore
vendored
1
bin/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
*.n
|
@@ -11,8 +11,8 @@
|
||||
"contributors": [
|
||||
"back2dos"
|
||||
],
|
||||
"releasenote": "Fix issue with .toComplex()",
|
||||
"version": "0.12.2",
|
||||
"releasenote": "Added Types.getMeta",
|
||||
"version": "0.13.4",
|
||||
"url": "http://haxetink.org/tink_macro",
|
||||
"dependencies": {
|
||||
"tink_core": ""
|
||||
|
@@ -5,6 +5,7 @@ import haxe.macro.Expr;
|
||||
import haxe.macro.Type;
|
||||
import tink.macro.TypeMap;
|
||||
|
||||
using tink.MacroApi;
|
||||
using haxe.macro.Tools;
|
||||
|
||||
typedef BuildContextN = {
|
||||
@@ -104,7 +105,7 @@ class BuildCache {
|
||||
usings: ctx.usings
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
static public function getType(name, ?type, ?pos:Position, build:BuildContext->TypeDefinition) {
|
||||
|
||||
if (pos == null)
|
||||
@@ -156,18 +157,29 @@ private class Group {
|
||||
usings: usings,
|
||||
name: path.split('.').pop()
|
||||
});
|
||||
|
||||
Context.defineModule(path, [def], usings);
|
||||
|
||||
entries.set(type, { name: path } );
|
||||
Context.defineModule(path, [def], usings);
|
||||
return Context.getType(path);
|
||||
}
|
||||
|
||||
|
||||
function doMake()
|
||||
while (true)
|
||||
switch '$name${counter++}' {
|
||||
case _.definedType() => Some(_):
|
||||
case v:
|
||||
return make(v);
|
||||
}
|
||||
|
||||
return
|
||||
switch entries.get(type) {
|
||||
case null:
|
||||
make('$name${counter++}');
|
||||
doMake();
|
||||
case v:
|
||||
Context.getType(v.name);
|
||||
switch v.name.definedType() {
|
||||
case Some(v): v;
|
||||
default: doMake();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -57,7 +57,7 @@ class Sisyphus {
|
||||
case null:
|
||||
null;
|
||||
case TMono(_.get() => t):
|
||||
t == null ? null : toComplexType(t);
|
||||
t == null ? Types.toComplex(type, { direct: true }) : toComplexType(t);
|
||||
case TEnum(_.get() => baseType, params):
|
||||
TPath(toTypePath(baseType, params));
|
||||
case TInst(_.get() => classType, params):
|
||||
|
@@ -13,6 +13,16 @@ using tink.macro.Functions;
|
||||
using tink.CoreApi;
|
||||
|
||||
class Types {
|
||||
|
||||
static public function definedType(typeName:String)
|
||||
return
|
||||
try {
|
||||
Some(Context.getType(typeName));
|
||||
}
|
||||
catch (e:Dynamic)
|
||||
if (Std.string(e) == 'Type not found \'$typeName\'') None;
|
||||
else neko.Lib.rethrow(e);
|
||||
|
||||
static var types = new Map<Int,Void->Type>();
|
||||
static var idCounter = 0;
|
||||
static public function getID(t:Type, ?reduced = true)
|
||||
@@ -39,6 +49,16 @@ class Types {
|
||||
throw 'not implemented';
|
||||
}
|
||||
|
||||
static public function getMeta(type:Type)
|
||||
return switch type {
|
||||
case TInst(_.get().meta => m, _): [m];
|
||||
case TEnum(_.get().meta => m, _): [m];
|
||||
case TAbstract(_.get().meta => m, _): [m];
|
||||
case TType(_.get() => t, _): [t.meta].concat(getMeta(t.type));
|
||||
case TLazy(f): getMeta(f());
|
||||
default: [];
|
||||
}
|
||||
|
||||
static function getDeclaredFields(t:ClassType, out:Array<ClassField>, marker:Map<String,Bool>) {
|
||||
for (field in t.fields.get())
|
||||
if (!marker.exists(field.name)) {
|
||||
|
Reference in New Issue
Block a user