diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-04-23 17:51:28 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-04-23 17:54:19 +0200 |
commit | 2b09d8caf5497c4e016a3e1179e5f7e842766176 (patch) | |
tree | 27c872f82fb8290b8cba6fa626ecd0b0dd627229 /src/library/scala/reflect/makro/Reifiers.scala | |
parent | 14df5d74b58505e082d6f7c0e42b51249d35eec4 (diff) | |
download | scala-2b09d8caf5497c4e016a3e1179e5f7e842766176.tar.gz scala-2b09d8caf5497c4e016a3e1179e5f7e842766176.tar.bz2 scala-2b09d8caf5497c4e016a3e1179e5f7e842766176.zip |
rethinks tags
* introduces ArrayTag and ErasureTag
* all type tags now feature erasure
Diffstat (limited to 'src/library/scala/reflect/makro/Reifiers.scala')
-rw-r--r-- | src/library/scala/reflect/makro/Reifiers.scala | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/library/scala/reflect/makro/Reifiers.scala b/src/library/scala/reflect/makro/Reifiers.scala index b9e82e0387..ae6669946c 100644 --- a/src/library/scala/reflect/makro/Reifiers.scala +++ b/src/library/scala/reflect/makro/Reifiers.scala @@ -46,11 +46,12 @@ trait Reifiers { * The produced tree will be bound to the mirror specified by ``prefix'' (also see ``reflectMirrorPrefix''). * For more information and examples see the documentation for ``Context.reifyTree'' and ``Universe.reify''. */ - def reifyType(prefix: Tree, tpe: Type, dontSpliceAtTopLevel: Boolean = false, requireConcreteTypeTag: Boolean = false): Tree + def reifyType(prefix: Tree, tpe: Type, dontSpliceAtTopLevel: Boolean = false, concrete: Boolean = false): Tree /** Given a type, generate a tree that when compiled and executed produces the erasure of the original type. + * If ``concrete'' is true, then this function will bail on types, whose erasure includes abstract types (like `ClassTag` does). */ - def reifyErasure(tpe: Type): Tree + def reifyErasure(tpe: Type, concrete: Boolean = true): Tree /** Undoes reification of a tree. * @@ -67,20 +68,10 @@ trait Reifiers { * 3) compileAndEval(unreifyTree(reifyTree(tree))) ~ compileAndEval(tree) // at runtime original and unreified trees are behaviorally equivalent */ def unreifyTree(tree: Tree): Tree +} - /** Represents an error during reification - */ - type ReificationError <: Throwable - val ReificationError: ReificationErrorExtractor - abstract class ReificationErrorExtractor { - def unapply(error: ReificationError): Option[(Position, String)] - } +// made these guys non path-dependent, otherwise exception handling quickly becomes a mess - /** Wraps an unexpected error during reification - */ - type UnexpectedReificationError <: Throwable - val UnexpectedReificationError: UnexpectedReificationErrorExtractor - abstract class UnexpectedReificationErrorExtractor { - def unapply(error: UnexpectedReificationError): Option[(Position, String, Throwable)] - } -} +case class ReificationError(var pos: reflect.api.Position, val msg: String) extends Throwable(msg) + +case class UnexpectedReificationError(val pos: reflect.api.Position, val msg: String, val cause: Throwable = null) extends Throwable(msg)
\ No newline at end of file |