diff options
author | mihaylov <mihaylov@epfl.ch> | 2006-03-04 23:13:58 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2006-03-04 23:13:58 +0000 |
commit | 4f42f5b49bb150be0c07d75d20dec616412934eb (patch) | |
tree | 33714f0b26a37d8ccc0ad59eb92918b70fb99d7b /src | |
parent | 0d35144e70d663b8a3e45b248e42a13a0fc17a90 (diff) | |
download | scala-4f42f5b49bb150be0c07d75d20dec616412934eb.tar.gz scala-4f42f5b49bb150be0c07d75d20dec616412934eb.tar.bz2 scala-4f42f5b49bb150be0c07d75d20dec616412934eb.zip |
use 'mixin/abstract class' instead of 'trait'
Diffstat (limited to 'src')
11 files changed, 21 insertions, 34 deletions
diff --git a/src/compiler/scala/tools/nsc/EvalLoop.scala b/src/compiler/scala/tools/nsc/EvalLoop.scala index 240547491a..fc6c30f27a 100644 --- a/src/compiler/scala/tools/nsc/EvalLoop.scala +++ b/src/compiler/scala/tools/nsc/EvalLoop.scala @@ -1,19 +1,15 @@ package scala.tools.nsc; -import java.io._; - -trait EvalLoop { +mixin class EvalLoop { def prompt: String; - def loop(action: (String) => Unit): unit = { - val in = new BufferedReader(new InputStreamReader(System.in)); - System.out.print(prompt); - var line = in.readLine(); - while (line != null && line.length() > 0) { + def loop(action: (String) => Unit): Unit = { + Console.print(prompt); + val line = Console.readLine; + if (line != null && line.length() > 0) { action(line); - System.out.print(prompt); - line = in.readLine(); + loop(action); } } } diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index c05f5cf4c5..663eda6758 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -90,7 +90,7 @@ mixin class Trees requires Global { } } - [_trait_] abstract class SymTree extends Tree { + mixin class SymTree extends Tree { override def hasSymbol = true; override var symbol: Symbol = NoSymbol; } @@ -100,11 +100,11 @@ mixin class Trees requires Global { override def isDef = true; } - trait TermTree extends Tree { + mixin class TermTree extends Tree { override def isTerm = true } - trait TypTree extends Tree { + mixin class TypTree extends Tree { override def isType = true } @@ -586,7 +586,7 @@ mixin class Trees requires Global { case AppliedTypeTree(tpt, args) => (eliminated by typecheck) */ - trait TreeCopier { + abstract class TreeCopier { def ClassDef(tree: Tree, mods: Modifiers, name: Name, tparams: List[AbsTypeDef], tpt: Tree, impl: Template): ClassDef; def PackageDef(tree: Tree, name: Name, stats: List[Tree]): PackageDef; def ModuleDef(tree: Tree, mods: Modifiers, name: Name, impl: Template): ModuleDef; diff --git a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala index b6293cd50c..a74d6d4ba1 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala @@ -5,22 +5,13 @@ // $Id$ package scala.tools.nsc.ast.parser; -//import java.lang.{Integer, Long, Float, Double}; - -//import scalac._; -//import scalac.ast._; -//import scalac.atree.AConstant; -//import scalac.symtab.Modifiers; - -import scala.Iterator; import scala.collection.immutable.ListMap ; import scala.collection.mutable; -//import scala.tools.scalac.util.NewArray; import scala.tools.nsc.util.Position; import scala.xml.{Text,TextBuffer}; -trait MarkupParsers requires SyntaxAnalyzer { +mixin class MarkupParsers requires SyntaxAnalyzer { import global._ ; import posAssigner.atPos; diff --git a/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala b/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala index d6b81a84fe..3a13767900 100644 --- a/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala +++ b/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala @@ -22,7 +22,7 @@ import scala.collection.mutable.MutableList; * * @see scala.tools.nsc.backend.icode.Linearizers */ -trait WorklistAlgorithm { +mixin class WorklistAlgorithm { type Elem; type WList <: MutableList[Elem]; diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala index ae326c0714..c0b6ada3c3 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala @@ -13,7 +13,7 @@ import scala.collection.mutable.{Stack, HashSet}; mixin class Linearizers requires ICodes { import opcodes._; - trait Linearizer { + abstract class Linearizer { def linearize(c: IMethod): List[BasicBlock]; } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala index 40e2e64639..57fa0ff327 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala @@ -427,7 +427,7 @@ mixin class Opcodes requires ICodes { } /** This class represents a method invocation style. */ - trait InvokeStyle { + sealed abstract class InvokeStyle { /** Is this a dynamic method call? */ def isDynamic: Boolean = this match { diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala index 69f1f34cb7..6aa8507c57 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala @@ -9,7 +9,7 @@ package scala.tools.nsc.backend.icode; import scala.tools.nsc.backend.icode.Primitives; -trait TypeStacks requires ICodes { +mixin class TypeStacks requires ICodes { import opcodes._; import global.{Symbol, Type, definitions}; diff --git a/src/compiler/scala/tools/nsc/models/Models.scala b/src/compiler/scala/tools/nsc/models/Models.scala index 9f2eca3164..f89e2da145 100644 --- a/src/compiler/scala/tools/nsc/models/Models.scala +++ b/src/compiler/scala/tools/nsc/models/Models.scala @@ -161,7 +161,7 @@ abstract class Models { def treex = tree.asInstanceOf[PackageDef]; } - [_trait_] abstract class Composite extends Model { + mixin class Composite extends Model { import scala.collection.mutable._; @@ -245,7 +245,7 @@ abstract class Models { } abstract class MemberComposite(parent0: Composite) extends MemberMod(parent0) with Composite; - [_trait_] abstract class HasClassObjects extends Composite { + mixin class HasClassObjects extends Composite { override def isMember(tree : Tree) : Boolean = (super.isMember(tree) || (tree.isInstanceOf[ImplDef])); } diff --git a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala index e59e5b61f0..730c460822 100644 --- a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala +++ b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala @@ -50,12 +50,12 @@ class SemanticTokens(val compiler: Global) { else pos; } - [_trait_] abstract class HasNext extends Token { + mixin class HasNext extends Token { var next0: HasPrev = _; def next = next0; } - [_trait_] abstract class HasPrev extends Token { + mixin class HasPrev extends Token { var prev0: HasNext = _; def prev = prev0; } diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index c420718ac5..b715886dc5 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -1097,7 +1097,7 @@ mixin class Types requires SymbolTable { /** A prototype for mapping a function over all possible types */ - trait TypeMap extends Function1[Type, Type] { + abstract class TypeMap extends Function1[Type, Type] { // deferred inherited: def apply(tp: Type): Type private def cloneDecls(result: Type, tp: Type, decls: Scope): Type = { diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index dddd9b9821..a775008ab2 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -10,7 +10,7 @@ import symtab.Flags; import symtab.Flags._; /** Methods to create symbols and to enter them into scopes. */ -trait Namers requires Analyzer { +mixin class Namers requires Analyzer { import global._; import definitions._; |