aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/NameOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-31 12:50:56 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-31 12:51:06 +0100
commita3fe0c6b63b7c2019c80546f100693b261bb2f34 (patch)
treec469bcdbad8f4254e6bf0dbf3332418f19e4c78c /src/dotty/tools/dotc/core/NameOps.scala
parente56b26b55de6459ae74ff86e2a62dd2d00436ab2 (diff)
downloaddotty-a3fe0c6b63b7c2019c80546f100693b261bb2f34.tar.gz
dotty-a3fe0c6b63b7c2019c80546f100693b261bb2f34.tar.bz2
dotty-a3fe0c6b63b7c2019c80546f100693b261bb2f34.zip
Adding a prototype of the right-hand side of default-getters.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/NameOps.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala
index 6eee1f203..cd37c6086 100644
--- a/src/dotty/tools/dotc/core/NameOps.scala
+++ b/src/dotty/tools/dotc/core/NameOps.scala
@@ -222,6 +222,13 @@ object NameOps {
} else name
}
+ /** If this is a default getter, its index (starting from 0), else -1 */
+ def defaultGetterIndex: Int = {
+ val p = name.indexOfSlice(DEFAULT_GETTER)
+ if (p >= 0) name.drop(p + DEFAULT_GETTER.length).toString.toInt - 1
+ else -1
+ }
+
/** The name of a super-accessor */
def superAccessorName: TermName =
SUPER_PREFIX ++ name