diff options
Diffstat (limited to 'src/reflect')
4 files changed, 26 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index 7b88514429..ea680867da 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -153,6 +153,10 @@ trait Definitions extends api.StandardDefinitions { DoubleClass ) def ScalaPrimitiveValueClasses: List[ClassSymbol] = ScalaValueClasses + + def underlyingOfValueClass(clazz: Symbol): Type = + clazz.derivedValueClassUnbox.tpe.resultType + } abstract class DefinitionsClass extends DefinitionsApi with ValueClassDefinitions { diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala index 9f56e78059..02f22a16f6 100644 --- a/src/reflect/scala/reflect/internal/StdNames.scala +++ b/src/reflect/scala/reflect/internal/StdNames.scala @@ -609,6 +609,7 @@ trait StdNames { val TypeRef: NameType = "TypeRef" val TypeTree: NameType = "TypeTree" val UNIT : NameType = "UNIT" + val accessor: NameType = "accessor" val add_ : NameType = "add" val annotation: NameType = "annotation" val anyValClass: NameType = "anyValClass" diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index 9adddeed50..743c674eea 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -1001,7 +1001,8 @@ trait Trees extends api.Trees { // ---- values and creators --------------------------------------- /** @param sym the class symbol - * @return the implementation template + * @param impl the implementation template + * @return the class definition */ def ClassDef(sym: Symbol, impl: Template): ClassDef = atPos(sym.pos) { @@ -1011,6 +1012,25 @@ trait Trees extends api.Trees { impl) setSymbol sym } + /** @param sym the class symbol + * @param body trees that constitute the body of the class + * @return the class definition + */ + def ClassDef(sym: Symbol, body: List[Tree]): ClassDef = + ClassDef(sym, Template(sym, body)) + + /** @param sym the template's symbol + * @param body trees that constitute the body of the template + * @return the template + */ + def Template(sym: Symbol, body: List[Tree]): Template = { + atPos(sym.pos) { + Template(sym.info.parents map TypeTree, + if (sym.thisSym == sym) noSelfType else ValDef(sym), + body) + } + } + /** * @param sym the class symbol * @param impl the implementation template diff --git a/src/reflect/scala/reflect/internal/transform/Erasure.scala b/src/reflect/scala/reflect/internal/transform/Erasure.scala index 4aefc105e3..3eb3a4cdf4 100644 --- a/src/reflect/scala/reflect/internal/transform/Erasure.scala +++ b/src/reflect/scala/reflect/internal/transform/Erasure.scala @@ -77,9 +77,6 @@ trait Erasure { if (cls.owner.isClass) cls.owner.tpe_* else pre // why not cls.isNestedClass? } - def underlyingOfValueClass(clazz: Symbol): Type = - clazz.derivedValueClassUnbox.tpe.resultType - /** The type of the argument of a value class reference after erasure * This method needs to be called at a phase no later than erasurephase */ |