Compare commits

...

9 Commits

Author SHA1 Message Date
back2dos
32aa2d6570 Bump version. 2017-03-20 11:20:59 +01:00
back2dos
d81642e733 Use travix release. 2017-03-20 11:19:49 +01:00
Juraj Kirchheim
d5f4987ddb Release 0.13.1 2017-03-16 16:31:14 +01:00
Juraj Kirchheim
671f1bc995 Merge pull request #11 from haxetink/kevinresol-patch-1
Add TypeMap alias
2017-03-16 16:02:34 +01:00
back2dos
b1012937fc Release 0.13.0 2017-03-06 17:58:24 +01:00
back2dos
bd4b8c436f Build cache works better with compiler server. 2017-03-06 17:58:07 +01:00
back2dos
dbebd0d70d Allow querying whether a type exists. 2017-03-06 17:57:30 +01:00
Juraj Kirchheim
4c523e02a5 Release 0.12.3 2017-03-06 14:31:20 +01:00
Juraj Kirchheim
f39fc3b296 Try to save TMono. 2017-03-06 09:16:31 +01:00
5 changed files with 48 additions and 18 deletions

View File

@@ -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: haxelib run travis release
on:
tags: true

View File

@@ -11,8 +11,8 @@
"contributors": [
"back2dos"
],
"releasenote": "Fix issue with .toComplex()",
"version": "0.12.2",
"releasenote": "Alias for TypeMap",
"version": "0.13.2",
"url": "http://haxetink.org/tink_macro",
"dependencies": {
"tink_core": ""

View File

@@ -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();
}
}
}
}

View File

@@ -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):

View File

@@ -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)