aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/NameOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-11-29 19:34:33 +0100
committerMartin Odersky <odersky@gmail.com>2016-11-29 19:35:30 +0100
commite7a0d03f0d29b4644b09b0a36fb3557849d6cf72 (patch)
tree7094746ccadc200b14863a947f55e1a2fb170528 /compiler/src/dotty/tools/dotc/core/NameOps.scala
parentf7001a4b6e83307cc8299b049cb23c79d004f0e2 (diff)
downloaddotty-e7a0d03f0d29b4644b09b0a36fb3557849d6cf72.tar.gz
dotty-e7a0d03f0d29b4644b09b0a36fb3557849d6cf72.tar.bz2
dotty-e7a0d03f0d29b4644b09b0a36fb3557849d6cf72.zip
Create FunctionN types on demand
We know create FunctionN types on demand whenever their name is looked up in the scope of package `scala`. This obviates the need to predefine function traits 23 to 30.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/NameOps.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala
index 4c7f5b0a9..7a4fc0512 100644
--- a/compiler/src/dotty/tools/dotc/core/NameOps.scala
+++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala
@@ -229,6 +229,12 @@ object NameOps {
}
}
+ def functionArity: Int =
+ if (name.startsWith(tpnme.Function))
+ try name.drop(tpnme.Function.length).toString.toInt
+ catch { case ex: NumberFormatException => -1 }
+ else -1
+
/** The name of the generic runtime operation corresponding to an array operation */
def genericArrayOp: TermName = name match {
case nme.apply => nme.array_apply