diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-28 13:11:17 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-03-31 14:52:08 +0200 |
commit | e5d51859bd3d6fd0b286aa6c8e710f33f95b97cd (patch) | |
tree | 497679fcb45c3746dccda7e0ab43b0755b6689bb /src/dotty/tools | |
parent | ad437d8fa9bd4127889569952ae6fdb048d2b1ec (diff) | |
download | dotty-e5d51859bd3d6fd0b286aa6c8e710f33f95b97cd.tar.gz dotty-e5d51859bd3d6fd0b286aa6c8e710f33f95b97cd.tar.bz2 dotty-e5d51859bd3d6fd0b286aa6c8e710f33f95b97cd.zip |
Added dummy pattern matcher
at the place forseen for the real pattern matcher, so that following
transformations do not have to deal with patterns.
Diffstat (limited to 'src/dotty/tools')
-rw-r--r-- | src/dotty/tools/dotc/Compiler.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/PatternMatcher.scala | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala index 709f4b2db..6fd69beb8 100644 --- a/src/dotty/tools/dotc/Compiler.scala +++ b/src/dotty/tools/dotc/Compiler.scala @@ -20,7 +20,7 @@ class Compiler { def phases: List[List[Phase]] = List( List(new FrontEnd), - List(new LazyValsCreateCompanionObjects), //force separataion between lazyVals and LVCreateCO + List(new LazyValsCreateCompanionObjects, new PatternMatcher), //force separataion between lazyVals and LVCreateCO List(new LazyValTranformContext().transformer, new TypeTestsCasts), List(new Erasure), List(new UncurryTreeTransform) diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala new file mode 100644 index 000000000..ff25a94de --- /dev/null +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -0,0 +1,27 @@ +package dotty.tools.dotc +package transform + +import TreeTransforms._ +import core.DenotTransformers._ +import core.Denotations._ +import core.SymDenotations._ +import core.Contexts._ +import core.Symbols._ +import core.Types._ +import core.Constants._ +import core.StdNames._ +import core.transform.Erasure.isUnboundedGeneric +import typer.ErrorReporting._ +import ast.Trees._ + +/** This transform eliminates patterns. Right now it's a dummy. + * Awaiting the real pattern matcher. + */ +class PatternMatcher extends TreeTransform { + import ast.tpd._ + + override def name: String = "patternMatcher" + + override def transformCaseDef(tree: CaseDef)(implicit ctx: Context, info: TransformerInfo): Tree = + cpy.CaseDef(tree, Literal(Constant("<eliminated pattern>")), tree.guard, tree.body) +}
\ No newline at end of file |