aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-27 10:08:59 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:10 +0200
commit0698383d595fec40c70905eb0e06b430f93ba0b8 (patch)
tree03a44262dd7529370da08e7503d99ccd96b3a871 /compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala
parent606294c5729a7b106964415af6304d60cc102810 (diff)
downloaddotty-0698383d595fec40c70905eb0e06b430f93ba0b8.tar.gz
dotty-0698383d595fec40c70905eb0e06b430f93ba0b8.tar.bz2
dotty-0698383d595fec40c70905eb0e06b430f93ba0b8.zip
Add NameExtractors
Use a new scheme for creating and accessing semantic names which is based on semantic name extractors with nested info classes.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala27
1 files changed, 14 insertions, 13 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala b/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala
index 61a2c7fc5..e82a9b618 100644
--- a/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala
+++ b/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala
@@ -4,8 +4,10 @@ package core
package tasty
import collection.mutable
-import Names.{Name, chrs, DerivedTermName, SimpleTermName}
-import Decorators._, NameOps._
+import Names.{Name, chrs, SimpleTermName}
+import NameOps.NameDecorator
+import NameExtractors._
+import Decorators._
import TastyBuffer._
import scala.io.Codec
import TastyName._
@@ -27,20 +29,19 @@ class NameBuffer extends TastyBuffer(10000) {
def nameIndex(name: Name, toTasty: SimpleTermName => TastyName): NameRef = {
val tname = name.toTermName match {
- case DerivedTermName(name1, NameInfo.ModuleClass) =>
+ case ModuleClassName(name1) =>
ModuleClass(nameIndex(name1, toTasty))
- case DerivedTermName(name1, NameInfo.SuperAccessor) =>
+ case SuperAccessorName(name1) =>
SuperAccessor(nameIndex(name1, toTasty))
- case DerivedTermName(prefix, qual: NameInfo.Qualified) =>
- val tcon: (NameRef, NameRef) => TastyName = qual match {
- case _: NameInfo.Select => Qualified
- case _: NameInfo.Flatten => Flattened
- case _: NameInfo.Expand => Expanded
- }
- tcon(nameIndex(prefix, toTasty), nameIndex(qual.name))
- case DerivedTermName(prefix, NameInfo.DefaultGetter(num)) =>
+ case QualifiedName(prefix, selector) =>
+ Qualified(nameIndex(prefix, toTasty), nameIndex(selector))
+ case FlattenedName(prefix, selector) =>
+ Flattened(nameIndex(prefix, toTasty), nameIndex(selector))
+ case XpandedName(prefix, selector) =>
+ Expanded(nameIndex(prefix, toTasty), nameIndex(selector))
+ case DefaultGetterName(prefix, num) =>
DefaultGetter(nameIndex(prefix, toTasty), num)
- case DerivedTermName(prefix, NameInfo.Variant(sign)) =>
+ case VariantName(prefix, sign) =>
Variant(nameIndex(prefix, toTasty), sign)
case name1 =>
if (name1.isShadowedName) Shadowed(nameIndex(name1.revertShadowed, toTasty))