diff options
author | paltherr <paltherr@epfl.ch> | 2004-12-03 13:07:12 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2004-12-03 13:07:12 +0000 |
commit | 19158d78f8ca6d375f0da0a9425d99e560102895 (patch) | |
tree | 8fe338b6ffefdf61dfb670550da27823f072238f /sources | |
parent | a78d745dbd1fbc3788bbbd11755c42c5d2b1d67a (diff) | |
download | scala-19158d78f8ca6d375f0da0a9425d99e560102895.tar.gz scala-19158d78f8ca6d375f0da0a9425d99e560102895.tar.bz2 scala-19158d78f8ca6d375f0da0a9425d99e560102895.zip |
- Removed old checkers
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/tools/scalac/transformer/TransMatchPhase.scala | 8 | ||||
-rw-r--r-- | sources/scala/tools/scalac/transformer/UnCurryPhase.scala | 3 | ||||
-rw-r--r-- | sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala | 6 | ||||
-rw-r--r-- | sources/scala/tools/scalac/typechecker/RefCheckPhase.scala | 3 | ||||
-rw-r--r-- | sources/scala/tools/scalac/util/NewArray.scala | 9 | ||||
-rw-r--r-- | sources/scalac/Global.java | 4 | ||||
-rw-r--r-- | sources/scalac/Phase.java | 17 | ||||
-rw-r--r-- | sources/scalac/checkers/CheckSymbols.java | 56 | ||||
-rw-r--r-- | sources/scalac/checkers/CheckTypes.java | 69 | ||||
-rw-r--r-- | sources/scalac/checkers/Checker.java | 41 | ||||
-rw-r--r-- | sources/scalac/transformer/ErasurePhase.java | 10 | ||||
-rw-r--r-- | sources/scalac/transformer/ICodePhase.java | 1 | ||||
-rw-r--r-- | sources/scalac/transformer/LambdaLiftPhase.java | 7 | ||||
-rw-r--r-- | sources/scalac/transformer/WholeProgPhase.java | 1 |
14 files changed, 2 insertions, 233 deletions
diff --git a/sources/scala/tools/scalac/transformer/TransMatchPhase.scala b/sources/scala/tools/scalac/transformer/TransMatchPhase.scala index 39f34c68af..6bb55eceb7 100644 --- a/sources/scala/tools/scalac/transformer/TransMatchPhase.scala +++ b/sources/scala/tools/scalac/transformer/TransMatchPhase.scala @@ -10,7 +10,6 @@ import scalac.{Global => scalac_Global} import scalac.Phase; import scalac.PhaseDescriptor; import scalac.CompilationUnit; -import scalac.checkers._; package scala.tools.scalac.transformer { @@ -23,12 +22,7 @@ class TransMatchPhase(global:scalac_Global, descriptor:PhaseDescriptor ) new TransMatch( global ).apply( u ); } } - override def postCheckers( global:scalac_Global ):Array[Checker] = { - val a = new Array[Checker](2); - a.update(0, new CheckSymbols(global) ); - a.update(1, new CheckTypes(global) ); - a - } + } } diff --git a/sources/scala/tools/scalac/transformer/UnCurryPhase.scala b/sources/scala/tools/scalac/transformer/UnCurryPhase.scala index 5445d89cf5..ecd9f76961 100644 --- a/sources/scala/tools/scalac/transformer/UnCurryPhase.scala +++ b/sources/scala/tools/scalac/transformer/UnCurryPhase.scala @@ -8,7 +8,6 @@ import scalac.{Global => scalac_Global, _}; import scalac.symtab._; -import scalac.checkers._; package scala.tools.scalac.transformer { @@ -96,7 +95,5 @@ class UnCurryPhase(global: scalac_Global, descriptor: PhaseDescriptor) extends P false }); - override def postCheckers(global: scalac_Global): Array[Checker] = - NewArray.Checker(new CheckSymbols(global), new CheckTypes(global)); } } diff --git a/sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala b/sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala index ec42694767..275bba16d4 100644 --- a/sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala +++ b/sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala @@ -11,7 +11,6 @@ import scalac._; import scalac.symtab._; import scalac.util._; import scalac.ast._; -import scalac.checkers._; import java.util.HashMap; import java.util.ArrayList; import scala.tools.scalac.util.NewArray; @@ -72,10 +71,5 @@ class AnalyzerPhase(global: scalac_Global, descriptor: PhaseDescriptor) extends new Analyzer(global, this).lateEnter(unit); } - override def postCheckers(global: scalac_Global): Array[Checker] = - NewArray.Checker( - new CheckSymbols(global), - new CheckTypes(global) - ); } } diff --git a/sources/scala/tools/scalac/typechecker/RefCheckPhase.scala b/sources/scala/tools/scalac/typechecker/RefCheckPhase.scala index 32eba219c7..e3d5aa22ab 100644 --- a/sources/scala/tools/scalac/typechecker/RefCheckPhase.scala +++ b/sources/scala/tools/scalac/typechecker/RefCheckPhase.scala @@ -9,7 +9,6 @@ import scalac._; import scalac.ast._; import scalac.symtab._; -import scalac.checkers._; import scalac.{Global => scalac_Global} package scala.tools.scalac.typechecker { @@ -31,7 +30,5 @@ class RefCheckPhase(global: scalac_Global, descriptor: PhaseDescriptor) if (sym.isModule() && !sym.isStatic()) new Type$PolyType(Symbol.EMPTY_ARRAY, tp); else tp; - override def postCheckers(global: scalac_Global): Array[Checker] = - NewArray.Checker(new CheckSymbols(global), new CheckTypes(global)); } } diff --git a/sources/scala/tools/scalac/util/NewArray.scala b/sources/scala/tools/scalac/util/NewArray.scala index ba6e1b002f..ff68779a3f 100644 --- a/sources/scala/tools/scalac/util/NewArray.scala +++ b/sources/scala/tools/scalac/util/NewArray.scala @@ -7,7 +7,6 @@ // $Id$ import scalac.ast._; -import scalac.checkers.Checker; import scalac.symtab._; import scalac.util.Name; @@ -96,13 +95,5 @@ object NewArray { arr } - def Checker(xs: Checker*): Array[Checker] = { - val arr = new Array[Checker](xs.length); - var i = 0; - for (val t <- xs.elements) { - arr(i) = t; i = i + 1; - } - arr - } } } diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java index 5c1b2f564a..7dccabfc60 100644 --- a/sources/scalac/Global.java +++ b/sources/scalac/Global.java @@ -391,14 +391,12 @@ public abstract class Global { currentPhase = currentPhase.next; start(); // System.out.println("*** " + currentPhase.descriptor.description() + " ***"); - // !!! new scalac.checkers.SymbolChecker(this).check(); currentPhase.apply(units); stop(currentPhase.descriptor.taskDescription()); if (currentPhase.descriptor.hasPrintFlag()) print(); if (currentPhase.descriptor.hasGraphFlag()) currentPhase.graph(this); - if (currentPhase.descriptor.hasCheckFlag()) - currentPhase.check(this); + // if (currentPhase.descriptor.hasCheckFlag()) // !!! if (currentPhase == PHASE.PARSER.phase()) fix1(); if (currentPhase == PHASE.ANALYZER.phase()) fix2(); } diff --git a/sources/scalac/Phase.java b/sources/scalac/Phase.java index 778ea7ca26..7d9c785a13 100644 --- a/sources/scalac/Phase.java +++ b/sources/scalac/Phase.java @@ -11,7 +11,6 @@ package scalac; import scalac.ast.printer.TreePrinter; import scalac.symtab.Symbol; import scalac.symtab.Type; -import scalac.checkers.Checker; public abstract class Phase { @@ -77,22 +76,6 @@ public abstract class Phase { // !!! unit, unit.source + "-" + name() + ".gdl"); } - /** Checks all compilation units. */ - public void check(Global global) { - for (int i = 0; i < global.units.length; i++) check(global.units[i]); - } - - /** Check the result of this phase for the given compilation unit. */ - public void check(CompilationUnit unit) { - Checker[] checkers = postCheckers(unit.global); - for (int i = 0; i < checkers.length; i++) checkers[i].traverse(unit); - } - - /** Returns an array of checkers which can be applied after the phase. */ - public Checker[] postCheckers(Global global) { - return new Checker[0]; - } - /** Returns the name of this phase. */ public final String toString() { return descriptor.name(); diff --git a/sources/scalac/checkers/CheckSymbols.java b/sources/scalac/checkers/CheckSymbols.java deleted file mode 100644 index 67bf44a337..0000000000 --- a/sources/scalac/checkers/CheckSymbols.java +++ /dev/null @@ -1,56 +0,0 @@ -/* ____ ____ ____ ____ ______ *\ -** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala ** -** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL ** -** /_____/\____/\___/\____/____/ ** -\* */ - -// $Id$ - -package scalac.checkers; - -import scalac.ast.Tree; -import scalac.symtab.Symbol; -import scalac.Global; -import scalac.util.Debug; - -/** - * Verify that all tree nodes for which hasSymbol() is true have a - * non-null symbol. - * - * @author Michel Schinz - * @version 1.0 - */ - -public class CheckSymbols extends Checker { - public CheckSymbols(Global global) { super(global); } - - public void check(Tree tree) { - verify(tree, - implies(tree.hasSymbol(), tree.symbol() != null), - "symbol not null", - "hasSymbol => symbol not null"); - verify(tree, - implies(tree.hasSymbol(), tree.symbol() != Symbol.NONE), - "symbol not NONE", - "hasSymbol => symbol not NONE"); - - switch (tree) { - case ValDef(_, _, _, _): - case DefDef(_, _, _, _, _, _): - Symbol s1 = tree.symbol(); - Symbol owner = s1.owner(); - if (!owner.isClass()) - break; - Symbol[] ss = owner.nextInfo() - .members().lookup(s1.name).alternativeSymbols(); - int i; - for (i = 0; i < ss.length; i++) { - if (s1 == ss[i]) break; - } - verify(tree, i < ss.length, "symbol " + Debug.show(s1) - + " should be in its owner scope", - Debug.show(owner.members())); - break; - } - } -} diff --git a/sources/scalac/checkers/CheckTypes.java b/sources/scalac/checkers/CheckTypes.java deleted file mode 100644 index 890bd23f7f..0000000000 --- a/sources/scalac/checkers/CheckTypes.java +++ /dev/null @@ -1,69 +0,0 @@ -/* ____ ____ ____ ____ ______ *\ -** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala ** -** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL ** -** /_____/\____/\___/\____/____/ ** -\* */ - -// $Id$ - -package scalac.checkers; - -import scalac.ast.Tree; -import scalac.util.Name; -import scalac.symtab.Type; -import scalac.symtab.Symbol; -import scalac.symtab.Kinds; -import scalac.Global; -import scalac.util.Debug; - -/** - * Check the following properties: - * 1. all tree nodes have a type, - * 2. TypeRefs supply the correct number of arguments, - * 3. type terms are represented as TypeTerm nodes. - * - * @author Michel Schinz - * @version 1.0 - */ - -public class CheckTypes extends Checker { - public CheckTypes(Global global) { super(global); } - - public void checkIsTypeTerm(Tree tree, Tree tpe) { - verify(tree, - tpe == Tree.Empty || tpe instanceof Tree.TypeTerm, - "no syntactic types", - "`tpe' part of tree is not an instance of TypeTerm"); - } - - public void check(Tree tree) { - verify(tree, tree.type != null, "non-null type", "type of tree is not null"); - - if (tree.type != null) { - switch (tree.type) { - case TypeRef(Type pre, Symbol sym, Type[] args): - if (sym.kind == Kinds.CLASS) - verify(tree, - sym.typeParams().length == args.length, - "enough arguments for TypeRefs", - "Type " + Debug.show(sym) - + " expects " + sym.typeParams().length + " type arguments" - + " but is given " + args.length); - break; - } - - switch (tree) { - case ClassDef(_, _, _, _, Tree tpe, _): - checkIsTypeTerm(tree, tpe); break; - case ModuleDef(_, _, Tree tpe, _): - checkIsTypeTerm(tree, tpe); break; - case ValDef(_, _, Tree tpe, _): - checkIsTypeTerm(tree, tpe); break; - case DefDef(_, _, _, _, Tree tpe, _): - checkIsTypeTerm(tree, tpe); break; - case Typed(_, Tree tpe): - checkIsTypeTerm(tree, tpe); break; - } - } - } -} diff --git a/sources/scalac/checkers/Checker.java b/sources/scalac/checkers/Checker.java deleted file mode 100644 index c52651ef6d..0000000000 --- a/sources/scalac/checkers/Checker.java +++ /dev/null @@ -1,41 +0,0 @@ -/* ____ ____ ____ ____ ______ *\ -** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala ** -** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL ** -** /_____/\____/\___/\____/____/ ** -\* */ - -// $Id$ - -package scalac.checkers; - -import scalac.ast.*; -import scalac.Global; - -public abstract class Checker extends Traverser { - protected final Global global; - - public Checker(Global global) { - this.global = global; - } - - public boolean implies(boolean b1, boolean b2) { - return (!b1) | b2; - } - - public void verify(Tree tree, boolean b, String name, String message) { - if (! b) { - System.err.println("ERROR: Condition '" + name + "' violated (after " - + global.currentPhase + ")!"); - System.err.println(message); - System.err.println(tree); - System.err.println(); - } - } - - abstract public void check(Tree tree); - - public void traverse(Tree tree) { - check(tree); - super.traverse(tree); - } -} diff --git a/sources/scalac/transformer/ErasurePhase.java b/sources/scalac/transformer/ErasurePhase.java index 0f114aa771..cfe2e20da6 100644 --- a/sources/scalac/transformer/ErasurePhase.java +++ b/sources/scalac/transformer/ErasurePhase.java @@ -15,9 +15,6 @@ import scalac.PhaseDescriptor; import scalac.CompilationUnit; import scalac.backend.Primitive; import scalac.backend.Primitives; -import scalac.checkers.Checker; -import scalac.checkers.CheckSymbols; -import scalac.checkers.CheckTypes; import scalac.symtab.Definitions; import scalac.symtab.Modifiers; import scalac.symtab.Scope; @@ -99,13 +96,6 @@ public class ErasurePhase extends Phase { } } - public Checker[] postCheckers(Global global) { - return new Checker[] { - new CheckSymbols(global), - new CheckTypes(global), - }; - } - //######################################################################## // Private Methods diff --git a/sources/scalac/transformer/ICodePhase.java b/sources/scalac/transformer/ICodePhase.java index cc1e065389..beaa7f6aab 100644 --- a/sources/scalac/transformer/ICodePhase.java +++ b/sources/scalac/transformer/ICodePhase.java @@ -12,7 +12,6 @@ import scalac.Global; import scalac.Phase; import scalac.PhaseDescriptor; import scalac.CompilationUnit; -import scalac.checkers.TreeChecker; import scalac.symtab.Definitions; import ch.epfl.lamp.util.CodePrinter; diff --git a/sources/scalac/transformer/LambdaLiftPhase.java b/sources/scalac/transformer/LambdaLiftPhase.java index 01ee98bbda..e72575a707 100644 --- a/sources/scalac/transformer/LambdaLiftPhase.java +++ b/sources/scalac/transformer/LambdaLiftPhase.java @@ -12,7 +12,6 @@ import scalac.*; import scalac.util.*; import scalac.parser.*; import scalac.symtab.*; -import scalac.checkers.*; import java.util.ArrayList; public class LambdaLiftPhase extends Phase implements Kinds, Modifiers { @@ -153,10 +152,4 @@ public class LambdaLiftPhase extends Phase implements Kinds, Modifiers { //throw new ApplicationError("proxy " + fv + " in " + owner); } - public Checker[] postCheckers(Global global) { - return new Checker[] { - new CheckSymbols(global), - new CheckTypes(global), - }; - } } diff --git a/sources/scalac/transformer/WholeProgPhase.java b/sources/scalac/transformer/WholeProgPhase.java index c926569cde..5ad7d271e7 100644 --- a/sources/scalac/transformer/WholeProgPhase.java +++ b/sources/scalac/transformer/WholeProgPhase.java @@ -12,7 +12,6 @@ import scalac.Global; import scalac.Phase; import scalac.PhaseDescriptor; import scalac.CompilationUnit; -import scalac.checkers.TreeChecker; import scalac.symtab.Definitions; import ch.epfl.lamp.util.CodePrinter; |