summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/reflect/scala/reflect/api/FlagSets.scala76
-rw-r--r--src/reflect/scala/reflect/internal/FlagSets.scala5
-rw-r--r--src/reflect/scala/reflect/internal/Flags.scala14
3 files changed, 78 insertions, 17 deletions
diff --git a/src/reflect/scala/reflect/api/FlagSets.scala b/src/reflect/scala/reflect/api/FlagSets.scala
index 54b65166d8..44c5f78a48 100644
--- a/src/reflect/scala/reflect/api/FlagSets.scala
+++ b/src/reflect/scala/reflect/api/FlagSets.scala
@@ -167,9 +167,6 @@ trait FlagSets { self: Universe =>
/** Flag indicating that tree represents a variable or a member initialized to the default value */
val DEFAULTINIT: FlagSet
- /** Flag indicating that tree was generated by the compiler */
- val SYNTHETIC: FlagSet
-
/** Flag indicating that tree represents an enum.
*
* It can only appear at
@@ -177,6 +174,79 @@ trait FlagSets { self: Universe =>
* - enum constants
**/
val ENUM: FlagSet
+
+ /** Flag indicating that tree represents a parameter of the primary constructor of some class
+ * or a synthetic member underlying thereof:
+ *
+ * 13:57 ~$ parse 'class C(val x: Int)'
+ * [[syntax trees at end of parser]]// Scala source: tmposDU52
+ * class C extends scala.AnyRef {
+ * <paramaccessor> val x: Int = _;
+ * def <init>(x: Int) = {
+ * super.<init>();
+ * ()
+ * }
+ * }
+ * ClassDef(
+ * Modifiers(), TypeName("C"), List(),
+ * Template(
+ * List(Select(Ident(scala), TypeName("AnyRef"))),
+ * noSelfType,
+ * List(
+ * ValDef(Modifiers(PARAMACCESSOR), TermName("x"), Ident(TypeName("Int")), EmptyTree),
+ * DefDef(
+ * Modifiers(), nme.CONSTRUCTOR, List(),
+ * List(List(ValDef(Modifiers(PARAM | PARAMACCESSOR), TermName("x"), Ident(TypeName("Int")), EmptyTree))), TypeTree(),
+ * Block(List(pendingSuperCall), Literal(Constant(())))))))))
+ */
+ val PARAMACCESSOR: FlagSet
+
+ /** Flag indicating that tree represents a parameter of the primary constructor of some case class
+ * or a synthetic member underlying thereof:
+ *
+ * 13:58 ~$ parse 'case class C(val x: Int)'
+ * [[syntax trees at end of parser]]// Scala source: tmpnHkJ3y
+ * case class C extends scala.Product with scala.Serializable {
+ * <caseaccessor> <paramaccessor> val x: Int = _;
+ * def <init>(x: Int) = {
+ * super.<init>();
+ * ()
+ * }
+ * }
+ * ClassDef(
+ * Modifiers(CASE), TypeName("C"), List(),
+ * Template(
+ * List(Select(Ident(scala), TypeName("Product")), Select(Ident(scala), TypeName("Serializable"))),
+ * noSelfType,
+ * List(
+ * ValDef(Modifiers(CASEACCESSOR | PARAMACCESSOR), TermName("x"), Ident(TypeName("Int")), EmptyTree),
+ * DefDef(
+ * Modifiers(), nme.CONSTRUCTOR, List(),
+ * List(List(ValDef(Modifiers(PARAM | PARAMACCESSOR), TermName("x"), Ident(TypeName("Int")), EmptyTree))), TypeTree(),
+ * Block(List(pendingSuperCall), Literal(Constant(())))))))))
+ */
+ val CASEACCESSOR: FlagSet
+
+ /** Flag used to distinguish programmatically generated definitions from user-written ones.
+ * @see ARTIFACT
+ */
+ val SYNTHETIC: FlagSet
+
+ /** Flag used to distinguish platform-specific implementation details.
+ * Trees and symbols which are currently marked ARTIFACT by scalac:
+ * * $outer fields and accessors
+ * * super accessors
+ * * protected accessors
+ * * lazy local accessors
+ * * bridge methods
+ * * default argument getters
+ * * evaluation-order preserving locals for right-associative and out-of-order named arguments
+ * * catch-expression storing vals
+ * * anything else which feels a setFlag(ARTIFACT)
+ *
+ * @see SYNTHETIC
+ */
+ val ARTIFACT: FlagSet
}
/** The empty set of flags
diff --git a/src/reflect/scala/reflect/internal/FlagSets.scala b/src/reflect/scala/reflect/internal/FlagSets.scala
index 799f85054a..bc6a8ec01f 100644
--- a/src/reflect/scala/reflect/internal/FlagSets.scala
+++ b/src/reflect/scala/reflect/internal/FlagSets.scala
@@ -42,7 +42,10 @@ trait FlagSets extends api.FlagSets { self: SymbolTable =>
val DEFAULTPARAM : FlagSet = Flags.DEFAULTPARAM
val PRESUPER : FlagSet = Flags.PRESUPER
val DEFAULTINIT : FlagSet = Flags.DEFAULTINIT
- val SYNTHETIC : FlagSet = Flags.SYNTHETIC
val ENUM : FlagSet = Flags.ENUM
+ val PARAMACCESSOR : FlagSet = Flags.PARAMACCESSOR
+ val CASEACCESSOR : FlagSet = Flags.CASEACCESSOR
+ val SYNTHETIC : FlagSet = Flags.SYNTHETIC
+ val ARTIFACT : FlagSet = Flags.ARTIFACT
}
}
diff --git a/src/reflect/scala/reflect/internal/Flags.scala b/src/reflect/scala/reflect/internal/Flags.scala
index e66ed9a3d4..1707061817 100644
--- a/src/reflect/scala/reflect/internal/Flags.scala
+++ b/src/reflect/scala/reflect/internal/Flags.scala
@@ -118,22 +118,10 @@ class ModifierFlags {
final val PRESUPER = 1L << 37 // value is evaluated before super call
final val DEFAULTINIT = 1L << 41 // symbol is initialized to the default value: used by -Xcheckinit
final val ARTIFACT = 1L << 46 // symbol should be ignored when typechecking; will be marked ACC_SYNTHETIC in bytecode
+ // to see which symbols are marked as ARTIFACT, see scaladocs for FlagValues.ARTIFACT
final val DEFAULTMETHOD = 1L << 47 // symbol is a java default method
final val ENUM = 1L << 48 // symbol is an enum
- /** Symbols which are marked ARTIFACT. (Expand this list?)
- *
- * - $outer fields and accessors
- * - super accessors
- * - protected accessors
- * - lazy local accessors
- * - bridge methods
- * - default argument getters
- * - evaluation-order preserving locals for right-associative and out-of-order named arguments
- * - catch-expression storing vals
- * - anything else which feels a setFlag(ARTIFACT)
- */
-
// Overridden.
def flagToString(flag: Long): String = ""