summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2005-09-27 16:04:14 +0000
committerIulian Dragos <jaguarul@gmail.com>2005-09-27 16:04:14 +0000
commitec620e79d02ae45cd9b7f21e0260081a96618e5e (patch)
tree82fce5c08ee899b004054f0bea1baaa6b5caf48d
parent0af18b6efc9911787855fb439a29f58a20843b79 (diff)
downloadscala-ec620e79d02ae45cd9b7f21e0260081a96618e5e.tar.gz
scala-ec620e79d02ae45cd9b7f21e0260081a96618e5e.tar.bz2
scala-ec620e79d02ae45cd9b7f21e0260081a96618e5e.zip
Made label names in 'while' and 'do' unique.
-rwxr-xr-xsources/scala/tools/nsc/ast/parser/Parsers.scala12
1 files changed, 2 insertions, 10 deletions
diff --git a/sources/scala/tools/nsc/ast/parser/Parsers.scala b/sources/scala/tools/nsc/ast/parser/Parsers.scala
index 2d099890c7..450a32f737 100755
--- a/sources/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/sources/scala/tools/nsc/ast/parser/Parsers.scala
@@ -51,10 +51,6 @@ abstract class Parsers: SyntaxAnalyzer {
val xmlp = new MarkupParser(unit, s, this, false);
*/
- /** The current nesting depths of while and do loops.
- */
- var loopNestingDepth = 0;
-
object treeBuilder extends TreeBuilder {
val global: Parsers.this.global.type = Parsers.this.global;
def freshName(prefix: String): Name = unit.fresh.newName(prefix);
@@ -616,18 +612,15 @@ abstract class Parsers: SyntaxAnalyzer {
Try(body, catches, finalizer)
}
} else if (in.token == WHILE) {
- val lname: Name = "label$" + loopNestingDepth;
- loopNestingDepth = loopNestingDepth + 1;
+ val lname: Name = unit.fresh.newName("label$");
val pos = in.skipToken();
accept(LPAREN);
val cond = expr();
accept(RPAREN);
val body = expr();
- loopNestingDepth = loopNestingDepth - 1;
atPos(pos) { makeWhile(lname, cond, body) }
} else if (in.token == DO) {
- val lname: Name = "label$" + loopNestingDepth;
- loopNestingDepth = loopNestingDepth + 1;
+ val lname: Name = unit.fresh.newName("label$");
val pos = in.skipToken();
val body = expr();
if (in.token == SEMI) in.nextToken();
@@ -635,7 +628,6 @@ abstract class Parsers: SyntaxAnalyzer {
accept(LPAREN);
val cond = expr();
accept(RPAREN);
- loopNestingDepth = loopNestingDepth - 1;
atPos(pos) { makeDoWhile(lname, body, cond) }
} else if (in.token == FOR) {
atPos(in.skipToken()) {