summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-02-28 18:03:50 +0000
committerPaul Phillips <paulp@improving.org>2011-02-28 18:03:50 +0000
commitfce8415e570bedbc4e62b6049ad94737b56c8699 (patch)
tree802582e7a9097b64317070227390b2390d040d35
parent4073555ee54815015ee225149ac9989ee6b93af5 (diff)
downloadscala-fce8415e570bedbc4e62b6049ad94737b56c8699.tar.gz
scala-fce8415e570bedbc4e62b6049ad94737b56c8699.tar.bz2
scala-fce8415e570bedbc4e62b6049ad94737b56c8699.zip
Fixing the other half of my recent breakage.
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/NameManglers.scala1
-rw-r--r--src/library/scala/collection/mutable/ListBuffer.scala12
3 files changed, 15 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index f99db8cad7..c899e25302 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -786,6 +786,12 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
}
/* An iterator returning all the units being compiled in this run */
+ /* !!! Note: changing this to unitbuf.toList.iterator breaks a bunch
+ of tests in tests/res. This is bad, it means the resident compiler
+ relies on an iterator of a mutable data structure reflecting changes
+ made to the underlying structure (in whatever accidental way it is
+ currently depending upon.)
+ */
def units: Iterator[CompilationUnit] = unitbuf.iterator
/** A map from compiled top-level symbols to their source files */
diff --git a/src/compiler/scala/tools/nsc/symtab/NameManglers.scala b/src/compiler/scala/tools/nsc/symtab/NameManglers.scala
index 3a5c69e8a6..9fe8f9e37f 100644
--- a/src/compiler/scala/tools/nsc/symtab/NameManglers.scala
+++ b/src/compiler/scala/tools/nsc/symtab/NameManglers.scala
@@ -63,6 +63,7 @@ trait NameManglers {
def isConstructorName(name: Name) = name == CONSTRUCTOR || name == MIXIN_CONSTRUCTOR
def isExceptionResultName(name: Name) = name startsWith EXCEPTION_RESULT_PREFIX
+ /** !!! Foo$class$1 is an implClassName, I think. */
def isImplClassName(name: Name) = name endsWith IMPL_CLASS_SUFFIX
def isLocalDummyName(name: Name) = name startsWith LOCALDUMMY_PREFIX
def isLocalName(name: Name) = name endsWith LOCAL_SUFFIX_STRING
diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala
index ec33e6f9d9..67d34cb481 100644
--- a/src/library/scala/collection/mutable/ListBuffer.scala
+++ b/src/library/scala/collection/mutable/ListBuffer.scala
@@ -317,16 +317,20 @@ final class ListBuffer[A]
// on exhausted iterators (thus creating exceptions) merely because
// values were changed in-place.
var cursor: List[A] = null
- var remaining = ListBuffer.this.length
+ var delivered = 0
- def hasNext: Boolean = remaining > 0
+ // Note: arguably this should not be a "dynamic test" against
+ // the present length of the buffer, but fixed at the size of the
+ // buffer when the iterator is created. At the moment such a
+ // change breaks tests: see comment on def units in Global.scala.
+ def hasNext: Boolean = delivered < ListBuffer.this.length
def next(): A =
- if (remaining <= 0)
+ if (!hasNext)
throw new NoSuchElementException("next on empty Iterator")
else {
if (cursor eq null) cursor = start
else cursor = cursor.tail
- remaining -= 1
+ delivered += 1
cursor.head
}
}