back2dos/tinkerbell — pull request #37 by misprintt (2012-10-24 03:43:03+00:00)
Title: TypeTools.toComplex on private types requires pretty=false

When converting a private Type to a ComplexType using toComplex(type, true), the
resulting TPath is not valid and causes a compiler error (type not found)

The solution is to default back to non-pretty conversion if the BaseType is private and allow 'tink.macro.tools.TypeTools.getType' to do it's magic.

### Example

I've run into this edge case with mocking classes using

Mockatoo generates a Mock subclass using macros, but if a field's args or return type references a private type, the generated class does not have access to that type, causing the compilation error.

E.g. - On sys targets the Http class has a public method `customRequest()` containing an arg typed to the `private typedef AbstractSocket`

converting this arg's type to complex using TypeTools.toComplex generates a TypePath equivalent to:

haxe.Http.AbstractSocket

Really it should be using the typepath's pack rather than module to generate a reference to the private type:

haxe._Http.AbstractSocket

But even isn't valid for the compiler, because the module haxe._Http doesn't exist

The patch checks if a type is private before calling baseToComplex()

>P.S. Sorry for reporting these edge cases, but on the whole tink_macros is an amazing (