Skip to content

Commit 5e7f54b

Browse files
committed
Add constructors for TASTy reflect flags
1 parent 01078c4 commit 5e7f54b

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package dotty.tools.dotc
2+
package tastyreflect
3+
4+
import dotty.tools.dotc.core.Decorators._
5+
6+
trait FlagsOpsImpl extends scala.tasty.reflect.FlagsOps with CoreImpl {
7+
8+
object Flags extends FlagsModule {
9+
def Protected: FlagSet = new FlagSet(core.Flags.Protected)
10+
def Abstract: FlagSet = new FlagSet(core.Flags.Abstract)
11+
def Final: FlagSet = new FlagSet(core.Flags.Final)
12+
def Sealed: FlagSet = new FlagSet(core.Flags.Sealed)
13+
def Case: FlagSet = new FlagSet(core.Flags.Case)
14+
def Implicit: FlagSet = new FlagSet(core.Flags.Implicit)
15+
def Erased: FlagSet = new FlagSet(core.Flags.Erased)
16+
def Lazy: FlagSet = new FlagSet(core.Flags.Lazy)
17+
def Override: FlagSet = new FlagSet(core.Flags.Override)
18+
def Inline: FlagSet = new FlagSet(core.Flags.Inline)
19+
def Macro: FlagSet = new FlagSet(core.Flags.Macro)
20+
def Static: FlagSet = new FlagSet(core.Flags.JavaStatic)
21+
def Object: FlagSet = new FlagSet(core.Flags.Module)
22+
def Trait: FlagSet = new FlagSet(core.Flags.Trait)
23+
def Local: FlagSet = new FlagSet(core.Flags.Local)
24+
def Synthetic: FlagSet = new FlagSet(core.Flags.Synthetic)
25+
def Artifact: FlagSet = new FlagSet(core.Flags.Artifact)
26+
def Mutable: FlagSet = new FlagSet(core.Flags.Mutable)
27+
def FieldAccessor: FlagSet = new FlagSet(core.Flags.Accessor)
28+
def CaseAcessor: FlagSet = new FlagSet(core.Flags.CaseAccessor)
29+
def Covariant: FlagSet = new FlagSet(core.Flags.Covariant)
30+
def Contravariant: FlagSet = new FlagSet(core.Flags.Contravariant)
31+
def Scala2X: FlagSet = new FlagSet(core.Flags.Scala2x)
32+
def DefaultParameterized: FlagSet = new FlagSet(core.Flags.DefaultParameterized)
33+
def Stable: FlagSet = new FlagSet(core.Flags.Stable)
34+
def Param: FlagSet = new FlagSet(core.Flags.Param)
35+
def ParamAccessor: FlagSet = new FlagSet(core.Flags.ParamAccessor)
36+
}
37+
38+
}

compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class ReflectionImpl(val rootContext: Contexts.Context)
88
with CaseDefOpsImpl
99
with ConstantOpsImpl
1010
with ContextOpsImpl
11+
with FlagsOpsImpl
1112
with IdOpsImpl
1213
with ImportSelectorOpsImpl
1314
with QuotedOpsImpl

library/src/scala/tasty/Reflection.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ abstract class Reflection
77
with CaseDefOps
88
with ConstantOps
99
with ContextOps
10+
with FlagsOps
1011
with IdOps
1112
with ImportSelectorOps
1213
with QuotedOps
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package scala.tasty.reflect
2+
3+
trait FlagsOps extends Core {
4+
5+
val Flags: FlagsModule
6+
abstract class FlagsModule {
7+
/** Is this symbol `protected` */
8+
def Protected: FlagSet
9+
10+
/** Is this symbol `abstract` */
11+
def Abstract: FlagSet
12+
13+
/** Is this symbol `final` */
14+
def Final: FlagSet
15+
16+
/** Is this symbol `sealed` */
17+
def Sealed: FlagSet
18+
19+
/** Is this symbol `case` */
20+
def Case: FlagSet
21+
22+
/** Is this symbol `implicit` */
23+
def Implicit: FlagSet
24+
25+
/** Is this symbol `erased` */
26+
def Erased: FlagSet
27+
28+
/** Is this symbol `lazy` */
29+
def Lazy: FlagSet
30+
31+
/** Is this symbol `override` */
32+
def Override: FlagSet
33+
34+
/** Is this symbol `inline` */
35+
def Inline: FlagSet
36+
37+
/** Is this symbol markes as a macro. An inline method containing toplevel splices */
38+
def Macro: FlagSet
39+
40+
/** Is this symbol marked as static. Mapped to static Java member */
41+
def Static: FlagSet
42+
43+
/** Is this symbol an object or its class (used for a ValDef or a ClassDef extends Modifier respectively) */
44+
def Object: FlagSet
45+
46+
/** Is this symbol a trait */
47+
def Trait: FlagSet
48+
49+
/** Is this symbol local? Used in conjunction with Private/private[Type] to mean private[this] extends Modifier proctected[this] */
50+
def Local: FlagSet
51+
52+
/** Was this symbol generated by Scala compiler */
53+
def Synthetic: FlagSet
54+
55+
/** Is this symbol to be tagged Java Synthetic */
56+
def Artifact: FlagSet
57+
58+
/** Is this symbol a `var` (when used on a ValDef) */
59+
def Mutable: FlagSet
60+
61+
/** Is this symbol a getter or a setter */
62+
def FieldAccessor: FlagSet
63+
64+
/** Is this symbol a getter for case class parameter */
65+
def CaseAcessor: FlagSet
66+
67+
/** Is this symbol a type parameter marked as covariant `+` */
68+
def Covariant: FlagSet
69+
70+
/** Is this symbol a type parameter marked as contravariant `-` */
71+
def Contravariant: FlagSet
72+
73+
/** Was this symbol imported from Scala2.x */
74+
def Scala2X: FlagSet
75+
76+
/** Is this symbol a method with default parameters */
77+
def DefaultParameterized: FlagSet
78+
79+
/** Is this symbol member that is assumed to be stable */
80+
def Stable: FlagSet
81+
82+
/** Is this symbol a parameter */
83+
def Param: FlagSet
84+
85+
/** Is this symbol a parameter accessor */
86+
def ParamAccessor: FlagSet
87+
}
88+
89+
}

0 commit comments

Comments
 (0)