diff options
author | Martin Odersky <odersky@gmail.com> | 2014-09-06 11:38:55 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-09-06 11:39:45 +0200 |
commit | c3078b12582773e3a9bb356e168fb646ec6733b1 (patch) | |
tree | 26a03cbee889413c4300eab15fe27fa07ef8322d /src/dotty/tools/dotc/typer/Typer.scala | |
parent | b58b90683652e1b6e2c32412f0a03ba614b61b33 (diff) | |
download | dotty-c3078b12582773e3a9bb356e168fb646ec6733b1.tar.gz dotty-c3078b12582773e3a9bb356e168fb646ec6733b1.tar.bz2 dotty-c3078b12582773e3a9bb356e168fb646ec6733b1.zip |
Make foreach/exsists into tree infix methods
foreachSubTree and existsSubTree are now infix methods. Streamlines their use
somewhat.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 9c5fb09b0..1823b09fa 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -615,7 +615,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedCase(tree: untpd.CaseDef): CaseDef = track("typedCase") { def caseRest(pat: Tree)(implicit ctx: Context) = { gadtSyms foreach (_.resetGADTFlexType) - foreachSubTreeOf(pat) { + pat foreachSubTree { case b: Bind => if (ctx.scope.lookup(b.name) == NoSymbol) ctx.enter(b.symbol) else ctx.error(d"duplicate pattern variable: ${b.name}", b.pos) @@ -732,7 +732,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def checkRef(tree: Tree, sym: Symbol) = if (sym.maybeOwner == refineCls && tree.pos.start <= sym.pos.end) ctx.error("illegal forward reference in refinement", tree.pos) - foreachSubTreeOf(refinement) { + refinement foreachSubTree { case tree: RefTree => checkRef(tree, tree.symbol) case tree: TypeTree => checkRef(tree, tree.tpe.typeSymbol) case _ => |