From eb2b6bf420b24ac0307e17fc9fec38e91012d1af Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 18 Mar 2013 22:05:26 +0100 Subject: More changes for higher-kinded types emulation. --- src/dotty/tools/dotc/core/NameOps.scala | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/dotty/tools/dotc/core/NameOps.scala') diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index e83278814..1045d0de9 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -83,6 +83,14 @@ object NameOps { name.last == '=' && name.head != '=' && isOperatorPart(name.head) } + /** Is this the name of a higher-kinded type parameter? */ + def isHkParamName: Boolean = name(0) == '_' && name.startsWith(HK_PARAM_PREFIX) + + /** The index of the higher-kinded type parameter with this name. + * Pre: isHkParamName. + */ + def hkParamIndex: Int = name.drop(name.lastIndexOf('$') + 1).toString.toInt + /** If the name ends with $nn where nn are * all digits, strip the $ and the digits. * Otherwise return the argument. -- cgit v1.2.3