diff options
author | buraq <buraq@epfl.ch> | 2005-05-23 14:31:55 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2005-05-23 14:31:55 +0000 |
commit | 0f61edd914d4fcfaaebe014f5c5c71b2dc26c9ff (patch) | |
tree | d05434f8e54ed72ea3ace09c522cbe8ff0f8dc09 | |
parent | 676fbe45e3fc5ad7e426bc06ae894a5e67159097 (diff) | |
download | scala-0f61edd914d4fcfaaebe014f5c5c71b2dc26c9ff.tar.gz scala-0f61edd914d4fcfaaebe014f5c5c71b2dc26c9ff.tar.bz2 scala-0f61edd914d4fcfaaebe014f5c5c71b2dc26c9ff.zip |
beginnings of transmatch in nsc
-rw-r--r-- | config/list/nsc.lst | 2 | ||||
-rwxr-xr-x | sources/scala/tools/nsc/Global.scala | 9 | ||||
-rw-r--r-- | sources/scala/tools/nsc/transmatch/TransMatcher.scala | 33 |
3 files changed, 44 insertions, 0 deletions
diff --git a/config/list/nsc.lst b/config/list/nsc.lst index 57e8babdcd..5f6143184e 100644 --- a/config/list/nsc.lst +++ b/config/list/nsc.lst @@ -43,6 +43,8 @@ symtab/classfile/Pickler.scala symtab/classfile/SymblfileParser.scala symtab/classfile/UnPickler.scala +transmatch/TransMatcher.scala + typechecker/Analyzer.scala typechecker/ConstantFolder.scala typechecker/Contexts.scala diff --git a/sources/scala/tools/nsc/Global.scala b/sources/scala/tools/nsc/Global.scala index 95de98a498..c8b7973684 100755 --- a/sources/scala/tools/nsc/Global.scala +++ b/sources/scala/tools/nsc/Global.scala @@ -16,6 +16,7 @@ import util._; import ast._; import ast.parser._; import typechecker._; +import transmatch._; class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable with Trees with CompilationUnits { @@ -135,13 +136,21 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable object analyzer extends Analyzer { val global: Global.this.type = Global.this; } + + object transmatcher extends TransMatcher { + val global: Global.this.type = Global.this; + } + val infer = new analyzer.Inferencer(analyzer.NoContext); val namerPhase = new analyzer.NamerPhase(parserPhase); val typeCheckPhase = new analyzer.TypeCheckPhase(namerPhase); + val transMatchPhase = new transmatcher.TransMatchPhase(typeCheckPhase); + val picklePhase = new pickler.PicklePhase(typeCheckPhase); + /* object icode extends ICode { val global: Global.this.type = Global.this diff --git a/sources/scala/tools/nsc/transmatch/TransMatcher.scala b/sources/scala/tools/nsc/transmatch/TransMatcher.scala new file mode 100644 index 0000000000..d384afb845 --- /dev/null +++ b/sources/scala/tools/nsc/transmatch/TransMatcher.scala @@ -0,0 +1,33 @@ +/* NSC -- new scala compiler + * Copyright 2005 LAMP/EPFL + * @author buraq + */ +// $Id$ +package scala.tools.nsc.transmatch; + +/** Translation of pattern matching + */ +abstract class TransMatcher { + + val global: Global; + + import global._; + import definitions._; + import posAssigner.atPos; + + class TransMatchPhase(prev: Phase) extends StdPhase(prev) { + def name = "transmatcher"; + val global: TransMatcher.this.global.type = TransMatcher.this.global; + def apply(unit: CompilationUnit): unit = + unit.body = newTransMatcher.transform(unit.body); + } + + def newTransMatcher = new TransMatch(); + + class TransMatch extends Transformer(copy) { + override def transform(tree: Tree) = tree match { + case _ => super.transform(tree); + } + } + +} |