@@ -5,105 +5,4 @@ import dotty.tools.dotc.core.Constants
55
66trait ConstantOpsImpl extends scala.tasty.reflect.ConstantOps with CoreImpl {
77
8- object Constant extends ConstantModule {
9-
10- object Unit extends UnitModule {
11- def apply (): Constant = Constants .Constant (())
12- def unapply (x : Constant ): Boolean = x.tag == Constants .UnitTag
13- }
14-
15- object Null extends NullModule {
16- def apply (): Constant = Constants .Constant (null )
17- def unapply (x : Constant ): Boolean = x.tag == Constants .NullTag
18- }
19-
20- object Boolean extends BooleanModule {
21- def apply (x : Boolean ): Constant = Constants .Constant (x)
22- def unapply (x : Constant ): Option [Boolean ] = x match {
23- case x : Constants .Constant if x.tag == Constants .BooleanTag => Some (x.booleanValue)
24- case _ => None
25- }
26- }
27-
28- object Byte extends ByteModule {
29- def apply (x : Byte ): Constant = Constants .Constant (x)
30- def unapply (x : Constant ): Option [Byte ] = x match {
31- case x : Constants .Constant if x.tag == Constants .ByteTag => Some (x.byteValue)
32- case _ => None
33- }
34- }
35-
36- object Short extends ShortModule {
37- def apply (x : Short ): Constant = Constants .Constant (x)
38- def unapply (x : Constant ): Option [Short ] = x match {
39- case x : Constants .Constant if x.tag == Constants .ShortTag => Some (x.shortValue)
40- case _ => None
41- }
42- }
43-
44- object Char extends CharModule {
45- def apply (x : Char ): Constant = Constants .Constant (x)
46- def unapply (x : Constant ): Option [Char ] = x match {
47- case x : Constants .Constant if x.tag == Constants .CharTag => Some (x.charValue)
48- case _ => None
49- }
50- }
51-
52- object Int extends IntModule {
53- def apply (x : Int ): Constant = Constants .Constant (x)
54- def unapply (x : Constant ): Option [Int ] = x match {
55- case x : Constants .Constant if x.tag == Constants .IntTag => Some (x.intValue)
56- case _ => None
57- }
58- }
59-
60- object Long extends LongModule {
61- def apply (x : Long ): Constant = Constants .Constant (x)
62- def unapply (x : Constant ): Option [Long ] = x match {
63- case x : Constants .Constant if x.tag == Constants .LongTag => Some (x.longValue)
64- case _ => None
65- }
66- }
67-
68- object Float extends FloatModule {
69- def apply (x : Float ): Constant = Constants .Constant (x)
70- def unapply (x : Constant ): Option [Float ] = x match {
71- case x : Constants .Constant if x.tag == Constants .FloatTag => Some (x.floatValue)
72- case _ => None
73- }
74- }
75-
76- object Double extends DoubleModule {
77- def apply (x : Double ): Constant = Constants .Constant (x)
78- def unapply (x : Constant ): Option [Double ] = x match {
79- case x : Constants .Constant if x.tag == Constants .DoubleTag => Some (x.doubleValue)
80- case _ => None
81- }
82- }
83-
84- object String extends StringModule {
85- def apply (x : String ): Constant = Constants .Constant (x)
86- def unapply (x : Constant ): Option [String ] = x match {
87- case x : Constants .Constant if x.tag == Constants .StringTag => Some (x.stringValue)
88- case _ => None
89- }
90- }
91-
92- object ClassTag extends ClassTagModule {
93- def apply [T ](implicit x : scala.reflect.ClassTag [T ]): Constant = Constants .Constant (x)
94- def unapply (x : Constant ): Option [Type ] = x match {
95- case x : Constants .Constant if x.tag == Constants .ClazzTag => Some (x.typeValue)
96- case _ => None
97- }
98- }
99-
100- object Symbol extends SymbolModule {
101- def apply (x : scala.Symbol ): Constant = Constants .Constant (x)
102- def unapply (x : Constant ): Option [scala.Symbol ] = x match {
103- case x : Constants .Constant if x.tag == Constants .ScalaSymbolTag => Some (x.scalaSymbolValue)
104- case _ => None
105- }
106- }
107- }
108-
1098}
0 commit comments