aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-09-04 08:35:42 +0200
committerMartin Odersky <odersky@gmail.com>2014-09-04 08:41:01 +0200
commit225102627d37f16134bc682eb5b01270684a02e4 (patch)
tree6a57d22adc7c8231b7fbfcc22832ab68a698cb95 /src/dotty/tools/dotc/core
parent2558c49984611935fff91b0b062f6af5a61e71ce (diff)
downloaddotty-225102627d37f16134bc682eb5b01270684a02e4.tar.gz
dotty-225102627d37f16134bc682eb5b01270684a02e4.tar.bz2
dotty-225102627d37f16134bc682eb5b01270684a02e4.zip
Add inSuperCall mode and flag.
Needed to keep a record of definitions in supercall arguments. These may not see the enclosing class.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala3
-rw-r--r--src/dotty/tools/dotc/core/Flags.scala12
2 files changed, 8 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index b221d4083..6b9b1dec7 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -267,6 +267,7 @@ object Contexts {
* - as owner: The primary constructor of the class
* - as outer context: The context enclosing the class context
* - as scope: The parameter accessors in the class context
+ * - with additional mode: InSuperCall
*
* The reasons for this peculiar choice of attributes are as follows:
*
@@ -303,7 +304,7 @@ object Contexts {
/** The super= or this-call context with given owner and locals. */
private def superOrThisCallContext(owner: Symbol, locals: Scope): FreshContext = {
assert(isClassDefContext)
- outer.fresh.setOwner(owner).setScope(locals)
+ outer.fresh.setOwner(owner).setScope(locals).setMode(ctx.mode | Mode.InSuperCall)
}
/** The current source file; will be derived from current
diff --git a/src/dotty/tools/dotc/core/Flags.scala b/src/dotty/tools/dotc/core/Flags.scala
index d28a879d1..f89a5ce46 100644
--- a/src/dotty/tools/dotc/core/Flags.scala
+++ b/src/dotty/tools/dotc/core/Flags.scala
@@ -238,9 +238,6 @@ object Flags {
/** A mutable var */
final val Mutable = termFlag(12, "mutable")
- /** Class symbol is defined in this/superclass constructor. */
- final val InConstructor = typeFlag(12, "<inconstructor>")
-
/** Symbol is local to current class (i.e. private[this] or protected[this]
* pre: Private or Protected are also set
*/
@@ -359,6 +356,9 @@ object Flags {
// Flags following this one are not pickled
+ /** Symbol is defined in a super call */
+ final val InSuperCall = commonFlag(46, "<in supercall>")
+
/** Symbol with private access is accessed outside its private scope */
final val NotJavaPrivate = commonFlag(47, "<not-java-private>")
@@ -432,8 +432,8 @@ object Flags {
/** Flags guaranteed to be set upon symbol creation */
final val FromStartFlags =
- AccessFlags | Module | Package | Deferred | MethodOrHKCommon | Param | ParamAccessor | Scala2ExistentialCommon | Touched |
- Static | CovariantOrOuter | ContravariantOrLabel | ExpandedName | AccessorOrSealed |
+ AccessFlags | Module | Package | Deferred | MethodOrHKCommon | Param | ParamAccessor | Scala2ExistentialCommon |
+ InSuperCall | Touched | Static | CovariantOrOuter | ContravariantOrLabel | ExpandedName | AccessorOrSealed |
CaseAccessorOrTypeArgument | Frozen | Erroneous | ImplicitCommon | Permanent | SelfNameOrImplClass
assert(FromStartFlags.isTermFlags && FromStartFlags.isTypeFlags)
@@ -476,7 +476,7 @@ object Flags {
/** Flags that can apply to a module class */
final val RetainedModuleClassFlags: FlagSet = RetainedModuleValAndClassFlags |
- InConstructor | ImplClass
+ InSuperCall | ImplClass
/** Packages and package classes always have these flags set */
final val PackageCreationFlags =