summaryrefslogblamecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
blob: ee666c8e4951800e8330fa67c74f559b938a064b (plain) (tree)
1
2
3
4
5
6
7
8
9




                            

                                    

                               
              
                       




                          
                             
                                   
 
                     






                                                                 
                                                         






                                                                 
                 
                                              
                                                                

     
 
 
/* NSC -- new scala compiler
 * Copyright 2005 LAMP/EPFL
 * @author  Martin Odersky
 */
// $Id$
package scala.tools.nsc.typechecker;

/** The main attribution phase.
 */
trait Analyzer
	 extends AnyRef
            with Contexts
    	    with Namers
	    with Typers
	    with Infer
	    with Variances
            with EtaExpansion
	    with SyntheticMethods {

  val global: Global;
  import global._;

  object namerFactory extends SubComponent {
    val global: Analyzer.this.global.type = Analyzer.this.global;
    val phaseName = "namer";
    def newPhase(_prev: Phase): StdPhase = new StdPhase(_prev) {
      def apply(unit: CompilationUnit): unit =
	new Namer(rootContext(unit)).enterSym(unit.body);
    }
  }

  object typerFactory extends SubComponent {
    val global: Analyzer.this.global.type = Analyzer.this.global;
    val phaseName = "typer";
    def newPhase(_prev: Phase): StdPhase = new StdPhase(_prev) {
      resetTyper;
      def apply(unit: CompilationUnit): unit =
        unit.body = newTyper(rootContext(unit)).typed(unit.body)
    }
  }
}