aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/parsing
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-31 18:32:02 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:12 +0200
commitb4f21c6da6b6bc1797908f1400631573b6445e31 (patch)
tree19efe5c588230059b04ef046114c30d3fd64b1f9 /compiler/src/dotty/tools/dotc/parsing
parent7a927ce233a8ea4b8ddc285b8a36c61ca3fdd405 (diff)
downloaddotty-b4f21c6da6b6bc1797908f1400631573b6445e31.tar.gz
dotty-b4f21c6da6b6bc1797908f1400631573b6445e31.tar.bz2
dotty-b4f21c6da6b6bc1797908f1400631573b6445e31.zip
Names are no longer Seqs
Drop Seq implementation of name. This implementation was always problematic because it entailed potentially very costly conversions to toSimpleName. We now have better control over when we convert a name to a simple name.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/parsing')
-rw-r--r--compiler/src/dotty/tools/dotc/parsing/Scanners.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/parsing/package.scala2
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
index 3084c30a8..b0fa8d760 100644
--- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
+++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
@@ -37,7 +37,7 @@ object Scanners {
var lastOffset: Offset = 0
/** the name of an identifier */
- var name: TermName = null
+ var name: SimpleTermName = null
/** the string value of a literal */
var strVal: String = null
@@ -98,10 +98,10 @@ object Scanners {
/** Clear buffer and set name and token */
def finishNamed(idtoken: Token = IDENTIFIER, target: TokenData = this): Unit = {
- target.name = flushBuf(litBuf).toTermName
+ target.name = termName(flushBuf(litBuf))
target.token = idtoken
if (idtoken == IDENTIFIER) {
- val idx = target.name.asSimpleName.start
+ val idx = target.name.start
target.token = toToken(idx)
}
}
diff --git a/compiler/src/dotty/tools/dotc/parsing/package.scala b/compiler/src/dotty/tools/dotc/parsing/package.scala
index 8b113ed96..cdb30d0be 100644
--- a/compiler/src/dotty/tools/dotc/parsing/package.scala
+++ b/compiler/src/dotty/tools/dotc/parsing/package.scala
@@ -10,7 +10,7 @@ package object parsing {
def precedence(operator: Name): Int =
if (operator eq nme.ERROR) -1
else {
- val firstCh = operator(0)
+ val firstCh = operator.firstPart.head
if (isScalaLetter(firstCh)) 1
else if (operator.isOpAssignmentName) 0
else firstCh match {