Changed EOL flag of all files to be consistent. Corrected some files which had mixed EOL.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@5359 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
2bc2506ffb
commit
b8ec2ebe38
|
@ -1,42 +1,42 @@
|
|||
<?xml version=1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<shortcuts>
|
||||
<?xml version=1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<shortcuts>
|
||||
|
||||
<programGroup defaultName="Scala 1.4.0.1" location="applications" />
|
||||
|
||||
|
||||
<skipIfNotSupported />
|
||||
|
||||
|
||||
<shortcut
|
||||
os="windows"
|
||||
name="Scala Interpreter"
|
||||
os="windows"
|
||||
name="Scala Interpreter"
|
||||
target="$INSTALL_PATH\bin\scalaint.bat"
|
||||
workingDirectory="$SYSTEM_user_home"
|
||||
workingDirectory="$SYSTEM_user_home"
|
||||
commandLine=""
|
||||
terminal="true"
|
||||
programGroup="yes" />
|
||||
|
||||
<shortcut
|
||||
os="windows"
|
||||
name="Scala API Documentation"
|
||||
target="$INSTALL_PATH\doc\api\index.html"
|
||||
commandLine=""
|
||||
terminal="true"
|
||||
programGroup="yes" />
|
||||
|
||||
<shortcut
|
||||
os="windows"
|
||||
name="ScalaByExample.pdf"
|
||||
target="$INSTALL_PATH\doc\ScalaByExample.pdf"
|
||||
programGroup="yes" />
|
||||
|
||||
<shortcut
|
||||
os="windows"
|
||||
name="ScalaReference.pdf"
|
||||
target="$INSTALL_PATH\doc\ScalaReference.pdf"
|
||||
os="windows"
|
||||
name="Scala API Documentation"
|
||||
target="$INSTALL_PATH\doc\api\index.html"
|
||||
commandLine=""
|
||||
programGroup="yes" />
|
||||
|
||||
<shortcut
|
||||
os="windows"
|
||||
name="ScalaTutorial.pdf"
|
||||
target="$INSTALL_PATH\doc\ScalaTutorial.pdf"
|
||||
os="windows"
|
||||
name="ScalaByExample.pdf"
|
||||
target="$INSTALL_PATH\doc\ScalaByExample.pdf"
|
||||
programGroup="yes" />
|
||||
|
||||
</shortcuts>
|
||||
|
||||
<shortcut
|
||||
os="windows"
|
||||
name="ScalaReference.pdf"
|
||||
target="$INSTALL_PATH\doc\ScalaReference.pdf"
|
||||
programGroup="yes" />
|
||||
|
||||
<shortcut
|
||||
os="windows"
|
||||
name="ScalaTutorial.pdf"
|
||||
target="$INSTALL_PATH\doc\ScalaTutorial.pdf"
|
||||
programGroup="yes" />
|
||||
|
||||
</shortcuts>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Manifest-Version: 1.0
|
||||
Created-By: 1.4.2_09 (Sun Microsystems Inc.)
|
||||
Main-Class: Main
|
||||
Manifest-Version: 1.0
|
||||
Created-By: 1.4.2_09 (Sun Microsystems Inc.)
|
||||
Main-Class: Main
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** **
|
||||
** $Id$
|
||||
\* */
|
||||
package scala;
|
||||
|
||||
|
||||
/** This class implements errors which are thrown whenever an
|
||||
* object doesn't match any pattern of a pattern matching
|
||||
* expression.
|
||||
*
|
||||
* @author Matthias Zenger
|
||||
* @author Martin Odersky
|
||||
* @version 1.1, 05/03/2004
|
||||
*/
|
||||
object MatchError {
|
||||
|
||||
// todo: change pattern matcher so that dummy type parameter T can be removed.
|
||||
def fail[T](source: String, line: Int): All = throw new MatchError(source, line);
|
||||
|
||||
def report(source: String, line: Int, obj: Any) =
|
||||
try {
|
||||
throw new MatchError(source, line, obj.toString())
|
||||
} catch {
|
||||
case e: MatchError => throw e
|
||||
case e: Throwable => throw new MatchError(source, line)
|
||||
}
|
||||
}
|
||||
|
||||
final class MatchError(msg: String) extends Error(msg) {
|
||||
def this(source: String, line: Int) =
|
||||
this(" in '" + source + "' at line " + line);
|
||||
def this(source: String, line: Int, obj: String) =
|
||||
this("for object " + obj + " in '" + source + "' at line " + line);
|
||||
}
|
||||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** **
|
||||
** $Id$
|
||||
\* */
|
||||
package scala;
|
||||
|
||||
|
||||
/** This class implements errors which are thrown whenever an
|
||||
* object doesn't match any pattern of a pattern matching
|
||||
* expression.
|
||||
*
|
||||
* @author Matthias Zenger
|
||||
* @author Martin Odersky
|
||||
* @version 1.1, 05/03/2004
|
||||
*/
|
||||
object MatchError {
|
||||
|
||||
// todo: change pattern matcher so that dummy type parameter T can be removed.
|
||||
def fail[T](source: String, line: Int): All = throw new MatchError(source, line);
|
||||
|
||||
def report(source: String, line: Int, obj: Any) =
|
||||
try {
|
||||
throw new MatchError(source, line, obj.toString())
|
||||
} catch {
|
||||
case e: MatchError => throw e
|
||||
case e: Throwable => throw new MatchError(source, line)
|
||||
}
|
||||
}
|
||||
|
||||
final class MatchError(msg: String) extends Error(msg) {
|
||||
def this(source: String, line: Int) =
|
||||
this(" in '" + source + "' at line " + line);
|
||||
def this(source: String, line: Int, obj: String) =
|
||||
this("for object " + obj + " in '" + source + "' at line " + line);
|
||||
}
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002-2004, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** $Id$
|
||||
\* */
|
||||
package scala.reflect;
|
||||
|
||||
abstract class Symbol {
|
||||
val owner: Symbol;
|
||||
val name: String;
|
||||
val tpe: Type;
|
||||
}
|
||||
|
||||
abstract class GlobalSymbol(val fullname: String) extends Symbol {
|
||||
private val pointIndex = fullname.lastIndexOf('.');
|
||||
val owner: Symbol =
|
||||
if (pointIndex < 0) RootSymbol else Class(fullname.substring(0, pointIndex));
|
||||
val name: String =
|
||||
if (pointIndex < 0) fullname else fullname.substring(pointIndex, fullname.length());
|
||||
}
|
||||
|
||||
abstract class LocalSymbol extends Symbol {}
|
||||
|
||||
case class Class(override val fullname: String) extends GlobalSymbol(fullname) {
|
||||
val tpe = NamedType(fullname);
|
||||
}
|
||||
|
||||
case class Method(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname);
|
||||
|
||||
case class Field(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname);
|
||||
|
||||
case class TypeField(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname);
|
||||
|
||||
case class LocalValue(owner: Symbol, name: String, tpe: Type) extends LocalSymbol;
|
||||
|
||||
case class LocalMethod(owner: Symbol, name: String, tpe: Type) extends LocalSymbol;
|
||||
|
||||
case object NoSymbol extends Symbol {
|
||||
val owner = null;
|
||||
val name = null;
|
||||
val tpe = NoType
|
||||
}
|
||||
|
||||
case object RootSymbol extends Symbol {
|
||||
val owner = NoSymbol;
|
||||
val name = "<root>";
|
||||
val tpe = NoPrefix
|
||||
}
|
||||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002-2004, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** $Id$
|
||||
\* */
|
||||
package scala.reflect;
|
||||
|
||||
abstract class Symbol {
|
||||
val owner: Symbol;
|
||||
val name: String;
|
||||
val tpe: Type;
|
||||
}
|
||||
|
||||
abstract class GlobalSymbol(val fullname: String) extends Symbol {
|
||||
private val pointIndex = fullname.lastIndexOf('.');
|
||||
val owner: Symbol =
|
||||
if (pointIndex < 0) RootSymbol else Class(fullname.substring(0, pointIndex));
|
||||
val name: String =
|
||||
if (pointIndex < 0) fullname else fullname.substring(pointIndex, fullname.length());
|
||||
}
|
||||
|
||||
abstract class LocalSymbol extends Symbol {}
|
||||
|
||||
case class Class(override val fullname: String) extends GlobalSymbol(fullname) {
|
||||
val tpe = NamedType(fullname);
|
||||
}
|
||||
|
||||
case class Method(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname);
|
||||
|
||||
case class Field(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname);
|
||||
|
||||
case class TypeField(override val fullname: String, tpe: Type) extends GlobalSymbol(fullname);
|
||||
|
||||
case class LocalValue(owner: Symbol, name: String, tpe: Type) extends LocalSymbol;
|
||||
|
||||
case class LocalMethod(owner: Symbol, name: String, tpe: Type) extends LocalSymbol;
|
||||
|
||||
case object NoSymbol extends Symbol {
|
||||
val owner = null;
|
||||
val name = null;
|
||||
val tpe = NoType
|
||||
}
|
||||
|
||||
case object RootSymbol extends Symbol {
|
||||
val owner = NoSymbol;
|
||||
val name = "<root>";
|
||||
val tpe = NoPrefix
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002-2004, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** $Id$
|
||||
\* */
|
||||
package scala.reflect;
|
||||
|
||||
class TypedCode[T](val code: Code) {
|
||||
}
|
||||
|
||||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002-2004, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** $Id$
|
||||
\* */
|
||||
package scala.reflect;
|
||||
|
||||
class TypedCode[T](val code: Code) {
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
// $Id$
|
||||
|
||||
using System;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
// $Id$
|
||||
|
||||
using System;
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc;
|
||||
|
||||
class CompilerRun {
|
||||
def firstPhase: Phase = NoPhase;
|
||||
def terminalPhase: Phase = NoPhase;
|
||||
def namerPhase: Phase = NoPhase;
|
||||
def typerPhase: Phase = NoPhase;
|
||||
def refchecksPhase: Phase = NoPhase;
|
||||
def explicitOuterPhase: Phase = NoPhase;
|
||||
def erasurePhase: Phase = NoPhase;
|
||||
def flattenPhase: Phase = NoPhase;
|
||||
def mixinPhase: Phase = NoPhase;
|
||||
def phaseNamed(name: String): Phase = NoPhase;
|
||||
}
|
||||
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc;
|
||||
|
||||
class CompilerRun {
|
||||
def firstPhase: Phase = NoPhase;
|
||||
def terminalPhase: Phase = NoPhase;
|
||||
def namerPhase: Phase = NoPhase;
|
||||
def typerPhase: Phase = NoPhase;
|
||||
def refchecksPhase: Phase = NoPhase;
|
||||
def explicitOuterPhase: Phase = NoPhase;
|
||||
def erasurePhase: Phase = NoPhase;
|
||||
def flattenPhase: Phase = NoPhase;
|
||||
def mixinPhase: Phase = NoPhase;
|
||||
def phaseNamed(name: String): Phase = NoPhase;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc;
|
||||
|
||||
import symtab.Flags;
|
||||
|
||||
abstract class Phase(val prev: Phase) {
|
||||
|
||||
type Id = int;
|
||||
|
||||
val id: Id = if (prev == null) 0 else prev.id + 1;
|
||||
|
||||
def newFlags: long = 0l;
|
||||
private var fmask: long =
|
||||
if (prev == null) Flags.InitialFlags else prev.flagMask | newFlags;
|
||||
def flagMask: long = fmask;
|
||||
|
||||
private var nx: Phase = this;
|
||||
if (prev != null) prev.nx = this;
|
||||
|
||||
def next: Phase = nx;
|
||||
|
||||
def name: String;
|
||||
def description: String = name;
|
||||
def erasedTypes: boolean = false;
|
||||
def flatClasses: boolean = false;
|
||||
def run: unit;
|
||||
|
||||
override def toString() = name;
|
||||
}
|
||||
|
||||
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc;
|
||||
|
||||
import symtab.Flags;
|
||||
|
||||
abstract class Phase(val prev: Phase) {
|
||||
|
||||
type Id = int;
|
||||
|
||||
val id: Id = if (prev == null) 0 else prev.id + 1;
|
||||
|
||||
def newFlags: long = 0l;
|
||||
private var fmask: long =
|
||||
if (prev == null) Flags.InitialFlags else prev.flagMask | newFlags;
|
||||
def flagMask: long = fmask;
|
||||
|
||||
private var nx: Phase = this;
|
||||
if (prev != null) prev.nx = this;
|
||||
|
||||
def next: Phase = nx;
|
||||
|
||||
def name: String;
|
||||
def description: String = name;
|
||||
def erasedTypes: boolean = false;
|
||||
def flatClasses: boolean = false;
|
||||
def run: unit;
|
||||
|
||||
override def toString() = name;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,158 +1,158 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.ast;
|
||||
|
||||
import scala.tools.nsc.util.Position;
|
||||
import symtab.Flags._;
|
||||
|
||||
abstract class TreeGen {
|
||||
|
||||
val global: Global;
|
||||
|
||||
import global._;
|
||||
import definitions._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** Builds a reference to value whose type is given stable prefix.
|
||||
*/
|
||||
def mkQualifier(tpe: Type): Tree = tpe match {
|
||||
case NoPrefix =>
|
||||
EmptyTree
|
||||
case ThisType(clazz) =>
|
||||
if (clazz.isRoot || clazz.isEmptyPackageClass) EmptyTree else This(clazz)
|
||||
case SingleType(pre, sym) =>
|
||||
if (sym.isThisSkolem) {
|
||||
mkQualifier(ThisType(sym.deSkolemize))
|
||||
} else {
|
||||
val qual = mkStableRef(pre, sym);
|
||||
qual.tpe match {
|
||||
case MethodType(List(), restpe) =>
|
||||
Apply(qual, List()) setType restpe
|
||||
case _ =>
|
||||
qual
|
||||
}
|
||||
}
|
||||
case TypeRef(pre, sym, args) =>
|
||||
assert(phase.erasedTypes);
|
||||
if (sym.isModuleClass && !sym.isRoot) {
|
||||
val qual = Select(mkQualifier(sym.owner.tpe), sym.sourceModule);
|
||||
qual.tpe match {
|
||||
case MethodType(List(), restpe) =>
|
||||
Apply(qual, List()) setType restpe
|
||||
case _ =>
|
||||
qual
|
||||
}
|
||||
} else This(sym)
|
||||
}
|
||||
|
||||
/** Builds a reference to given symbol with given stable prefix. */
|
||||
def mkRef(pre: Type, sym: Symbol): Tree = {
|
||||
val qual = mkQualifier(pre);
|
||||
if (qual == EmptyTree) Ident(sym) else Select(qual, sym)
|
||||
}
|
||||
|
||||
/** Builds a reference to given symbol. */
|
||||
def mkRef(sym: Symbol): Tree =
|
||||
if (sym.owner.isClass) mkRef(sym.owner.thisType, sym) else Ident(sym);
|
||||
|
||||
/** Replaces tree type with a stable type if possible */
|
||||
def stabilize(tree: Tree): Tree = tree match {
|
||||
case Ident(_) =>
|
||||
if (tree.symbol.isStable) tree.setType(singleType(tree.symbol.owner.thisType, tree.symbol))
|
||||
else tree
|
||||
case Select(qual, _) =>
|
||||
if (tree.symbol.isStable && qual.tpe.isStable) tree.setType(singleType(qual.tpe, tree.symbol))
|
||||
else tree
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
|
||||
/** Cast `tree' to type `pt' */
|
||||
def cast(tree: Tree, pt: Type): Tree = {
|
||||
if (settings.debug.value) log("casting " + tree + ":" + tree.tpe + " to " + pt);
|
||||
assert(!tree.tpe.isInstanceOf[MethodType], tree);
|
||||
typer.typed {
|
||||
atPos(tree.pos) {
|
||||
Apply(TypeApply(Select(tree, Object_asInstanceOf), List(TypeTree(pt))), List())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Builds a reference with stable type to given symbol */
|
||||
def mkStableRef(pre: Type, sym: Symbol): Tree = stabilize(mkRef(pre, sym));
|
||||
def mkStableRef(sym: Symbol): Tree = stabilize(mkRef(sym));
|
||||
|
||||
def This(sym: Symbol): Tree =
|
||||
global.This(sym.name) setSymbol sym setType sym.thisType;
|
||||
|
||||
def Ident(sym: Symbol): Tree = {
|
||||
assert(sym.isTerm);
|
||||
global.Ident(sym.name) setSymbol sym setType sym.tpe;
|
||||
}
|
||||
|
||||
def Select(qual: Tree, sym: Symbol): Tree =
|
||||
if (qual.symbol != null &&
|
||||
(qual.symbol.name.toTermName == nme.ROOT ||
|
||||
qual.symbol.name.toTermName == nme.EMPTY_PACKAGE_NAME)) {
|
||||
this.Ident(sym)
|
||||
} else {
|
||||
assert(sym.isTerm);
|
||||
val result = global.Select(qual, sym.name) setSymbol sym;
|
||||
if (qual.tpe != null) result setType qual.tpe.memberType(sym);
|
||||
result
|
||||
}
|
||||
|
||||
/** Builds an instance test with given value and type. */
|
||||
def mkIsInstanceOf(value: Tree, tpe: Type, erased: Boolean): Tree = {
|
||||
val sym =
|
||||
if(erased)
|
||||
definitions.Any_isInstanceOfErased
|
||||
else
|
||||
definitions.Any_isInstanceOf;
|
||||
Apply(
|
||||
TypeApply(
|
||||
Select(value, sym),
|
||||
List(TypeTree(tpe))),
|
||||
List())
|
||||
}
|
||||
|
||||
def mkIsInstanceOf(value: Tree, tpe: Type): Tree = {
|
||||
mkIsInstanceOf(value, tpe, global.phase.erasedTypes);
|
||||
}
|
||||
|
||||
/** Builds a cast with given value and type. */
|
||||
def mkAsInstanceOf(value: Tree, tpe: Type, erased: Boolean): Tree = {
|
||||
val sym =
|
||||
if(erased)
|
||||
definitions.Any_asInstanceOfErased
|
||||
else
|
||||
definitions.Any_asInstanceOf;
|
||||
|
||||
Apply(
|
||||
TypeApply(
|
||||
Select(value, sym),
|
||||
List(TypeTree(tpe))),
|
||||
List())
|
||||
}
|
||||
|
||||
def mkAsInstanceOf(value: Tree, tpe: Type): Tree = {
|
||||
mkAsInstanceOf(value, tpe, global.phase.erasedTypes);
|
||||
}
|
||||
|
||||
|
||||
/** Builds a list with given head and tail. */
|
||||
def mkNewCons(head: Tree, tail: Tree): Tree =
|
||||
New(Apply(mkRef(definitions.ConsClass), List(head,tail)));
|
||||
|
||||
/** Builds a list with given head and tail. */
|
||||
def mkNil: Tree =
|
||||
mkRef(definitions.NilModule);
|
||||
|
||||
/** Builds a pair */
|
||||
def mkNewPair(left: Tree, right: Tree) =
|
||||
New(Apply(mkRef(definitions.TupleClass(2)), List(left,right)));
|
||||
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.ast;
|
||||
|
||||
import scala.tools.nsc.util.Position;
|
||||
import symtab.Flags._;
|
||||
|
||||
abstract class TreeGen {
|
||||
|
||||
val global: Global;
|
||||
|
||||
import global._;
|
||||
import definitions._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** Builds a reference to value whose type is given stable prefix.
|
||||
*/
|
||||
def mkQualifier(tpe: Type): Tree = tpe match {
|
||||
case NoPrefix =>
|
||||
EmptyTree
|
||||
case ThisType(clazz) =>
|
||||
if (clazz.isRoot || clazz.isEmptyPackageClass) EmptyTree else This(clazz)
|
||||
case SingleType(pre, sym) =>
|
||||
if (sym.isThisSkolem) {
|
||||
mkQualifier(ThisType(sym.deSkolemize))
|
||||
} else {
|
||||
val qual = mkStableRef(pre, sym);
|
||||
qual.tpe match {
|
||||
case MethodType(List(), restpe) =>
|
||||
Apply(qual, List()) setType restpe
|
||||
case _ =>
|
||||
qual
|
||||
}
|
||||
}
|
||||
case TypeRef(pre, sym, args) =>
|
||||
assert(phase.erasedTypes);
|
||||
if (sym.isModuleClass && !sym.isRoot) {
|
||||
val qual = Select(mkQualifier(sym.owner.tpe), sym.sourceModule);
|
||||
qual.tpe match {
|
||||
case MethodType(List(), restpe) =>
|
||||
Apply(qual, List()) setType restpe
|
||||
case _ =>
|
||||
qual
|
||||
}
|
||||
} else This(sym)
|
||||
}
|
||||
|
||||
/** Builds a reference to given symbol with given stable prefix. */
|
||||
def mkRef(pre: Type, sym: Symbol): Tree = {
|
||||
val qual = mkQualifier(pre);
|
||||
if (qual == EmptyTree) Ident(sym) else Select(qual, sym)
|
||||
}
|
||||
|
||||
/** Builds a reference to given symbol. */
|
||||
def mkRef(sym: Symbol): Tree =
|
||||
if (sym.owner.isClass) mkRef(sym.owner.thisType, sym) else Ident(sym);
|
||||
|
||||
/** Replaces tree type with a stable type if possible */
|
||||
def stabilize(tree: Tree): Tree = tree match {
|
||||
case Ident(_) =>
|
||||
if (tree.symbol.isStable) tree.setType(singleType(tree.symbol.owner.thisType, tree.symbol))
|
||||
else tree
|
||||
case Select(qual, _) =>
|
||||
if (tree.symbol.isStable && qual.tpe.isStable) tree.setType(singleType(qual.tpe, tree.symbol))
|
||||
else tree
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
|
||||
/** Cast `tree' to type `pt' */
|
||||
def cast(tree: Tree, pt: Type): Tree = {
|
||||
if (settings.debug.value) log("casting " + tree + ":" + tree.tpe + " to " + pt);
|
||||
assert(!tree.tpe.isInstanceOf[MethodType], tree);
|
||||
typer.typed {
|
||||
atPos(tree.pos) {
|
||||
Apply(TypeApply(Select(tree, Object_asInstanceOf), List(TypeTree(pt))), List())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Builds a reference with stable type to given symbol */
|
||||
def mkStableRef(pre: Type, sym: Symbol): Tree = stabilize(mkRef(pre, sym));
|
||||
def mkStableRef(sym: Symbol): Tree = stabilize(mkRef(sym));
|
||||
|
||||
def This(sym: Symbol): Tree =
|
||||
global.This(sym.name) setSymbol sym setType sym.thisType;
|
||||
|
||||
def Ident(sym: Symbol): Tree = {
|
||||
assert(sym.isTerm);
|
||||
global.Ident(sym.name) setSymbol sym setType sym.tpe;
|
||||
}
|
||||
|
||||
def Select(qual: Tree, sym: Symbol): Tree =
|
||||
if (qual.symbol != null &&
|
||||
(qual.symbol.name.toTermName == nme.ROOT ||
|
||||
qual.symbol.name.toTermName == nme.EMPTY_PACKAGE_NAME)) {
|
||||
this.Ident(sym)
|
||||
} else {
|
||||
assert(sym.isTerm);
|
||||
val result = global.Select(qual, sym.name) setSymbol sym;
|
||||
if (qual.tpe != null) result setType qual.tpe.memberType(sym);
|
||||
result
|
||||
}
|
||||
|
||||
/** Builds an instance test with given value and type. */
|
||||
def mkIsInstanceOf(value: Tree, tpe: Type, erased: Boolean): Tree = {
|
||||
val sym =
|
||||
if(erased)
|
||||
definitions.Any_isInstanceOfErased
|
||||
else
|
||||
definitions.Any_isInstanceOf;
|
||||
Apply(
|
||||
TypeApply(
|
||||
Select(value, sym),
|
||||
List(TypeTree(tpe))),
|
||||
List())
|
||||
}
|
||||
|
||||
def mkIsInstanceOf(value: Tree, tpe: Type): Tree = {
|
||||
mkIsInstanceOf(value, tpe, global.phase.erasedTypes);
|
||||
}
|
||||
|
||||
/** Builds a cast with given value and type. */
|
||||
def mkAsInstanceOf(value: Tree, tpe: Type, erased: Boolean): Tree = {
|
||||
val sym =
|
||||
if(erased)
|
||||
definitions.Any_asInstanceOfErased
|
||||
else
|
||||
definitions.Any_asInstanceOf;
|
||||
|
||||
Apply(
|
||||
TypeApply(
|
||||
Select(value, sym),
|
||||
List(TypeTree(tpe))),
|
||||
List())
|
||||
}
|
||||
|
||||
def mkAsInstanceOf(value: Tree, tpe: Type): Tree = {
|
||||
mkAsInstanceOf(value, tpe, global.phase.erasedTypes);
|
||||
}
|
||||
|
||||
|
||||
/** Builds a list with given head and tail. */
|
||||
def mkNewCons(head: Tree, tail: Tree): Tree =
|
||||
New(Apply(mkRef(definitions.ConsClass), List(head,tail)));
|
||||
|
||||
/** Builds a list with given head and tail. */
|
||||
def mkNil: Tree =
|
||||
mkRef(definitions.NilModule);
|
||||
|
||||
/** Builds a pair */
|
||||
def mkNewPair(left: Tree, right: Tree) =
|
||||
New(Apply(mkRef(definitions.TupleClass(2)), List(left,right)));
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,189 +1,189 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id: Trees.scala,v 1.35 2005/11/14 16:58:21 mcdirmid Exp $
|
||||
package scala.tools.nsc.models;
|
||||
|
||||
import scala.tools.nsc.Global;
|
||||
import scala.tools.nsc.ast.Trees;
|
||||
import scala.tools.nsc.symtab.Flags;
|
||||
import scala.tools.nsc.symtab.Names;
|
||||
|
||||
[_trait_] abstract class Models {
|
||||
val global : Global;
|
||||
|
||||
import global._;
|
||||
|
||||
abstract class Model {
|
||||
}
|
||||
abstract class HasTree extends Model {
|
||||
var tree : Tree = _;
|
||||
def update(tree0 : Tree): Boolean = {
|
||||
tree = tree0;
|
||||
false;
|
||||
}
|
||||
def replacedBy(tree0 : Tree) : Boolean = true;
|
||||
}
|
||||
class ImportMod extends HasTree {
|
||||
def treex = tree.asInstanceOf[Import];
|
||||
|
||||
override def replacedBy(tree0 : Tree) : Boolean = if (super.replacedBy(tree0) && tree0.isInstanceOf[Import]) {
|
||||
val tree1 = tree0.asInstanceOf[Import];
|
||||
tree1.tpe == treex.tpe;
|
||||
} else false;
|
||||
}
|
||||
|
||||
abstract class Composite extends Model {
|
||||
import scala.collection.mutable._;
|
||||
class Members extends HashSet[HasTree] with ObservableSet[HasTree, Members] {
|
||||
override def +=(elem: HasTree): Unit = super.+=(elem);
|
||||
override def -=(elem: HasTree): Unit = super.-=(elem);
|
||||
override def clear: Unit = super.clear;
|
||||
}
|
||||
object members extends Members;
|
||||
|
||||
def isMember(tree : Tree) : Boolean = false;
|
||||
|
||||
def update0(members1 : List[Tree]) : Boolean = {
|
||||
val marked = new HashSet[HasTree];
|
||||
var updated = false;
|
||||
for (val mmbr1 <- members1) {
|
||||
var found = false;
|
||||
for (val mmbr <- members) if (!found && mmbr.replacedBy(mmbr1)) {
|
||||
found = true;
|
||||
updated = mmbr.update(mmbr1) || updated;
|
||||
marked += mmbr;
|
||||
}
|
||||
if (!found) {
|
||||
updated = true;
|
||||
val add = modelFor(mmbr1);
|
||||
add.update(mmbr1);
|
||||
members += (add);
|
||||
marked += add;
|
||||
}
|
||||
}
|
||||
val sz = members.size;
|
||||
members.intersect(marked);
|
||||
updated = updated || sz < members.size;
|
||||
// check if anything was removed!
|
||||
updated;
|
||||
}
|
||||
}
|
||||
abstract class MemberMod extends HasTree {
|
||||
def treex = tree.asInstanceOf[MemberDef];
|
||||
def flags = new Flags.Flag(treex.mods0);
|
||||
def name : Name = { treex.name0; }
|
||||
|
||||
override def replacedBy(tree0 : Tree) : Boolean = if (super.replacedBy(tree0) && tree0.isInstanceOf[MemberDef]) {
|
||||
val tree1 = tree0.asInstanceOf[MemberDef];
|
||||
treex.name0 == tree1.name0;
|
||||
} else false;
|
||||
|
||||
override def update(tree0 : Tree): Boolean = {
|
||||
val updated = tree == null || (treex.mods0 != tree0.asInstanceOf[MemberDef].mods0);
|
||||
super.update(tree0) || updated;
|
||||
}
|
||||
}
|
||||
abstract class MemberComposite extends MemberMod with Composite;
|
||||
|
||||
abstract class HasClassObjects extends Composite {
|
||||
override def isMember(tree : Tree) : Boolean = super.isMember(tree) || tree.isInstanceOf[ImplDef];
|
||||
}
|
||||
abstract class ValOrDefMod extends MemberComposite with HasClassObjects {
|
||||
def treey = tree.asInstanceOf[ValOrDefDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ValOrDefDef]);
|
||||
|
||||
override def update(tree0 : Tree): Boolean = {
|
||||
val tree1 = tree0.asInstanceOf[ValOrDefDef];
|
||||
val updated = tree == null || treex.tpe != tree1.tpe;
|
||||
update0(flatten(tree1.rhs0, (tree2 : Tree) => isMember(tree2)));
|
||||
super.update(tree0) || updated;
|
||||
}
|
||||
}
|
||||
class ValMod extends ValOrDefMod {
|
||||
def treez = tree.asInstanceOf[ValDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ValDef]);
|
||||
}
|
||||
class DefMod extends ValOrDefMod {
|
||||
def treez = tree.asInstanceOf[DefDef];
|
||||
|
||||
override def replacedBy(tree0 : Tree) : Boolean = if (super.replacedBy(tree0) && tree0.isInstanceOf[DefDef]) {
|
||||
val tree1 = tree0.asInstanceOf[DefDef];
|
||||
if (tree1.vparamss.length == treez.vparamss.length) {
|
||||
val tpz = for (val vd <- treez.vparamss) yield for (val xd <- vd) yield xd.tpe;
|
||||
val tp1 = for (val vd <- tree1.vparamss) yield for (val xd <- vd) yield xd.tpe;
|
||||
tpz == tp1;
|
||||
} else false;
|
||||
} else false;
|
||||
}
|
||||
abstract class ImplMod extends MemberComposite with HasClassObjects {
|
||||
def treey = tree.asInstanceOf[ImplDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ImplDef]);
|
||||
override def isMember(tree : Tree) : Boolean = super.isMember(tree) || tree.isInstanceOf[ValOrDefDef] || tree.isInstanceOf[AliasTypeDef];
|
||||
|
||||
override def update(tree0 : Tree): Boolean = {
|
||||
val tree1 = tree0.asInstanceOf[ImplDef];
|
||||
|
||||
var updated = update0(tree1.impl0.body);
|
||||
|
||||
// XXX: ignore parents for now!
|
||||
|
||||
(super.update(tree0) || updated) && !flags.isPrivate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
class ClassMod extends ImplMod {
|
||||
def treez = tree.asInstanceOf[ClassDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ClassDef]);
|
||||
|
||||
override def update(tree0 : Tree): Boolean = {
|
||||
// XXX: type parameters and this type!
|
||||
|
||||
|
||||
super.update(tree0);
|
||||
}
|
||||
}
|
||||
class ObjectMod extends ImplMod {
|
||||
def treez = tree.asInstanceOf[ModuleDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ModuleDef]);
|
||||
}
|
||||
class AliasTypeMod extends MemberMod {
|
||||
def treey = tree.asInstanceOf[AliasTypeDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[AliasTypeDef]);
|
||||
}
|
||||
class SourceMod(val unit : CompilationUnit) extends Composite with HasClassObjects {
|
||||
override def isMember(tree : Tree) : Boolean = super.isMember(tree) || tree.isInstanceOf[Import];
|
||||
}
|
||||
|
||||
|
||||
def flatten0(exprs : List[Tree], filter: (Tree) => Boolean) : List[Tree] =
|
||||
for (val expr <- exprs; val t : Tree <- flatten(expr,filter)) yield t;
|
||||
|
||||
def flatten(expr : Tree, filter: (Tree) => Boolean) : List[Tree] =
|
||||
if (filter(expr)) expr :: Nil; else expr match {
|
||||
case Block(stats,last) => flatten0(stats, filter) ::: flatten(last, filter);
|
||||
case If(cond,thenp,elsep) => flatten(cond,filter) ::: flatten(thenp,filter) ::: flatten(elsep,filter);
|
||||
case Assign(lhs,rhs) => flatten(rhs,filter);
|
||||
case CaseDef(pat,guard,body) => flatten(body,filter);
|
||||
case Return(expr0) => flatten(expr0,filter);
|
||||
case Throw(expr0) => flatten(expr0,filter);
|
||||
case Try(block,catches,finalizer) => flatten(block,filter) ::: flatten(finalizer,filter) ::: flatten0(catches, filter);
|
||||
case Match(selector,cases) => flatten(selector,filter) ::: flatten0(cases, filter);
|
||||
case Apply(fun,args) => flatten(fun,filter) ::: flatten0(args,filter);
|
||||
case TypeApply(fun,args) => flatten(fun,filter) ::: flatten0(args,filter);
|
||||
case _ => Nil;
|
||||
}
|
||||
|
||||
|
||||
def modelFor(tree: Tree): HasTree = tree match {
|
||||
case _: ValDef => new ValMod();
|
||||
case _: DefDef => new DefMod();
|
||||
case _: ClassDef => new ClassMod();
|
||||
case _: ModuleDef => new ObjectMod();
|
||||
case _: AliasTypeDef => new AliasTypeMod();
|
||||
case _: Import => new ImportMod();
|
||||
}
|
||||
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id: Trees.scala,v 1.35 2005/11/14 16:58:21 mcdirmid Exp $
|
||||
package scala.tools.nsc.models;
|
||||
|
||||
import scala.tools.nsc.Global;
|
||||
import scala.tools.nsc.ast.Trees;
|
||||
import scala.tools.nsc.symtab.Flags;
|
||||
import scala.tools.nsc.symtab.Names;
|
||||
|
||||
[_trait_] abstract class Models {
|
||||
val global : Global;
|
||||
|
||||
import global._;
|
||||
|
||||
abstract class Model {
|
||||
}
|
||||
abstract class HasTree extends Model {
|
||||
var tree : Tree = _;
|
||||
def update(tree0 : Tree): Boolean = {
|
||||
tree = tree0;
|
||||
false;
|
||||
}
|
||||
def replacedBy(tree0 : Tree) : Boolean = true;
|
||||
}
|
||||
class ImportMod extends HasTree {
|
||||
def treex = tree.asInstanceOf[Import];
|
||||
|
||||
override def replacedBy(tree0 : Tree) : Boolean = if (super.replacedBy(tree0) && tree0.isInstanceOf[Import]) {
|
||||
val tree1 = tree0.asInstanceOf[Import];
|
||||
tree1.tpe == treex.tpe;
|
||||
} else false;
|
||||
}
|
||||
|
||||
abstract class Composite extends Model {
|
||||
import scala.collection.mutable._;
|
||||
class Members extends HashSet[HasTree] with ObservableSet[HasTree, Members] {
|
||||
override def +=(elem: HasTree): Unit = super.+=(elem);
|
||||
override def -=(elem: HasTree): Unit = super.-=(elem);
|
||||
override def clear: Unit = super.clear;
|
||||
}
|
||||
object members extends Members;
|
||||
|
||||
def isMember(tree : Tree) : Boolean = false;
|
||||
|
||||
def update0(members1 : List[Tree]) : Boolean = {
|
||||
val marked = new HashSet[HasTree];
|
||||
var updated = false;
|
||||
for (val mmbr1 <- members1) {
|
||||
var found = false;
|
||||
for (val mmbr <- members) if (!found && mmbr.replacedBy(mmbr1)) {
|
||||
found = true;
|
||||
updated = mmbr.update(mmbr1) || updated;
|
||||
marked += mmbr;
|
||||
}
|
||||
if (!found) {
|
||||
updated = true;
|
||||
val add = modelFor(mmbr1);
|
||||
add.update(mmbr1);
|
||||
members += (add);
|
||||
marked += add;
|
||||
}
|
||||
}
|
||||
val sz = members.size;
|
||||
members.intersect(marked);
|
||||
updated = updated || sz < members.size;
|
||||
// check if anything was removed!
|
||||
updated;
|
||||
}
|
||||
}
|
||||
abstract class MemberMod extends HasTree {
|
||||
def treex = tree.asInstanceOf[MemberDef];
|
||||
def flags = new Flags.Flag(treex.mods0);
|
||||
def name : Name = { treex.name0; }
|
||||
|
||||
override def replacedBy(tree0 : Tree) : Boolean = if (super.replacedBy(tree0) && tree0.isInstanceOf[MemberDef]) {
|
||||
val tree1 = tree0.asInstanceOf[MemberDef];
|
||||
treex.name0 == tree1.name0;
|
||||
} else false;
|
||||
|
||||
override def update(tree0 : Tree): Boolean = {
|
||||
val updated = tree == null || (treex.mods0 != tree0.asInstanceOf[MemberDef].mods0);
|
||||
super.update(tree0) || updated;
|
||||
}
|
||||
}
|
||||
abstract class MemberComposite extends MemberMod with Composite;
|
||||
|
||||
abstract class HasClassObjects extends Composite {
|
||||
override def isMember(tree : Tree) : Boolean = super.isMember(tree) || tree.isInstanceOf[ImplDef];
|
||||
}
|
||||
abstract class ValOrDefMod extends MemberComposite with HasClassObjects {
|
||||
def treey = tree.asInstanceOf[ValOrDefDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ValOrDefDef]);
|
||||
|
||||
override def update(tree0 : Tree): Boolean = {
|
||||
val tree1 = tree0.asInstanceOf[ValOrDefDef];
|
||||
val updated = tree == null || treex.tpe != tree1.tpe;
|
||||
update0(flatten(tree1.rhs0, (tree2 : Tree) => isMember(tree2)));
|
||||
super.update(tree0) || updated;
|
||||
}
|
||||
}
|
||||
class ValMod extends ValOrDefMod {
|
||||
def treez = tree.asInstanceOf[ValDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ValDef]);
|
||||
}
|
||||
class DefMod extends ValOrDefMod {
|
||||
def treez = tree.asInstanceOf[DefDef];
|
||||
|
||||
override def replacedBy(tree0 : Tree) : Boolean = if (super.replacedBy(tree0) && tree0.isInstanceOf[DefDef]) {
|
||||
val tree1 = tree0.asInstanceOf[DefDef];
|
||||
if (tree1.vparamss.length == treez.vparamss.length) {
|
||||
val tpz = for (val vd <- treez.vparamss) yield for (val xd <- vd) yield xd.tpe;
|
||||
val tp1 = for (val vd <- tree1.vparamss) yield for (val xd <- vd) yield xd.tpe;
|
||||
tpz == tp1;
|
||||
} else false;
|
||||
} else false;
|
||||
}
|
||||
abstract class ImplMod extends MemberComposite with HasClassObjects {
|
||||
def treey = tree.asInstanceOf[ImplDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ImplDef]);
|
||||
override def isMember(tree : Tree) : Boolean = super.isMember(tree) || tree.isInstanceOf[ValOrDefDef] || tree.isInstanceOf[AliasTypeDef];
|
||||
|
||||
override def update(tree0 : Tree): Boolean = {
|
||||
val tree1 = tree0.asInstanceOf[ImplDef];
|
||||
|
||||
var updated = update0(tree1.impl0.body);
|
||||
|
||||
// XXX: ignore parents for now!
|
||||
|
||||
(super.update(tree0) || updated) && !flags.isPrivate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
class ClassMod extends ImplMod {
|
||||
def treez = tree.asInstanceOf[ClassDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ClassDef]);
|
||||
|
||||
override def update(tree0 : Tree): Boolean = {
|
||||
// XXX: type parameters and this type!
|
||||
|
||||
|
||||
super.update(tree0);
|
||||
}
|
||||
}
|
||||
class ObjectMod extends ImplMod {
|
||||
def treez = tree.asInstanceOf[ModuleDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[ModuleDef]);
|
||||
}
|
||||
class AliasTypeMod extends MemberMod {
|
||||
def treey = tree.asInstanceOf[AliasTypeDef];
|
||||
override def replacedBy(tree0 : Tree) : Boolean = (super.replacedBy(tree0) && tree0.isInstanceOf[AliasTypeDef]);
|
||||
}
|
||||
class SourceMod(val unit : CompilationUnit) extends Composite with HasClassObjects {
|
||||
override def isMember(tree : Tree) : Boolean = super.isMember(tree) || tree.isInstanceOf[Import];
|
||||
}
|
||||
|
||||
|
||||
def flatten0(exprs : List[Tree], filter: (Tree) => Boolean) : List[Tree] =
|
||||
for (val expr <- exprs; val t : Tree <- flatten(expr,filter)) yield t;
|
||||
|
||||
def flatten(expr : Tree, filter: (Tree) => Boolean) : List[Tree] =
|
||||
if (filter(expr)) expr :: Nil; else expr match {
|
||||
case Block(stats,last) => flatten0(stats, filter) ::: flatten(last, filter);
|
||||
case If(cond,thenp,elsep) => flatten(cond,filter) ::: flatten(thenp,filter) ::: flatten(elsep,filter);
|
||||
case Assign(lhs,rhs) => flatten(rhs,filter);
|
||||
case CaseDef(pat,guard,body) => flatten(body,filter);
|
||||
case Return(expr0) => flatten(expr0,filter);
|
||||
case Throw(expr0) => flatten(expr0,filter);
|
||||
case Try(block,catches,finalizer) => flatten(block,filter) ::: flatten(finalizer,filter) ::: flatten0(catches, filter);
|
||||
case Match(selector,cases) => flatten(selector,filter) ::: flatten0(cases, filter);
|
||||
case Apply(fun,args) => flatten(fun,filter) ::: flatten0(args,filter);
|
||||
case TypeApply(fun,args) => flatten(fun,filter) ::: flatten0(args,filter);
|
||||
case _ => Nil;
|
||||
}
|
||||
|
||||
|
||||
def modelFor(tree: Tree): HasTree = tree match {
|
||||
case _: ValDef => new ValMod();
|
||||
case _: DefDef => new DefMod();
|
||||
case _: ClassDef => new ClassMod();
|
||||
case _: ModuleDef => new ObjectMod();
|
||||
case _: AliasTypeDef => new AliasTypeMod();
|
||||
case _: Import => new ImportMod();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,191 +1,191 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab;
|
||||
|
||||
object Flags {
|
||||
|
||||
// modifiers
|
||||
final val IMPLICIT = 0x00000001;
|
||||
final val FINAL = 0x00000002;
|
||||
final val PRIVATE = 0x00000004;
|
||||
final val PROTECTED = 0x00000008;
|
||||
|
||||
final val SEALED = 0x00000010;
|
||||
final val OVERRIDE = 0x00000020;
|
||||
final val CASE = 0x00000040;
|
||||
final val ABSTRACT = 0x00000080; // abstract class, or used in conjunction
|
||||
// with abstract override.
|
||||
// Note difference to DEFERRED!
|
||||
|
||||
final val DEFERRED = 0x00000100; // was `abstract' for members
|
||||
final val METHOD = 0x00000200; // a method
|
||||
final val MODULE = 0x00000400; // symbol is module or class implementing a module
|
||||
final val INTERFACE = 0x00000800; // symbol is an interface
|
||||
|
||||
final val MUTABLE = 0x00001000; // symbol is a mutable variable.
|
||||
final val PARAM = 0x00002000; // symbol is a (value or type) parameter to a method
|
||||
final val PACKAGE = 0x00004000; // symbol is a java package
|
||||
final val DEPRECATED = 0x00008000; // symbol is deprecated.
|
||||
|
||||
final val COVARIANT = 0x00010000; // symbol is a covariant type variable
|
||||
final val CONTRAVARIANT = 0x00020000; // symbol is a contravariant type variable
|
||||
final val ABSOVERRIDE = 0x00040000; // combination of abstract & override
|
||||
final val LOCAL = 0x00080000; // symbol is local to current class.
|
||||
// pre: PRIVATE is also set
|
||||
|
||||
final val JAVA = 0x00100000; // symbol was defined by a Java class
|
||||
final val SYNTHETIC = 0x00200000; // symbol is compiler-generated
|
||||
final val STABLE = 0x00400000; // functions that are assumed to be stable
|
||||
// (typically, access methods for valdefs)
|
||||
final val STATIC = 0x00800000; // static field, method or class
|
||||
|
||||
final val CASEACCESSOR = 0x01000000; // symbol is a case parameter (or its accessor)
|
||||
final val TRAIT = 0x02000000; // symbol is a trait
|
||||
final val BRIDGE = 0x04000000; // function is a bridge method. Set by Erasure
|
||||
final val ACCESSOR = 0x08000000; // a value or variable accessor
|
||||
|
||||
final val SUPERACCESSOR = 0x10000000; // a super accessor
|
||||
final val PARAMACCESSOR = 0x20000000; // for value definitions: is an access method for a final val parameter
|
||||
// for parameters: is a val parameter
|
||||
|
||||
final val CAPTURED = 0x40000000; // variable is accessed from nested function. Set by LambdaLift
|
||||
final val BYNAMEPARAM = 0x40000000; // parameter is by name
|
||||
|
||||
final val LABEL = 0x80000000L; // method symbol is a label. Set by TailCall
|
||||
final val INCONSTRUCTOR = 0x80000000L; // class symbol is defined in this/superclass constructor.
|
||||
|
||||
final val IS_ERROR = 0x100000000L; // symbol is an error symbol
|
||||
final val OVERLOADED = 0x200000000L; // symbol is overloaded
|
||||
final val LIFTED = 0x400000000L; // class has been lifted out to package level
|
||||
// local value has been lifted out to class level
|
||||
//todo: make LIFTED = latePRIVATE?
|
||||
|
||||
final val MIXEDIN = 0x800000000L; // member has been mixed in
|
||||
|
||||
final val EXPANDEDNAME = 0x1000000000L; // name has been expanded with class suffix
|
||||
final val IMPLCLASS = 0x2000000000L; // symbol is an implementation class
|
||||
final val TRANS_FLAG = 0x4000000000L; // transient flag guaranteed to be reset after each phase.
|
||||
|
||||
final val LOCKED = 0x8000000000L; // temporary flag to catch cyclic dependencies
|
||||
|
||||
final val InitialFlags = 0x000000FFFFFFFFFFL; // flags that are enabled from phase 1.
|
||||
final val LateFlags = 0x000FFF0000000000L; // flags that override flags in 0xFFF.
|
||||
final val AntiFlags = 0x7FF0000000000000L; // flags that cancel flags in 0x7FF
|
||||
final val LateShift = 40L;
|
||||
final val AntiShift = 52L;
|
||||
|
||||
// late flags (set by a transformer phase)
|
||||
final val latePRIVATE = (PRIVATE: long) << LateShift;
|
||||
final val lateDEFERRED = (DEFERRED: long) << LateShift;
|
||||
final val lateINTERFACE = (INTERFACE: long) << LateShift;
|
||||
final val lateMODULE = (MODULE: long) << LateShift;
|
||||
final val lateFINAL = (FINAL: long) << LateShift;
|
||||
final val lateMETHOD = (METHOD: long) << LateShift;
|
||||
final val notPRIVATE = (PRIVATE: long) << AntiShift;
|
||||
final val notPROTECTED = (PROTECTED: long) << AntiShift;
|
||||
final val notABSTRACT = (ABSTRACT: long) << AntiShift;
|
||||
final val notOVERRIDE = (OVERRIDE: long) << AntiShift;
|
||||
final val notMETHOD = (METHOD: long) << AntiShift;
|
||||
|
||||
final val STATICMODULE = lateMODULE;
|
||||
final val STATICMEMBER = notOVERRIDE;
|
||||
|
||||
|
||||
// masks
|
||||
/** This flags can be set when class or module symbol is first created. */
|
||||
final val TopLevelCreationFlags =
|
||||
MODULE | PACKAGE | FINAL | JAVA;
|
||||
|
||||
final val ExplicitFlags = // these modifiers can be set explicitly in source programs.
|
||||
PRIVATE | PROTECTED | ABSTRACT | FINAL | SEALED | OVERRIDE | CASE | IMPLICIT | ABSOVERRIDE;
|
||||
|
||||
final val PrintableFlags = // these modifiers appear in TreePrinter output.
|
||||
(ExplicitFlags | LOCAL | SYNTHETIC | STABLE | CASEACCESSOR | ACCESSOR |
|
||||
SUPERACCESSOR | PARAMACCESSOR | BRIDGE | STATIC);
|
||||
|
||||
final val FieldFlags = MUTABLE | CASEACCESSOR | PARAMACCESSOR | STATIC | FINAL;
|
||||
|
||||
final val AccessFlags = PRIVATE | PROTECTED;
|
||||
final val VARIANCES = COVARIANT | CONTRAVARIANT;
|
||||
final val ConstrFlags = JAVA;
|
||||
final val PickledFlags = 0xFFFFFFFF;
|
||||
|
||||
/** Module flags inherited by their module-class */
|
||||
final val ModuleToClassFlags = AccessFlags | PACKAGE | CASE;
|
||||
|
||||
def flagsToString(flags: long, suffixes: List[Pair[long, String]]): String =
|
||||
(for (val i <- List.range(0, 63)) yield {
|
||||
var s = flagToString(flags & (1L << i));
|
||||
suffixes.find(._1.==(i)) match {
|
||||
case Some(Pair(i, suffix)) => s = s + "[" + suffix + "]"
|
||||
case None =>
|
||||
}
|
||||
s
|
||||
}).filter("" !=).mkString("", " ", "");
|
||||
|
||||
def flagsToString(flags: long): String = flagsToString(flags, List());
|
||||
|
||||
private def flagToString(flag: long): String = {
|
||||
if (flag == LABEL) "<label>"
|
||||
else if (flag == INTERFACE) "<interface>"
|
||||
else if (flag == IS_ERROR) "<is-error>"
|
||||
else if (flag == OVERLOADED) "<overloaded>"
|
||||
else if (flag == LIFTED) "<lifted>"
|
||||
else if (flag == TRANS_FLAG) "<trans-flag>"
|
||||
else if (flag == MIXEDIN) "<mixedin>"
|
||||
else if (flag == EXPANDEDNAME) "<expandedname>"
|
||||
else if (flag == LOCKED) "<locked>"
|
||||
else if (flag == STATICMODULE) "<staticobject>"
|
||||
else if (flag == STATICMEMBER) "<staticmember>"
|
||||
else flag.asInstanceOf[int] match {
|
||||
case IMPLICIT => "implicit"
|
||||
case FINAL => "final"
|
||||
case PRIVATE => "private"
|
||||
case PROTECTED => "protected"
|
||||
|
||||
case SEALED => "sealed"
|
||||
case OVERRIDE => "override"
|
||||
case CASE => "case"
|
||||
case ABSTRACT => "abstract"
|
||||
|
||||
case DEFERRED => "<deferred>"
|
||||
case METHOD => "<method>"
|
||||
case TRAIT => "<trait>"
|
||||
case MODULE => "<module>"
|
||||
|
||||
case MUTABLE => "<mutable>"
|
||||
case PARAM => "<param>"
|
||||
case PACKAGE => "<package>"
|
||||
case DEPRECATED => "<deprecated>"
|
||||
|
||||
case COVARIANT => "<covariant>"
|
||||
case CONTRAVARIANT => "<contravariant>"
|
||||
case ABSOVERRIDE => "abstract override"
|
||||
case LOCAL => "<local>"
|
||||
|
||||
case JAVA => "<java>"
|
||||
case SYNTHETIC => "<synthetic>"
|
||||
case STABLE => "<stable>"
|
||||
case STATIC => "<static>"
|
||||
|
||||
case CASEACCESSOR => "<caseaccessor>"
|
||||
case ACCESSOR => "<accessor>"
|
||||
|
||||
case SUPERACCESSOR => "<superaccessor>"
|
||||
case PARAMACCESSOR => "<paramaccessor>"
|
||||
case BRIDGE => "<bridge>"
|
||||
case CAPTURED => "<captured>"
|
||||
|
||||
case _ => ""
|
||||
}
|
||||
}
|
||||
class Flag(mods : int) {
|
||||
def isPrivate = ((mods & PRIVATE ) != 0);
|
||||
def isProtected = ((mods & PROTECTED) != 0);
|
||||
def isVariable = ((mods & MUTABLE) != 0);
|
||||
def isPublic = !isPrivate && !isProtected;
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab;
|
||||
|
||||
object Flags {
|
||||
|
||||
// modifiers
|
||||
final val IMPLICIT = 0x00000001;
|
||||
final val FINAL = 0x00000002;
|
||||
final val PRIVATE = 0x00000004;
|
||||
final val PROTECTED = 0x00000008;
|
||||
|
||||
final val SEALED = 0x00000010;
|
||||
final val OVERRIDE = 0x00000020;
|
||||
final val CASE = 0x00000040;
|
||||
final val ABSTRACT = 0x00000080; // abstract class, or used in conjunction
|
||||
// with abstract override.
|
||||
// Note difference to DEFERRED!
|
||||
|
||||
final val DEFERRED = 0x00000100; // was `abstract' for members
|
||||
final val METHOD = 0x00000200; // a method
|
||||
final val MODULE = 0x00000400; // symbol is module or class implementing a module
|
||||
final val INTERFACE = 0x00000800; // symbol is an interface
|
||||
|
||||
final val MUTABLE = 0x00001000; // symbol is a mutable variable.
|
||||
final val PARAM = 0x00002000; // symbol is a (value or type) parameter to a method
|
||||
final val PACKAGE = 0x00004000; // symbol is a java package
|
||||
final val DEPRECATED = 0x00008000; // symbol is deprecated.
|
||||
|
||||
final val COVARIANT = 0x00010000; // symbol is a covariant type variable
|
||||
final val CONTRAVARIANT = 0x00020000; // symbol is a contravariant type variable
|
||||
final val ABSOVERRIDE = 0x00040000; // combination of abstract & override
|
||||
final val LOCAL = 0x00080000; // symbol is local to current class.
|
||||
// pre: PRIVATE is also set
|
||||
|
||||
final val JAVA = 0x00100000; // symbol was defined by a Java class
|
||||
final val SYNTHETIC = 0x00200000; // symbol is compiler-generated
|
||||
final val STABLE = 0x00400000; // functions that are assumed to be stable
|
||||
// (typically, access methods for valdefs)
|
||||
final val STATIC = 0x00800000; // static field, method or class
|
||||
|
||||
final val CASEACCESSOR = 0x01000000; // symbol is a case parameter (or its accessor)
|
||||
final val TRAIT = 0x02000000; // symbol is a trait
|
||||
final val BRIDGE = 0x04000000; // function is a bridge method. Set by Erasure
|
||||
final val ACCESSOR = 0x08000000; // a value or variable accessor
|
||||
|
||||
final val SUPERACCESSOR = 0x10000000; // a super accessor
|
||||
final val PARAMACCESSOR = 0x20000000; // for value definitions: is an access method for a final val parameter
|
||||
// for parameters: is a val parameter
|
||||
|
||||
final val CAPTURED = 0x40000000; // variable is accessed from nested function. Set by LambdaLift
|
||||
final val BYNAMEPARAM = 0x40000000; // parameter is by name
|
||||
|
||||
final val LABEL = 0x80000000L; // method symbol is a label. Set by TailCall
|
||||
final val INCONSTRUCTOR = 0x80000000L; // class symbol is defined in this/superclass constructor.
|
||||
|
||||
final val IS_ERROR = 0x100000000L; // symbol is an error symbol
|
||||
final val OVERLOADED = 0x200000000L; // symbol is overloaded
|
||||
final val LIFTED = 0x400000000L; // class has been lifted out to package level
|
||||
// local value has been lifted out to class level
|
||||
//todo: make LIFTED = latePRIVATE?
|
||||
|
||||
final val MIXEDIN = 0x800000000L; // member has been mixed in
|
||||
|
||||
final val EXPANDEDNAME = 0x1000000000L; // name has been expanded with class suffix
|
||||
final val IMPLCLASS = 0x2000000000L; // symbol is an implementation class
|
||||
final val TRANS_FLAG = 0x4000000000L; // transient flag guaranteed to be reset after each phase.
|
||||
|
||||
final val LOCKED = 0x8000000000L; // temporary flag to catch cyclic dependencies
|
||||
|
||||
final val InitialFlags = 0x000000FFFFFFFFFFL; // flags that are enabled from phase 1.
|
||||
final val LateFlags = 0x000FFF0000000000L; // flags that override flags in 0xFFF.
|
||||
final val AntiFlags = 0x7FF0000000000000L; // flags that cancel flags in 0x7FF
|
||||
final val LateShift = 40L;
|
||||
final val AntiShift = 52L;
|
||||
|
||||
// late flags (set by a transformer phase)
|
||||
final val latePRIVATE = (PRIVATE: long) << LateShift;
|
||||
final val lateDEFERRED = (DEFERRED: long) << LateShift;
|
||||
final val lateINTERFACE = (INTERFACE: long) << LateShift;
|
||||
final val lateMODULE = (MODULE: long) << LateShift;
|
||||
final val lateFINAL = (FINAL: long) << LateShift;
|
||||
final val lateMETHOD = (METHOD: long) << LateShift;
|
||||
final val notPRIVATE = (PRIVATE: long) << AntiShift;
|
||||
final val notPROTECTED = (PROTECTED: long) << AntiShift;
|
||||
final val notABSTRACT = (ABSTRACT: long) << AntiShift;
|
||||
final val notOVERRIDE = (OVERRIDE: long) << AntiShift;
|
||||
final val notMETHOD = (METHOD: long) << AntiShift;
|
||||
|
||||
final val STATICMODULE = lateMODULE;
|
||||
final val STATICMEMBER = notOVERRIDE;
|
||||
|
||||
|
||||
// masks
|
||||
/** This flags can be set when class or module symbol is first created. */
|
||||
final val TopLevelCreationFlags =
|
||||
MODULE | PACKAGE | FINAL | JAVA;
|
||||
|
||||
final val ExplicitFlags = // these modifiers can be set explicitly in source programs.
|
||||
PRIVATE | PROTECTED | ABSTRACT | FINAL | SEALED | OVERRIDE | CASE | IMPLICIT | ABSOVERRIDE;
|
||||
|
||||
final val PrintableFlags = // these modifiers appear in TreePrinter output.
|
||||
(ExplicitFlags | LOCAL | SYNTHETIC | STABLE | CASEACCESSOR | ACCESSOR |
|
||||
SUPERACCESSOR | PARAMACCESSOR | BRIDGE | STATIC);
|
||||
|
||||
final val FieldFlags = MUTABLE | CASEACCESSOR | PARAMACCESSOR | STATIC | FINAL;
|
||||
|
||||
final val AccessFlags = PRIVATE | PROTECTED;
|
||||
final val VARIANCES = COVARIANT | CONTRAVARIANT;
|
||||
final val ConstrFlags = JAVA;
|
||||
final val PickledFlags = 0xFFFFFFFF;
|
||||
|
||||
/** Module flags inherited by their module-class */
|
||||
final val ModuleToClassFlags = AccessFlags | PACKAGE | CASE;
|
||||
|
||||
def flagsToString(flags: long, suffixes: List[Pair[long, String]]): String =
|
||||
(for (val i <- List.range(0, 63)) yield {
|
||||
var s = flagToString(flags & (1L << i));
|
||||
suffixes.find(._1.==(i)) match {
|
||||
case Some(Pair(i, suffix)) => s = s + "[" + suffix + "]"
|
||||
case None =>
|
||||
}
|
||||
s
|
||||
}).filter("" !=).mkString("", " ", "");
|
||||
|
||||
def flagsToString(flags: long): String = flagsToString(flags, List());
|
||||
|
||||
private def flagToString(flag: long): String = {
|
||||
if (flag == LABEL) "<label>"
|
||||
else if (flag == INTERFACE) "<interface>"
|
||||
else if (flag == IS_ERROR) "<is-error>"
|
||||
else if (flag == OVERLOADED) "<overloaded>"
|
||||
else if (flag == LIFTED) "<lifted>"
|
||||
else if (flag == TRANS_FLAG) "<trans-flag>"
|
||||
else if (flag == MIXEDIN) "<mixedin>"
|
||||
else if (flag == EXPANDEDNAME) "<expandedname>"
|
||||
else if (flag == LOCKED) "<locked>"
|
||||
else if (flag == STATICMODULE) "<staticobject>"
|
||||
else if (flag == STATICMEMBER) "<staticmember>"
|
||||
else flag.asInstanceOf[int] match {
|
||||
case IMPLICIT => "implicit"
|
||||
case FINAL => "final"
|
||||
case PRIVATE => "private"
|
||||
case PROTECTED => "protected"
|
||||
|
||||
case SEALED => "sealed"
|
||||
case OVERRIDE => "override"
|
||||
case CASE => "case"
|
||||
case ABSTRACT => "abstract"
|
||||
|
||||
case DEFERRED => "<deferred>"
|
||||
case METHOD => "<method>"
|
||||
case TRAIT => "<trait>"
|
||||
case MODULE => "<module>"
|
||||
|
||||
case MUTABLE => "<mutable>"
|
||||
case PARAM => "<param>"
|
||||
case PACKAGE => "<package>"
|
||||
case DEPRECATED => "<deprecated>"
|
||||
|
||||
case COVARIANT => "<covariant>"
|
||||
case CONTRAVARIANT => "<contravariant>"
|
||||
case ABSOVERRIDE => "abstract override"
|
||||
case LOCAL => "<local>"
|
||||
|
||||
case JAVA => "<java>"
|
||||
case SYNTHETIC => "<synthetic>"
|
||||
case STABLE => "<stable>"
|
||||
case STATIC => "<static>"
|
||||
|
||||
case CASEACCESSOR => "<caseaccessor>"
|
||||
case ACCESSOR => "<accessor>"
|
||||
|
||||
case SUPERACCESSOR => "<superaccessor>"
|
||||
case PARAMACCESSOR => "<paramaccessor>"
|
||||
case BRIDGE => "<bridge>"
|
||||
case CAPTURED => "<captured>"
|
||||
|
||||
case _ => ""
|
||||
}
|
||||
}
|
||||
class Flag(mods : int) {
|
||||
def isPrivate = ((mods & PRIVATE ) != 0);
|
||||
def isProtected = ((mods & PROTECTED) != 0);
|
||||
def isVariable = ((mods & MUTABLE) != 0);
|
||||
def isPublic = !isPrivate && !isProtected;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,249 +1,249 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab;
|
||||
|
||||
[_trait_] abstract class Scopes: SymbolTable {
|
||||
|
||||
class ScopeEntry(val sym: Symbol, val owner: Scope) {
|
||||
|
||||
/** the next entry in the hash bucket
|
||||
*/
|
||||
var tail: ScopeEntry = _;
|
||||
|
||||
/** the next entry in this scope
|
||||
*/
|
||||
var next: ScopeEntry = null;
|
||||
|
||||
override def hashCode(): int = sym.name.start;
|
||||
override def toString(): String = sym.toString();
|
||||
}
|
||||
|
||||
def newScopeEntry(sym: Symbol, owner: Scope): ScopeEntry = {
|
||||
val e = new ScopeEntry(sym, owner);
|
||||
e.next = owner.elems;
|
||||
owner.elems = e;
|
||||
e
|
||||
}
|
||||
|
||||
object NoScopeEntry extends ScopeEntry(NoSymbol, null);
|
||||
|
||||
class Scope(initElems: ScopeEntry) {
|
||||
|
||||
var elems: ScopeEntry = initElems;
|
||||
|
||||
/** The number of times this scope is neted in another
|
||||
*/
|
||||
private var nestinglevel = 0;
|
||||
|
||||
/** the hash table
|
||||
*/
|
||||
private var hashtable: Array[ScopeEntry] = null;
|
||||
|
||||
/** a cache for all elements, to be used by symbol iterator.
|
||||
*/
|
||||
private var elemsCache: List[Symbol] = null;
|
||||
|
||||
/** size and mask of hash tables
|
||||
* todo: make hashtables grow?
|
||||
*/
|
||||
private val HASHSIZE = 0x80;
|
||||
private val HASHMASK = 0x7f;
|
||||
|
||||
/** the threshold number of entries from which a hashtable is constructed.
|
||||
*/
|
||||
private val MIN_HASH = 8;
|
||||
|
||||
if (size >= MIN_HASH) createHash;
|
||||
|
||||
def this() = this(null: ScopeEntry);
|
||||
|
||||
def this(base: Scope) = {
|
||||
this(base.elems);
|
||||
/*
|
||||
if (base.hashtable != null) {
|
||||
this.hashtable = new Array[ScopeEntry](HASHSIZE);
|
||||
System.arraycopy(base.hashtable, 0, this.hashtable, 0, HASHSIZE);
|
||||
}
|
||||
*/
|
||||
nestinglevel = base.nestinglevel + 1
|
||||
}
|
||||
|
||||
def this(decls: List[Symbol]) = {
|
||||
this();
|
||||
decls foreach enter
|
||||
}
|
||||
|
||||
/** Returns a new scope with the same content as this one. */
|
||||
def cloneScope: Scope = {
|
||||
val clone = new Scope();
|
||||
this.toList foreach clone.enter;
|
||||
clone
|
||||
}
|
||||
|
||||
/** is the scope empty? */
|
||||
def isEmpty: boolean = elems == null;
|
||||
|
||||
/** the number of entries in this scope */
|
||||
def size: int = {
|
||||
var s = 0;
|
||||
var e = elems;
|
||||
while (e != null) {
|
||||
s = s + 1;
|
||||
e = e.next
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
/** enter a scope entry
|
||||
*/
|
||||
def enter(e: ScopeEntry): unit = {
|
||||
elemsCache = null;
|
||||
if (hashtable != null) {
|
||||
val i = e.sym.name.start & HASHMASK;
|
||||
elems.tail = hashtable(i);
|
||||
hashtable(i) = elems;
|
||||
} else if (size >= MIN_HASH) {
|
||||
createHash;
|
||||
}
|
||||
}
|
||||
|
||||
/** enter a symbol
|
||||
*/
|
||||
def enter(sym: Symbol): unit = enter(newScopeEntry(sym, this));
|
||||
|
||||
/** enter a symbol, asserting that no symbol with same name exists in scope
|
||||
*/
|
||||
def enterUnique(sym: Symbol): unit = {
|
||||
assert(lookup(sym.name) == NoSymbol);
|
||||
enter(sym);
|
||||
}
|
||||
|
||||
private def createHash: unit = {
|
||||
hashtable = new Array[ScopeEntry](HASHSIZE);
|
||||
enterInHash(elems);
|
||||
}
|
||||
|
||||
private def enterInHash(e: ScopeEntry): unit = {
|
||||
if (e != null) {
|
||||
enterInHash(e.next);
|
||||
val i = e.sym.name.start & HASHMASK;
|
||||
e.tail = hashtable(i);
|
||||
hashtable(i) = e;
|
||||
}
|
||||
}
|
||||
|
||||
/** remove entry
|
||||
*/
|
||||
def unlink(e: ScopeEntry): unit = {
|
||||
if (elems == e) {
|
||||
elems = e.next;
|
||||
} else {
|
||||
var e1 = elems;
|
||||
while (e1.next != e) e1 = e1.next;
|
||||
e1.next = e.next;
|
||||
}
|
||||
if (hashtable != null) {
|
||||
var e1 = hashtable(e.sym.name.start & HASHMASK);
|
||||
if (e1 == e) {
|
||||
hashtable(e.sym.name.start & HASHMASK) = e.tail;
|
||||
} else {
|
||||
while (e1.tail != e) e1 = e1.tail;
|
||||
e1.tail = e.tail;
|
||||
}
|
||||
}
|
||||
elemsCache = null
|
||||
}
|
||||
|
||||
/** remove symbol */
|
||||
def unlink(sym: Symbol): unit = {
|
||||
var e = lookupEntry(sym.name);
|
||||
while (e != null) {
|
||||
if (e.sym == sym) unlink(e);
|
||||
e = lookupNextEntry(e)
|
||||
}
|
||||
}
|
||||
|
||||
/** lookup a symbol
|
||||
*/
|
||||
def lookup(name: Name): Symbol = {
|
||||
val e = lookupEntry(name);
|
||||
if (e == null) NoSymbol else e.sym;
|
||||
}
|
||||
|
||||
/** lookup a symbol entry matching given name
|
||||
*/
|
||||
def lookupEntry(name: Name): ScopeEntry = {
|
||||
var e: ScopeEntry = null;
|
||||
if (false & hashtable != null) {
|
||||
e = hashtable(name.start & HASHMASK);
|
||||
while (e != null && e.sym.name != name) e = e.tail;
|
||||
} else {
|
||||
e = elems;
|
||||
while (e != null && e.sym.name != name) e = e.next;
|
||||
}
|
||||
e
|
||||
}
|
||||
|
||||
/** lookup next entry with same name as this one */
|
||||
def lookupNextEntry(entry: ScopeEntry): ScopeEntry = {
|
||||
var e = entry;
|
||||
if (hashtable != null) //debug
|
||||
do { e = e.tail } while (e != null && e.sym.name != entry.sym.name)
|
||||
else
|
||||
do { e = e.next } while (e != null && e.sym.name != entry.sym.name);
|
||||
e
|
||||
}
|
||||
|
||||
/** Return all symbols as a list in the order they were entered in this scope.
|
||||
*/
|
||||
def toList: List[Symbol] = {
|
||||
if (elemsCache == null) {
|
||||
elemsCache = Nil;
|
||||
var e = elems;
|
||||
while (e != null && e.owner == this) {
|
||||
elemsCache = e.sym :: elemsCache;
|
||||
e = e.next
|
||||
}
|
||||
}
|
||||
elemsCache
|
||||
}
|
||||
|
||||
/** Return all symbols as an interator in the order they were entered in this scope.
|
||||
*/
|
||||
def elements: Iterator[Symbol] = toList.elements;
|
||||
|
||||
def mkString(start: String, sep: String, end: String) =
|
||||
toList.map(.defString).mkString(start, sep, end);
|
||||
|
||||
override def toString(): String = mkString("{\n ", ";\n ", "\n}");
|
||||
|
||||
/** Return the nesting level of this scope, i.e. the number of times this scope
|
||||
* was nested in another */
|
||||
def nestingLevel = nestinglevel;
|
||||
}
|
||||
|
||||
/** The empty scope (immutable).
|
||||
*/
|
||||
object EmptyScope extends Scope {
|
||||
override def enter(e: ScopeEntry): unit =
|
||||
throw new Error("EmptyScope.enter");
|
||||
}
|
||||
|
||||
/** The error scope.
|
||||
*/
|
||||
class ErrorScope(owner: Symbol) extends Scope(null: ScopeEntry) {
|
||||
override def lookupEntry(name: Name): ScopeEntry = {
|
||||
val e = super.lookupEntry(name);
|
||||
if (e != NoSymbol) e
|
||||
else {
|
||||
enter(if (name.isTermName) owner.newErrorValue(name)
|
||||
else owner.newErrorClass(name));
|
||||
super.lookupEntry(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab;
|
||||
|
||||
[_trait_] abstract class Scopes: SymbolTable {
|
||||
|
||||
class ScopeEntry(val sym: Symbol, val owner: Scope) {
|
||||
|
||||
/** the next entry in the hash bucket
|
||||
*/
|
||||
var tail: ScopeEntry = _;
|
||||
|
||||
/** the next entry in this scope
|
||||
*/
|
||||
var next: ScopeEntry = null;
|
||||
|
||||
override def hashCode(): int = sym.name.start;
|
||||
override def toString(): String = sym.toString();
|
||||
}
|
||||
|
||||
def newScopeEntry(sym: Symbol, owner: Scope): ScopeEntry = {
|
||||
val e = new ScopeEntry(sym, owner);
|
||||
e.next = owner.elems;
|
||||
owner.elems = e;
|
||||
e
|
||||
}
|
||||
|
||||
object NoScopeEntry extends ScopeEntry(NoSymbol, null);
|
||||
|
||||
class Scope(initElems: ScopeEntry) {
|
||||
|
||||
var elems: ScopeEntry = initElems;
|
||||
|
||||
/** The number of times this scope is neted in another
|
||||
*/
|
||||
private var nestinglevel = 0;
|
||||
|
||||
/** the hash table
|
||||
*/
|
||||
private var hashtable: Array[ScopeEntry] = null;
|
||||
|
||||
/** a cache for all elements, to be used by symbol iterator.
|
||||
*/
|
||||
private var elemsCache: List[Symbol] = null;
|
||||
|
||||
/** size and mask of hash tables
|
||||
* todo: make hashtables grow?
|
||||
*/
|
||||
private val HASHSIZE = 0x80;
|
||||
private val HASHMASK = 0x7f;
|
||||
|
||||
/** the threshold number of entries from which a hashtable is constructed.
|
||||
*/
|
||||
private val MIN_HASH = 8;
|
||||
|
||||
if (size >= MIN_HASH) createHash;
|
||||
|
||||
def this() = this(null: ScopeEntry);
|
||||
|
||||
def this(base: Scope) = {
|
||||
this(base.elems);
|
||||
/*
|
||||
if (base.hashtable != null) {
|
||||
this.hashtable = new Array[ScopeEntry](HASHSIZE);
|
||||
System.arraycopy(base.hashtable, 0, this.hashtable, 0, HASHSIZE);
|
||||
}
|
||||
*/
|
||||
nestinglevel = base.nestinglevel + 1
|
||||
}
|
||||
|
||||
def this(decls: List[Symbol]) = {
|
||||
this();
|
||||
decls foreach enter
|
||||
}
|
||||
|
||||
/** Returns a new scope with the same content as this one. */
|
||||
def cloneScope: Scope = {
|
||||
val clone = new Scope();
|
||||
this.toList foreach clone.enter;
|
||||
clone
|
||||
}
|
||||
|
||||
/** is the scope empty? */
|
||||
def isEmpty: boolean = elems == null;
|
||||
|
||||
/** the number of entries in this scope */
|
||||
def size: int = {
|
||||
var s = 0;
|
||||
var e = elems;
|
||||
while (e != null) {
|
||||
s = s + 1;
|
||||
e = e.next
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
/** enter a scope entry
|
||||
*/
|
||||
def enter(e: ScopeEntry): unit = {
|
||||
elemsCache = null;
|
||||
if (hashtable != null) {
|
||||
val i = e.sym.name.start & HASHMASK;
|
||||
elems.tail = hashtable(i);
|
||||
hashtable(i) = elems;
|
||||
} else if (size >= MIN_HASH) {
|
||||
createHash;
|
||||
}
|
||||
}
|
||||
|
||||
/** enter a symbol
|
||||
*/
|
||||
def enter(sym: Symbol): unit = enter(newScopeEntry(sym, this));
|
||||
|
||||
/** enter a symbol, asserting that no symbol with same name exists in scope
|
||||
*/
|
||||
def enterUnique(sym: Symbol): unit = {
|
||||
assert(lookup(sym.name) == NoSymbol);
|
||||
enter(sym);
|
||||
}
|
||||
|
||||
private def createHash: unit = {
|
||||
hashtable = new Array[ScopeEntry](HASHSIZE);
|
||||
enterInHash(elems);
|
||||
}
|
||||
|
||||
private def enterInHash(e: ScopeEntry): unit = {
|
||||
if (e != null) {
|
||||
enterInHash(e.next);
|
||||
val i = e.sym.name.start & HASHMASK;
|
||||
e.tail = hashtable(i);
|
||||
hashtable(i) = e;
|
||||
}
|
||||
}
|
||||
|
||||
/** remove entry
|
||||
*/
|
||||
def unlink(e: ScopeEntry): unit = {
|
||||
if (elems == e) {
|
||||
elems = e.next;
|
||||
} else {
|
||||
var e1 = elems;
|
||||
while (e1.next != e) e1 = e1.next;
|
||||
e1.next = e.next;
|
||||
}
|
||||
if (hashtable != null) {
|
||||
var e1 = hashtable(e.sym.name.start & HASHMASK);
|
||||
if (e1 == e) {
|
||||
hashtable(e.sym.name.start & HASHMASK) = e.tail;
|
||||
} else {
|
||||
while (e1.tail != e) e1 = e1.tail;
|
||||
e1.tail = e.tail;
|
||||
}
|
||||
}
|
||||
elemsCache = null
|
||||
}
|
||||
|
||||
/** remove symbol */
|
||||
def unlink(sym: Symbol): unit = {
|
||||
var e = lookupEntry(sym.name);
|
||||
while (e != null) {
|
||||
if (e.sym == sym) unlink(e);
|
||||
e = lookupNextEntry(e)
|
||||
}
|
||||
}
|
||||
|
||||
/** lookup a symbol
|
||||
*/
|
||||
def lookup(name: Name): Symbol = {
|
||||
val e = lookupEntry(name);
|
||||
if (e == null) NoSymbol else e.sym;
|
||||
}
|
||||
|
||||
/** lookup a symbol entry matching given name
|
||||
*/
|
||||
def lookupEntry(name: Name): ScopeEntry = {
|
||||
var e: ScopeEntry = null;
|
||||
if (false & hashtable != null) {
|
||||
e = hashtable(name.start & HASHMASK);
|
||||
while (e != null && e.sym.name != name) e = e.tail;
|
||||
} else {
|
||||
e = elems;
|
||||
while (e != null && e.sym.name != name) e = e.next;
|
||||
}
|
||||
e
|
||||
}
|
||||
|
||||
/** lookup next entry with same name as this one */
|
||||
def lookupNextEntry(entry: ScopeEntry): ScopeEntry = {
|
||||
var e = entry;
|
||||
if (hashtable != null) //debug
|
||||
do { e = e.tail } while (e != null && e.sym.name != entry.sym.name)
|
||||
else
|
||||
do { e = e.next } while (e != null && e.sym.name != entry.sym.name);
|
||||
e
|
||||
}
|
||||
|
||||
/** Return all symbols as a list in the order they were entered in this scope.
|
||||
*/
|
||||
def toList: List[Symbol] = {
|
||||
if (elemsCache == null) {
|
||||
elemsCache = Nil;
|
||||
var e = elems;
|
||||
while (e != null && e.owner == this) {
|
||||
elemsCache = e.sym :: elemsCache;
|
||||
e = e.next
|
||||
}
|
||||
}
|
||||
elemsCache
|
||||
}
|
||||
|
||||
/** Return all symbols as an interator in the order they were entered in this scope.
|
||||
*/
|
||||
def elements: Iterator[Symbol] = toList.elements;
|
||||
|
||||
def mkString(start: String, sep: String, end: String) =
|
||||
toList.map(.defString).mkString(start, sep, end);
|
||||
|
||||
override def toString(): String = mkString("{\n ", ";\n ", "\n}");
|
||||
|
||||
/** Return the nesting level of this scope, i.e. the number of times this scope
|
||||
* was nested in another */
|
||||
def nestingLevel = nestinglevel;
|
||||
}
|
||||
|
||||
/** The empty scope (immutable).
|
||||
*/
|
||||
object EmptyScope extends Scope {
|
||||
override def enter(e: ScopeEntry): unit =
|
||||
throw new Error("EmptyScope.enter");
|
||||
}
|
||||
|
||||
/** The error scope.
|
||||
*/
|
||||
class ErrorScope(owner: Symbol) extends Scope(null: ScopeEntry) {
|
||||
override def lookupEntry(name: Name): ScopeEntry = {
|
||||
val e = super.lookupEntry(name);
|
||||
if (e != NoSymbol) e
|
||||
else {
|
||||
enter(if (name.isTermName) owner.newErrorValue(name)
|
||||
else owner.newErrorClass(name));
|
||||
super.lookupEntry(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab;
|
||||
|
||||
import util._;
|
||||
|
||||
abstract class SymbolTable extends Names
|
||||
with Symbols
|
||||
with Types
|
||||
with Scopes
|
||||
with Definitions
|
||||
with Constants
|
||||
with InfoTransformers
|
||||
with StdNames {
|
||||
def settings: Settings;
|
||||
def rootLoader: LazyType;
|
||||
def log(msg: Object): unit;
|
||||
|
||||
private var ph: Phase = NoPhase;
|
||||
def phase: Phase = ph;
|
||||
def phase_=(p: Phase): unit = {
|
||||
//System.out.println("setting phase to " + p);
|
||||
assert(p != null && p != NoPhase);
|
||||
ph = p
|
||||
}
|
||||
|
||||
final val NoRun = null;
|
||||
|
||||
/** The current compiler run. */
|
||||
def currentRun: CompilerRun;
|
||||
|
||||
def atPhase[T](ph: Phase)(op: => T): T = {
|
||||
val current = phase;
|
||||
phase = ph;
|
||||
val result = op;
|
||||
phase = current;
|
||||
result
|
||||
}
|
||||
|
||||
var infoTransformers = new InfoTransformer {
|
||||
val pid = NoPhase.id;
|
||||
val changesBaseClasses = true;
|
||||
def transform(sym: Symbol, tpe: Type): Type = tpe;
|
||||
}
|
||||
|
||||
val phaseWithId: Array[Phase];
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab;
|
||||
|
||||
import util._;
|
||||
|
||||
abstract class SymbolTable extends Names
|
||||
with Symbols
|
||||
with Types
|
||||
with Scopes
|
||||
with Definitions
|
||||
with Constants
|
||||
with InfoTransformers
|
||||
with StdNames {
|
||||
def settings: Settings;
|
||||
def rootLoader: LazyType;
|
||||
def log(msg: Object): unit;
|
||||
|
||||
private var ph: Phase = NoPhase;
|
||||
def phase: Phase = ph;
|
||||
def phase_=(p: Phase): unit = {
|
||||
//System.out.println("setting phase to " + p);
|
||||
assert(p != null && p != NoPhase);
|
||||
ph = p
|
||||
}
|
||||
|
||||
final val NoRun = null;
|
||||
|
||||
/** The current compiler run. */
|
||||
def currentRun: CompilerRun;
|
||||
|
||||
def atPhase[T](ph: Phase)(op: => T): T = {
|
||||
val current = phase;
|
||||
phase = ph;
|
||||
val result = op;
|
||||
phase = current;
|
||||
result
|
||||
}
|
||||
|
||||
var infoTransformers = new InfoTransformer {
|
||||
val pid = NoPhase.id;
|
||||
val changesBaseClasses = true;
|
||||
def transform(sym: Symbol, tpe: Type): Type = tpe;
|
||||
}
|
||||
|
||||
val phaseWithId: Array[Phase];
|
||||
}
|
||||
|
|
|
@ -1,118 +1,118 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab.classfile;
|
||||
|
||||
/** Variable length byte arrays, with methods for basic pickling and unpickling.
|
||||
* @param data: The initial buffer
|
||||
* @param from: The first index where defined data are found
|
||||
* @param to : The first index where new data can be written
|
||||
*/
|
||||
class PickleBuffer(data: Array[byte], from: int, to: int) {
|
||||
|
||||
var bytes = data;
|
||||
var readIndex = from;
|
||||
var writeIndex = to;
|
||||
|
||||
/** Double bytes array */
|
||||
private def dble: unit = {
|
||||
val bytes1 = new Array[byte](bytes.length * 2);
|
||||
System.arraycopy(bytes, 0, bytes1, 0, writeIndex);
|
||||
bytes = bytes1
|
||||
}
|
||||
|
||||
def ensureCapacity(capacity: int) = while (bytes.length < writeIndex + capacity) dble;
|
||||
|
||||
// -- Basic output routines --------------------------------------------
|
||||
|
||||
/** Write a byte of data */
|
||||
def writeByte(b: int): unit = {
|
||||
if (writeIndex == bytes.length) dble;
|
||||
bytes(writeIndex) = b.asInstanceOf[byte];
|
||||
writeIndex = writeIndex + 1
|
||||
}
|
||||
|
||||
/** Write a natural number in big endian format, base 128.
|
||||
* All but the last digits have bit 0x80 set.*/
|
||||
def writeNat(x: int): unit = {
|
||||
def writeNatPrefix(x: int): unit = {
|
||||
val y = x >>> 7;
|
||||
if (y != 0) writeNatPrefix(y);
|
||||
writeByte((x & 0x7f) | 0x80);
|
||||
}
|
||||
val y = x >>> 7;
|
||||
if (y != 0) writeNatPrefix(y);
|
||||
writeByte(x & 0x7f)
|
||||
}
|
||||
|
||||
/** Write a natural number at `pos'
|
||||
* If number is more than one byte, shift rest of array to make space. */
|
||||
def patchNat(pos: int, x: int): unit = {
|
||||
def patchNatPrefix(x: int): unit = {
|
||||
writeByte(0);
|
||||
System.arraycopy(bytes, pos, bytes, pos+1, writeIndex - (pos+1));
|
||||
bytes(pos) = ((x & 0x7f) | 0x80).asInstanceOf[byte];
|
||||
val y = x >>> 7;
|
||||
if (y != 0) patchNatPrefix(y)
|
||||
}
|
||||
bytes(pos) = (x & 0x7f).asInstanceOf[byte];
|
||||
val y = x >>> 7;
|
||||
if (y != 0) patchNatPrefix(y);
|
||||
}
|
||||
|
||||
/** Write a long number in signed big endian format, base 256. */
|
||||
def writeLong(x: long): unit = {
|
||||
val y = x >> 8;
|
||||
val z = x & 0xff;
|
||||
if (-y != (z >> 7)) writeLong(y);
|
||||
writeByte(z.asInstanceOf[int]);
|
||||
}
|
||||
|
||||
// -- Basic input routines --------------------------------------------
|
||||
|
||||
/** Read a byte */
|
||||
def readByte(): int = {
|
||||
val x = bytes(readIndex); readIndex = readIndex + 1; x
|
||||
}
|
||||
|
||||
/** Read a natural number in big endian format, base 128.
|
||||
* All but the last digits have bit 0x80 set.*/
|
||||
def readNat(): int = {
|
||||
var b = 0;
|
||||
var x = 0;
|
||||
do {
|
||||
b = readByte();
|
||||
x = (x << 7) + (b & 0x7f);
|
||||
} while ((b & 0x80) != 0);
|
||||
x
|
||||
}
|
||||
|
||||
/** Read a long number in signed big endian format, base 256. */
|
||||
def readLong(len: int): long = {
|
||||
var x = 0L;
|
||||
var i = 0;
|
||||
while (i < len) {
|
||||
x = (x << 8) + (readByte() & 0xff);
|
||||
i = i + 1
|
||||
}
|
||||
val leading = 64 - (len << 3);
|
||||
x << leading >> leading
|
||||
}
|
||||
|
||||
/** Perform operation `op' until readIndex == end. Concatenate results into a list. */
|
||||
def until[T](end: int, op: () => T): List[T] =
|
||||
if (readIndex == end) List() else op() :: until(end, op);
|
||||
|
||||
/** Create an index */
|
||||
def createIndex: Array[int] = {
|
||||
val index = new Array[int](readNat());
|
||||
for (val i <- Iterator.range(0, index.length)) {
|
||||
index(i) = readIndex;
|
||||
readByte();
|
||||
readIndex = readNat() + readIndex
|
||||
}
|
||||
index
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab.classfile;
|
||||
|
||||
/** Variable length byte arrays, with methods for basic pickling and unpickling.
|
||||
* @param data: The initial buffer
|
||||
* @param from: The first index where defined data are found
|
||||
* @param to : The first index where new data can be written
|
||||
*/
|
||||
class PickleBuffer(data: Array[byte], from: int, to: int) {
|
||||
|
||||
var bytes = data;
|
||||
var readIndex = from;
|
||||
var writeIndex = to;
|
||||
|
||||
/** Double bytes array */
|
||||
private def dble: unit = {
|
||||
val bytes1 = new Array[byte](bytes.length * 2);
|
||||
System.arraycopy(bytes, 0, bytes1, 0, writeIndex);
|
||||
bytes = bytes1
|
||||
}
|
||||
|
||||
def ensureCapacity(capacity: int) = while (bytes.length < writeIndex + capacity) dble;
|
||||
|
||||
// -- Basic output routines --------------------------------------------
|
||||
|
||||
/** Write a byte of data */
|
||||
def writeByte(b: int): unit = {
|
||||
if (writeIndex == bytes.length) dble;
|
||||
bytes(writeIndex) = b.asInstanceOf[byte];
|
||||
writeIndex = writeIndex + 1
|
||||
}
|
||||
|
||||
/** Write a natural number in big endian format, base 128.
|
||||
* All but the last digits have bit 0x80 set.*/
|
||||
def writeNat(x: int): unit = {
|
||||
def writeNatPrefix(x: int): unit = {
|
||||
val y = x >>> 7;
|
||||
if (y != 0) writeNatPrefix(y);
|
||||
writeByte((x & 0x7f) | 0x80);
|
||||
}
|
||||
val y = x >>> 7;
|
||||
if (y != 0) writeNatPrefix(y);
|
||||
writeByte(x & 0x7f)
|
||||
}
|
||||
|
||||
/** Write a natural number at `pos'
|
||||
* If number is more than one byte, shift rest of array to make space. */
|
||||
def patchNat(pos: int, x: int): unit = {
|
||||
def patchNatPrefix(x: int): unit = {
|
||||
writeByte(0);
|
||||
System.arraycopy(bytes, pos, bytes, pos+1, writeIndex - (pos+1));
|
||||
bytes(pos) = ((x & 0x7f) | 0x80).asInstanceOf[byte];
|
||||
val y = x >>> 7;
|
||||
if (y != 0) patchNatPrefix(y)
|
||||
}
|
||||
bytes(pos) = (x & 0x7f).asInstanceOf[byte];
|
||||
val y = x >>> 7;
|
||||
if (y != 0) patchNatPrefix(y);
|
||||
}
|
||||
|
||||
/** Write a long number in signed big endian format, base 256. */
|
||||
def writeLong(x: long): unit = {
|
||||
val y = x >> 8;
|
||||
val z = x & 0xff;
|
||||
if (-y != (z >> 7)) writeLong(y);
|
||||
writeByte(z.asInstanceOf[int]);
|
||||
}
|
||||
|
||||
// -- Basic input routines --------------------------------------------
|
||||
|
||||
/** Read a byte */
|
||||
def readByte(): int = {
|
||||
val x = bytes(readIndex); readIndex = readIndex + 1; x
|
||||
}
|
||||
|
||||
/** Read a natural number in big endian format, base 128.
|
||||
* All but the last digits have bit 0x80 set.*/
|
||||
def readNat(): int = {
|
||||
var b = 0;
|
||||
var x = 0;
|
||||
do {
|
||||
b = readByte();
|
||||
x = (x << 7) + (b & 0x7f);
|
||||
} while ((b & 0x80) != 0);
|
||||
x
|
||||
}
|
||||
|
||||
/** Read a long number in signed big endian format, base 256. */
|
||||
def readLong(len: int): long = {
|
||||
var x = 0L;
|
||||
var i = 0;
|
||||
while (i < len) {
|
||||
x = (x << 8) + (readByte() & 0xff);
|
||||
i = i + 1
|
||||
}
|
||||
val leading = 64 - (len << 3);
|
||||
x << leading >> leading
|
||||
}
|
||||
|
||||
/** Perform operation `op' until readIndex == end. Concatenate results into a list. */
|
||||
def until[T](end: int, op: () => T): List[T] =
|
||||
if (readIndex == end) List() else op() :: until(end, op);
|
||||
|
||||
/** Create an index */
|
||||
def createIndex: Array[int] = {
|
||||
val index = new Array[int](readNat());
|
||||
for (val i <- Iterator.range(0, index.length)) {
|
||||
index(i) = readIndex;
|
||||
readByte();
|
||||
readIndex = readNat() + readIndex
|
||||
}
|
||||
index
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,99 +1,99 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab.classfile;
|
||||
|
||||
object PickleFormat {
|
||||
|
||||
/***************************************************
|
||||
* Symbol table attribute format:
|
||||
* Symtab = nentries_Nat {Entry}
|
||||
* Entry = 1 TERMNAME len_Nat NameInfo
|
||||
* | 2 TYPENAME len_Nat NameInfo
|
||||
* | 3 NONEsym len_Nat
|
||||
* | 4 TYPEsym len_Nat SymbolInfo
|
||||
* | 5 ALIASsym len_Nat SymbolInfo
|
||||
* | 6 CLASSsym len_Nat SymbolInfo [thistype_Ref]
|
||||
* | 7 MODULEsym len_Nat SymbolInfo
|
||||
* | 8 VALsym len_Nat SymbolInfo [alias_Ref]
|
||||
* | 9 EXTref len_Nat name_Ref [owner_Ref]
|
||||
* | 10 EXTMODCLASSref len_Nat name_Ref [owner_Ref]
|
||||
* | 11 NOtpe len_Nat
|
||||
* | 12 NOPREFIXtpe len_Nat
|
||||
* | 13 THIStpe len_Nat sym_Ref
|
||||
* | 14 SINGLEtpe len_Nat type_Ref sym_Ref
|
||||
* | 15 CONSTANTtpe len_Nat type_Ref constant_Ref
|
||||
* | 16 TYPEREFtpe len_Nat type_Ref sym_Ref {targ_Ref}
|
||||
* | 17 TYPEBOUNDStpe len_Nat tpe_Ref tpe_Ref
|
||||
* | 18 REFINEDtpe len_Nat classsym_Ref {tpe_Ref}
|
||||
* | 19 CLASSINFOtpe len_Nat classsym_Ref {tpe_Ref}
|
||||
* | 20 METHODtpe len_Nat tpe_Ref {tpe_Ref}
|
||||
* | 21 POLYTtpe len_Nat tpe_Ref {sym_Ref}
|
||||
* | 22 IMPLICITMETHODtpe len_Nat tpe_Ref {tpe_Ref}
|
||||
* | 24 LITERALunit len_Nat
|
||||
* | 25 LITERALboolean len_Nat value_Long
|
||||
* | 26 LITERALbyte len_Nat value_Long
|
||||
* | 27 LITERALshort len_Nat value_Long
|
||||
* | 28 LITERALchar len_Nat value_Long
|
||||
* | 29 LITERALint len_Nat value_Long
|
||||
* | 30 LITERALlong len_Nat value_Long
|
||||
* | 31 LITERALfloat len_Nat value_Long
|
||||
* | 32 LITERALdouble len_Nat value_Long
|
||||
* | 33 LITERALstring len_Nat name_Ref
|
||||
* | 34 LITERALnull len_Nat
|
||||
* | 35 LITERALzero len_Nat
|
||||
* | 36 ATTRIBUTE sym_Ref type_Ref {constant_Ref} <not yet>
|
||||
* SymbolInfo = name_Ref owner_Ref flags_Nat info_Ref
|
||||
* NameInfo = <character sequence of length len_Nat in Utf8 format>
|
||||
* NumInfo = <len_Nat-byte signed number in big endian format>
|
||||
* Ref = Nat
|
||||
*
|
||||
* len is remaining length after `len'.
|
||||
*/
|
||||
val MajorVersion = 2;
|
||||
val MinorVersion = 0;
|
||||
|
||||
final val TERMname = 1;
|
||||
final val TYPEname = 2;
|
||||
final val NONEsym = 3;
|
||||
final val TYPEsym = 4;
|
||||
final val ALIASsym = 5;
|
||||
final val CLASSsym = 6;
|
||||
final val MODULEsym = 7;
|
||||
final val VALsym = 8;
|
||||
final val EXTref = 9;
|
||||
final val EXTMODCLASSref = 10;
|
||||
final val NOtpe = 11;
|
||||
final val NOPREFIXtpe = 12;
|
||||
final val THIStpe = 13;
|
||||
final val SINGLEtpe = 14;
|
||||
final val CONSTANTtpe = 15;
|
||||
final val TYPEREFtpe = 16;
|
||||
final val TYPEBOUNDStpe = 17;
|
||||
final val REFINEDtpe = 18;
|
||||
final val CLASSINFOtpe = 19;
|
||||
final val METHODtpe = 20;
|
||||
final val POLYtpe = 21;
|
||||
final val IMPLICITMETHODtpe = 22;
|
||||
final val LITERAL = 23; // base line for literals
|
||||
final val LITERALunit = 24;
|
||||
final val LITERALboolean = 25;
|
||||
final val LITERALbyte = 26;
|
||||
final val LITERALshort = 27;
|
||||
final val LITERALchar = 28;
|
||||
final val LITERALint = 29;
|
||||
final val LITERALlong = 30;
|
||||
final val LITERALfloat = 31;
|
||||
final val LITERALdouble = 32;
|
||||
final val LITERALstring = 33;
|
||||
final val LITERALnull = 34;
|
||||
final val LITERALzero = 35;
|
||||
final val ATTRIBUTE = 40;
|
||||
|
||||
final val firstSymTag = NONEsym;
|
||||
final val lastSymTag = VALsym;
|
||||
final val firstTypeTag = NOtpe;
|
||||
final val lastTypeTag = POLYtpe;
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab.classfile;
|
||||
|
||||
object PickleFormat {
|
||||
|
||||
/***************************************************
|
||||
* Symbol table attribute format:
|
||||
* Symtab = nentries_Nat {Entry}
|
||||
* Entry = 1 TERMNAME len_Nat NameInfo
|
||||
* | 2 TYPENAME len_Nat NameInfo
|
||||
* | 3 NONEsym len_Nat
|
||||
* | 4 TYPEsym len_Nat SymbolInfo
|
||||
* | 5 ALIASsym len_Nat SymbolInfo
|
||||
* | 6 CLASSsym len_Nat SymbolInfo [thistype_Ref]
|
||||
* | 7 MODULEsym len_Nat SymbolInfo
|
||||
* | 8 VALsym len_Nat SymbolInfo [alias_Ref]
|
||||
* | 9 EXTref len_Nat name_Ref [owner_Ref]
|
||||
* | 10 EXTMODCLASSref len_Nat name_Ref [owner_Ref]
|
||||
* | 11 NOtpe len_Nat
|
||||
* | 12 NOPREFIXtpe len_Nat
|
||||
* | 13 THIStpe len_Nat sym_Ref
|
||||
* | 14 SINGLEtpe len_Nat type_Ref sym_Ref
|
||||
* | 15 CONSTANTtpe len_Nat type_Ref constant_Ref
|
||||
* | 16 TYPEREFtpe len_Nat type_Ref sym_Ref {targ_Ref}
|
||||
* | 17 TYPEBOUNDStpe len_Nat tpe_Ref tpe_Ref
|
||||
* | 18 REFINEDtpe len_Nat classsym_Ref {tpe_Ref}
|
||||
* | 19 CLASSINFOtpe len_Nat classsym_Ref {tpe_Ref}
|
||||
* | 20 METHODtpe len_Nat tpe_Ref {tpe_Ref}
|
||||
* | 21 POLYTtpe len_Nat tpe_Ref {sym_Ref}
|
||||
* | 22 IMPLICITMETHODtpe len_Nat tpe_Ref {tpe_Ref}
|
||||
* | 24 LITERALunit len_Nat
|
||||
* | 25 LITERALboolean len_Nat value_Long
|
||||
* | 26 LITERALbyte len_Nat value_Long
|
||||
* | 27 LITERALshort len_Nat value_Long
|
||||
* | 28 LITERALchar len_Nat value_Long
|
||||
* | 29 LITERALint len_Nat value_Long
|
||||
* | 30 LITERALlong len_Nat value_Long
|
||||
* | 31 LITERALfloat len_Nat value_Long
|
||||
* | 32 LITERALdouble len_Nat value_Long
|
||||
* | 33 LITERALstring len_Nat name_Ref
|
||||
* | 34 LITERALnull len_Nat
|
||||
* | 35 LITERALzero len_Nat
|
||||
* | 36 ATTRIBUTE sym_Ref type_Ref {constant_Ref} <not yet>
|
||||
* SymbolInfo = name_Ref owner_Ref flags_Nat info_Ref
|
||||
* NameInfo = <character sequence of length len_Nat in Utf8 format>
|
||||
* NumInfo = <len_Nat-byte signed number in big endian format>
|
||||
* Ref = Nat
|
||||
*
|
||||
* len is remaining length after `len'.
|
||||
*/
|
||||
val MajorVersion = 2;
|
||||
val MinorVersion = 0;
|
||||
|
||||
final val TERMname = 1;
|
||||
final val TYPEname = 2;
|
||||
final val NONEsym = 3;
|
||||
final val TYPEsym = 4;
|
||||
final val ALIASsym = 5;
|
||||
final val CLASSsym = 6;
|
||||
final val MODULEsym = 7;
|
||||
final val VALsym = 8;
|
||||
final val EXTref = 9;
|
||||
final val EXTMODCLASSref = 10;
|
||||
final val NOtpe = 11;
|
||||
final val NOPREFIXtpe = 12;
|
||||
final val THIStpe = 13;
|
||||
final val SINGLEtpe = 14;
|
||||
final val CONSTANTtpe = 15;
|
||||
final val TYPEREFtpe = 16;
|
||||
final val TYPEBOUNDStpe = 17;
|
||||
final val REFINEDtpe = 18;
|
||||
final val CLASSINFOtpe = 19;
|
||||
final val METHODtpe = 20;
|
||||
final val POLYtpe = 21;
|
||||
final val IMPLICITMETHODtpe = 22;
|
||||
final val LITERAL = 23; // base line for literals
|
||||
final val LITERALunit = 24;
|
||||
final val LITERALboolean = 25;
|
||||
final val LITERALbyte = 26;
|
||||
final val LITERALshort = 27;
|
||||
final val LITERALchar = 28;
|
||||
final val LITERALint = 29;
|
||||
final val LITERALlong = 30;
|
||||
final val LITERALfloat = 31;
|
||||
final val LITERALdouble = 32;
|
||||
final val LITERALstring = 33;
|
||||
final val LITERALnull = 34;
|
||||
final val LITERALzero = 35;
|
||||
final val ATTRIBUTE = 40;
|
||||
|
||||
final val firstSymTag = NONEsym;
|
||||
final val lastSymTag = VALsym;
|
||||
final val firstTypeTag = NOtpe;
|
||||
final val lastTypeTag = POLYtpe;
|
||||
}
|
||||
|
|
|
@ -1,244 +1,244 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab.classfile;
|
||||
|
||||
import java.io._;
|
||||
import java.lang.{Float, Double}
|
||||
import scala.collection.mutable.HashMap;
|
||||
import Flags._;
|
||||
import PickleFormat._;
|
||||
|
||||
/**
|
||||
* Serialize a top-level module and/or class;
|
||||
* @see EntryTags.scala for symbol table attribute format.
|
||||
*/
|
||||
abstract class Pickler extends SubComponent {
|
||||
import global._;
|
||||
|
||||
val phaseName = "pickler";
|
||||
def newPhase(prev: Phase): StdPhase = new PicklePhase(prev);
|
||||
|
||||
class PicklePhase(prev: Phase) extends StdPhase(prev) {
|
||||
def apply(unit: CompilationUnit): unit = {
|
||||
def pickle(tree: Tree): unit = {
|
||||
|
||||
def add(sym: Symbol, pickle: Pickle) = {
|
||||
if (!sym.isExternal && !currentRun.symData.contains(sym)) {
|
||||
if (settings.debug.value) log("pickling " + sym);
|
||||
pickle.putSymbol(sym);
|
||||
currentRun.symData(sym) = pickle;
|
||||
}
|
||||
}
|
||||
|
||||
tree match {
|
||||
case PackageDef(_, stats) => stats foreach pickle;
|
||||
case ClassDef(_, _, _, _, _) | ModuleDef(_, _, _) =>
|
||||
val sym = tree.symbol;
|
||||
val pickle = new Pickle(sym.name.toTermName, sym.owner);
|
||||
add(sym, pickle);
|
||||
add(sym.linkedSym, pickle);
|
||||
pickle.finish
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
pickle(unit.body);
|
||||
}
|
||||
}
|
||||
|
||||
class Pickle(rootName: Name, rootOwner: Symbol) extends PickleBuffer(new Array[byte](4096), -1, 0) {
|
||||
private var entries = new Array[AnyRef](256);
|
||||
private var ep = 0;
|
||||
private val index = new HashMap[AnyRef, int];
|
||||
|
||||
/** Is root in symbol.owner*? */
|
||||
private def isLocal(sym: Symbol): boolean = (
|
||||
sym.isRefinementClass ||
|
||||
sym.name.toTermName == rootName && sym.owner == rootOwner ||
|
||||
sym != NoSymbol && isLocal(sym.owner)
|
||||
);
|
||||
|
||||
// Phase 1 methods: Populate entries/index ------------------------------------
|
||||
|
||||
/** Store entry `e' in index at next available position unless it it
|
||||
* already there. Return true iff entry is new. */
|
||||
private def putEntry(entry: AnyRef): boolean = index.get(entry) match {
|
||||
case Some(_) => false
|
||||
case None =>
|
||||
if (ep == entries.length) {
|
||||
val entries1 = new Array[AnyRef](ep * 2);
|
||||
System.arraycopy(entries, 0, entries1, 0, ep);
|
||||
entries = entries1;
|
||||
}
|
||||
entries(ep) = entry;
|
||||
index(entry) = ep;
|
||||
ep = ep + 1;
|
||||
true
|
||||
}
|
||||
|
||||
/** Store symbol in index. If symbol is local, also store everything it refers to. */
|
||||
def putSymbol(sym: Symbol): unit = if (putEntry(sym)) {
|
||||
if (isLocal(sym)) {
|
||||
putEntry(sym.name);
|
||||
putSymbol(sym.owner);
|
||||
putType(sym.info);
|
||||
if (sym.thisSym != sym)
|
||||
putType(sym.typeOfThis);
|
||||
putSymbol(sym.alias);
|
||||
//for (val attr <- sym.attributes) putAttribute(sym, attr);
|
||||
} else if (sym != NoSymbol) {
|
||||
putEntry(if (sym.isModuleClass) sym.name.toTermName else sym.name);
|
||||
if (!sym.owner.isRoot) putSymbol(sym.owner);
|
||||
}
|
||||
}
|
||||
private def putSymbols(syms: List[Symbol]) = syms foreach putSymbol;
|
||||
|
||||
/** Store type and everythig it refers to in index. */
|
||||
private def putType(tp: Type): unit = if (putEntry(tp)) {
|
||||
tp match {
|
||||
case NoType | NoPrefix =>
|
||||
;
|
||||
case ThisType(sym) =>
|
||||
putSymbol(sym)
|
||||
case SingleType(pre, sym) =>
|
||||
putType(pre); putSymbol(sym)
|
||||
case ConstantType(value) =>
|
||||
putConstant(value)
|
||||
case TypeRef(pre, sym, args) =>
|
||||
putType(pre); putSymbol(sym); putTypes(args)
|
||||
case TypeBounds(lo, hi) =>
|
||||
putType(lo); putType(hi);
|
||||
case RefinedType(parents, decls) =>
|
||||
putSymbol(tp.symbol); putTypes(parents); putSymbols(decls.toList)
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
putSymbol(clazz); putTypes(parents); putSymbols(decls.toList)
|
||||
case MethodType(formals, restpe) =>
|
||||
putType(restpe); putTypes(formals)
|
||||
case PolyType(tparams, restpe) =>
|
||||
putType(restpe); putSymbols(tparams)
|
||||
case _ =>
|
||||
throw new FatalError("bad type: " + tp + "(" + tp.getClass() + ")")
|
||||
}
|
||||
}
|
||||
private def putTypes(tps: List[Type]): unit = tps foreach putType;
|
||||
|
||||
private def putConstant(c: Constant) =
|
||||
if (putEntry(c) && c.tag == StringTag) putEntry(newTermName(c.stringValue));
|
||||
|
||||
/*
|
||||
private def putAttribute(attr: AttrInfo): unit = if (putEntry(attr)) {
|
||||
putType(attr._1);
|
||||
for (val c <- attr._2) putConstant(c);
|
||||
}
|
||||
*/
|
||||
// Phase 2 methods: Write all entries to byte array ------------------------------
|
||||
|
||||
private val buf = new PickleBuffer(new Array[byte](4096), -1, 0);
|
||||
|
||||
/** Write a reference to object, i.e., the object's number in the index. */
|
||||
private def writeRef(ref: AnyRef): unit = writeNat(index(ref));
|
||||
private def writeRefs(refs: List[AnyRef]): unit = refs foreach writeRef;
|
||||
|
||||
/** Write name, owner, flags, and info of a symbol */
|
||||
private def writeSymInfo(sym: Symbol): unit = {
|
||||
writeRef(sym.name);
|
||||
writeRef(sym.owner);
|
||||
writeNat((sym.flags & PickledFlags).asInstanceOf[int]);
|
||||
writeRef(sym.info)
|
||||
}
|
||||
|
||||
/** Write a name in Utf8 format. */
|
||||
def writeName(name: Name): unit = {
|
||||
ensureCapacity(name.length * 3);
|
||||
writeIndex = name.copyUTF8(bytes, writeIndex);
|
||||
}
|
||||
|
||||
/** Write an entry */
|
||||
private def writeEntry(entry: AnyRef): unit = {
|
||||
def writeBody: int = entry match {
|
||||
case name: Name =>
|
||||
writeName(name);
|
||||
if (name.isTermName) TERMname else TYPEname
|
||||
case NoSymbol =>
|
||||
NONEsym
|
||||
case sym: Symbol if !isLocal(sym) =>
|
||||
val tag =
|
||||
if (sym.isModuleClass) {
|
||||
writeRef(sym.name.toTermName); EXTMODCLASSref
|
||||
} else {
|
||||
writeRef(sym.name); EXTref
|
||||
}
|
||||
if (!sym.owner.isRoot) writeRef(sym.owner);
|
||||
tag
|
||||
case sym: ClassSymbol =>
|
||||
writeSymInfo(sym);
|
||||
if (sym.thisSym != sym) writeRef(sym.typeOfThis);
|
||||
CLASSsym
|
||||
case sym: TypeSymbol =>
|
||||
writeSymInfo(sym);
|
||||
if (sym.isAbstractType) TYPEsym else ALIASsym
|
||||
case sym: TermSymbol =>
|
||||
writeSymInfo(sym);
|
||||
if (sym.alias != NoSymbol) writeRef(sym.alias);
|
||||
if (sym.isModule) MODULEsym else VALsym
|
||||
case NoType =>
|
||||
NOtpe
|
||||
case NoPrefix =>
|
||||
NOPREFIXtpe
|
||||
case ThisType(sym) =>
|
||||
writeRef(sym); THIStpe
|
||||
case SingleType(pre, sym) =>
|
||||
writeRef(pre); writeRef(sym); SINGLEtpe
|
||||
case ConstantType(value) =>
|
||||
writeRef(value);
|
||||
CONSTANTtpe
|
||||
case TypeRef(pre, sym, args) =>
|
||||
writeRef(pre); writeRef(sym); writeRefs(args); TYPEREFtpe
|
||||
case TypeBounds(lo, hi) =>
|
||||
writeRef(lo); writeRef(hi); TYPEBOUNDStpe
|
||||
case tp @ RefinedType(parents, decls) =>
|
||||
writeRef(tp.symbol); writeRefs(parents); REFINEDtpe
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
writeRef(clazz); writeRefs(parents); CLASSINFOtpe
|
||||
case MethodType(formals, restpe) =>
|
||||
writeRef(restpe); writeRefs(formals);
|
||||
if (entry.isInstanceOf[ImplicitMethodType]) IMPLICITMETHODtpe
|
||||
else METHODtpe
|
||||
case PolyType(tparams, restpe) =>
|
||||
writeRef(restpe); writeRefs(tparams); POLYtpe
|
||||
case c @ Constant(_) =>
|
||||
if (c.tag == BooleanTag) writeLong(if (c.booleanValue) 1 else 0)
|
||||
else if (ByteTag <= c.tag && c.tag <= LongTag) writeLong(c.longValue)
|
||||
else if (c.tag == FloatTag) writeLong(Float.floatToIntBits(c.floatValue))
|
||||
else if (c.tag == DoubleTag) writeLong(Double.doubleToLongBits(c.doubleValue));
|
||||
else if (c.tag == StringTag) writeRef(newTermName(c.stringValue));
|
||||
LITERAL + c.tag
|
||||
/*
|
||||
case Pair(tp, cs) =>
|
||||
writeRef(tp);
|
||||
for (val c <- cs) writeRef(cs);
|
||||
ATTRIBUTE
|
||||
*/
|
||||
case _ =>
|
||||
throw new FatalError("bad entry: " + entry + " " + entry.getClass());//debug
|
||||
}
|
||||
val startpos = writeIndex;
|
||||
writeByte(0); writeByte(0);
|
||||
patchNat(startpos, writeBody);
|
||||
patchNat(startpos + 1, writeIndex - (startpos + 2));
|
||||
}
|
||||
|
||||
/** Write byte array */
|
||||
def finish = {
|
||||
assert(writeIndex == 0);
|
||||
writeNat(MajorVersion);
|
||||
writeNat(MinorVersion);
|
||||
writeNat(ep);
|
||||
if (settings.debug.value) log("" + ep + " entries");//debug
|
||||
for (val i <- Iterator.range(0, ep)) writeEntry(entries(i))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab.classfile;
|
||||
|
||||
import java.io._;
|
||||
import java.lang.{Float, Double}
|
||||
import scala.collection.mutable.HashMap;
|
||||
import Flags._;
|
||||
import PickleFormat._;
|
||||
|
||||
/**
|
||||
* Serialize a top-level module and/or class;
|
||||
* @see EntryTags.scala for symbol table attribute format.
|
||||
*/
|
||||
abstract class Pickler extends SubComponent {
|
||||
import global._;
|
||||
|
||||
val phaseName = "pickler";
|
||||
def newPhase(prev: Phase): StdPhase = new PicklePhase(prev);
|
||||
|
||||
class PicklePhase(prev: Phase) extends StdPhase(prev) {
|
||||
def apply(unit: CompilationUnit): unit = {
|
||||
def pickle(tree: Tree): unit = {
|
||||
|
||||
def add(sym: Symbol, pickle: Pickle) = {
|
||||
if (!sym.isExternal && !currentRun.symData.contains(sym)) {
|
||||
if (settings.debug.value) log("pickling " + sym);
|
||||
pickle.putSymbol(sym);
|
||||
currentRun.symData(sym) = pickle;
|
||||
}
|
||||
}
|
||||
|
||||
tree match {
|
||||
case PackageDef(_, stats) => stats foreach pickle;
|
||||
case ClassDef(_, _, _, _, _) | ModuleDef(_, _, _) =>
|
||||
val sym = tree.symbol;
|
||||
val pickle = new Pickle(sym.name.toTermName, sym.owner);
|
||||
add(sym, pickle);
|
||||
add(sym.linkedSym, pickle);
|
||||
pickle.finish
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
pickle(unit.body);
|
||||
}
|
||||
}
|
||||
|
||||
class Pickle(rootName: Name, rootOwner: Symbol) extends PickleBuffer(new Array[byte](4096), -1, 0) {
|
||||
private var entries = new Array[AnyRef](256);
|
||||
private var ep = 0;
|
||||
private val index = new HashMap[AnyRef, int];
|
||||
|
||||
/** Is root in symbol.owner*? */
|
||||
private def isLocal(sym: Symbol): boolean = (
|
||||
sym.isRefinementClass ||
|
||||
sym.name.toTermName == rootName && sym.owner == rootOwner ||
|
||||
sym != NoSymbol && isLocal(sym.owner)
|
||||
);
|
||||
|
||||
// Phase 1 methods: Populate entries/index ------------------------------------
|
||||
|
||||
/** Store entry `e' in index at next available position unless it it
|
||||
* already there. Return true iff entry is new. */
|
||||
private def putEntry(entry: AnyRef): boolean = index.get(entry) match {
|
||||
case Some(_) => false
|
||||
case None =>
|
||||
if (ep == entries.length) {
|
||||
val entries1 = new Array[AnyRef](ep * 2);
|
||||
System.arraycopy(entries, 0, entries1, 0, ep);
|
||||
entries = entries1;
|
||||
}
|
||||
entries(ep) = entry;
|
||||
index(entry) = ep;
|
||||
ep = ep + 1;
|
||||
true
|
||||
}
|
||||
|
||||
/** Store symbol in index. If symbol is local, also store everything it refers to. */
|
||||
def putSymbol(sym: Symbol): unit = if (putEntry(sym)) {
|
||||
if (isLocal(sym)) {
|
||||
putEntry(sym.name);
|
||||
putSymbol(sym.owner);
|
||||
putType(sym.info);
|
||||
if (sym.thisSym != sym)
|
||||
putType(sym.typeOfThis);
|
||||
putSymbol(sym.alias);
|
||||
//for (val attr <- sym.attributes) putAttribute(sym, attr);
|
||||
} else if (sym != NoSymbol) {
|
||||
putEntry(if (sym.isModuleClass) sym.name.toTermName else sym.name);
|
||||
if (!sym.owner.isRoot) putSymbol(sym.owner);
|
||||
}
|
||||
}
|
||||
private def putSymbols(syms: List[Symbol]) = syms foreach putSymbol;
|
||||
|
||||
/** Store type and everythig it refers to in index. */
|
||||
private def putType(tp: Type): unit = if (putEntry(tp)) {
|
||||
tp match {
|
||||
case NoType | NoPrefix =>
|
||||
;
|
||||
case ThisType(sym) =>
|
||||
putSymbol(sym)
|
||||
case SingleType(pre, sym) =>
|
||||
putType(pre); putSymbol(sym)
|
||||
case ConstantType(value) =>
|
||||
putConstant(value)
|
||||
case TypeRef(pre, sym, args) =>
|
||||
putType(pre); putSymbol(sym); putTypes(args)
|
||||
case TypeBounds(lo, hi) =>
|
||||
putType(lo); putType(hi);
|
||||
case RefinedType(parents, decls) =>
|
||||
putSymbol(tp.symbol); putTypes(parents); putSymbols(decls.toList)
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
putSymbol(clazz); putTypes(parents); putSymbols(decls.toList)
|
||||
case MethodType(formals, restpe) =>
|
||||
putType(restpe); putTypes(formals)
|
||||
case PolyType(tparams, restpe) =>
|
||||
putType(restpe); putSymbols(tparams)
|
||||
case _ =>
|
||||
throw new FatalError("bad type: " + tp + "(" + tp.getClass() + ")")
|
||||
}
|
||||
}
|
||||
private def putTypes(tps: List[Type]): unit = tps foreach putType;
|
||||
|
||||
private def putConstant(c: Constant) =
|
||||
if (putEntry(c) && c.tag == StringTag) putEntry(newTermName(c.stringValue));
|
||||
|
||||
/*
|
||||
private def putAttribute(attr: AttrInfo): unit = if (putEntry(attr)) {
|
||||
putType(attr._1);
|
||||
for (val c <- attr._2) putConstant(c);
|
||||
}
|
||||
*/
|
||||
// Phase 2 methods: Write all entries to byte array ------------------------------
|
||||
|
||||
private val buf = new PickleBuffer(new Array[byte](4096), -1, 0);
|
||||
|
||||
/** Write a reference to object, i.e., the object's number in the index. */
|
||||
private def writeRef(ref: AnyRef): unit = writeNat(index(ref));
|
||||
private def writeRefs(refs: List[AnyRef]): unit = refs foreach writeRef;
|
||||
|
||||
/** Write name, owner, flags, and info of a symbol */
|
||||
private def writeSymInfo(sym: Symbol): unit = {
|
||||
writeRef(sym.name);
|
||||
writeRef(sym.owner);
|
||||
writeNat((sym.flags & PickledFlags).asInstanceOf[int]);
|
||||
writeRef(sym.info)
|
||||
}
|
||||
|
||||
/** Write a name in Utf8 format. */
|
||||
def writeName(name: Name): unit = {
|
||||
ensureCapacity(name.length * 3);
|
||||
writeIndex = name.copyUTF8(bytes, writeIndex);
|
||||
}
|
||||
|
||||
/** Write an entry */
|
||||
private def writeEntry(entry: AnyRef): unit = {
|
||||
def writeBody: int = entry match {
|
||||
case name: Name =>
|
||||
writeName(name);
|
||||
if (name.isTermName) TERMname else TYPEname
|
||||
case NoSymbol =>
|
||||
NONEsym
|
||||
case sym: Symbol if !isLocal(sym) =>
|
||||
val tag =
|
||||
if (sym.isModuleClass) {
|
||||
writeRef(sym.name.toTermName); EXTMODCLASSref
|
||||
} else {
|
||||
writeRef(sym.name); EXTref
|
||||
}
|
||||
if (!sym.owner.isRoot) writeRef(sym.owner);
|
||||
tag
|
||||
case sym: ClassSymbol =>
|
||||
writeSymInfo(sym);
|
||||
if (sym.thisSym != sym) writeRef(sym.typeOfThis);
|
||||
CLASSsym
|
||||
case sym: TypeSymbol =>
|
||||
writeSymInfo(sym);
|
||||
if (sym.isAbstractType) TYPEsym else ALIASsym
|
||||
case sym: TermSymbol =>
|
||||
writeSymInfo(sym);
|
||||
if (sym.alias != NoSymbol) writeRef(sym.alias);
|
||||
if (sym.isModule) MODULEsym else VALsym
|
||||
case NoType =>
|
||||
NOtpe
|
||||
case NoPrefix =>
|
||||
NOPREFIXtpe
|
||||
case ThisType(sym) =>
|
||||
writeRef(sym); THIStpe
|
||||
case SingleType(pre, sym) =>
|
||||
writeRef(pre); writeRef(sym); SINGLEtpe
|
||||
case ConstantType(value) =>
|
||||
writeRef(value);
|
||||
CONSTANTtpe
|
||||
case TypeRef(pre, sym, args) =>
|
||||
writeRef(pre); writeRef(sym); writeRefs(args); TYPEREFtpe
|
||||
case TypeBounds(lo, hi) =>
|
||||
writeRef(lo); writeRef(hi); TYPEBOUNDStpe
|
||||
case tp @ RefinedType(parents, decls) =>
|
||||
writeRef(tp.symbol); writeRefs(parents); REFINEDtpe
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
writeRef(clazz); writeRefs(parents); CLASSINFOtpe
|
||||
case MethodType(formals, restpe) =>
|
||||
writeRef(restpe); writeRefs(formals);
|
||||
if (entry.isInstanceOf[ImplicitMethodType]) IMPLICITMETHODtpe
|
||||
else METHODtpe
|
||||
case PolyType(tparams, restpe) =>
|
||||
writeRef(restpe); writeRefs(tparams); POLYtpe
|
||||
case c @ Constant(_) =>
|
||||
if (c.tag == BooleanTag) writeLong(if (c.booleanValue) 1 else 0)
|
||||
else if (ByteTag <= c.tag && c.tag <= LongTag) writeLong(c.longValue)
|
||||
else if (c.tag == FloatTag) writeLong(Float.floatToIntBits(c.floatValue))
|
||||
else if (c.tag == DoubleTag) writeLong(Double.doubleToLongBits(c.doubleValue));
|
||||
else if (c.tag == StringTag) writeRef(newTermName(c.stringValue));
|
||||
LITERAL + c.tag
|
||||
/*
|
||||
case Pair(tp, cs) =>
|
||||
writeRef(tp);
|
||||
for (val c <- cs) writeRef(cs);
|
||||
ATTRIBUTE
|
||||
*/
|
||||
case _ =>
|
||||
throw new FatalError("bad entry: " + entry + " " + entry.getClass());//debug
|
||||
}
|
||||
val startpos = writeIndex;
|
||||
writeByte(0); writeByte(0);
|
||||
patchNat(startpos, writeBody);
|
||||
patchNat(startpos + 1, writeIndex - (startpos + 2));
|
||||
}
|
||||
|
||||
/** Write byte array */
|
||||
def finish = {
|
||||
assert(writeIndex == 0);
|
||||
writeNat(MajorVersion);
|
||||
writeNat(MinorVersion);
|
||||
writeNat(ep);
|
||||
if (settings.debug.value) log("" + ep + " entries");//debug
|
||||
for (val i <- Iterator.range(0, ep)) writeEntry(entries(i))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,260 +1,260 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab.classfile;
|
||||
|
||||
import scala.tools.nsc.util.Position;
|
||||
import scala.tools.util.UTF8Codec;
|
||||
import java.lang.{Float, Double};
|
||||
import Flags._;
|
||||
import PickleFormat._;
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class UnPickler {
|
||||
val global: Global;
|
||||
import global._;
|
||||
|
||||
def unpickle(bytes: Array[byte], offset: int, classRoot: Symbol, moduleRoot: Symbol): unit = try {
|
||||
new UnPickle(bytes, offset, classRoot, moduleRoot);
|
||||
} catch {
|
||||
case ex: Throwable =>
|
||||
ex.printStackTrace();//debug
|
||||
|
||||
throw new RuntimeException("error reading Scala signature of " + classRoot.nameString + ": " + ex.getMessage());
|
||||
}
|
||||
|
||||
private class UnPickle(bytes: Array[byte], offset: int, classRoot: Symbol, moduleRoot: Symbol) extends PickleBuffer(bytes, offset, -1) {
|
||||
if (settings.debug.value) global.log("unpickle " + classRoot + " and " + moduleRoot);
|
||||
|
||||
checkVersion();
|
||||
private val index = createIndex;
|
||||
private val entries = new Array[AnyRef](index.length);
|
||||
private val symScopes = new HashMap[Symbol, Scope];
|
||||
|
||||
for (val i <- Iterator.range(0, index.length))
|
||||
if (isSymbolEntry(i)) { at(i, readSymbol); () }
|
||||
|
||||
if (settings.debug.value) global.log("unpickled " + classRoot + ":" + classRoot.rawInfo + ", " + moduleRoot + ":" + moduleRoot.rawInfo);//debug
|
||||
|
||||
private def checkVersion() = {
|
||||
val major = readNat();
|
||||
val minor = readNat();
|
||||
if (major != MajorVersion || minor > MinorVersion)
|
||||
throw new TypeError("Scala signature " + classRoot.name +
|
||||
" has wrong version\n expected: " +
|
||||
MajorVersion + "." + MinorVersion +
|
||||
"\n found: " + major + "." + minor)
|
||||
}
|
||||
|
||||
/** The scope associated with given symbol */
|
||||
private def symScope(sym: Symbol) = symScopes.get(sym) match {
|
||||
case None => val s = new Scope(); symScopes(sym) = s; s
|
||||
case Some(s) => s
|
||||
}
|
||||
|
||||
/** Does entry represent an (internal) symbol */
|
||||
private def isSymbolEntry(i: int): boolean = {
|
||||
val tag = bytes(index(i));
|
||||
(firstSymTag <= tag && tag <= lastSymTag &&
|
||||
(tag != CLASSsym || !isRefinementSymbolEntry(i)))
|
||||
}
|
||||
|
||||
/** Does entry represent a refinement symbol?
|
||||
* pre: Entry is a class symbol
|
||||
*/
|
||||
private def isRefinementSymbolEntry(i: int): boolean = {
|
||||
val savedIndex = readIndex;
|
||||
readIndex = index(i);
|
||||
if (readByte() != CLASSsym) assert(false);
|
||||
readNat();
|
||||
val result = readNameRef() == nme.REFINE_CLASS_NAME.toTypeName;
|
||||
readIndex = savedIndex;
|
||||
result
|
||||
}
|
||||
|
||||
/** If entry at `i' is undefined, define it by performing operation `op' with
|
||||
* readIndex at start of i'th entry. Restore readIndex afterwards. */
|
||||
private def at[T <: AnyRef](i: int, op: () => T): T = {
|
||||
var r = entries(i);
|
||||
if (r == null) {
|
||||
val savedIndex = readIndex;
|
||||
readIndex = index(i);
|
||||
r = op();
|
||||
assert(entries(i) == null, entries(i));
|
||||
entries(i) = r;
|
||||
readIndex = savedIndex;
|
||||
}
|
||||
r.asInstanceOf[T]
|
||||
}
|
||||
|
||||
/** Read a name */
|
||||
private def readName(): Name = {
|
||||
val tag = readByte();
|
||||
val len = readNat();
|
||||
tag match {
|
||||
case TERMname => newTermName(bytes, readIndex, len)
|
||||
case TYPEname => newTypeName(bytes, readIndex, len)
|
||||
case _ => errorBadSignature("bad name tag: " + tag);
|
||||
}
|
||||
}
|
||||
|
||||
/** Read a symbol */
|
||||
private def readSymbol(): Symbol = {
|
||||
val tag = readByte();
|
||||
val end = readNat() + readIndex;
|
||||
var sym: Symbol = NoSymbol;
|
||||
tag match {
|
||||
case EXTref | EXTMODCLASSref =>
|
||||
val name = readNameRef();
|
||||
val owner = if (readIndex == end) definitions.RootClass else readSymbolRef();
|
||||
sym = if (tag == EXTref) owner.info.decl(name)
|
||||
else if (name.toTermName == nme.ROOT) definitions.RootClass
|
||||
else owner.info.decl(name).moduleClass;
|
||||
if (sym == NoSymbol)
|
||||
errorBadSignature(
|
||||
"reference " + (if (name.isTypeName) "type " else "value ") +
|
||||
name.decode + " of " + owner + " refers to nonexisting symbol.")
|
||||
case NONEsym =>
|
||||
sym = NoSymbol
|
||||
case _ =>
|
||||
val name = readNameRef();
|
||||
val owner = readSymbolRef();
|
||||
val flags = readNat();
|
||||
val inforef = readNat();
|
||||
tag match {
|
||||
case TYPEsym =>
|
||||
sym = owner.newAbstractType(Position.NOPOS, name);
|
||||
case ALIASsym =>
|
||||
sym = owner.newAliasType(Position.NOPOS, name);
|
||||
case CLASSsym =>
|
||||
sym =
|
||||
if (name == classRoot.name && owner == classRoot.owner)
|
||||
if ((flags & MODULE) != 0) moduleRoot.moduleClass
|
||||
else classRoot
|
||||
else
|
||||
if ((flags & MODULE) != 0) owner.newModuleClass(Position.NOPOS, name)
|
||||
else owner.newClass(Position.NOPOS, name);
|
||||
if (readIndex != end) sym.typeOfThis = new LazyTypeRef(readNat())
|
||||
case MODULEsym =>
|
||||
val clazz = at(inforef, readType).symbol;
|
||||
sym =
|
||||
if (name == moduleRoot.name && owner == moduleRoot.owner) moduleRoot
|
||||
else {
|
||||
assert(clazz.isInstanceOf[ModuleClassSymbol], clazz);
|
||||
val mclazz = clazz.asInstanceOf[ModuleClassSymbol];
|
||||
val m = owner.newModule(Position.NOPOS, name, mclazz);
|
||||
mclazz.setSourceModule(m);
|
||||
m
|
||||
}
|
||||
case VALsym =>
|
||||
sym = if (name == moduleRoot.name && owner == moduleRoot.owner) moduleRoot.resetFlag(MODULE)
|
||||
else owner.newValue(Position.NOPOS, name)
|
||||
case _ =>
|
||||
errorBadSignature("bad symbol tag: " + tag);
|
||||
}
|
||||
sym.setFlag(flags);
|
||||
if (readIndex != end) assert(sym hasFlag (SUPERACCESSOR | PARAMACCESSOR));
|
||||
if (sym hasFlag SUPERACCESSOR) assert(readIndex != end);
|
||||
sym.setInfo(
|
||||
if (readIndex != end) new LazyTypeRefAndAlias(inforef, readNat())
|
||||
else new LazyTypeRef(inforef));
|
||||
if (sym.owner.isClass && sym != classRoot && sym != moduleRoot &&
|
||||
!sym.isModuleClass && !sym.isRefinementClass && !sym.isTypeParameter)
|
||||
symScope(sym.owner) enter sym;
|
||||
}
|
||||
sym
|
||||
}
|
||||
|
||||
/** Read a type */
|
||||
private def readType(): Type = {
|
||||
val tag = readByte();
|
||||
val end = readNat() + readIndex;
|
||||
tag match {
|
||||
case NOtpe =>
|
||||
NoType
|
||||
case NOPREFIXtpe =>
|
||||
NoPrefix
|
||||
case THIStpe =>
|
||||
ThisType(readSymbolRef())
|
||||
case SINGLEtpe =>
|
||||
singleType(readTypeRef(), readSymbolRef())
|
||||
case CONSTANTtpe =>
|
||||
ConstantType(readConstantRef())
|
||||
case TYPEREFtpe =>
|
||||
rawTypeRef(readTypeRef(), readSymbolRef(), until(end, readTypeRef))
|
||||
case TYPEBOUNDStpe =>
|
||||
TypeBounds(readTypeRef(), readTypeRef())
|
||||
case REFINEDtpe =>
|
||||
val clazz = readSymbolRef();
|
||||
/*
|
||||
val ps = until(end, readTypeRef);
|
||||
val dcls = symScope(clazz);
|
||||
new RefinedType(ps, dcls) { override def symbol = clazz }
|
||||
*/
|
||||
new RefinedType(until(end, readTypeRef), symScope(clazz)) { override def symbol = clazz }
|
||||
case CLASSINFOtpe =>
|
||||
val clazz = readSymbolRef();
|
||||
ClassInfoType(until(end, readTypeRef), symScope(clazz), clazz)
|
||||
case METHODtpe =>
|
||||
val restpe = readTypeRef();
|
||||
MethodType(until(end, readTypeRef), restpe)
|
||||
case IMPLICITMETHODtpe =>
|
||||
val restpe = readTypeRef();
|
||||
ImplicitMethodType(until(end, readTypeRef), restpe)
|
||||
case POLYtpe =>
|
||||
val restpe = readTypeRef();
|
||||
PolyType(until(end, readSymbolRef), restpe)
|
||||
case _ =>
|
||||
errorBadSignature("bad type tag: " + tag);
|
||||
}
|
||||
}
|
||||
|
||||
/** Read a constant */
|
||||
private def readConstant(): Constant = {
|
||||
val tag = readByte();
|
||||
val len = readNat();
|
||||
tag match {
|
||||
case LITERALunit => Constant(())
|
||||
case LITERALboolean => Constant(if (readLong(len) == 0) false else true)
|
||||
case LITERALbyte => Constant(readLong(len).asInstanceOf[byte])
|
||||
case LITERALshort => Constant(readLong(len).asInstanceOf[short])
|
||||
case LITERALchar => Constant(readLong(len).asInstanceOf[char])
|
||||
case LITERALint => Constant(readLong(len).asInstanceOf[int])
|
||||
case LITERALlong => Constant(readLong(len))
|
||||
case LITERALfloat => Constant(Float.intBitsToFloat(readLong(len).asInstanceOf[int]))
|
||||
case LITERALdouble => Constant(Double.longBitsToDouble(readLong(len)))
|
||||
case LITERALstring => Constant(readNameRef().toString())
|
||||
case LITERALnull => Constant(null)
|
||||
case _ => errorBadSignature("bad constant tag: " + tag)
|
||||
}
|
||||
};
|
||||
|
||||
/** Read a reference to a name, symbol, type or constant */
|
||||
private def readNameRef(): Name = at(readNat(), readName);
|
||||
private def readSymbolRef(): Symbol = at(readNat(), readSymbol);
|
||||
private def readTypeRef(): Type = at(readNat(), readType);
|
||||
private def readConstantRef(): Constant = at(readNat(), readConstant);
|
||||
|
||||
private def errorBadSignature(msg: String) =
|
||||
throw new RuntimeException("malformed Scala signature of " + classRoot.name + " at " + readIndex + "; " + msg);
|
||||
|
||||
private class LazyTypeRef(i: int) extends LazyType {
|
||||
private val definedAtRun = currentRun;
|
||||
override def complete(sym: Symbol): unit = {
|
||||
val tp = at(i, readType);
|
||||
sym setInfo tp;
|
||||
if (currentRun != definedAtRun) tp.complete(sym)
|
||||
}
|
||||
override def load(sym: Symbol): unit = complete(sym)
|
||||
}
|
||||
|
||||
private class LazyTypeRefAndAlias(i: int, j: int) extends LazyTypeRef(i) {
|
||||
override def complete(sym: Symbol): unit = {
|
||||
super.complete(sym);
|
||||
sym.asInstanceOf[TermSymbol].setAlias(at(j, readSymbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.symtab.classfile;
|
||||
|
||||
import scala.tools.nsc.util.Position;
|
||||
import scala.tools.util.UTF8Codec;
|
||||
import java.lang.{Float, Double};
|
||||
import Flags._;
|
||||
import PickleFormat._;
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class UnPickler {
|
||||
val global: Global;
|
||||
import global._;
|
||||
|
||||
def unpickle(bytes: Array[byte], offset: int, classRoot: Symbol, moduleRoot: Symbol): unit = try {
|
||||
new UnPickle(bytes, offset, classRoot, moduleRoot);
|
||||
} catch {
|
||||
case ex: Throwable =>
|
||||
ex.printStackTrace();//debug
|
||||
|
||||
throw new RuntimeException("error reading Scala signature of " + classRoot.nameString + ": " + ex.getMessage());
|
||||
}
|
||||
|
||||
private class UnPickle(bytes: Array[byte], offset: int, classRoot: Symbol, moduleRoot: Symbol) extends PickleBuffer(bytes, offset, -1) {
|
||||
if (settings.debug.value) global.log("unpickle " + classRoot + " and " + moduleRoot);
|
||||
|
||||
checkVersion();
|
||||
private val index = createIndex;
|
||||
private val entries = new Array[AnyRef](index.length);
|
||||
private val symScopes = new HashMap[Symbol, Scope];
|
||||
|
||||
for (val i <- Iterator.range(0, index.length))
|
||||
if (isSymbolEntry(i)) { at(i, readSymbol); () }
|
||||
|
||||
if (settings.debug.value) global.log("unpickled " + classRoot + ":" + classRoot.rawInfo + ", " + moduleRoot + ":" + moduleRoot.rawInfo);//debug
|
||||
|
||||
private def checkVersion() = {
|
||||
val major = readNat();
|
||||
val minor = readNat();
|
||||
if (major != MajorVersion || minor > MinorVersion)
|
||||
throw new TypeError("Scala signature " + classRoot.name +
|
||||
" has wrong version\n expected: " +
|
||||
MajorVersion + "." + MinorVersion +
|
||||
"\n found: " + major + "." + minor)
|
||||
}
|
||||
|
||||
/** The scope associated with given symbol */
|
||||
private def symScope(sym: Symbol) = symScopes.get(sym) match {
|
||||
case None => val s = new Scope(); symScopes(sym) = s; s
|
||||
case Some(s) => s
|
||||
}
|
||||
|
||||
/** Does entry represent an (internal) symbol */
|
||||
private def isSymbolEntry(i: int): boolean = {
|
||||
val tag = bytes(index(i));
|
||||
(firstSymTag <= tag && tag <= lastSymTag &&
|
||||
(tag != CLASSsym || !isRefinementSymbolEntry(i)))
|
||||
}
|
||||
|
||||
/** Does entry represent a refinement symbol?
|
||||
* pre: Entry is a class symbol
|
||||
*/
|
||||
private def isRefinementSymbolEntry(i: int): boolean = {
|
||||
val savedIndex = readIndex;
|
||||
readIndex = index(i);
|
||||
if (readByte() != CLASSsym) assert(false);
|
||||
readNat();
|
||||
val result = readNameRef() == nme.REFINE_CLASS_NAME.toTypeName;
|
||||
readIndex = savedIndex;
|
||||
result
|
||||
}
|
||||
|
||||
/** If entry at `i' is undefined, define it by performing operation `op' with
|
||||
* readIndex at start of i'th entry. Restore readIndex afterwards. */
|
||||
private def at[T <: AnyRef](i: int, op: () => T): T = {
|
||||
var r = entries(i);
|
||||
if (r == null) {
|
||||
val savedIndex = readIndex;
|
||||
readIndex = index(i);
|
||||
r = op();
|
||||
assert(entries(i) == null, entries(i));
|
||||
entries(i) = r;
|
||||
readIndex = savedIndex;
|
||||
}
|
||||
r.asInstanceOf[T]
|
||||
}
|
||||
|
||||
/** Read a name */
|
||||
private def readName(): Name = {
|
||||
val tag = readByte();
|
||||
val len = readNat();
|
||||
tag match {
|
||||
case TERMname => newTermName(bytes, readIndex, len)
|
||||
case TYPEname => newTypeName(bytes, readIndex, len)
|
||||
case _ => errorBadSignature("bad name tag: " + tag);
|
||||
}
|
||||
}
|
||||
|
||||
/** Read a symbol */
|
||||
private def readSymbol(): Symbol = {
|
||||
val tag = readByte();
|
||||
val end = readNat() + readIndex;
|
||||
var sym: Symbol = NoSymbol;
|
||||
tag match {
|
||||
case EXTref | EXTMODCLASSref =>
|
||||
val name = readNameRef();
|
||||
val owner = if (readIndex == end) definitions.RootClass else readSymbolRef();
|
||||
sym = if (tag == EXTref) owner.info.decl(name)
|
||||
else if (name.toTermName == nme.ROOT) definitions.RootClass
|
||||
else owner.info.decl(name).moduleClass;
|
||||
if (sym == NoSymbol)
|
||||
errorBadSignature(
|
||||
"reference " + (if (name.isTypeName) "type " else "value ") +
|
||||
name.decode + " of " + owner + " refers to nonexisting symbol.")
|
||||
case NONEsym =>
|
||||
sym = NoSymbol
|
||||
case _ =>
|
||||
val name = readNameRef();
|
||||
val owner = readSymbolRef();
|
||||
val flags = readNat();
|
||||
val inforef = readNat();
|
||||
tag match {
|
||||
case TYPEsym =>
|
||||
sym = owner.newAbstractType(Position.NOPOS, name);
|
||||
case ALIASsym =>
|
||||
sym = owner.newAliasType(Position.NOPOS, name);
|
||||
case CLASSsym =>
|
||||
sym =
|
||||
if (name == classRoot.name && owner == classRoot.owner)
|
||||
if ((flags & MODULE) != 0) moduleRoot.moduleClass
|
||||
else classRoot
|
||||
else
|
||||
if ((flags & MODULE) != 0) owner.newModuleClass(Position.NOPOS, name)
|
||||
else owner.newClass(Position.NOPOS, name);
|
||||
if (readIndex != end) sym.typeOfThis = new LazyTypeRef(readNat())
|
||||
case MODULEsym =>
|
||||
val clazz = at(inforef, readType).symbol;
|
||||
sym =
|
||||
if (name == moduleRoot.name && owner == moduleRoot.owner) moduleRoot
|
||||
else {
|
||||
assert(clazz.isInstanceOf[ModuleClassSymbol], clazz);
|
||||
val mclazz = clazz.asInstanceOf[ModuleClassSymbol];
|
||||
val m = owner.newModule(Position.NOPOS, name, mclazz);
|
||||
mclazz.setSourceModule(m);
|
||||
m
|
||||
}
|
||||
case VALsym =>
|
||||
sym = if (name == moduleRoot.name && owner == moduleRoot.owner) moduleRoot.resetFlag(MODULE)
|
||||
else owner.newValue(Position.NOPOS, name)
|
||||
case _ =>
|
||||
errorBadSignature("bad symbol tag: " + tag);
|
||||
}
|
||||
sym.setFlag(flags);
|
||||
if (readIndex != end) assert(sym hasFlag (SUPERACCESSOR | PARAMACCESSOR));
|
||||
if (sym hasFlag SUPERACCESSOR) assert(readIndex != end);
|
||||
sym.setInfo(
|
||||
if (readIndex != end) new LazyTypeRefAndAlias(inforef, readNat())
|
||||
else new LazyTypeRef(inforef));
|
||||
if (sym.owner.isClass && sym != classRoot && sym != moduleRoot &&
|
||||
!sym.isModuleClass && !sym.isRefinementClass && !sym.isTypeParameter)
|
||||
symScope(sym.owner) enter sym;
|
||||
}
|
||||
sym
|
||||
}
|
||||
|
||||
/** Read a type */
|
||||
private def readType(): Type = {
|
||||
val tag = readByte();
|
||||
val end = readNat() + readIndex;
|
||||
tag match {
|
||||
case NOtpe =>
|
||||
NoType
|
||||
case NOPREFIXtpe =>
|
||||
NoPrefix
|
||||
case THIStpe =>
|
||||
ThisType(readSymbolRef())
|
||||
case SINGLEtpe =>
|
||||
singleType(readTypeRef(), readSymbolRef())
|
||||
case CONSTANTtpe =>
|
||||
ConstantType(readConstantRef())
|
||||
case TYPEREFtpe =>
|
||||
rawTypeRef(readTypeRef(), readSymbolRef(), until(end, readTypeRef))
|
||||
case TYPEBOUNDStpe =>
|
||||
TypeBounds(readTypeRef(), readTypeRef())
|
||||
case REFINEDtpe =>
|
||||
val clazz = readSymbolRef();
|
||||
/*
|
||||
val ps = until(end, readTypeRef);
|
||||
val dcls = symScope(clazz);
|
||||
new RefinedType(ps, dcls) { override def symbol = clazz }
|
||||
*/
|
||||
new RefinedType(until(end, readTypeRef), symScope(clazz)) { override def symbol = clazz }
|
||||
case CLASSINFOtpe =>
|
||||
val clazz = readSymbolRef();
|
||||
ClassInfoType(until(end, readTypeRef), symScope(clazz), clazz)
|
||||
case METHODtpe =>
|
||||
val restpe = readTypeRef();
|
||||
MethodType(until(end, readTypeRef), restpe)
|
||||
case IMPLICITMETHODtpe =>
|
||||
val restpe = readTypeRef();
|
||||
ImplicitMethodType(until(end, readTypeRef), restpe)
|
||||
case POLYtpe =>
|
||||
val restpe = readTypeRef();
|
||||
PolyType(until(end, readSymbolRef), restpe)
|
||||
case _ =>
|
||||
errorBadSignature("bad type tag: " + tag);
|
||||
}
|
||||
}
|
||||
|
||||
/** Read a constant */
|
||||
private def readConstant(): Constant = {
|
||||
val tag = readByte();
|
||||
val len = readNat();
|
||||
tag match {
|
||||
case LITERALunit => Constant(())
|
||||
case LITERALboolean => Constant(if (readLong(len) == 0) false else true)
|
||||
case LITERALbyte => Constant(readLong(len).asInstanceOf[byte])
|
||||
case LITERALshort => Constant(readLong(len).asInstanceOf[short])
|
||||
case LITERALchar => Constant(readLong(len).asInstanceOf[char])
|
||||
case LITERALint => Constant(readLong(len).asInstanceOf[int])
|
||||
case LITERALlong => Constant(readLong(len))
|
||||
case LITERALfloat => Constant(Float.intBitsToFloat(readLong(len).asInstanceOf[int]))
|
||||
case LITERALdouble => Constant(Double.longBitsToDouble(readLong(len)))
|
||||
case LITERALstring => Constant(readNameRef().toString())
|
||||
case LITERALnull => Constant(null)
|
||||
case _ => errorBadSignature("bad constant tag: " + tag)
|
||||
}
|
||||
};
|
||||
|
||||
/** Read a reference to a name, symbol, type or constant */
|
||||
private def readNameRef(): Name = at(readNat(), readName);
|
||||
private def readSymbolRef(): Symbol = at(readNat(), readSymbol);
|
||||
private def readTypeRef(): Type = at(readNat(), readType);
|
||||
private def readConstantRef(): Constant = at(readNat(), readConstant);
|
||||
|
||||
private def errorBadSignature(msg: String) =
|
||||
throw new RuntimeException("malformed Scala signature of " + classRoot.name + " at " + readIndex + "; " + msg);
|
||||
|
||||
private class LazyTypeRef(i: int) extends LazyType {
|
||||
private val definedAtRun = currentRun;
|
||||
override def complete(sym: Symbol): unit = {
|
||||
val tp = at(i, readType);
|
||||
sym setInfo tp;
|
||||
if (currentRun != definedAtRun) tp.complete(sym)
|
||||
}
|
||||
override def load(sym: Symbol): unit = complete(sym)
|
||||
}
|
||||
|
||||
private class LazyTypeRefAndAlias(i: int, j: int) extends LazyTypeRef(i) {
|
||||
override def complete(sym: Symbol): unit = {
|
||||
super.complete(sym);
|
||||
sym.asInstanceOf[TermSymbol].setAlias(at(j, readSymbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,258 +1,258 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.ListBuffer;
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class AddInterfaces extends InfoTransform {
|
||||
import global._; // the global environment
|
||||
import definitions._; // standard classes and methods
|
||||
import posAssigner.atPos; // for filling in tree positions
|
||||
|
||||
override def phaseNewFlags: long = lateDEFERRED | lateINTERFACE;
|
||||
|
||||
// Type transformation
|
||||
|
||||
def erasedTypeRef(sym: Symbol): Type;
|
||||
|
||||
private val implClassMap = new HashMap[Symbol, Symbol];
|
||||
private val implMethodMap = new HashMap[Symbol, Symbol];
|
||||
|
||||
override def newPhase(prev: scala.tools.nsc.Phase): StdPhase = {
|
||||
implClassMap.clear;
|
||||
implMethodMap.clear;
|
||||
super.newPhase(prev)
|
||||
}
|
||||
|
||||
private def needsImplMethod(sym: Symbol): boolean = (
|
||||
sym.isMethod && isInterfaceMember(sym) &&
|
||||
(!(sym hasFlag (DEFERRED | SUPERACCESSOR)) || (sym hasFlag lateDEFERRED))
|
||||
);
|
||||
|
||||
private def isInterfaceMember(sym: Symbol): boolean = {
|
||||
sym.info; // to set lateMETHOD flag if necessary
|
||||
(sym.isType ||
|
||||
sym.isMethod && !(sym hasFlag (PRIVATE | BRIDGE | LABEL)) &&
|
||||
!sym.isConstructor && !sym.isImplOnly)
|
||||
}
|
||||
|
||||
def implClass(iface: Symbol): Symbol = implClassMap.get(iface) match {
|
||||
case Some(c) => c
|
||||
case None =>
|
||||
atPhase(currentRun.erasurePhase) {
|
||||
val implName = nme.implClassName(iface.name);
|
||||
var impl = if (iface.owner.isClass) iface.owner.info.decl(implName) else NoSymbol;
|
||||
if (impl == NoSymbol) {
|
||||
impl = iface.cloneSymbolImpl(iface.owner);
|
||||
impl.name = implName;
|
||||
if (iface.owner.isClass) iface.owner.info.decls enter impl
|
||||
}
|
||||
impl setPos iface.pos;
|
||||
impl.flags = iface.flags & ~(INTERFACE | lateINTERFACE) | IMPLCLASS;
|
||||
impl setInfo new LazyImplClassType(iface);
|
||||
implClassMap(iface) = impl;
|
||||
if (settings.debug.value) log("generating impl class " + impl + " in " + iface.owner);//debug
|
||||
impl
|
||||
}
|
||||
}
|
||||
|
||||
private class LazyImplClassType(iface: Symbol) extends LazyType {
|
||||
|
||||
def implDecls(implClass: Symbol, ifaceDecls: Scope): Scope = {
|
||||
val decls = new Scope();
|
||||
for (val sym <- ifaceDecls.elements) {
|
||||
if (isInterfaceMember(sym)) {
|
||||
if (needsImplMethod(sym)) {
|
||||
val impl = sym.cloneSymbol(implClass).setInfo(sym.info).resetFlag(lateDEFERRED);
|
||||
if (!impl.isExternal) implMethodMap(sym) = impl;
|
||||
decls enter impl;
|
||||
sym setFlag lateDEFERRED
|
||||
}
|
||||
} else {
|
||||
sym.owner = implClass;
|
||||
decls enter sym;
|
||||
}
|
||||
}
|
||||
decls
|
||||
}
|
||||
|
||||
override def complete(sym: Symbol): unit = {
|
||||
def implType(tp: Type): Type = tp match {
|
||||
case ClassInfoType(parents, decls, _) =>
|
||||
//ClassInfoType(traitToImplClass(parents) ::: List(iface.tpe), implDecls(sym, decls), sym)
|
||||
ClassInfoType(
|
||||
ObjectClass.tpe :: (parents.tail map traitToImplClass) ::: List(iface.tpe),
|
||||
implDecls(sym, decls),
|
||||
sym)
|
||||
case PolyType(tparams, restpe) =>
|
||||
PolyType(tparams, implType(restpe))
|
||||
}
|
||||
sym.setInfo(atPhase(currentRun.erasurePhase)(implType(iface.info)));
|
||||
}
|
||||
|
||||
override def load(clazz: Symbol): unit = complete(clazz)
|
||||
}
|
||||
|
||||
private def traitToImplClass(tp: Type): Type = tp match {
|
||||
case TypeRef(pre, sym, args) if (sym.needsImplClass) =>
|
||||
typeRef(pre, implClass(sym), args)
|
||||
case _ =>
|
||||
tp
|
||||
}
|
||||
|
||||
def transformTraitInfo(tp: Type): Type = tp match {
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
if (clazz.needsImplClass) {
|
||||
clazz setFlag lateINTERFACE;
|
||||
implClass(clazz) // generate an impl class
|
||||
}
|
||||
val parents1 =
|
||||
if (parents.isEmpty) List()
|
||||
else {
|
||||
assert(!parents.head.symbol.isTrait || clazz == RepeatedParamClass, clazz);
|
||||
if (clazz hasFlag INTERFACE) erasedTypeRef(ObjectClass) :: parents.tail
|
||||
else if (clazz.isImplClass || clazz == ArrayClass) parents
|
||||
else parents map traitToImplClass
|
||||
}
|
||||
val decls1 = if (clazz hasFlag INTERFACE) new Scope(decls.toList filter isInterfaceMember)
|
||||
else decls;
|
||||
if ((parents1 eq parents) && (decls1 eq decls)) tp
|
||||
else ClassInfoType(parents1, decls1, clazz)
|
||||
case _ =>
|
||||
tp
|
||||
}
|
||||
|
||||
// Tree transformation --------------------------------------------------------------
|
||||
|
||||
private class ChangeOwnerAndReturnTraverser(oldowner: Symbol, newowner: Symbol)
|
||||
extends ChangeOwnerTraverser(oldowner, newowner) {
|
||||
override def traverse(tree: Tree): unit = {
|
||||
tree match {
|
||||
case Return(expr) =>
|
||||
if (tree.symbol == oldowner) tree.symbol = newowner;
|
||||
case _ =>
|
||||
}
|
||||
super.traverse(tree)
|
||||
}
|
||||
}
|
||||
|
||||
private def ifaceMemberDef(tree: Tree): Tree =
|
||||
if (!tree.isDef || !isInterfaceMember(tree.symbol)) EmptyTree
|
||||
else if (needsImplMethod(tree.symbol)) DefDef(tree.symbol, vparamss => EmptyTree)
|
||||
else tree;
|
||||
|
||||
private def ifaceTemplate(templ: Template): Template =
|
||||
copy.Template(templ, templ.parents, templ.body map ifaceMemberDef);
|
||||
|
||||
private def implMethodDef(tree: Tree, ifaceMethod: Symbol): Tree =
|
||||
implMethodMap.get(ifaceMethod) match {
|
||||
case Some(implMethod) =>
|
||||
tree.symbol = implMethod;
|
||||
new ChangeOwnerAndReturnTraverser(ifaceMethod, implMethod)(tree)
|
||||
case None =>
|
||||
throw new Error("implMethod missing for " + ifaceMethod)
|
||||
}
|
||||
|
||||
private def implMemberDef(tree: Tree): Tree =
|
||||
if (!tree.isDef || !isInterfaceMember(tree.symbol)) tree
|
||||
else if (needsImplMethod(tree.symbol)) implMethodDef(tree, tree.symbol)
|
||||
else EmptyTree;
|
||||
|
||||
private def implTemplate(clazz: Symbol, templ: Template): Template = atPos(templ.pos){
|
||||
val templ1 = Template(templ.parents, templ.body map implMemberDef)
|
||||
.setPos(templ.pos)
|
||||
.setSymbol(clazz.newLocalDummy(templ.pos));
|
||||
new ChangeOwnerTraverser(templ.symbol.owner, clazz)(
|
||||
new ChangeOwnerTraverser(templ.symbol, templ1.symbol)(templ1))
|
||||
}
|
||||
|
||||
def implClassDefs(trees: List[Tree]): List[Tree] = {
|
||||
val buf = new ListBuffer[Tree];
|
||||
for (val tree <- trees)
|
||||
tree match {
|
||||
case ClassDef(_, _, _, _, impl) =>
|
||||
if (tree.symbol.needsImplClass)
|
||||
buf += {
|
||||
val clazz = implClass(tree.symbol).initialize;
|
||||
ClassDef(clazz, implTemplate(clazz, impl))
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
buf.toList
|
||||
}
|
||||
|
||||
protected val traitTransformer = new Transformer {
|
||||
override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] =
|
||||
(super.transformStats(stats, exprOwner) :::
|
||||
super.transformStats(implClassDefs(stats), exprOwner));
|
||||
override def transform(tree: Tree): Tree = {
|
||||
val tree1 = tree match {
|
||||
case ClassDef(mods, name, tparams, tpt, impl) =>
|
||||
if (tree.symbol.needsImplClass) {
|
||||
implClass(tree.symbol).initialize; // to force lateDEFERRED flags
|
||||
copy.ClassDef(tree, mods | INTERFACE, name, tparams, tpt, ifaceTemplate(impl))
|
||||
}
|
||||
else tree
|
||||
case Template(parents, body) =>
|
||||
val parents1 = tree.symbol.owner.info.parents map (t => TypeTree(t) setPos tree.pos);
|
||||
copy.Template(tree, parents1, body)
|
||||
case This(_) =>
|
||||
if (tree.symbol.needsImplClass) {
|
||||
val impl = implClass(tree.symbol);
|
||||
var owner = currentOwner;
|
||||
while (owner != tree.symbol && owner != impl) owner = owner.owner;
|
||||
if (owner == impl) This(impl) setPos tree.pos
|
||||
else tree
|
||||
} else tree
|
||||
case Super(qual, mix) =>
|
||||
val mix1 =
|
||||
if (mix == nme.EMPTY.toTypeName) mix
|
||||
else {
|
||||
val ps = atPhase(currentRun.erasurePhase) {
|
||||
tree.symbol.info.parents dropWhile (p => p.symbol.name != mix)
|
||||
}
|
||||
assert(!ps.isEmpty, tree);
|
||||
if (ps.head.symbol.needsImplClass) implClass(ps.head.symbol).name
|
||||
else mix
|
||||
}
|
||||
if (tree.symbol.needsImplClass) Super(implClass(tree.symbol), mix1) setPos tree.pos
|
||||
else copy.Super(tree, qual, mix1)
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
super.transform(tree1)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
val ensureNoEscapes = new TypeTraverser {
|
||||
def ensureNoEscape(sym: Symbol): unit = {
|
||||
if (sym.hasFlag(PRIVATE)) {
|
||||
var o = currentOwner;
|
||||
while (o != NoSymbol && o != sym.owner && !o.isLocal && !o.hasFlag(PRIVATE))
|
||||
o = o.owner;
|
||||
if (o == sym.owner) sym.makeNotPrivate(base);
|
||||
}
|
||||
}
|
||||
def traverse(t: Type): TypeTraverser = {
|
||||
t match {
|
||||
case TypeRef(qual, sym, args) =>
|
||||
ensureNoEscape(sym);
|
||||
mapOver(t);
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
parents foreach { p => traverse; () }
|
||||
traverse(t.typeOfThis);
|
||||
case _ =>
|
||||
mapOver(t)
|
||||
}
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.ListBuffer;
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class AddInterfaces extends InfoTransform {
|
||||
import global._; // the global environment
|
||||
import definitions._; // standard classes and methods
|
||||
import posAssigner.atPos; // for filling in tree positions
|
||||
|
||||
override def phaseNewFlags: long = lateDEFERRED | lateINTERFACE;
|
||||
|
||||
// Type transformation
|
||||
|
||||
def erasedTypeRef(sym: Symbol): Type;
|
||||
|
||||
private val implClassMap = new HashMap[Symbol, Symbol];
|
||||
private val implMethodMap = new HashMap[Symbol, Symbol];
|
||||
|
||||
override def newPhase(prev: scala.tools.nsc.Phase): StdPhase = {
|
||||
implClassMap.clear;
|
||||
implMethodMap.clear;
|
||||
super.newPhase(prev)
|
||||
}
|
||||
|
||||
private def needsImplMethod(sym: Symbol): boolean = (
|
||||
sym.isMethod && isInterfaceMember(sym) &&
|
||||
(!(sym hasFlag (DEFERRED | SUPERACCESSOR)) || (sym hasFlag lateDEFERRED))
|
||||
);
|
||||
|
||||
private def isInterfaceMember(sym: Symbol): boolean = {
|
||||
sym.info; // to set lateMETHOD flag if necessary
|
||||
(sym.isType ||
|
||||
sym.isMethod && !(sym hasFlag (PRIVATE | BRIDGE | LABEL)) &&
|
||||
!sym.isConstructor && !sym.isImplOnly)
|
||||
}
|
||||
|
||||
def implClass(iface: Symbol): Symbol = implClassMap.get(iface) match {
|
||||
case Some(c) => c
|
||||
case None =>
|
||||
atPhase(currentRun.erasurePhase) {
|
||||
val implName = nme.implClassName(iface.name);
|
||||
var impl = if (iface.owner.isClass) iface.owner.info.decl(implName) else NoSymbol;
|
||||
if (impl == NoSymbol) {
|
||||
impl = iface.cloneSymbolImpl(iface.owner);
|
||||
impl.name = implName;
|
||||
if (iface.owner.isClass) iface.owner.info.decls enter impl
|
||||
}
|
||||
impl setPos iface.pos;
|
||||
impl.flags = iface.flags & ~(INTERFACE | lateINTERFACE) | IMPLCLASS;
|
||||
impl setInfo new LazyImplClassType(iface);
|
||||
implClassMap(iface) = impl;
|
||||
if (settings.debug.value) log("generating impl class " + impl + " in " + iface.owner);//debug
|
||||
impl
|
||||
}
|
||||
}
|
||||
|
||||
private class LazyImplClassType(iface: Symbol) extends LazyType {
|
||||
|
||||
def implDecls(implClass: Symbol, ifaceDecls: Scope): Scope = {
|
||||
val decls = new Scope();
|
||||
for (val sym <- ifaceDecls.elements) {
|
||||
if (isInterfaceMember(sym)) {
|
||||
if (needsImplMethod(sym)) {
|
||||
val impl = sym.cloneSymbol(implClass).setInfo(sym.info).resetFlag(lateDEFERRED);
|
||||
if (!impl.isExternal) implMethodMap(sym) = impl;
|
||||
decls enter impl;
|
||||
sym setFlag lateDEFERRED
|
||||
}
|
||||
} else {
|
||||
sym.owner = implClass;
|
||||
decls enter sym;
|
||||
}
|
||||
}
|
||||
decls
|
||||
}
|
||||
|
||||
override def complete(sym: Symbol): unit = {
|
||||
def implType(tp: Type): Type = tp match {
|
||||
case ClassInfoType(parents, decls, _) =>
|
||||
//ClassInfoType(traitToImplClass(parents) ::: List(iface.tpe), implDecls(sym, decls), sym)
|
||||
ClassInfoType(
|
||||
ObjectClass.tpe :: (parents.tail map traitToImplClass) ::: List(iface.tpe),
|
||||
implDecls(sym, decls),
|
||||
sym)
|
||||
case PolyType(tparams, restpe) =>
|
||||
PolyType(tparams, implType(restpe))
|
||||
}
|
||||
sym.setInfo(atPhase(currentRun.erasurePhase)(implType(iface.info)));
|
||||
}
|
||||
|
||||
override def load(clazz: Symbol): unit = complete(clazz)
|
||||
}
|
||||
|
||||
private def traitToImplClass(tp: Type): Type = tp match {
|
||||
case TypeRef(pre, sym, args) if (sym.needsImplClass) =>
|
||||
typeRef(pre, implClass(sym), args)
|
||||
case _ =>
|
||||
tp
|
||||
}
|
||||
|
||||
def transformTraitInfo(tp: Type): Type = tp match {
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
if (clazz.needsImplClass) {
|
||||
clazz setFlag lateINTERFACE;
|
||||
implClass(clazz) // generate an impl class
|
||||
}
|
||||
val parents1 =
|
||||
if (parents.isEmpty) List()
|
||||
else {
|
||||
assert(!parents.head.symbol.isTrait || clazz == RepeatedParamClass, clazz);
|
||||
if (clazz hasFlag INTERFACE) erasedTypeRef(ObjectClass) :: parents.tail
|
||||
else if (clazz.isImplClass || clazz == ArrayClass) parents
|
||||
else parents map traitToImplClass
|
||||
}
|
||||
val decls1 = if (clazz hasFlag INTERFACE) new Scope(decls.toList filter isInterfaceMember)
|
||||
else decls;
|
||||
if ((parents1 eq parents) && (decls1 eq decls)) tp
|
||||
else ClassInfoType(parents1, decls1, clazz)
|
||||
case _ =>
|
||||
tp
|
||||
}
|
||||
|
||||
// Tree transformation --------------------------------------------------------------
|
||||
|
||||
private class ChangeOwnerAndReturnTraverser(oldowner: Symbol, newowner: Symbol)
|
||||
extends ChangeOwnerTraverser(oldowner, newowner) {
|
||||
override def traverse(tree: Tree): unit = {
|
||||
tree match {
|
||||
case Return(expr) =>
|
||||
if (tree.symbol == oldowner) tree.symbol = newowner;
|
||||
case _ =>
|
||||
}
|
||||
super.traverse(tree)
|
||||
}
|
||||
}
|
||||
|
||||
private def ifaceMemberDef(tree: Tree): Tree =
|
||||
if (!tree.isDef || !isInterfaceMember(tree.symbol)) EmptyTree
|
||||
else if (needsImplMethod(tree.symbol)) DefDef(tree.symbol, vparamss => EmptyTree)
|
||||
else tree;
|
||||
|
||||
private def ifaceTemplate(templ: Template): Template =
|
||||
copy.Template(templ, templ.parents, templ.body map ifaceMemberDef);
|
||||
|
||||
private def implMethodDef(tree: Tree, ifaceMethod: Symbol): Tree =
|
||||
implMethodMap.get(ifaceMethod) match {
|
||||
case Some(implMethod) =>
|
||||
tree.symbol = implMethod;
|
||||
new ChangeOwnerAndReturnTraverser(ifaceMethod, implMethod)(tree)
|
||||
case None =>
|
||||
throw new Error("implMethod missing for " + ifaceMethod)
|
||||
}
|
||||
|
||||
private def implMemberDef(tree: Tree): Tree =
|
||||
if (!tree.isDef || !isInterfaceMember(tree.symbol)) tree
|
||||
else if (needsImplMethod(tree.symbol)) implMethodDef(tree, tree.symbol)
|
||||
else EmptyTree;
|
||||
|
||||
private def implTemplate(clazz: Symbol, templ: Template): Template = atPos(templ.pos){
|
||||
val templ1 = Template(templ.parents, templ.body map implMemberDef)
|
||||
.setPos(templ.pos)
|
||||
.setSymbol(clazz.newLocalDummy(templ.pos));
|
||||
new ChangeOwnerTraverser(templ.symbol.owner, clazz)(
|
||||
new ChangeOwnerTraverser(templ.symbol, templ1.symbol)(templ1))
|
||||
}
|
||||
|
||||
def implClassDefs(trees: List[Tree]): List[Tree] = {
|
||||
val buf = new ListBuffer[Tree];
|
||||
for (val tree <- trees)
|
||||
tree match {
|
||||
case ClassDef(_, _, _, _, impl) =>
|
||||
if (tree.symbol.needsImplClass)
|
||||
buf += {
|
||||
val clazz = implClass(tree.symbol).initialize;
|
||||
ClassDef(clazz, implTemplate(clazz, impl))
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
buf.toList
|
||||
}
|
||||
|
||||
protected val traitTransformer = new Transformer {
|
||||
override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] =
|
||||
(super.transformStats(stats, exprOwner) :::
|
||||
super.transformStats(implClassDefs(stats), exprOwner));
|
||||
override def transform(tree: Tree): Tree = {
|
||||
val tree1 = tree match {
|
||||
case ClassDef(mods, name, tparams, tpt, impl) =>
|
||||
if (tree.symbol.needsImplClass) {
|
||||
implClass(tree.symbol).initialize; // to force lateDEFERRED flags
|
||||
copy.ClassDef(tree, mods | INTERFACE, name, tparams, tpt, ifaceTemplate(impl))
|
||||
}
|
||||
else tree
|
||||
case Template(parents, body) =>
|
||||
val parents1 = tree.symbol.owner.info.parents map (t => TypeTree(t) setPos tree.pos);
|
||||
copy.Template(tree, parents1, body)
|
||||
case This(_) =>
|
||||
if (tree.symbol.needsImplClass) {
|
||||
val impl = implClass(tree.symbol);
|
||||
var owner = currentOwner;
|
||||
while (owner != tree.symbol && owner != impl) owner = owner.owner;
|
||||
if (owner == impl) This(impl) setPos tree.pos
|
||||
else tree
|
||||
} else tree
|
||||
case Super(qual, mix) =>
|
||||
val mix1 =
|
||||
if (mix == nme.EMPTY.toTypeName) mix
|
||||
else {
|
||||
val ps = atPhase(currentRun.erasurePhase) {
|
||||
tree.symbol.info.parents dropWhile (p => p.symbol.name != mix)
|
||||
}
|
||||
assert(!ps.isEmpty, tree);
|
||||
if (ps.head.symbol.needsImplClass) implClass(ps.head.symbol).name
|
||||
else mix
|
||||
}
|
||||
if (tree.symbol.needsImplClass) Super(implClass(tree.symbol), mix1) setPos tree.pos
|
||||
else copy.Super(tree, qual, mix1)
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
super.transform(tree1)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
val ensureNoEscapes = new TypeTraverser {
|
||||
def ensureNoEscape(sym: Symbol): unit = {
|
||||
if (sym.hasFlag(PRIVATE)) {
|
||||
var o = currentOwner;
|
||||
while (o != NoSymbol && o != sym.owner && !o.isLocal && !o.hasFlag(PRIVATE))
|
||||
o = o.owner;
|
||||
if (o == sym.owner) sym.makeNotPrivate(base);
|
||||
}
|
||||
}
|
||||
def traverse(t: Type): TypeTraverser = {
|
||||
t match {
|
||||
case TypeRef(qual, sym, args) =>
|
||||
ensureNoEscape(sym);
|
||||
mapOver(t);
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
parents foreach { p => traverse; () }
|
||||
traverse(t.typeOfThis);
|
||||
case _ =>
|
||||
mapOver(t)
|
||||
}
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
|
@ -1,163 +1,163 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.{ListBuffer, TreeSet}
|
||||
|
||||
abstract class Constructors extends Transform {
|
||||
import global._;
|
||||
import definitions._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** the following two members override abstract members in Transform */
|
||||
val phaseName: String = "constructors";
|
||||
|
||||
protected def newTransformer(unit: CompilationUnit): Transformer = new ConstructorTransformer;
|
||||
|
||||
class ConstructorTransformer extends Transformer {
|
||||
|
||||
def transformClassTemplate(impl: Template): Template = {
|
||||
val clazz = impl.symbol.owner;
|
||||
val stats = impl.body;
|
||||
val localTyper = typer.atOwner(impl, clazz);
|
||||
var constr: DefDef = null;
|
||||
var constrParams: List[Symbol] = null;
|
||||
var constrBody: Block = null;
|
||||
// decompose primary constructor into the three entities above.
|
||||
for (val stat <- stats) {
|
||||
stat match {
|
||||
case ddef @ DefDef(_, _, _, List(vparams), _, rhs @ Block(_, Literal(_))) =>
|
||||
if (ddef.symbol.isPrimaryConstructor) {
|
||||
constr = ddef;
|
||||
constrParams = vparams map (.symbol);
|
||||
constrBody = rhs
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
|
||||
val paramAccessors = clazz.constrParamAccessors;
|
||||
def parameter(acc: Symbol) = {
|
||||
val accname = nme.getterName(acc.originalName);
|
||||
val ps = constrParams.filter { param => accname == param.name }
|
||||
if (ps.isEmpty) assert(false, "" + accname + " not in " + constrParams);
|
||||
ps.head
|
||||
}
|
||||
|
||||
var thisRefSeen: boolean = false;
|
||||
|
||||
val intoConstructorTransformer = new Transformer {
|
||||
override def transform(tree: Tree): Tree = tree match {
|
||||
case Apply(Select(This(_), _), List())
|
||||
if ((tree.symbol hasFlag PARAMACCESSOR) && tree.symbol.owner == clazz) =>
|
||||
gen.Ident(parameter(tree.symbol.accessed)) setPos tree.pos;
|
||||
case Select(This(_), _)
|
||||
if ((tree.symbol hasFlag PARAMACCESSOR) && tree.symbol.owner == clazz) =>
|
||||
gen.Ident(parameter(tree.symbol)) setPos tree.pos;
|
||||
case This(_) =>
|
||||
thisRefSeen = true;
|
||||
super.transform(tree)
|
||||
case Super(_, _) =>
|
||||
thisRefSeen = true;
|
||||
super.transform(tree)
|
||||
case _ =>
|
||||
super.transform(tree)
|
||||
}
|
||||
}
|
||||
|
||||
def intoConstructor(oldowner: Symbol, tree: Tree) =
|
||||
intoConstructorTransformer.transform(
|
||||
new ChangeOwnerTraverser(oldowner, constr.symbol)(tree));
|
||||
|
||||
def canBeMoved(tree: Tree) = tree match {
|
||||
case ValDef(_, _, _, _) => !thisRefSeen
|
||||
case _ => false
|
||||
}
|
||||
|
||||
def mkAssign(to: Symbol, from: Tree): Tree =
|
||||
atPos(to.pos) {
|
||||
localTyper.typed {
|
||||
Assign(Select(This(clazz), to), from)
|
||||
}
|
||||
}
|
||||
|
||||
val defBuf = new ListBuffer[Tree];
|
||||
val constrStatBuf = new ListBuffer[Tree];
|
||||
val constrPrefixBuf = new ListBuffer[Tree];
|
||||
constrBody.stats foreach (constrStatBuf +=);
|
||||
|
||||
for (val stat <- stats) stat match {
|
||||
case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
|
||||
stat.symbol.tpe match {
|
||||
case MethodType(List(), tp @ ConstantType(c)) =>
|
||||
defBuf += copy.DefDef(
|
||||
stat, mods, name, tparams, vparamss, tpt,
|
||||
Literal(c) setPos rhs.pos setType tp)
|
||||
case _ =>
|
||||
if (!stat.symbol.isPrimaryConstructor) defBuf += stat
|
||||
}
|
||||
case ValDef(mods, name, tpt, rhs) =>
|
||||
if (stat.symbol.tpe.isInstanceOf[ConstantType])
|
||||
assert(stat.symbol.getter(stat.symbol.owner) != NoSymbol, stat)
|
||||
else {
|
||||
if (rhs != EmptyTree) {
|
||||
val rhs1 = intoConstructor(stat.symbol, rhs);
|
||||
(if (canBeMoved(stat)) constrPrefixBuf else constrStatBuf) += mkAssign(
|
||||
stat.symbol, rhs1)
|
||||
}
|
||||
defBuf += copy.ValDef(stat, mods, name, tpt, EmptyTree)
|
||||
}
|
||||
case ClassDef(_, _, _, _, _) =>
|
||||
defBuf += (new ConstructorTransformer).transform(stat)
|
||||
case _ =>
|
||||
constrStatBuf += intoConstructor(impl.symbol, stat)
|
||||
}
|
||||
|
||||
val accessed = new TreeSet[Symbol]((x, y) => x isLess y);
|
||||
|
||||
def isAccessed(sym: Symbol) = (
|
||||
sym.owner != clazz ||
|
||||
!(sym hasFlag PARAMACCESSOR) ||
|
||||
!(sym hasFlag LOCAL) ||
|
||||
(accessed contains sym)
|
||||
);
|
||||
|
||||
val accessTraverser = new Traverser {
|
||||
override def traverse(tree: Tree) = {
|
||||
tree match {
|
||||
case Select(_, _) =>
|
||||
if (!isAccessed(tree.symbol)) accessed addEntry tree.symbol;
|
||||
case _ =>
|
||||
}
|
||||
super.traverse(tree)
|
||||
}
|
||||
}
|
||||
|
||||
for (val stat <- defBuf.elements) accessTraverser.traverse(stat);
|
||||
|
||||
val paramInits = for (val acc <- paramAccessors; isAccessed(acc))
|
||||
yield mkAssign(acc, Ident(parameter(acc)));
|
||||
|
||||
defBuf += copy.DefDef(
|
||||
constr, constr.mods, constr.name, constr.tparams, constr.vparamss, constr.tpt,
|
||||
copy.Block(
|
||||
constrBody,
|
||||
paramInits ::: constrPrefixBuf.toList ::: constrStatBuf.toList,
|
||||
constrBody.expr));
|
||||
|
||||
copy.Template(impl, impl.parents, defBuf.toList filter (stat => isAccessed(stat.symbol)))
|
||||
}
|
||||
|
||||
override def transform(tree: Tree): Tree = tree match {
|
||||
case ClassDef(mods, name, tparams, tpt, impl) if !tree.symbol.hasFlag(INTERFACE) =>
|
||||
copy.ClassDef(tree, mods, name, tparams, tpt, transformClassTemplate(impl))
|
||||
case _ =>
|
||||
super.transform(tree)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.{ListBuffer, TreeSet}
|
||||
|
||||
abstract class Constructors extends Transform {
|
||||
import global._;
|
||||
import definitions._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** the following two members override abstract members in Transform */
|
||||
val phaseName: String = "constructors";
|
||||
|
||||
protected def newTransformer(unit: CompilationUnit): Transformer = new ConstructorTransformer;
|
||||
|
||||
class ConstructorTransformer extends Transformer {
|
||||
|
||||
def transformClassTemplate(impl: Template): Template = {
|
||||
val clazz = impl.symbol.owner;
|
||||
val stats = impl.body;
|
||||
val localTyper = typer.atOwner(impl, clazz);
|
||||
var constr: DefDef = null;
|
||||
var constrParams: List[Symbol] = null;
|
||||
var constrBody: Block = null;
|
||||
// decompose primary constructor into the three entities above.
|
||||
for (val stat <- stats) {
|
||||
stat match {
|
||||
case ddef @ DefDef(_, _, _, List(vparams), _, rhs @ Block(_, Literal(_))) =>
|
||||
if (ddef.symbol.isPrimaryConstructor) {
|
||||
constr = ddef;
|
||||
constrParams = vparams map (.symbol);
|
||||
constrBody = rhs
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
|
||||
val paramAccessors = clazz.constrParamAccessors;
|
||||
def parameter(acc: Symbol) = {
|
||||
val accname = nme.getterName(acc.originalName);
|
||||
val ps = constrParams.filter { param => accname == param.name }
|
||||
if (ps.isEmpty) assert(false, "" + accname + " not in " + constrParams);
|
||||
ps.head
|
||||
}
|
||||
|
||||
var thisRefSeen: boolean = false;
|
||||
|
||||
val intoConstructorTransformer = new Transformer {
|
||||
override def transform(tree: Tree): Tree = tree match {
|
||||
case Apply(Select(This(_), _), List())
|
||||
if ((tree.symbol hasFlag PARAMACCESSOR) && tree.symbol.owner == clazz) =>
|
||||
gen.Ident(parameter(tree.symbol.accessed)) setPos tree.pos;
|
||||
case Select(This(_), _)
|
||||
if ((tree.symbol hasFlag PARAMACCESSOR) && tree.symbol.owner == clazz) =>
|
||||
gen.Ident(parameter(tree.symbol)) setPos tree.pos;
|
||||
case This(_) =>
|
||||
thisRefSeen = true;
|
||||
super.transform(tree)
|
||||
case Super(_, _) =>
|
||||
thisRefSeen = true;
|
||||
super.transform(tree)
|
||||
case _ =>
|
||||
super.transform(tree)
|
||||
}
|
||||
}
|
||||
|
||||
def intoConstructor(oldowner: Symbol, tree: Tree) =
|
||||
intoConstructorTransformer.transform(
|
||||
new ChangeOwnerTraverser(oldowner, constr.symbol)(tree));
|
||||
|
||||
def canBeMoved(tree: Tree) = tree match {
|
||||
case ValDef(_, _, _, _) => !thisRefSeen
|
||||
case _ => false
|
||||
}
|
||||
|
||||
def mkAssign(to: Symbol, from: Tree): Tree =
|
||||
atPos(to.pos) {
|
||||
localTyper.typed {
|
||||
Assign(Select(This(clazz), to), from)
|
||||
}
|
||||
}
|
||||
|
||||
val defBuf = new ListBuffer[Tree];
|
||||
val constrStatBuf = new ListBuffer[Tree];
|
||||
val constrPrefixBuf = new ListBuffer[Tree];
|
||||
constrBody.stats foreach (constrStatBuf +=);
|
||||
|
||||
for (val stat <- stats) stat match {
|
||||
case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
|
||||
stat.symbol.tpe match {
|
||||
case MethodType(List(), tp @ ConstantType(c)) =>
|
||||
defBuf += copy.DefDef(
|
||||
stat, mods, name, tparams, vparamss, tpt,
|
||||
Literal(c) setPos rhs.pos setType tp)
|
||||
case _ =>
|
||||
if (!stat.symbol.isPrimaryConstructor) defBuf += stat
|
||||
}
|
||||
case ValDef(mods, name, tpt, rhs) =>
|
||||
if (stat.symbol.tpe.isInstanceOf[ConstantType])
|
||||
assert(stat.symbol.getter(stat.symbol.owner) != NoSymbol, stat)
|
||||
else {
|
||||
if (rhs != EmptyTree) {
|
||||
val rhs1 = intoConstructor(stat.symbol, rhs);
|
||||
(if (canBeMoved(stat)) constrPrefixBuf else constrStatBuf) += mkAssign(
|
||||
stat.symbol, rhs1)
|
||||
}
|
||||
defBuf += copy.ValDef(stat, mods, name, tpt, EmptyTree)
|
||||
}
|
||||
case ClassDef(_, _, _, _, _) =>
|
||||
defBuf += (new ConstructorTransformer).transform(stat)
|
||||
case _ =>
|
||||
constrStatBuf += intoConstructor(impl.symbol, stat)
|
||||
}
|
||||
|
||||
val accessed = new TreeSet[Symbol]((x, y) => x isLess y);
|
||||
|
||||
def isAccessed(sym: Symbol) = (
|
||||
sym.owner != clazz ||
|
||||
!(sym hasFlag PARAMACCESSOR) ||
|
||||
!(sym hasFlag LOCAL) ||
|
||||
(accessed contains sym)
|
||||
);
|
||||
|
||||
val accessTraverser = new Traverser {
|
||||
override def traverse(tree: Tree) = {
|
||||
tree match {
|
||||
case Select(_, _) =>
|
||||
if (!isAccessed(tree.symbol)) accessed addEntry tree.symbol;
|
||||
case _ =>
|
||||
}
|
||||
super.traverse(tree)
|
||||
}
|
||||
}
|
||||
|
||||
for (val stat <- defBuf.elements) accessTraverser.traverse(stat);
|
||||
|
||||
val paramInits = for (val acc <- paramAccessors; isAccessed(acc))
|
||||
yield mkAssign(acc, Ident(parameter(acc)));
|
||||
|
||||
defBuf += copy.DefDef(
|
||||
constr, constr.mods, constr.name, constr.tparams, constr.vparamss, constr.tpt,
|
||||
copy.Block(
|
||||
constrBody,
|
||||
paramInits ::: constrPrefixBuf.toList ::: constrStatBuf.toList,
|
||||
constrBody.expr));
|
||||
|
||||
copy.Template(impl, impl.parents, defBuf.toList filter (stat => isAccessed(stat.symbol)))
|
||||
}
|
||||
|
||||
override def transform(tree: Tree): Tree = tree match {
|
||||
case ClassDef(mods, name, tparams, tpt, impl) if !tree.symbol.hasFlag(INTERFACE) =>
|
||||
copy.ClassDef(tree, mods, name, tparams, tpt, transformClassTemplate(impl))
|
||||
case _ =>
|
||||
super.transform(tree)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,330 +1,330 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.ListBuffer;
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class ExplicitOuter extends InfoTransform {
|
||||
import global._;
|
||||
import definitions._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
override def phaseNewFlags: long = notPRIVATE | notPROTECTED;
|
||||
|
||||
/** the following two members override abstract members in Transform */
|
||||
val phaseName: String = "explicitouter";
|
||||
override def changesBaseClasses = false;
|
||||
|
||||
protected def newTransformer(unit: CompilationUnit): Transformer =
|
||||
new ExplicitOuterTransformer(unit);
|
||||
|
||||
private def outerClass(clazz: Symbol): Symbol =
|
||||
if (clazz.owner.isClass) clazz.owner
|
||||
else outerClass(if (clazz.isClassLocalToConstructor) clazz.owner.owner else clazz.owner);
|
||||
|
||||
private def isStatic(clazz: Symbol) =
|
||||
clazz.isPackageClass || outerClass(clazz).isStaticOwner;
|
||||
|
||||
/** The type transformation method:
|
||||
* 1. Add an outer paramter to the formal parameters of a constructor or mixin constructor
|
||||
* in a non-static class;
|
||||
* 2. Add a mixin constructor $init$ to all traits except interfaces
|
||||
* Leave all other types unchanged.
|
||||
*/
|
||||
def transformInfo(sym: Symbol, tp: Type): Type = tp match {
|
||||
case MethodType(formals, restpe) =>
|
||||
//todo: needed?
|
||||
if (sym.owner.isTrait && (sym hasFlag PROTECTED)) sym setFlag notPROTECTED;
|
||||
if (sym.isConstructor && !isStatic(sym.owner))
|
||||
MethodType(formals ::: List(outerClass(sym.owner).toInterface.thisType), restpe)
|
||||
else tp;
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
var decls1 = decls;
|
||||
if (!(clazz hasFlag INTERFACE)) {
|
||||
if (!isStatic(clazz)) {
|
||||
decls1 = new Scope(decls1.toList);
|
||||
val outerAcc = clazz.newMethod(clazz.pos, nme.OUTER);
|
||||
if ((clazz hasFlag TRAIT) || (decls.toList exists (.isClass)))
|
||||
outerAcc.expandName(clazz);
|
||||
decls1 enter (
|
||||
outerAcc setFlag (PARAMACCESSOR | ACCESSOR | STABLE)
|
||||
setInfo MethodType(List(), outerClass(clazz).thisType));
|
||||
decls1 enter (clazz.newValue(clazz.pos, nme.getterToLocal(outerAcc.name))
|
||||
setFlag (LOCAL | PRIVATE | PARAMACCESSOR | (outerAcc getFlag EXPANDEDNAME))
|
||||
setInfo outerClass(clazz).thisType);
|
||||
}
|
||||
if (clazz.isTrait) {
|
||||
decls1 = new Scope(decls1.toList);
|
||||
decls1 enter makeMixinConstructor(clazz);
|
||||
}
|
||||
}
|
||||
if (decls1 eq decls) tp else ClassInfoType(parents, decls1, clazz)
|
||||
case PolyType(tparams, restp) =>
|
||||
val restp1 = transformInfo(sym, restp);
|
||||
if (restp eq restp1) tp else PolyType(tparams, restp1)
|
||||
case _ =>
|
||||
tp
|
||||
}
|
||||
|
||||
private def outerMember(tp: Type): Symbol = {
|
||||
var e = tp.decls.elems;
|
||||
while (e != null && !(e.sym.originalName.startsWith(nme.OUTER) && (e.sym hasFlag ACCESSOR)))
|
||||
e = e.next;
|
||||
assert(e != null, tp);
|
||||
e.sym
|
||||
}
|
||||
|
||||
private def makeMixinConstructor(clazz: Symbol): Symbol =
|
||||
clazz.newMethod(clazz.pos, nme.MIXIN_CONSTRUCTOR) setInfo MethodType(List(), UnitClass.tpe);
|
||||
|
||||
/** A base class for transformers that maintain `outerParam' values for
|
||||
* outer parameters of constructors.
|
||||
* The class provides methods for referencing via outer.
|
||||
*/
|
||||
class OuterPathTransformer extends Transformer {
|
||||
|
||||
/** The directly enclosing outer parameter, if we are in a constructor */
|
||||
protected var outerParam: Symbol = NoSymbol;
|
||||
|
||||
/** The first outer selection from currently transformed tree
|
||||
*/
|
||||
protected def outerValue: Tree =
|
||||
if (outerParam != NoSymbol) gen.Ident(outerParam)
|
||||
else outerSelect(gen.This(currentOwner.enclClass));
|
||||
|
||||
/** The path
|
||||
* `base'.$outer ... .$outer
|
||||
* which refers to the outer instance `to' of value `base
|
||||
*/
|
||||
protected def outerPath(base: Tree, to: Symbol): Tree =
|
||||
if (base.tpe.symbol == to) base else outerPath(outerSelect(base), to);
|
||||
|
||||
/** Select and apply outer accessor from `base'
|
||||
*/
|
||||
private def outerSelect(base: Tree): Tree = {
|
||||
val otp = outerClass(base.tpe.symbol).thisType;
|
||||
Apply(
|
||||
Select(base, outerMember(base.tpe)) setType MethodType(List(), otp),
|
||||
List()) setType otp
|
||||
}
|
||||
|
||||
override def transform(tree: Tree): Tree = {
|
||||
try {//debug
|
||||
val savedOuterParam = outerParam;
|
||||
tree match {
|
||||
case Template(_, _) =>
|
||||
outerParam = NoSymbol;
|
||||
case DefDef(_, _, _, vparamss, _, _) =>
|
||||
if (tree.symbol.isConstructor && !(isStatic(tree.symbol.owner))) {
|
||||
val lastParam = vparamss.head.last;
|
||||
assert(lastParam.name.startsWith(nme.OUTER), tree);
|
||||
outerParam = lastParam.symbol
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
val result = super.transform(tree);
|
||||
outerParam = savedOuterParam;
|
||||
result
|
||||
} catch {//debug
|
||||
case ex: Throwable =>
|
||||
System.out.println("exception when transforming " + tree);
|
||||
throw ex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ExplicitOuterTransformer(unit: CompilationUnit) extends Transformer {
|
||||
|
||||
/** The first step performs the following transformations:
|
||||
* 1. A class which is not an interface and is not static gets an outer link
|
||||
* (@see outerDefs)
|
||||
* 2. A mixin which is not also an interface gets a mixin constructor
|
||||
* (@see mixinConstructorDef)
|
||||
* 3. Constructor bodies are augmented by calls to supermixin constructors
|
||||
* (@see addMixinConstructorCalls)
|
||||
* 4. A constructor of a class with an outer link gets an outer parameter.
|
||||
* 5. A reference C.this where C refers to an outer class is replaced by a selection
|
||||
* this.$outer ... .$outer (@see outerPath)
|
||||
* 7. A call to a constructor Q.<init>(args) or Q.$init$(args) where Q != this and
|
||||
* the constructor belongs to a non-static class is augmented by an outer argument.
|
||||
* E.g. Q.<init>(args, OUTER) where OUTER is the qualifier corresponding to the
|
||||
* singleton type Q.
|
||||
* 8. A call to a constructor this.<init>(args) in a secondary constructor
|
||||
* is augmented to this.<init>(args, OUTER) where OUTER is the last parameter
|
||||
* of the secondary constructor.
|
||||
*/
|
||||
private val firstTransformer = new OuterPathTransformer {
|
||||
|
||||
var localTyper: analyzer.Typer = typer;
|
||||
|
||||
/** The two definitions
|
||||
* val outer : C.this.type _;
|
||||
* def outer(): C.this.type = outer ;
|
||||
* Here, C is the class enclosing the class `clazz' containing the two definitions.
|
||||
*/
|
||||
def outerDefs(clazz: Symbol): List[Tree] = {
|
||||
val outerDef = outerMember(clazz.info);
|
||||
val outerVal = outerDef.accessed;
|
||||
List(
|
||||
localTyper.typed {
|
||||
atPos(clazz.pos) {
|
||||
ValDef(outerVal)
|
||||
}
|
||||
},
|
||||
localTyper.typed {
|
||||
atPos(clazz.pos) {
|
||||
DefDef(outerDef, vparamss => Select(This(clazz), outerVal))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** The mixin constructor definition
|
||||
* def $init$(): Unit = ()
|
||||
*/
|
||||
def mixinConstructorDef(clazz: Symbol): Tree =
|
||||
localTyper.typed {
|
||||
val constr = clazz.primaryConstructor;
|
||||
atPhase(currentRun.explicitOuterPhase) {
|
||||
// necessary so that we do not include an outer parameter already here;
|
||||
// this will be added later in transform.
|
||||
DefDef(constr, vparamss => Literal(()))
|
||||
}
|
||||
}
|
||||
|
||||
/** Add calls to supermixin constructors
|
||||
* super[mix].$init$()
|
||||
* to `tree'. `tree' which is assumed to be the body of a constructor of class `clazz'.
|
||||
*/
|
||||
def addMixinConstructorCalls(tree: Tree, clazz: Symbol): Tree = {
|
||||
def mixinConstructorCall(mixin: Symbol): Tree =
|
||||
atPos(tree.pos) {
|
||||
Apply(
|
||||
localTyper.typedOperator {
|
||||
Select(Super(clazz, mixin.name), mixin.primaryConstructor)
|
||||
},
|
||||
List()) setType UnitClass.tpe; // don't type this with typed(...),
|
||||
// as constructor arguments might be missing
|
||||
}
|
||||
val mixinConstructorCalls =
|
||||
for (val mixin <- clazz.info.parents.tail; !(mixin.symbol hasFlag INTERFACE)) yield
|
||||
mixinConstructorCall(mixin.symbol);
|
||||
tree match {
|
||||
case Block(supercall :: stats, expr) =>
|
||||
assert(supercall match {
|
||||
case Apply(Select(Super(_, _), _), _) => true
|
||||
case _ => false
|
||||
});
|
||||
copy.Block(tree, supercall :: mixinConstructorCalls ::: stats, expr);
|
||||
case Block(_, _) =>
|
||||
assert(false, tree); tree
|
||||
case expr =>
|
||||
Block(mixinConstructorCalls, expr) setType expr.tpe setPos expr.pos;
|
||||
}
|
||||
}
|
||||
|
||||
/** The first-step transformation method */
|
||||
override def transform(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
val tree1 = tree match {
|
||||
case Template(parents, decls) =>
|
||||
val savedLocalTyper = localTyper;
|
||||
localTyper = localTyper.atOwner(tree, currentOwner);
|
||||
var decls1 = decls;
|
||||
if (!(currentOwner hasFlag INTERFACE)) {
|
||||
if (!isStatic(currentOwner))
|
||||
decls1 = decls1 ::: outerDefs(currentOwner); // (1)
|
||||
if (currentOwner.isTrait)
|
||||
decls1 = decls1 ::: List(mixinConstructorDef(currentOwner)) // (2)
|
||||
}
|
||||
localTyper = savedLocalTyper;
|
||||
copy.Template(tree, parents, decls1);
|
||||
case constrDef @ DefDef(mods, name, tparams, vparamss, tpt, rhs)
|
||||
if (sym.isConstructor) =>
|
||||
val vparamss1 =
|
||||
if (isStatic(sym.owner)) vparamss
|
||||
else { // (4)
|
||||
val outerField = outerMember(sym.owner.info).accessed;
|
||||
val outerParam = sym.newValueParameter(sym.pos, nme.OUTER) setInfo outerField.info;
|
||||
List(vparamss.head ::: List(ValDef(outerParam) setType NoType))
|
||||
}
|
||||
val rhs1 =
|
||||
if ((sym.isPrimaryConstructor || sym.isMixinConstructor) && sym.owner != ArrayClass)
|
||||
addMixinConstructorCalls(rhs, sym.owner); // (3)
|
||||
else rhs;
|
||||
copy.DefDef(tree, mods, name, tparams, vparamss1, tpt, rhs1);
|
||||
case This(qual) =>
|
||||
if (sym == currentOwner.enclClass || (sym hasFlag MODULE) && sym.isStatic) tree
|
||||
else atPos(tree.pos)(outerPath(outerValue, sym)); // (5)
|
||||
case Apply(sel @ Select(qual, name), args)
|
||||
if ((name == nme.CONSTRUCTOR || name == nme.MIXIN_CONSTRUCTOR) && !isStatic(sel.symbol.owner)) =>
|
||||
val outerVal =
|
||||
atPos(tree.pos) {
|
||||
if (qual.isInstanceOf[This]) { assert(outerParam != NoSymbol); outerValue } // (8)
|
||||
else {
|
||||
var pre = qual.tpe.prefix;
|
||||
if (pre == NoPrefix) pre = outerClass(sym.owner).thisType;
|
||||
gen.mkQualifier(pre)
|
||||
}
|
||||
}
|
||||
copy.Apply(tree, sel, args ::: List(outerVal))
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
super.transform(tree1)
|
||||
}
|
||||
}
|
||||
|
||||
/** The second step performs the following transformations:
|
||||
* 2. Remove private modifiers from members M of mixins T. (@see makeNotPrivate)
|
||||
* 3. Remove `private' modifier from class members M that are accessed from an inner class.
|
||||
* 4. Remove `protected' modifier from class members M that are accessed
|
||||
* without a super qualifier accessed from an inner class.
|
||||
* 5. Remove `private' and `protected' modifiers from type symbols
|
||||
*/
|
||||
private val secondTransformer = new Transformer {
|
||||
|
||||
/** The second-step transformation method */
|
||||
override def transform(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
val tree1 = super.transform(tree);
|
||||
tree1 match {
|
||||
case DefDef(_, _, _, _, _, _) =>
|
||||
if (sym.owner.isTrait && (sym hasFlag (ACCESSOR | SUPERACCESSOR)))
|
||||
sym.makeNotPrivate(sym.owner); //(2)
|
||||
tree1
|
||||
case Select(qual, name) =>
|
||||
if (currentOwner.enclClass != sym.owner) // (3)
|
||||
sym.makeNotPrivate(sym.owner);
|
||||
if ((sym hasFlag PROTECTED) && //(4)
|
||||
!(qual.isInstanceOf[Super] ||
|
||||
(qual.tpe.widen.symbol isSubClass currentOwner.enclClass)))
|
||||
sym setFlag notPROTECTED;
|
||||
tree1
|
||||
case _ =>
|
||||
if (sym != null && sym.isType) {//(5)
|
||||
if (sym hasFlag PRIVATE) sym setFlag notPRIVATE;
|
||||
if (sym hasFlag PROTECTED) sym setFlag notPROTECTED;
|
||||
}
|
||||
tree1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The main transformation method:
|
||||
* First, perform step 1 on whole tree of compilation unit.
|
||||
* Then, perform step 2 on resulting tree
|
||||
*/
|
||||
override def transform(tree: Tree) =
|
||||
atPhase(phase.next) {
|
||||
secondTransformer.transform(firstTransformer.transform(tree))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.ListBuffer;
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class ExplicitOuter extends InfoTransform {
|
||||
import global._;
|
||||
import definitions._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
override def phaseNewFlags: long = notPRIVATE | notPROTECTED;
|
||||
|
||||
/** the following two members override abstract members in Transform */
|
||||
val phaseName: String = "explicitouter";
|
||||
override def changesBaseClasses = false;
|
||||
|
||||
protected def newTransformer(unit: CompilationUnit): Transformer =
|
||||
new ExplicitOuterTransformer(unit);
|
||||
|
||||
private def outerClass(clazz: Symbol): Symbol =
|
||||
if (clazz.owner.isClass) clazz.owner
|
||||
else outerClass(if (clazz.isClassLocalToConstructor) clazz.owner.owner else clazz.owner);
|
||||
|
||||
private def isStatic(clazz: Symbol) =
|
||||
clazz.isPackageClass || outerClass(clazz).isStaticOwner;
|
||||
|
||||
/** The type transformation method:
|
||||
* 1. Add an outer paramter to the formal parameters of a constructor or mixin constructor
|
||||
* in a non-static class;
|
||||
* 2. Add a mixin constructor $init$ to all traits except interfaces
|
||||
* Leave all other types unchanged.
|
||||
*/
|
||||
def transformInfo(sym: Symbol, tp: Type): Type = tp match {
|
||||
case MethodType(formals, restpe) =>
|
||||
//todo: needed?
|
||||
if (sym.owner.isTrait && (sym hasFlag PROTECTED)) sym setFlag notPROTECTED;
|
||||
if (sym.isConstructor && !isStatic(sym.owner))
|
||||
MethodType(formals ::: List(outerClass(sym.owner).toInterface.thisType), restpe)
|
||||
else tp;
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
var decls1 = decls;
|
||||
if (!(clazz hasFlag INTERFACE)) {
|
||||
if (!isStatic(clazz)) {
|
||||
decls1 = new Scope(decls1.toList);
|
||||
val outerAcc = clazz.newMethod(clazz.pos, nme.OUTER);
|
||||
if ((clazz hasFlag TRAIT) || (decls.toList exists (.isClass)))
|
||||
outerAcc.expandName(clazz);
|
||||
decls1 enter (
|
||||
outerAcc setFlag (PARAMACCESSOR | ACCESSOR | STABLE)
|
||||
setInfo MethodType(List(), outerClass(clazz).thisType));
|
||||
decls1 enter (clazz.newValue(clazz.pos, nme.getterToLocal(outerAcc.name))
|
||||
setFlag (LOCAL | PRIVATE | PARAMACCESSOR | (outerAcc getFlag EXPANDEDNAME))
|
||||
setInfo outerClass(clazz).thisType);
|
||||
}
|
||||
if (clazz.isTrait) {
|
||||
decls1 = new Scope(decls1.toList);
|
||||
decls1 enter makeMixinConstructor(clazz);
|
||||
}
|
||||
}
|
||||
if (decls1 eq decls) tp else ClassInfoType(parents, decls1, clazz)
|
||||
case PolyType(tparams, restp) =>
|
||||
val restp1 = transformInfo(sym, restp);
|
||||
if (restp eq restp1) tp else PolyType(tparams, restp1)
|
||||
case _ =>
|
||||
tp
|
||||
}
|
||||
|
||||
private def outerMember(tp: Type): Symbol = {
|
||||
var e = tp.decls.elems;
|
||||
while (e != null && !(e.sym.originalName.startsWith(nme.OUTER) && (e.sym hasFlag ACCESSOR)))
|
||||
e = e.next;
|
||||
assert(e != null, tp);
|
||||
e.sym
|
||||
}
|
||||
|
||||
private def makeMixinConstructor(clazz: Symbol): Symbol =
|
||||
clazz.newMethod(clazz.pos, nme.MIXIN_CONSTRUCTOR) setInfo MethodType(List(), UnitClass.tpe);
|
||||
|
||||
/** A base class for transformers that maintain `outerParam' values for
|
||||
* outer parameters of constructors.
|
||||
* The class provides methods for referencing via outer.
|
||||
*/
|
||||
class OuterPathTransformer extends Transformer {
|
||||
|
||||
/** The directly enclosing outer parameter, if we are in a constructor */
|
||||
protected var outerParam: Symbol = NoSymbol;
|
||||
|
||||
/** The first outer selection from currently transformed tree
|
||||
*/
|
||||
protected def outerValue: Tree =
|
||||
if (outerParam != NoSymbol) gen.Ident(outerParam)
|
||||
else outerSelect(gen.This(currentOwner.enclClass));
|
||||
|
||||
/** The path
|
||||
* `base'.$outer ... .$outer
|
||||
* which refers to the outer instance `to' of value `base
|
||||
*/
|
||||
protected def outerPath(base: Tree, to: Symbol): Tree =
|
||||
if (base.tpe.symbol == to) base else outerPath(outerSelect(base), to);
|
||||
|
||||
/** Select and apply outer accessor from `base'
|
||||
*/
|
||||
private def outerSelect(base: Tree): Tree = {
|
||||
val otp = outerClass(base.tpe.symbol).thisType;
|
||||
Apply(
|
||||
Select(base, outerMember(base.tpe)) setType MethodType(List(), otp),
|
||||
List()) setType otp
|
||||
}
|
||||
|
||||
override def transform(tree: Tree): Tree = {
|
||||
try {//debug
|
||||
val savedOuterParam = outerParam;
|
||||
tree match {
|
||||
case Template(_, _) =>
|
||||
outerParam = NoSymbol;
|
||||
case DefDef(_, _, _, vparamss, _, _) =>
|
||||
if (tree.symbol.isConstructor && !(isStatic(tree.symbol.owner))) {
|
||||
val lastParam = vparamss.head.last;
|
||||
assert(lastParam.name.startsWith(nme.OUTER), tree);
|
||||
outerParam = lastParam.symbol
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
val result = super.transform(tree);
|
||||
outerParam = savedOuterParam;
|
||||
result
|
||||
} catch {//debug
|
||||
case ex: Throwable =>
|
||||
System.out.println("exception when transforming " + tree);
|
||||
throw ex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ExplicitOuterTransformer(unit: CompilationUnit) extends Transformer {
|
||||
|
||||
/** The first step performs the following transformations:
|
||||
* 1. A class which is not an interface and is not static gets an outer link
|
||||
* (@see outerDefs)
|
||||
* 2. A mixin which is not also an interface gets a mixin constructor
|
||||
* (@see mixinConstructorDef)
|
||||
* 3. Constructor bodies are augmented by calls to supermixin constructors
|
||||
* (@see addMixinConstructorCalls)
|
||||
* 4. A constructor of a class with an outer link gets an outer parameter.
|
||||
* 5. A reference C.this where C refers to an outer class is replaced by a selection
|
||||
* this.$outer ... .$outer (@see outerPath)
|
||||
* 7. A call to a constructor Q.<init>(args) or Q.$init$(args) where Q != this and
|
||||
* the constructor belongs to a non-static class is augmented by an outer argument.
|
||||
* E.g. Q.<init>(args, OUTER) where OUTER is the qualifier corresponding to the
|
||||
* singleton type Q.
|
||||
* 8. A call to a constructor this.<init>(args) in a secondary constructor
|
||||
* is augmented to this.<init>(args, OUTER) where OUTER is the last parameter
|
||||
* of the secondary constructor.
|
||||
*/
|
||||
private val firstTransformer = new OuterPathTransformer {
|
||||
|
||||
var localTyper: analyzer.Typer = typer;
|
||||
|
||||
/** The two definitions
|
||||
* val outer : C.this.type _;
|
||||
* def outer(): C.this.type = outer ;
|
||||
* Here, C is the class enclosing the class `clazz' containing the two definitions.
|
||||
*/
|
||||
def outerDefs(clazz: Symbol): List[Tree] = {
|
||||
val outerDef = outerMember(clazz.info);
|
||||
val outerVal = outerDef.accessed;
|
||||
List(
|
||||
localTyper.typed {
|
||||
atPos(clazz.pos) {
|
||||
ValDef(outerVal)
|
||||
}
|
||||
},
|
||||
localTyper.typed {
|
||||
atPos(clazz.pos) {
|
||||
DefDef(outerDef, vparamss => Select(This(clazz), outerVal))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** The mixin constructor definition
|
||||
* def $init$(): Unit = ()
|
||||
*/
|
||||
def mixinConstructorDef(clazz: Symbol): Tree =
|
||||
localTyper.typed {
|
||||
val constr = clazz.primaryConstructor;
|
||||
atPhase(currentRun.explicitOuterPhase) {
|
||||
// necessary so that we do not include an outer parameter already here;
|
||||
// this will be added later in transform.
|
||||
DefDef(constr, vparamss => Literal(()))
|
||||
}
|
||||
}
|
||||
|
||||
/** Add calls to supermixin constructors
|
||||
* super[mix].$init$()
|
||||
* to `tree'. `tree' which is assumed to be the body of a constructor of class `clazz'.
|
||||
*/
|
||||
def addMixinConstructorCalls(tree: Tree, clazz: Symbol): Tree = {
|
||||
def mixinConstructorCall(mixin: Symbol): Tree =
|
||||
atPos(tree.pos) {
|
||||
Apply(
|
||||
localTyper.typedOperator {
|
||||
Select(Super(clazz, mixin.name), mixin.primaryConstructor)
|
||||
},
|
||||
List()) setType UnitClass.tpe; // don't type this with typed(...),
|
||||
// as constructor arguments might be missing
|
||||
}
|
||||
val mixinConstructorCalls =
|
||||
for (val mixin <- clazz.info.parents.tail; !(mixin.symbol hasFlag INTERFACE)) yield
|
||||
mixinConstructorCall(mixin.symbol);
|
||||
tree match {
|
||||
case Block(supercall :: stats, expr) =>
|
||||
assert(supercall match {
|
||||
case Apply(Select(Super(_, _), _), _) => true
|
||||
case _ => false
|
||||
});
|
||||
copy.Block(tree, supercall :: mixinConstructorCalls ::: stats, expr);
|
||||
case Block(_, _) =>
|
||||
assert(false, tree); tree
|
||||
case expr =>
|
||||
Block(mixinConstructorCalls, expr) setType expr.tpe setPos expr.pos;
|
||||
}
|
||||
}
|
||||
|
||||
/** The first-step transformation method */
|
||||
override def transform(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
val tree1 = tree match {
|
||||
case Template(parents, decls) =>
|
||||
val savedLocalTyper = localTyper;
|
||||
localTyper = localTyper.atOwner(tree, currentOwner);
|
||||
var decls1 = decls;
|
||||
if (!(currentOwner hasFlag INTERFACE)) {
|
||||
if (!isStatic(currentOwner))
|
||||
decls1 = decls1 ::: outerDefs(currentOwner); // (1)
|
||||
if (currentOwner.isTrait)
|
||||
decls1 = decls1 ::: List(mixinConstructorDef(currentOwner)) // (2)
|
||||
}
|
||||
localTyper = savedLocalTyper;
|
||||
copy.Template(tree, parents, decls1);
|
||||
case constrDef @ DefDef(mods, name, tparams, vparamss, tpt, rhs)
|
||||
if (sym.isConstructor) =>
|
||||
val vparamss1 =
|
||||
if (isStatic(sym.owner)) vparamss
|
||||
else { // (4)
|
||||
val outerField = outerMember(sym.owner.info).accessed;
|
||||
val outerParam = sym.newValueParameter(sym.pos, nme.OUTER) setInfo outerField.info;
|
||||
List(vparamss.head ::: List(ValDef(outerParam) setType NoType))
|
||||
}
|
||||
val rhs1 =
|
||||
if ((sym.isPrimaryConstructor || sym.isMixinConstructor) && sym.owner != ArrayClass)
|
||||
addMixinConstructorCalls(rhs, sym.owner); // (3)
|
||||
else rhs;
|
||||
copy.DefDef(tree, mods, name, tparams, vparamss1, tpt, rhs1);
|
||||
case This(qual) =>
|
||||
if (sym == currentOwner.enclClass || (sym hasFlag MODULE) && sym.isStatic) tree
|
||||
else atPos(tree.pos)(outerPath(outerValue, sym)); // (5)
|
||||
case Apply(sel @ Select(qual, name), args)
|
||||
if ((name == nme.CONSTRUCTOR || name == nme.MIXIN_CONSTRUCTOR) && !isStatic(sel.symbol.owner)) =>
|
||||
val outerVal =
|
||||
atPos(tree.pos) {
|
||||
if (qual.isInstanceOf[This]) { assert(outerParam != NoSymbol); outerValue } // (8)
|
||||
else {
|
||||
var pre = qual.tpe.prefix;
|
||||
if (pre == NoPrefix) pre = outerClass(sym.owner).thisType;
|
||||
gen.mkQualifier(pre)
|
||||
}
|
||||
}
|
||||
copy.Apply(tree, sel, args ::: List(outerVal))
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
super.transform(tree1)
|
||||
}
|
||||
}
|
||||
|
||||
/** The second step performs the following transformations:
|
||||
* 2. Remove private modifiers from members M of mixins T. (@see makeNotPrivate)
|
||||
* 3. Remove `private' modifier from class members M that are accessed from an inner class.
|
||||
* 4. Remove `protected' modifier from class members M that are accessed
|
||||
* without a super qualifier accessed from an inner class.
|
||||
* 5. Remove `private' and `protected' modifiers from type symbols
|
||||
*/
|
||||
private val secondTransformer = new Transformer {
|
||||
|
||||
/** The second-step transformation method */
|
||||
override def transform(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
val tree1 = super.transform(tree);
|
||||
tree1 match {
|
||||
case DefDef(_, _, _, _, _, _) =>
|
||||
if (sym.owner.isTrait && (sym hasFlag (ACCESSOR | SUPERACCESSOR)))
|
||||
sym.makeNotPrivate(sym.owner); //(2)
|
||||
tree1
|
||||
case Select(qual, name) =>
|
||||
if (currentOwner.enclClass != sym.owner) // (3)
|
||||
sym.makeNotPrivate(sym.owner);
|
||||
if ((sym hasFlag PROTECTED) && //(4)
|
||||
!(qual.isInstanceOf[Super] ||
|
||||
(qual.tpe.widen.symbol isSubClass currentOwner.enclClass)))
|
||||
sym setFlag notPROTECTED;
|
||||
tree1
|
||||
case _ =>
|
||||
if (sym != null && sym.isType) {//(5)
|
||||
if (sym hasFlag PRIVATE) sym setFlag notPRIVATE;
|
||||
if (sym hasFlag PROTECTED) sym setFlag notPROTECTED;
|
||||
}
|
||||
tree1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The main transformation method:
|
||||
* First, perform step 1 on whole tree of compilation unit.
|
||||
* Then, perform step 2 on resulting tree
|
||||
*/
|
||||
override def transform(tree: Tree) =
|
||||
atPhase(phase.next) {
|
||||
secondTransformer.transform(firstTransformer.transform(tree))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,112 +1,112 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.ListBuffer;
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class Flatten extends InfoTransform {
|
||||
import global._;
|
||||
import definitions._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** the following two members override abstract members in Transform */
|
||||
val phaseName: String = "flatten";
|
||||
|
||||
private def liftClass(sym: Symbol): unit =
|
||||
if (!(sym hasFlag LIFTED)) {
|
||||
sym setFlag LIFTED;
|
||||
atPhase(phase.next) {
|
||||
if (settings.debug.value) log("re-enter " + sym + " in " + sym.owner);
|
||||
assert(sym.owner.isPackageClass, sym);//debug
|
||||
val scope = sym.owner.info.decls;
|
||||
val old = scope lookup sym.name;
|
||||
if (old != NoSymbol) scope unlink old;
|
||||
scope enter sym;
|
||||
}
|
||||
}
|
||||
|
||||
private val flattened = new TypeMap {
|
||||
def apply(tp: Type): Type = tp match {
|
||||
case TypeRef(pre, sym, args) if (pre.symbol.isClass && !pre.symbol.isPackageClass) =>
|
||||
assert(args.isEmpty);
|
||||
typeRef(sym.toplevelClass.owner.thisType, sym, args)
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
var parents1 = parents;
|
||||
val decls1 = new Scope();
|
||||
if (clazz.isPackageClass) {
|
||||
atPhase(phase.next)(decls.toList foreach (decls1 enter));
|
||||
} else {
|
||||
val oldowner = clazz.owner;
|
||||
atPhase(phase.next)(oldowner.info);
|
||||
parents1 = List.mapConserve(parents)(this);
|
||||
for (val sym <- decls.toList) {
|
||||
if (sym.isTerm && !sym.isStaticModule) {
|
||||
decls1 enter sym;
|
||||
if (sym.isModule) sym.moduleClass setFlag LIFTED;
|
||||
} else if (sym.isClass) {
|
||||
liftClass(sym);
|
||||
if (sym.needsImplClass) liftClass(erasure.implClass(sym))
|
||||
}
|
||||
}
|
||||
}
|
||||
ClassInfoType(parents1, decls1, clazz)
|
||||
case PolyType(tparams, restp) =>
|
||||
val restp1 = apply(restp);
|
||||
if (restp1 eq restp) tp else PolyType(tparams, restp1)
|
||||
case _ =>
|
||||
mapOver(tp)
|
||||
}
|
||||
}
|
||||
|
||||
def transformInfo(sym: Symbol, tp: Type): Type = flattened(tp);
|
||||
|
||||
protected def newTransformer(unit: CompilationUnit): Transformer = new Flattener;
|
||||
|
||||
class Flattener extends Transformer {
|
||||
|
||||
/** Buffers for lifted out classes */
|
||||
private val liftedDefs = new HashMap[Symbol, ListBuffer[Tree]];
|
||||
|
||||
override def transform(tree: Tree): Tree = {
|
||||
tree match {
|
||||
case PackageDef(_, _) =>
|
||||
liftedDefs(tree.symbol.moduleClass) = new ListBuffer;
|
||||
case _ =>
|
||||
}
|
||||
postTransform(super.transform(tree))
|
||||
}
|
||||
|
||||
private def postTransform(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
val tree1 = tree match {
|
||||
case ClassDef(_, _, _, _, _) if sym.isNestedClass =>
|
||||
liftedDefs(sym.toplevelClass.owner) += tree;
|
||||
EmptyTree
|
||||
case Select(qual, name) if (sym.isStaticModule && !sym.owner.isPackageClass) =>
|
||||
atPhase(phase.next) {
|
||||
atPos(tree.pos) {
|
||||
gen.mkRef(sym)
|
||||
}
|
||||
}
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
tree1 setType flattened(tree1.tpe)
|
||||
}
|
||||
|
||||
/** Transform statements and add lifted definitions to them. */
|
||||
override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] = {
|
||||
val stats1 = super.transformStats(stats, exprOwner);
|
||||
if (currentOwner.isPackageClass && liftedDefs(currentOwner).hasNext)
|
||||
stats1 ::: liftedDefs(currentOwner).toList
|
||||
else
|
||||
stats1
|
||||
}
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.ListBuffer;
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class Flatten extends InfoTransform {
|
||||
import global._;
|
||||
import definitions._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** the following two members override abstract members in Transform */
|
||||
val phaseName: String = "flatten";
|
||||
|
||||
private def liftClass(sym: Symbol): unit =
|
||||
if (!(sym hasFlag LIFTED)) {
|
||||
sym setFlag LIFTED;
|
||||
atPhase(phase.next) {
|
||||
if (settings.debug.value) log("re-enter " + sym + " in " + sym.owner);
|
||||
assert(sym.owner.isPackageClass, sym);//debug
|
||||
val scope = sym.owner.info.decls;
|
||||
val old = scope lookup sym.name;
|
||||
if (old != NoSymbol) scope unlink old;
|
||||
scope enter sym;
|
||||
}
|
||||
}
|
||||
|
||||
private val flattened = new TypeMap {
|
||||
def apply(tp: Type): Type = tp match {
|
||||
case TypeRef(pre, sym, args) if (pre.symbol.isClass && !pre.symbol.isPackageClass) =>
|
||||
assert(args.isEmpty);
|
||||
typeRef(sym.toplevelClass.owner.thisType, sym, args)
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
var parents1 = parents;
|
||||
val decls1 = new Scope();
|
||||
if (clazz.isPackageClass) {
|
||||
atPhase(phase.next)(decls.toList foreach (decls1 enter));
|
||||
} else {
|
||||
val oldowner = clazz.owner;
|
||||
atPhase(phase.next)(oldowner.info);
|
||||
parents1 = List.mapConserve(parents)(this);
|
||||
for (val sym <- decls.toList) {
|
||||
if (sym.isTerm && !sym.isStaticModule) {
|
||||
decls1 enter sym;
|
||||
if (sym.isModule) sym.moduleClass setFlag LIFTED;
|
||||
} else if (sym.isClass) {
|
||||
liftClass(sym);
|
||||
if (sym.needsImplClass) liftClass(erasure.implClass(sym))
|
||||
}
|
||||
}
|
||||
}
|
||||
ClassInfoType(parents1, decls1, clazz)
|
||||
case PolyType(tparams, restp) =>
|
||||
val restp1 = apply(restp);
|
||||
if (restp1 eq restp) tp else PolyType(tparams, restp1)
|
||||
case _ =>
|
||||
mapOver(tp)
|
||||
}
|
||||
}
|
||||
|
||||
def transformInfo(sym: Symbol, tp: Type): Type = flattened(tp);
|
||||
|
||||
protected def newTransformer(unit: CompilationUnit): Transformer = new Flattener;
|
||||
|
||||
class Flattener extends Transformer {
|
||||
|
||||
/** Buffers for lifted out classes */
|
||||
private val liftedDefs = new HashMap[Symbol, ListBuffer[Tree]];
|
||||
|
||||
override def transform(tree: Tree): Tree = {
|
||||
tree match {
|
||||
case PackageDef(_, _) =>
|
||||
liftedDefs(tree.symbol.moduleClass) = new ListBuffer;
|
||||
case _ =>
|
||||
}
|
||||
postTransform(super.transform(tree))
|
||||
}
|
||||
|
||||
private def postTransform(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
val tree1 = tree match {
|
||||
case ClassDef(_, _, _, _, _) if sym.isNestedClass =>
|
||||
liftedDefs(sym.toplevelClass.owner) += tree;
|
||||
EmptyTree
|
||||
case Select(qual, name) if (sym.isStaticModule && !sym.owner.isPackageClass) =>
|
||||
atPhase(phase.next) {
|
||||
atPos(tree.pos) {
|
||||
gen.mkRef(sym)
|
||||
}
|
||||
}
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
tree1 setType flattened(tree1.tpe)
|
||||
}
|
||||
|
||||
/** Transform statements and add lifted definitions to them. */
|
||||
override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] = {
|
||||
val stats1 = super.transformStats(stats, exprOwner);
|
||||
if (currentOwner.isPackageClass && liftedDefs(currentOwner).hasNext)
|
||||
stats1 ::: liftedDefs(currentOwner).toList
|
||||
else
|
||||
stats1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,352 +1,352 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.{ListBuffer, TreeSet};
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class LambdaLift extends InfoTransform {
|
||||
import global._;
|
||||
import definitions._;
|
||||
import typer.{typed, typedOperator};
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** the following two members override abstract members in Transform */
|
||||
val phaseName: String = "lambdalift";
|
||||
|
||||
private val lifted = new TypeMap {
|
||||
def apply(tp: Type): Type = tp match {
|
||||
case TypeRef(pre, sym, args) =>
|
||||
if (pre == NoPrefix && sym.isClass && !sym.isPackageClass) {
|
||||
assert(args.isEmpty);
|
||||
typeRef(apply(sym.owner.enclClass.thisType), sym, args)
|
||||
} else mapOver(tp)
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
val parents1 = List.mapConserve(parents)(this);
|
||||
if (parents1 eq parents) tp
|
||||
else ClassInfoType(parents1, decls, clazz)
|
||||
case _ =>
|
||||
mapOver(tp)
|
||||
}
|
||||
}
|
||||
|
||||
def transformInfo(sym: Symbol, tp: Type): Type = lifted(tp);
|
||||
|
||||
protected def newTransformer(unit: CompilationUnit): Transformer =
|
||||
new LambdaLifter(unit);
|
||||
|
||||
class LambdaLifter(unit: CompilationUnit) extends explicitOuter.OuterPathTransformer {
|
||||
|
||||
/** A map storing free variables of functions and classes */
|
||||
private val free = new HashMap[Symbol,SymSet];
|
||||
|
||||
/** A map storing the free variable proxies of functions and classes */
|
||||
private val proxies = new HashMap[Symbol, List[Symbol]];
|
||||
|
||||
/** A hashtable storing calls between functions */
|
||||
private val called = new HashMap[Symbol, SymSet];
|
||||
|
||||
/** The set of symbols that need to be renamed. */
|
||||
private val renamable = newSymSet;
|
||||
|
||||
/** A flag to indicate whether new free variables have been found */
|
||||
private var changedFreeVars: boolean = _;
|
||||
|
||||
/** Buffers for lifted out classes and methods */
|
||||
private val liftedDefs = new HashMap[Symbol, ListBuffer[Tree]];
|
||||
|
||||
private type SymSet = TreeSet[Symbol];
|
||||
|
||||
private def newSymSet = new TreeSet[Symbol]((x, y) => x.isLess(y));
|
||||
|
||||
private def symSet(f: HashMap[Symbol, SymSet], sym: Symbol): SymSet = f.get(sym) match {
|
||||
case Some(ss) => ss
|
||||
case None => val ss = newSymSet; f(sym) = ss; ss
|
||||
}
|
||||
|
||||
private def outer(sym: Symbol): Symbol =
|
||||
if (sym.isConstructor) sym.owner.owner else sym.owner;
|
||||
|
||||
private def enclMethOrClass(sym: Symbol): Symbol = {
|
||||
def localToConstr(sym: Symbol) =
|
||||
if (sym.isLocalDummy) sym.owner.primaryConstructor else sym;
|
||||
var encl = localToConstr(sym);
|
||||
while (!encl.isMethod && !encl.isClass)
|
||||
encl = localToConstr(outer(encl));
|
||||
encl
|
||||
}
|
||||
|
||||
/** Mark symbol `sym' as being free in `owner', unless `sym'
|
||||
* is defined in `owner' or there is a class between `owner's owner
|
||||
* and the owner of `sym'.
|
||||
* Return `true' if there is no class between `owner' and
|
||||
* the owner of sym.
|
||||
* pre: sym.isLocal, (owner.isMethod || owner.isClass)
|
||||
*/
|
||||
private def markFree(sym: Symbol, owner: Symbol): boolean = {
|
||||
if (settings.debug.value) log("mark " + sym + " of " + sym.owner + " free in " + owner);
|
||||
if (owner == enclMethOrClass(sym.owner)) true
|
||||
else if (owner.isPackageClass || !markFree(sym, enclMethOrClass(outer(owner)))) false
|
||||
else {
|
||||
val ss = symSet(free, owner);
|
||||
if (!(ss contains sym)) {
|
||||
ss addEntry sym;
|
||||
renamable addEntry sym;
|
||||
changedFreeVars = true;
|
||||
if (settings.debug.value) log("" + sym + " is free in " + owner);
|
||||
if (sym.isVariable && !(sym hasFlag CAPTURED)) {
|
||||
sym setFlag CAPTURED;
|
||||
val symClass = sym.tpe.symbol;
|
||||
atPhase(phase.next) {
|
||||
sym updateInfo (
|
||||
if (isValueClass(symClass)) refClass(symClass).tpe else ObjectRefClass.tpe)
|
||||
}
|
||||
}
|
||||
}
|
||||
!owner.isClass
|
||||
}
|
||||
}
|
||||
|
||||
def freeVars(sym: Symbol): Iterator[Symbol] = free.get(sym) match {
|
||||
case Some(ss) => ss.elements
|
||||
case None => Iterator.empty
|
||||
}
|
||||
|
||||
/** The traverse function */
|
||||
private val freeVarTraverser = new Traverser {
|
||||
override def traverse(tree: Tree): unit = {
|
||||
try { //debug
|
||||
val sym = tree.symbol;
|
||||
tree match {
|
||||
case ClassDef(_, _, _, _, _) =>
|
||||
liftedDefs(tree.symbol) = new ListBuffer;
|
||||
if (sym.isLocal) renamable addEntry sym;
|
||||
case DefDef(_, _, _, _, _, _) =>
|
||||
if (sym.isLocal) {
|
||||
renamable addEntry sym;
|
||||
sym setFlag (PRIVATE | LOCAL | FINAL)
|
||||
} else if (sym.isPrimaryConstructor) {
|
||||
symSet(called, sym) addEntry sym.owner
|
||||
}
|
||||
case Ident(name) =>
|
||||
if (sym == NoSymbol) {
|
||||
assert(name == nme.WILDCARD)
|
||||
} else if (sym.isLocal) {
|
||||
val owner = enclMethOrClass(currentOwner);
|
||||
if (sym.isTerm && !sym.isMethod) markFree(sym, owner)
|
||||
else if (owner.isMethod && sym.isMethod) symSet(called, owner) addEntry sym;
|
||||
}
|
||||
case Select(_, _) =>
|
||||
if (sym.isConstructor && sym.owner.isLocal) {
|
||||
val owner = enclMethOrClass(currentOwner);
|
||||
if (owner.isMethod) symSet(called, owner) addEntry sym;
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
super.traverse(tree)
|
||||
} catch {//debug
|
||||
case ex: Throwable =>
|
||||
System.out.println("exception when traversing " + tree);
|
||||
throw ex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Compute free variables map `fvs'.
|
||||
* Also assign unique names to all
|
||||
* value/variable/let that are free in some function or class, and to
|
||||
* all class/function symbols that are owned by some function.
|
||||
*/
|
||||
private def computeFreeVars: unit = {
|
||||
freeVarTraverser.traverse(unit.body);
|
||||
|
||||
do {
|
||||
changedFreeVars = false;
|
||||
for (val caller <- called.keys;
|
||||
val callee <- called(caller).elements;
|
||||
val fv <- freeVars(callee))
|
||||
markFree(fv, caller);
|
||||
} while (changedFreeVars);
|
||||
|
||||
for (val sym <- renamable.elements) {
|
||||
sym.name = unit.fresh.newName(sym.name.toString());
|
||||
if (settings.debug.value) log("renamed: " + sym.name);
|
||||
}
|
||||
|
||||
atPhase(phase.next) {
|
||||
for (val owner <- free.keys) {
|
||||
if (settings.debug.value)
|
||||
log("free(" + owner + owner.locationString + ") = " + free(owner).elements.toList);
|
||||
proxies(owner) =
|
||||
for (val fv <- free(owner).elements.toList) yield {
|
||||
val proxy = owner.newValue(owner.pos, fv.name)
|
||||
.setFlag(if (owner.isClass) PARAMACCESSOR | PRIVATE | LOCAL else PARAM)
|
||||
.setFlag(SYNTHETIC)
|
||||
.setInfo(fv.info);
|
||||
if (owner.isClass) owner.info.decls enter proxy;
|
||||
proxy
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def proxy(sym: Symbol) = {
|
||||
def searchIn(owner: Symbol): Symbol = {
|
||||
if (settings.debug.value) log("searching for " + sym + "(" + sym.owner + ") in " + owner + " " + enclMethOrClass(owner));//debug
|
||||
proxies.get(enclMethOrClass(owner)) match {
|
||||
case Some(ps) =>
|
||||
ps filter (p => p.name == sym.name) match {
|
||||
case List(p) => p
|
||||
case List() => searchIn(outer(owner))
|
||||
}
|
||||
case None => searchIn(outer(owner))
|
||||
}
|
||||
}
|
||||
if (settings.debug.value) log("proxy " + sym + " in " + sym.owner + " from " + currentOwner.ownerChain + " " + enclMethOrClass(sym.owner));//debug
|
||||
if (enclMethOrClass(sym.owner) == enclMethOrClass(currentOwner)) sym
|
||||
else searchIn(currentOwner)
|
||||
}
|
||||
|
||||
private def memberRef(sym: Symbol) = {
|
||||
val clazz = sym.owner.enclClass;
|
||||
val qual = if (clazz == currentOwner.enclClass) gen.This(clazz)
|
||||
else {
|
||||
sym resetFlag(LOCAL | PRIVATE);
|
||||
if (clazz.isStaticOwner) gen.mkQualifier(clazz.thisType)
|
||||
else outerPath(outerValue, clazz)
|
||||
}
|
||||
Select(qual, sym) setType sym.tpe
|
||||
}
|
||||
|
||||
private def proxyRef(sym: Symbol) = {
|
||||
if (sym.owner.isLabel) //
|
||||
gen.Ident(sym) // bq: account for the fact that LambdaLift does not know how to handle references to LabelDef parameters.
|
||||
else { //
|
||||
val psym = proxy(sym);
|
||||
if (psym.isLocal) gen.Ident(psym) else memberRef(psym)
|
||||
}
|
||||
}
|
||||
|
||||
private def addFreeArgs(pos: int, sym: Symbol, args: List[Tree]) = {
|
||||
def freeArg(fv: Symbol) = atPos(pos)(proxyRef(fv));
|
||||
val fvs = freeVars(sym).toList;
|
||||
if (fvs.isEmpty) args else args ::: (fvs map freeArg)
|
||||
}
|
||||
|
||||
private def addFreeParams(tree: Tree, sym: Symbol): Tree = proxies.get(sym) match {
|
||||
case Some(ps) =>
|
||||
val freeParams = ps map (p => ValDef(p) setPos tree.pos setType NoType);
|
||||
tree match {
|
||||
case DefDef(mods, name, tparams, List(vparams), tpt, rhs) =>
|
||||
sym.updateInfo(
|
||||
lifted(MethodType(sym.info.paramTypes ::: (ps map (.tpe)), sym.info.resultType)));
|
||||
copy.DefDef(tree, mods, name, tparams, List(vparams ::: freeParams), tpt, rhs)
|
||||
case ClassDef(mods, name, tparams, tpt, impl @ Template(parents, body)) =>
|
||||
copy.ClassDef(tree, mods, name, tparams, tpt,
|
||||
copy.Template(impl, parents, body ::: freeParams))
|
||||
}
|
||||
case None =>
|
||||
tree
|
||||
}
|
||||
|
||||
private def liftDef(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
sym.owner = sym.owner.enclClass;
|
||||
if (sym.isClass) sym.owner = sym.owner.toInterface;
|
||||
if (sym.isMethod) sym setFlag LIFTED;
|
||||
liftedDefs(sym.owner) += tree;
|
||||
sym.owner.info.decls enterUnique sym;
|
||||
if (settings.debug.value) log("lifted: " + sym + sym.locationString);
|
||||
EmptyTree
|
||||
}
|
||||
|
||||
private def postTransform(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
tree match {
|
||||
case ClassDef(_, _, _, _, _) =>
|
||||
val tree1 = addFreeParams(tree, sym);
|
||||
if (sym.isLocal) liftDef(tree1) else tree1
|
||||
case DefDef(_, _, _, _, _, _) =>
|
||||
val tree1 = addFreeParams(tree, sym);
|
||||
if (sym.isLocal) liftDef(tree1) else tree1
|
||||
case ValDef(mods, name, tpt, rhs) =>
|
||||
if (sym.isCapturedVariable) {
|
||||
val tpt1 = TypeTree(sym.tpe) setPos tpt.pos;
|
||||
val rhs1 =
|
||||
atPos(rhs.pos) {
|
||||
typed {
|
||||
Apply(Select(New(TypeTree(sym.tpe)), nme.CONSTRUCTOR), List(rhs))
|
||||
}
|
||||
}
|
||||
copy.ValDef(tree, mods, name, tpt1, rhs1)
|
||||
} else tree
|
||||
case Return(Block(stats, value)) =>
|
||||
Block(stats, copy.Return(tree, value)) setType tree.tpe setPos tree.pos;
|
||||
case Return(expr) =>
|
||||
if (sym != currentOwner.enclMethod) {
|
||||
System.out.println(sym);//debug
|
||||
System.out.println(currentOwner.enclMethod);//debug
|
||||
unit.error(tree.pos, "non-local return not yet implemented");
|
||||
}
|
||||
tree
|
||||
case Apply(fn, args) =>
|
||||
copy.Apply(tree, fn, addFreeArgs(tree.pos, sym, args));
|
||||
case Assign(Apply(TypeApply(sel @ Select(qual, _), _), List()), rhs) =>
|
||||
// eliminate casts introduced by selecting a captured variable field
|
||||
// on the lhs of an assignment.
|
||||
assert(sel.symbol == Object_asInstanceOf);
|
||||
copy.Assign(tree, qual, rhs)
|
||||
case Ident(name) =>
|
||||
val tree1 =
|
||||
if (sym != NoSymbol && sym.isTerm && !sym.isLabel)
|
||||
if (sym.isMethod)
|
||||
atPos(tree.pos)(memberRef(sym))
|
||||
else if (sym.isLocal && enclMethOrClass(sym.owner) != enclMethOrClass(currentOwner))
|
||||
atPos(tree.pos)(proxyRef(sym))
|
||||
else tree
|
||||
else tree;
|
||||
if (sym.isCapturedVariable)
|
||||
atPos(tree.pos) {
|
||||
val tp = tree.tpe;
|
||||
val elemTree = typed { Select(tree1 setType sym.tpe, nme.elem) }
|
||||
if (elemTree.tpe.symbol != tp.symbol) gen.cast(elemTree, tp) else elemTree
|
||||
}
|
||||
else tree1
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
}
|
||||
|
||||
override def transform(tree: Tree): Tree = {
|
||||
postTransform(super.transform(tree) setType lifted(tree.tpe));
|
||||
}
|
||||
/** Transform statements and add lifted definitions to them. */
|
||||
override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] = {
|
||||
def addLifted(stat: Tree): Tree = stat match {
|
||||
case ClassDef(mods, name, tparams, tpt, impl @ Template(parents, body)) =>
|
||||
val result =
|
||||
if (liftedDefs(stat.symbol).hasNext) {
|
||||
val lifted = liftedDefs(stat.symbol).toList map addLifted;
|
||||
copy.ClassDef(stat, mods, name, tparams, tpt,
|
||||
copy.Template(impl, parents, body ::: lifted))
|
||||
} else stat;
|
||||
liftedDefs -= stat.symbol;
|
||||
result
|
||||
case _ =>
|
||||
stat
|
||||
}
|
||||
super.transformStats(stats, exprOwner) map addLifted
|
||||
}
|
||||
|
||||
override def transformUnit(unit: CompilationUnit): unit = {
|
||||
computeFreeVars;
|
||||
atPhase(phase.next)(super.transformUnit(unit));
|
||||
assert(liftedDefs.size == 0, liftedDefs.keys.toList)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab._;
|
||||
import Flags._;
|
||||
import util.{ListBuffer, TreeSet};
|
||||
import collection.mutable.HashMap;
|
||||
|
||||
abstract class LambdaLift extends InfoTransform {
|
||||
import global._;
|
||||
import definitions._;
|
||||
import typer.{typed, typedOperator};
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** the following two members override abstract members in Transform */
|
||||
val phaseName: String = "lambdalift";
|
||||
|
||||
private val lifted = new TypeMap {
|
||||
def apply(tp: Type): Type = tp match {
|
||||
case TypeRef(pre, sym, args) =>
|
||||
if (pre == NoPrefix && sym.isClass && !sym.isPackageClass) {
|
||||
assert(args.isEmpty);
|
||||
typeRef(apply(sym.owner.enclClass.thisType), sym, args)
|
||||
} else mapOver(tp)
|
||||
case ClassInfoType(parents, decls, clazz) =>
|
||||
val parents1 = List.mapConserve(parents)(this);
|
||||
if (parents1 eq parents) tp
|
||||
else ClassInfoType(parents1, decls, clazz)
|
||||
case _ =>
|
||||
mapOver(tp)
|
||||
}
|
||||
}
|
||||
|
||||
def transformInfo(sym: Symbol, tp: Type): Type = lifted(tp);
|
||||
|
||||
protected def newTransformer(unit: CompilationUnit): Transformer =
|
||||
new LambdaLifter(unit);
|
||||
|
||||
class LambdaLifter(unit: CompilationUnit) extends explicitOuter.OuterPathTransformer {
|
||||
|
||||
/** A map storing free variables of functions and classes */
|
||||
private val free = new HashMap[Symbol,SymSet];
|
||||
|
||||
/** A map storing the free variable proxies of functions and classes */
|
||||
private val proxies = new HashMap[Symbol, List[Symbol]];
|
||||
|
||||
/** A hashtable storing calls between functions */
|
||||
private val called = new HashMap[Symbol, SymSet];
|
||||
|
||||
/** The set of symbols that need to be renamed. */
|
||||
private val renamable = newSymSet;
|
||||
|
||||
/** A flag to indicate whether new free variables have been found */
|
||||
private var changedFreeVars: boolean = _;
|
||||
|
||||
/** Buffers for lifted out classes and methods */
|
||||
private val liftedDefs = new HashMap[Symbol, ListBuffer[Tree]];
|
||||
|
||||
private type SymSet = TreeSet[Symbol];
|
||||
|
||||
private def newSymSet = new TreeSet[Symbol]((x, y) => x.isLess(y));
|
||||
|
||||
private def symSet(f: HashMap[Symbol, SymSet], sym: Symbol): SymSet = f.get(sym) match {
|
||||
case Some(ss) => ss
|
||||
case None => val ss = newSymSet; f(sym) = ss; ss
|
||||
}
|
||||
|
||||
private def outer(sym: Symbol): Symbol =
|
||||
if (sym.isConstructor) sym.owner.owner else sym.owner;
|
||||
|
||||
private def enclMethOrClass(sym: Symbol): Symbol = {
|
||||
def localToConstr(sym: Symbol) =
|
||||
if (sym.isLocalDummy) sym.owner.primaryConstructor else sym;
|
||||
var encl = localToConstr(sym);
|
||||
while (!encl.isMethod && !encl.isClass)
|
||||
encl = localToConstr(outer(encl));
|
||||
encl
|
||||
}
|
||||
|
||||
/** Mark symbol `sym' as being free in `owner', unless `sym'
|
||||
* is defined in `owner' or there is a class between `owner's owner
|
||||
* and the owner of `sym'.
|
||||
* Return `true' if there is no class between `owner' and
|
||||
* the owner of sym.
|
||||
* pre: sym.isLocal, (owner.isMethod || owner.isClass)
|
||||
*/
|
||||
private def markFree(sym: Symbol, owner: Symbol): boolean = {
|
||||
if (settings.debug.value) log("mark " + sym + " of " + sym.owner + " free in " + owner);
|
||||
if (owner == enclMethOrClass(sym.owner)) true
|
||||
else if (owner.isPackageClass || !markFree(sym, enclMethOrClass(outer(owner)))) false
|
||||
else {
|
||||
val ss = symSet(free, owner);
|
||||
if (!(ss contains sym)) {
|
||||
ss addEntry sym;
|
||||
renamable addEntry sym;
|
||||
changedFreeVars = true;
|
||||
if (settings.debug.value) log("" + sym + " is free in " + owner);
|
||||
if (sym.isVariable && !(sym hasFlag CAPTURED)) {
|
||||
sym setFlag CAPTURED;
|
||||
val symClass = sym.tpe.symbol;
|
||||
atPhase(phase.next) {
|
||||
sym updateInfo (
|
||||
if (isValueClass(symClass)) refClass(symClass).tpe else ObjectRefClass.tpe)
|
||||
}
|
||||
}
|
||||
}
|
||||
!owner.isClass
|
||||
}
|
||||
}
|
||||
|
||||
def freeVars(sym: Symbol): Iterator[Symbol] = free.get(sym) match {
|
||||
case Some(ss) => ss.elements
|
||||
case None => Iterator.empty
|
||||
}
|
||||
|
||||
/** The traverse function */
|
||||
private val freeVarTraverser = new Traverser {
|
||||
override def traverse(tree: Tree): unit = {
|
||||
try { //debug
|
||||
val sym = tree.symbol;
|
||||
tree match {
|
||||
case ClassDef(_, _, _, _, _) =>
|
||||
liftedDefs(tree.symbol) = new ListBuffer;
|
||||
if (sym.isLocal) renamable addEntry sym;
|
||||
case DefDef(_, _, _, _, _, _) =>
|
||||
if (sym.isLocal) {
|
||||
renamable addEntry sym;
|
||||
sym setFlag (PRIVATE | LOCAL | FINAL)
|
||||
} else if (sym.isPrimaryConstructor) {
|
||||
symSet(called, sym) addEntry sym.owner
|
||||
}
|
||||
case Ident(name) =>
|
||||
if (sym == NoSymbol) {
|
||||
assert(name == nme.WILDCARD)
|
||||
} else if (sym.isLocal) {
|
||||
val owner = enclMethOrClass(currentOwner);
|
||||
if (sym.isTerm && !sym.isMethod) markFree(sym, owner)
|
||||
else if (owner.isMethod && sym.isMethod) symSet(called, owner) addEntry sym;
|
||||
}
|
||||
case Select(_, _) =>
|
||||
if (sym.isConstructor && sym.owner.isLocal) {
|
||||
val owner = enclMethOrClass(currentOwner);
|
||||
if (owner.isMethod) symSet(called, owner) addEntry sym;
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
super.traverse(tree)
|
||||
} catch {//debug
|
||||
case ex: Throwable =>
|
||||
System.out.println("exception when traversing " + tree);
|
||||
throw ex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Compute free variables map `fvs'.
|
||||
* Also assign unique names to all
|
||||
* value/variable/let that are free in some function or class, and to
|
||||
* all class/function symbols that are owned by some function.
|
||||
*/
|
||||
private def computeFreeVars: unit = {
|
||||
freeVarTraverser.traverse(unit.body);
|
||||
|
||||
do {
|
||||
changedFreeVars = false;
|
||||
for (val caller <- called.keys;
|
||||
val callee <- called(caller).elements;
|
||||
val fv <- freeVars(callee))
|
||||
markFree(fv, caller);
|
||||
} while (changedFreeVars);
|
||||
|
||||
for (val sym <- renamable.elements) {
|
||||
sym.name = unit.fresh.newName(sym.name.toString());
|
||||
if (settings.debug.value) log("renamed: " + sym.name);
|
||||
}
|
||||
|
||||
atPhase(phase.next) {
|
||||
for (val owner <- free.keys) {
|
||||
if (settings.debug.value)
|
||||
log("free(" + owner + owner.locationString + ") = " + free(owner).elements.toList);
|
||||
proxies(owner) =
|
||||
for (val fv <- free(owner).elements.toList) yield {
|
||||
val proxy = owner.newValue(owner.pos, fv.name)
|
||||
.setFlag(if (owner.isClass) PARAMACCESSOR | PRIVATE | LOCAL else PARAM)
|
||||
.setFlag(SYNTHETIC)
|
||||
.setInfo(fv.info);
|
||||
if (owner.isClass) owner.info.decls enter proxy;
|
||||
proxy
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def proxy(sym: Symbol) = {
|
||||
def searchIn(owner: Symbol): Symbol = {
|
||||
if (settings.debug.value) log("searching for " + sym + "(" + sym.owner + ") in " + owner + " " + enclMethOrClass(owner));//debug
|
||||
proxies.get(enclMethOrClass(owner)) match {
|
||||
case Some(ps) =>
|
||||
ps filter (p => p.name == sym.name) match {
|
||||
case List(p) => p
|
||||
case List() => searchIn(outer(owner))
|
||||
}
|
||||
case None => searchIn(outer(owner))
|
||||
}
|
||||
}
|
||||
if (settings.debug.value) log("proxy " + sym + " in " + sym.owner + " from " + currentOwner.ownerChain + " " + enclMethOrClass(sym.owner));//debug
|
||||
if (enclMethOrClass(sym.owner) == enclMethOrClass(currentOwner)) sym
|
||||
else searchIn(currentOwner)
|
||||
}
|
||||
|
||||
private def memberRef(sym: Symbol) = {
|
||||
val clazz = sym.owner.enclClass;
|
||||
val qual = if (clazz == currentOwner.enclClass) gen.This(clazz)
|
||||
else {
|
||||
sym resetFlag(LOCAL | PRIVATE);
|
||||
if (clazz.isStaticOwner) gen.mkQualifier(clazz.thisType)
|
||||
else outerPath(outerValue, clazz)
|
||||
}
|
||||
Select(qual, sym) setType sym.tpe
|
||||
}
|
||||
|
||||
private def proxyRef(sym: Symbol) = {
|
||||
if (sym.owner.isLabel) //
|
||||
gen.Ident(sym) // bq: account for the fact that LambdaLift does not know how to handle references to LabelDef parameters.
|
||||
else { //
|
||||
val psym = proxy(sym);
|
||||
if (psym.isLocal) gen.Ident(psym) else memberRef(psym)
|
||||
}
|
||||
}
|
||||
|
||||
private def addFreeArgs(pos: int, sym: Symbol, args: List[Tree]) = {
|
||||
def freeArg(fv: Symbol) = atPos(pos)(proxyRef(fv));
|
||||
val fvs = freeVars(sym).toList;
|
||||
if (fvs.isEmpty) args else args ::: (fvs map freeArg)
|
||||
}
|
||||
|
||||
private def addFreeParams(tree: Tree, sym: Symbol): Tree = proxies.get(sym) match {
|
||||
case Some(ps) =>
|
||||
val freeParams = ps map (p => ValDef(p) setPos tree.pos setType NoType);
|
||||
tree match {
|
||||
case DefDef(mods, name, tparams, List(vparams), tpt, rhs) =>
|
||||
sym.updateInfo(
|
||||
lifted(MethodType(sym.info.paramTypes ::: (ps map (.tpe)), sym.info.resultType)));
|
||||
copy.DefDef(tree, mods, name, tparams, List(vparams ::: freeParams), tpt, rhs)
|
||||
case ClassDef(mods, name, tparams, tpt, impl @ Template(parents, body)) =>
|
||||
copy.ClassDef(tree, mods, name, tparams, tpt,
|
||||
copy.Template(impl, parents, body ::: freeParams))
|
||||
}
|
||||
case None =>
|
||||
tree
|
||||
}
|
||||
|
||||
private def liftDef(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
sym.owner = sym.owner.enclClass;
|
||||
if (sym.isClass) sym.owner = sym.owner.toInterface;
|
||||
if (sym.isMethod) sym setFlag LIFTED;
|
||||
liftedDefs(sym.owner) += tree;
|
||||
sym.owner.info.decls enterUnique sym;
|
||||
if (settings.debug.value) log("lifted: " + sym + sym.locationString);
|
||||
EmptyTree
|
||||
}
|
||||
|
||||
private def postTransform(tree: Tree): Tree = {
|
||||
val sym = tree.symbol;
|
||||
tree match {
|
||||
case ClassDef(_, _, _, _, _) =>
|
||||
val tree1 = addFreeParams(tree, sym);
|
||||
if (sym.isLocal) liftDef(tree1) else tree1
|
||||
case DefDef(_, _, _, _, _, _) =>
|
||||
val tree1 = addFreeParams(tree, sym);
|
||||
if (sym.isLocal) liftDef(tree1) else tree1
|
||||
case ValDef(mods, name, tpt, rhs) =>
|
||||
if (sym.isCapturedVariable) {
|
||||
val tpt1 = TypeTree(sym.tpe) setPos tpt.pos;
|
||||
val rhs1 =
|
||||
atPos(rhs.pos) {
|
||||
typed {
|
||||
Apply(Select(New(TypeTree(sym.tpe)), nme.CONSTRUCTOR), List(rhs))
|
||||
}
|
||||
}
|
||||
copy.ValDef(tree, mods, name, tpt1, rhs1)
|
||||
} else tree
|
||||
case Return(Block(stats, value)) =>
|
||||
Block(stats, copy.Return(tree, value)) setType tree.tpe setPos tree.pos;
|
||||
case Return(expr) =>
|
||||
if (sym != currentOwner.enclMethod) {
|
||||
System.out.println(sym);//debug
|
||||
System.out.println(currentOwner.enclMethod);//debug
|
||||
unit.error(tree.pos, "non-local return not yet implemented");
|
||||
}
|
||||
tree
|
||||
case Apply(fn, args) =>
|
||||
copy.Apply(tree, fn, addFreeArgs(tree.pos, sym, args));
|
||||
case Assign(Apply(TypeApply(sel @ Select(qual, _), _), List()), rhs) =>
|
||||
// eliminate casts introduced by selecting a captured variable field
|
||||
// on the lhs of an assignment.
|
||||
assert(sel.symbol == Object_asInstanceOf);
|
||||
copy.Assign(tree, qual, rhs)
|
||||
case Ident(name) =>
|
||||
val tree1 =
|
||||
if (sym != NoSymbol && sym.isTerm && !sym.isLabel)
|
||||
if (sym.isMethod)
|
||||
atPos(tree.pos)(memberRef(sym))
|
||||
else if (sym.isLocal && enclMethOrClass(sym.owner) != enclMethOrClass(currentOwner))
|
||||
atPos(tree.pos)(proxyRef(sym))
|
||||
else tree
|
||||
else tree;
|
||||
if (sym.isCapturedVariable)
|
||||
atPos(tree.pos) {
|
||||
val tp = tree.tpe;
|
||||
val elemTree = typed { Select(tree1 setType sym.tpe, nme.elem) }
|
||||
if (elemTree.tpe.symbol != tp.symbol) gen.cast(elemTree, tp) else elemTree
|
||||
}
|
||||
else tree1
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
}
|
||||
|
||||
override def transform(tree: Tree): Tree = {
|
||||
postTransform(super.transform(tree) setType lifted(tree.tpe));
|
||||
}
|
||||
/** Transform statements and add lifted definitions to them. */
|
||||
override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] = {
|
||||
def addLifted(stat: Tree): Tree = stat match {
|
||||
case ClassDef(mods, name, tparams, tpt, impl @ Template(parents, body)) =>
|
||||
val result =
|
||||
if (liftedDefs(stat.symbol).hasNext) {
|
||||
val lifted = liftedDefs(stat.symbol).toList map addLifted;
|
||||
copy.ClassDef(stat, mods, name, tparams, tpt,
|
||||
copy.Template(impl, parents, body ::: lifted))
|
||||
} else stat;
|
||||
liftedDefs -= stat.symbol;
|
||||
result
|
||||
case _ =>
|
||||
stat
|
||||
}
|
||||
super.transformStats(stats, exprOwner) map addLifted
|
||||
}
|
||||
|
||||
override def transformUnit(unit: CompilationUnit): unit = {
|
||||
computeFreeVars;
|
||||
atPhase(phase.next)(super.transformUnit(unit));
|
||||
assert(liftedDefs.size == 0, liftedDefs.keys.toList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,365 +1,365 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab.Flags._;
|
||||
|
||||
/*<export>*/
|
||||
/** - uncurry all symbol and tree types (@see UnCurryPhase)
|
||||
* - for every curried parameter list: (ps_1) ... (ps_n) ==> (ps_1, ..., ps_n)
|
||||
* - for every curried application: f(args_1)...(args_n) ==> f(args_1, ..., args_n)
|
||||
* - for every type application: f[Ts] ==> f[Ts]() unless followed by parameters
|
||||
* - for every use of a parameterless function: f ==> f() and q.f ==> q.f()
|
||||
* - for every def-parameter: x: => T ==> x: () => T
|
||||
* - for every use of a def-parameter: x ==> x.apply()
|
||||
* - for every argument to a def parameter `x: => T':
|
||||
* if argument is not a reference to a def parameter:
|
||||
* convert argument `e' to (expansion of) `() => e'
|
||||
* - for every repated parameter `x: T*' --> x: Seq[a].
|
||||
* - for every argument list that corresponds to a repeated parameter
|
||||
* (a_1, ..., a_n) => (Seq(a_1, ..., a_n))
|
||||
* - for every argument list that is an escaped sequence
|
||||
* (a_1:_*) => (a_1)g
|
||||
* - convert implicit method types to method types
|
||||
* - convert non-trivial catches in try statements to matches
|
||||
*/
|
||||
/*</export>*/
|
||||
abstract class UnCurry extends InfoTransform {
|
||||
import global._; // the global environment
|
||||
import definitions._; // standard classes and methods
|
||||
import typer.{typed}; // methods to type trees
|
||||
import posAssigner.atPos; // for filling in tree positions
|
||||
|
||||
val phaseName: String = "uncurry";
|
||||
def newTransformer(unit: CompilationUnit): Transformer = new UnCurryTransformer(unit);
|
||||
override def changesBaseClasses = false;
|
||||
|
||||
private val uncurry = new TypeMap {
|
||||
def apply(tp: Type): Type = tp match {
|
||||
case MethodType(formals, MethodType(formals1, restpe)) =>
|
||||
apply(MethodType(formals ::: formals1, restpe))
|
||||
case mt: ImplicitMethodType =>
|
||||
apply(MethodType(mt.paramTypes, mt.resultType))
|
||||
case PolyType(List(), restpe) =>
|
||||
apply(MethodType(List(), restpe))
|
||||
case PolyType(tparams, restpe) =>
|
||||
PolyType(tparams, apply(MethodType(List(), restpe)))
|
||||
case TypeRef(pre, sym, List(arg)) if (sym == ByNameParamClass) =>
|
||||
apply(functionType(List(), arg))
|
||||
case TypeRef(pre, sym, args) if (sym == RepeatedParamClass) =>
|
||||
apply(rawTypeRef(pre, SeqClass, args));
|
||||
case _ =>
|
||||
mapOver(tp)
|
||||
}
|
||||
}
|
||||
|
||||
/** - return symbol's transformed type,
|
||||
* - if symbol is a def parameter with transformed type T, return () => T
|
||||
*/
|
||||
def transformInfo(sym: Symbol, tp: Type): Type =
|
||||
if (sym.isType) tp
|
||||
else uncurry(tp);
|
||||
|
||||
class UnCurryTransformer(unit: CompilationUnit) extends Transformer {
|
||||
|
||||
private var needTryLift = false;
|
||||
private var inPattern = false;
|
||||
private var inConstructorFlag = 0L;
|
||||
|
||||
override def transform(tree: Tree): Tree = try { //debug
|
||||
postTransform(mainTransform(tree));
|
||||
} catch {
|
||||
case ex: Throwable =>
|
||||
System.out.println("exception when traversing " + tree);
|
||||
throw ex
|
||||
}
|
||||
|
||||
/* Is tree a reference `x' to a call by name parameter that neeeds to be converted to
|
||||
* x.apply()? Note that this is not the case if `x' is used as an argument to another
|
||||
* call by name parameter.
|
||||
*/
|
||||
def isByNameRef(tree: Tree): boolean = (
|
||||
tree.isTerm && tree.hasSymbol &&
|
||||
tree.symbol.tpe.symbol == ByNameParamClass && tree.tpe == tree.symbol.tpe.typeArgs.head
|
||||
);
|
||||
|
||||
/** Uncurry a type of a tree node.
|
||||
* This function is sensitive to whether or not we are in a pattern -- when in a pattern
|
||||
* additional parameter sections of a case class are skipped.
|
||||
*/
|
||||
def uncurryTreeType(tp: Type): Type = tp match {
|
||||
case MethodType(formals, MethodType(formals1, restpe)) if (inPattern) =>
|
||||
uncurryTreeType(MethodType(formals, restpe))
|
||||
case _ =>
|
||||
uncurry(tp)
|
||||
}
|
||||
|
||||
/* Transform a function node (x_1,...,x_n) => body of type FunctionN[T_1, .., T_N, R] to
|
||||
*
|
||||
* class $anon() extends Object() with FunctionN[T_1, .., T_N, R] with ScalaObject {
|
||||
* def apply(x_1: T_1, ..., x_N: T_n): R = body
|
||||
* }
|
||||
* new $anon()
|
||||
*
|
||||
* transform a function node (x => body) of type PartialFunction[T, R] where
|
||||
* body = x match { case P_i if G_i => E_i }_i=1..n
|
||||
* to:
|
||||
*
|
||||
* class $anon() extends Object() with PartialFunction[T, R] with ScalaObject {
|
||||
* def apply(x: T): R = body;
|
||||
* def isDefinedAt(x: T): boolean = x match {
|
||||
* case P_1 if G_1 => true
|
||||
* ...
|
||||
* case P_n if G_n => true
|
||||
* case _ => false
|
||||
* }
|
||||
* }
|
||||
* new $anon()
|
||||
*
|
||||
* However, if one of the patterns P_i if G_i is a default pattern, generate instead
|
||||
*
|
||||
* def isDefinedAt(x: T): boolean = true
|
||||
*/
|
||||
def transformFunction(fun: Function): Tree = {
|
||||
val anonClass = fun.symbol.owner.newAnonymousFunctionClass(fun.pos)
|
||||
.setFlag(FINAL | SYNTHETIC | inConstructorFlag);
|
||||
val formals = fun.tpe.typeArgs.init;
|
||||
val restpe = fun.tpe.typeArgs.last;
|
||||
anonClass setInfo ClassInfoType(
|
||||
List(ObjectClass.tpe, fun.tpe, ScalaObjectClass.tpe), new Scope(), anonClass);
|
||||
val applyMethod = anonClass.newMethod(fun.pos, nme.apply)
|
||||
.setFlag(FINAL).setInfo(MethodType(formals, restpe));
|
||||
anonClass.info.decls enter applyMethod;
|
||||
for (val vparam <- fun.vparams) vparam.symbol.owner = applyMethod;
|
||||
new ChangeOwnerTraverser(fun.symbol, applyMethod).traverse(fun.body);
|
||||
var members = List(
|
||||
DefDef(Modifiers(FINAL), nme.apply, List(), List(fun.vparams), TypeTree(restpe), fun.body)
|
||||
setSymbol applyMethod);
|
||||
if (fun.tpe.symbol == PartialFunctionClass) {
|
||||
val isDefinedAtMethod = anonClass.newMethod(fun.pos, nme.isDefinedAt)
|
||||
.setFlag(FINAL).setInfo(MethodType(formals, BooleanClass.tpe));
|
||||
anonClass.info.decls enter isDefinedAtMethod;
|
||||
def idbody(idparam: Symbol) = fun.body match {
|
||||
case Match(_, cases) =>
|
||||
val substParam = new TreeSymSubstituter(List(fun.vparams.head.symbol), List(idparam));
|
||||
def transformCase(cdef: CaseDef): CaseDef =
|
||||
resetAttrs(CaseDef(cdef.pat.duplicate, cdef.guard.duplicate, Literal(true)));
|
||||
if (cases exists treeInfo.isDefaultCase) Literal(true)
|
||||
else
|
||||
Match(
|
||||
Ident(idparam),
|
||||
(cases map transformCase) :::
|
||||
List(CaseDef(Ident(nme.WILDCARD), EmptyTree, Literal(false))))
|
||||
}
|
||||
members = DefDef(isDefinedAtMethod, vparamss => idbody(vparamss.head.head)) :: members;
|
||||
}
|
||||
typer.atOwner(currentOwner).typed {
|
||||
atPos(fun.pos) {
|
||||
Block(
|
||||
List(ClassDef(anonClass, List(List()), List(List()), members)),
|
||||
Typed(
|
||||
New(TypeTree(anonClass.tpe), List(List())),
|
||||
TypeTree(fun.tpe)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def transformArgs(pos: int, args: List[Tree], formals: List[Type]) = {
|
||||
if (formals.isEmpty) {
|
||||
assert(args.isEmpty); List()
|
||||
} else {
|
||||
val args1 =
|
||||
formals.last match {
|
||||
case TypeRef(pre, sym, List(elempt)) if (sym == RepeatedParamClass) =>
|
||||
def mkSequence(args: List[Tree]) =
|
||||
atPos(pos)(ArrayValue(TypeTree(elempt), args) setType formals.last);
|
||||
if (args.isEmpty) List(mkSequence(args))
|
||||
else {
|
||||
val suffix = args.last match {
|
||||
case Typed(arg, Ident(name)) if name == nme.WILDCARD_STAR.toTypeName =>
|
||||
arg setType seqType(arg.tpe)
|
||||
case _ =>
|
||||
mkSequence(args.drop(formals.length - 1))
|
||||
}
|
||||
args.take(formals.length - 1) ::: List(suffix)
|
||||
}
|
||||
case _ => args
|
||||
}
|
||||
List.map2(formals, args1) ((formal, arg) =>
|
||||
if (formal.symbol != ByNameParamClass) arg
|
||||
else if (isByNameRef(arg)) arg setType functionType(List(), arg.tpe)
|
||||
else {
|
||||
val fun = typer.atOwner(currentOwner).typed(
|
||||
Function(List(), arg) setPos arg.pos).asInstanceOf[Function];
|
||||
new ChangeOwnerTraverser(currentOwner, fun.symbol).traverse(arg);
|
||||
transformFunction(fun)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
def mainTransform(tree: Tree): Tree = {
|
||||
|
||||
def withNeedLift(needLift: Boolean)(f: => Tree): Tree = {
|
||||
val savedNeedTryLift = needTryLift;
|
||||
needTryLift = needLift;
|
||||
val t = f;
|
||||
needTryLift = savedNeedTryLift;
|
||||
t
|
||||
}
|
||||
|
||||
def withInConstructorFlag(inConstructorFlag: long)(f: => Tree): Tree = {
|
||||
val savedInConstructorFlag = this.inConstructorFlag;
|
||||
this.inConstructorFlag = inConstructorFlag;
|
||||
val t = f;
|
||||
this.inConstructorFlag = savedInConstructorFlag;
|
||||
t
|
||||
}
|
||||
|
||||
tree match {
|
||||
case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
|
||||
withNeedLift(false) {
|
||||
if (tree.symbol.isConstructor) {
|
||||
atOwner(tree.symbol) {
|
||||
val rhs1 = rhs match {
|
||||
case Block(stat :: stats, expr) =>
|
||||
copy.Block(
|
||||
rhs,
|
||||
withInConstructorFlag(INCONSTRUCTOR) { transform(stat) } :: transformTrees(stats),
|
||||
transform(expr));
|
||||
case _ =>
|
||||
withInConstructorFlag(INCONSTRUCTOR) { transform(rhs) }
|
||||
}
|
||||
copy.DefDef(
|
||||
tree, mods, name, transformAbsTypeDefs(tparams),
|
||||
transformValDefss(vparamss), transform(tpt), rhs1)
|
||||
}
|
||||
} else {
|
||||
super.transform(tree)
|
||||
}
|
||||
}
|
||||
|
||||
case ValDef(_, _, _, rhs)
|
||||
if (!tree.symbol.owner.isSourceMethod) =>
|
||||
withNeedLift(true) { super.transform(tree) }
|
||||
|
||||
|
||||
case Apply(Select(Block(List(), Function(vparams, body)), nme.apply), args) =>
|
||||
// perform beta-reduction; this helps keep view applications small
|
||||
withNeedLift(true) {
|
||||
mainTransform(new TreeSubstituter(vparams map (.symbol), args).transform(body))
|
||||
}
|
||||
|
||||
case Apply(fn, args) =>
|
||||
if (settings.noassertions.value &&
|
||||
fn.symbol != null &&
|
||||
(fn.symbol.name == nme.assert_ || fn.symbol.name == nme.assume_) &&
|
||||
fn.symbol.owner == PredefModule.moduleClass) {
|
||||
Literal(()).setPos(tree.pos).setType(UnitClass.tpe)
|
||||
} else {
|
||||
withNeedLift(true) {
|
||||
val formals = fn.tpe.paramTypes;
|
||||
copy.Apply(tree, transform(fn), transformTrees(transformArgs(tree.pos, args, formals)))
|
||||
}
|
||||
}
|
||||
|
||||
case Assign(Select(_, _), _) =>
|
||||
withNeedLift(true) { super.transform(tree) }
|
||||
|
||||
case Try(block, catches, finalizer) =>
|
||||
if (needTryLift) {
|
||||
if (settings.debug.value)
|
||||
log("lifting try at: " + unit.position(tree.pos));
|
||||
|
||||
val sym = currentOwner.newMethod(tree.pos, unit.fresh.newName("liftedTry"));
|
||||
sym.setInfo(MethodType(List(), tree.tpe));
|
||||
new ChangeOwnerTraverser(currentOwner, sym).traverse(tree);
|
||||
|
||||
transform(typed(atPos(tree.pos)(
|
||||
Block(List(DefDef(sym, List(List()), tree)),
|
||||
Apply(Ident(sym), Nil)))))
|
||||
} else
|
||||
super.transform(tree)
|
||||
|
||||
case CaseDef(pat, guard, body) =>
|
||||
inPattern = true;
|
||||
val pat1 = transform(pat);
|
||||
inPattern = false;
|
||||
copy.CaseDef(tree, pat1, transform(guard), transform(body))
|
||||
|
||||
case fun @ Function(_, _) =>
|
||||
mainTransform(transformFunction(fun))
|
||||
|
||||
case Template(_, _) =>
|
||||
withInConstructorFlag(0) { super.transform(tree) }
|
||||
|
||||
case _ =>
|
||||
val tree1 = super.transform(tree);
|
||||
if (isByNameRef(tree1))
|
||||
typed(atPos(tree1.pos)(
|
||||
Apply(Select(tree1 setType functionType(List(), tree1.tpe), nme.apply), List())))
|
||||
else tree1;
|
||||
}
|
||||
} setType uncurryTreeType(tree.tpe);
|
||||
|
||||
def postTransform(tree: Tree): Tree = atPhase(phase.next) {
|
||||
def applyUnary(tree: Tree): Tree =
|
||||
if (tree.symbol.isMethod && (!tree.tpe.isInstanceOf[PolyType] || tree.tpe.typeParams.isEmpty)) {
|
||||
if (!tree.tpe.isInstanceOf[MethodType]) tree.tpe = MethodType(List(), tree.tpe);
|
||||
atPos(tree.pos)(Apply(tree, List()) setType tree.tpe.resultType)
|
||||
} else if (tree.isType && !tree.isInstanceOf[TypeTree]) {
|
||||
TypeTree(tree.tpe) setPos tree.pos
|
||||
} else {
|
||||
tree
|
||||
}
|
||||
tree match {
|
||||
case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
|
||||
copy.DefDef(tree, mods, name, tparams, List(List.flatten(vparamss)), tpt, rhs);
|
||||
case Try(body, catches, finalizer) =>
|
||||
if (catches forall treeInfo.isCatchCase) tree
|
||||
else {
|
||||
val exname = unit.fresh.newName("ex$");
|
||||
val cases =
|
||||
if (catches exists treeInfo.isDefaultCase) catches
|
||||
else catches ::: List(CaseDef(Ident(nme.WILDCARD), EmptyTree, Throw(Ident(exname))));
|
||||
val catchall =
|
||||
atPos(tree.pos) {
|
||||
CaseDef(
|
||||
Bind(exname, Ident(nme.WILDCARD)),
|
||||
EmptyTree,
|
||||
Match(Ident(exname), cases))
|
||||
}
|
||||
if (settings.debug.value) log("rewrote try: " + catches + " ==> " + catchall);
|
||||
val catches1 = typer.atOwner(currentOwner).typedCases(
|
||||
tree, List(catchall), ThrowableClass.tpe, WildcardType);
|
||||
copy.Try(tree, body, catches1, finalizer)
|
||||
}
|
||||
case Apply(Apply(fn, args), args1) =>
|
||||
copy.Apply(tree, fn, args ::: args1)
|
||||
case Ident(name) =>
|
||||
if (name == nme.WILDCARD_STAR.toTypeName)
|
||||
unit.error(tree.pos, " argument does not correspond to `*'-parameter");
|
||||
applyUnary(tree);
|
||||
case Select(_, _) =>
|
||||
applyUnary(tree)
|
||||
case TypeApply(_, _) =>
|
||||
applyUnary(tree)
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val resetAttrs = new Traverser {
|
||||
override def traverse(tree: Tree): unit = tree match {
|
||||
case EmptyTree | TypeTree() =>
|
||||
;
|
||||
case _ =>
|
||||
if (tree.hasSymbol) tree.symbol = NoSymbol;
|
||||
tree.tpe = null;
|
||||
super.traverse(tree)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.transform;
|
||||
|
||||
import symtab.Flags._;
|
||||
|
||||
/*<export>*/
|
||||
/** - uncurry all symbol and tree types (@see UnCurryPhase)
|
||||
* - for every curried parameter list: (ps_1) ... (ps_n) ==> (ps_1, ..., ps_n)
|
||||
* - for every curried application: f(args_1)...(args_n) ==> f(args_1, ..., args_n)
|
||||
* - for every type application: f[Ts] ==> f[Ts]() unless followed by parameters
|
||||
* - for every use of a parameterless function: f ==> f() and q.f ==> q.f()
|
||||
* - for every def-parameter: x: => T ==> x: () => T
|
||||
* - for every use of a def-parameter: x ==> x.apply()
|
||||
* - for every argument to a def parameter `x: => T':
|
||||
* if argument is not a reference to a def parameter:
|
||||
* convert argument `e' to (expansion of) `() => e'
|
||||
* - for every repated parameter `x: T*' --> x: Seq[a].
|
||||
* - for every argument list that corresponds to a repeated parameter
|
||||
* (a_1, ..., a_n) => (Seq(a_1, ..., a_n))
|
||||
* - for every argument list that is an escaped sequence
|
||||
* (a_1:_*) => (a_1)g
|
||||
* - convert implicit method types to method types
|
||||
* - convert non-trivial catches in try statements to matches
|
||||
*/
|
||||
/*</export>*/
|
||||
abstract class UnCurry extends InfoTransform {
|
||||
import global._; // the global environment
|
||||
import definitions._; // standard classes and methods
|
||||
import typer.{typed}; // methods to type trees
|
||||
import posAssigner.atPos; // for filling in tree positions
|
||||
|
||||
val phaseName: String = "uncurry";
|
||||
def newTransformer(unit: CompilationUnit): Transformer = new UnCurryTransformer(unit);
|
||||
override def changesBaseClasses = false;
|
||||
|
||||
private val uncurry = new TypeMap {
|
||||
def apply(tp: Type): Type = tp match {
|
||||
case MethodType(formals, MethodType(formals1, restpe)) =>
|
||||
apply(MethodType(formals ::: formals1, restpe))
|
||||
case mt: ImplicitMethodType =>
|
||||
apply(MethodType(mt.paramTypes, mt.resultType))
|
||||
case PolyType(List(), restpe) =>
|
||||
apply(MethodType(List(), restpe))
|
||||
case PolyType(tparams, restpe) =>
|
||||
PolyType(tparams, apply(MethodType(List(), restpe)))
|
||||
case TypeRef(pre, sym, List(arg)) if (sym == ByNameParamClass) =>
|
||||
apply(functionType(List(), arg))
|
||||
case TypeRef(pre, sym, args) if (sym == RepeatedParamClass) =>
|
||||
apply(rawTypeRef(pre, SeqClass, args));
|
||||
case _ =>
|
||||
mapOver(tp)
|
||||
}
|
||||
}
|
||||
|
||||
/** - return symbol's transformed type,
|
||||
* - if symbol is a def parameter with transformed type T, return () => T
|
||||
*/
|
||||
def transformInfo(sym: Symbol, tp: Type): Type =
|
||||
if (sym.isType) tp
|
||||
else uncurry(tp);
|
||||
|
||||
class UnCurryTransformer(unit: CompilationUnit) extends Transformer {
|
||||
|
||||
private var needTryLift = false;
|
||||
private var inPattern = false;
|
||||
private var inConstructorFlag = 0L;
|
||||
|
||||
override def transform(tree: Tree): Tree = try { //debug
|
||||
postTransform(mainTransform(tree));
|
||||
} catch {
|
||||
case ex: Throwable =>
|
||||
System.out.println("exception when traversing " + tree);
|
||||
throw ex
|
||||
}
|
||||
|
||||
/* Is tree a reference `x' to a call by name parameter that neeeds to be converted to
|
||||
* x.apply()? Note that this is not the case if `x' is used as an argument to another
|
||||
* call by name parameter.
|
||||
*/
|
||||
def isByNameRef(tree: Tree): boolean = (
|
||||
tree.isTerm && tree.hasSymbol &&
|
||||
tree.symbol.tpe.symbol == ByNameParamClass && tree.tpe == tree.symbol.tpe.typeArgs.head
|
||||
);
|
||||
|
||||
/** Uncurry a type of a tree node.
|
||||
* This function is sensitive to whether or not we are in a pattern -- when in a pattern
|
||||
* additional parameter sections of a case class are skipped.
|
||||
*/
|
||||
def uncurryTreeType(tp: Type): Type = tp match {
|
||||
case MethodType(formals, MethodType(formals1, restpe)) if (inPattern) =>
|
||||
uncurryTreeType(MethodType(formals, restpe))
|
||||
case _ =>
|
||||
uncurry(tp)
|
||||
}
|
||||
|
||||
/* Transform a function node (x_1,...,x_n) => body of type FunctionN[T_1, .., T_N, R] to
|
||||
*
|
||||
* class $anon() extends Object() with FunctionN[T_1, .., T_N, R] with ScalaObject {
|
||||
* def apply(x_1: T_1, ..., x_N: T_n): R = body
|
||||
* }
|
||||
* new $anon()
|
||||
*
|
||||
* transform a function node (x => body) of type PartialFunction[T, R] where
|
||||
* body = x match { case P_i if G_i => E_i }_i=1..n
|
||||
* to:
|
||||
*
|
||||
* class $anon() extends Object() with PartialFunction[T, R] with ScalaObject {
|
||||
* def apply(x: T): R = body;
|
||||
* def isDefinedAt(x: T): boolean = x match {
|
||||
* case P_1 if G_1 => true
|
||||
* ...
|
||||
* case P_n if G_n => true
|
||||
* case _ => false
|
||||
* }
|
||||
* }
|
||||
* new $anon()
|
||||
*
|
||||
* However, if one of the patterns P_i if G_i is a default pattern, generate instead
|
||||
*
|
||||
* def isDefinedAt(x: T): boolean = true
|
||||
*/
|
||||
def transformFunction(fun: Function): Tree = {
|
||||
val anonClass = fun.symbol.owner.newAnonymousFunctionClass(fun.pos)
|
||||
.setFlag(FINAL | SYNTHETIC | inConstructorFlag);
|
||||
val formals = fun.tpe.typeArgs.init;
|
||||
val restpe = fun.tpe.typeArgs.last;
|
||||
anonClass setInfo ClassInfoType(
|
||||
List(ObjectClass.tpe, fun.tpe, ScalaObjectClass.tpe), new Scope(), anonClass);
|
||||
val applyMethod = anonClass.newMethod(fun.pos, nme.apply)
|
||||
.setFlag(FINAL).setInfo(MethodType(formals, restpe));
|
||||
anonClass.info.decls enter applyMethod;
|
||||
for (val vparam <- fun.vparams) vparam.symbol.owner = applyMethod;
|
||||
new ChangeOwnerTraverser(fun.symbol, applyMethod).traverse(fun.body);
|
||||
var members = List(
|
||||
DefDef(Modifiers(FINAL), nme.apply, List(), List(fun.vparams), TypeTree(restpe), fun.body)
|
||||
setSymbol applyMethod);
|
||||
if (fun.tpe.symbol == PartialFunctionClass) {
|
||||
val isDefinedAtMethod = anonClass.newMethod(fun.pos, nme.isDefinedAt)
|
||||
.setFlag(FINAL).setInfo(MethodType(formals, BooleanClass.tpe));
|
||||
anonClass.info.decls enter isDefinedAtMethod;
|
||||
def idbody(idparam: Symbol) = fun.body match {
|
||||
case Match(_, cases) =>
|
||||
val substParam = new TreeSymSubstituter(List(fun.vparams.head.symbol), List(idparam));
|
||||
def transformCase(cdef: CaseDef): CaseDef =
|
||||
resetAttrs(CaseDef(cdef.pat.duplicate, cdef.guard.duplicate, Literal(true)));
|
||||
if (cases exists treeInfo.isDefaultCase) Literal(true)
|
||||
else
|
||||
Match(
|
||||
Ident(idparam),
|
||||
(cases map transformCase) :::
|
||||
List(CaseDef(Ident(nme.WILDCARD), EmptyTree, Literal(false))))
|
||||
}
|
||||
members = DefDef(isDefinedAtMethod, vparamss => idbody(vparamss.head.head)) :: members;
|
||||
}
|
||||
typer.atOwner(currentOwner).typed {
|
||||
atPos(fun.pos) {
|
||||
Block(
|
||||
List(ClassDef(anonClass, List(List()), List(List()), members)),
|
||||
Typed(
|
||||
New(TypeTree(anonClass.tpe), List(List())),
|
||||
TypeTree(fun.tpe)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def transformArgs(pos: int, args: List[Tree], formals: List[Type]) = {
|
||||
if (formals.isEmpty) {
|
||||
assert(args.isEmpty); List()
|
||||
} else {
|
||||
val args1 =
|
||||
formals.last match {
|
||||
case TypeRef(pre, sym, List(elempt)) if (sym == RepeatedParamClass) =>
|
||||
def mkSequence(args: List[Tree]) =
|
||||
atPos(pos)(ArrayValue(TypeTree(elempt), args) setType formals.last);
|
||||
if (args.isEmpty) List(mkSequence(args))
|
||||
else {
|
||||
val suffix = args.last match {
|
||||
case Typed(arg, Ident(name)) if name == nme.WILDCARD_STAR.toTypeName =>
|
||||
arg setType seqType(arg.tpe)
|
||||
case _ =>
|
||||
mkSequence(args.drop(formals.length - 1))
|
||||
}
|
||||
args.take(formals.length - 1) ::: List(suffix)
|
||||
}
|
||||
case _ => args
|
||||
}
|
||||
List.map2(formals, args1) ((formal, arg) =>
|
||||
if (formal.symbol != ByNameParamClass) arg
|
||||
else if (isByNameRef(arg)) arg setType functionType(List(), arg.tpe)
|
||||
else {
|
||||
val fun = typer.atOwner(currentOwner).typed(
|
||||
Function(List(), arg) setPos arg.pos).asInstanceOf[Function];
|
||||
new ChangeOwnerTraverser(currentOwner, fun.symbol).traverse(arg);
|
||||
transformFunction(fun)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
def mainTransform(tree: Tree): Tree = {
|
||||
|
||||
def withNeedLift(needLift: Boolean)(f: => Tree): Tree = {
|
||||
val savedNeedTryLift = needTryLift;
|
||||
needTryLift = needLift;
|
||||
val t = f;
|
||||
needTryLift = savedNeedTryLift;
|
||||
t
|
||||
}
|
||||
|
||||
def withInConstructorFlag(inConstructorFlag: long)(f: => Tree): Tree = {
|
||||
val savedInConstructorFlag = this.inConstructorFlag;
|
||||
this.inConstructorFlag = inConstructorFlag;
|
||||
val t = f;
|
||||
this.inConstructorFlag = savedInConstructorFlag;
|
||||
t
|
||||
}
|
||||
|
||||
tree match {
|
||||
case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
|
||||
withNeedLift(false) {
|
||||
if (tree.symbol.isConstructor) {
|
||||
atOwner(tree.symbol) {
|
||||
val rhs1 = rhs match {
|
||||
case Block(stat :: stats, expr) =>
|
||||
copy.Block(
|
||||
rhs,
|
||||
withInConstructorFlag(INCONSTRUCTOR) { transform(stat) } :: transformTrees(stats),
|
||||
transform(expr));
|
||||
case _ =>
|
||||
withInConstructorFlag(INCONSTRUCTOR) { transform(rhs) }
|
||||
}
|
||||
copy.DefDef(
|
||||
tree, mods, name, transformAbsTypeDefs(tparams),
|
||||
transformValDefss(vparamss), transform(tpt), rhs1)
|
||||
}
|
||||
} else {
|
||||
super.transform(tree)
|
||||
}
|
||||
}
|
||||
|
||||
case ValDef(_, _, _, rhs)
|
||||
if (!tree.symbol.owner.isSourceMethod) =>
|
||||
withNeedLift(true) { super.transform(tree) }
|
||||
|
||||
|
||||
case Apply(Select(Block(List(), Function(vparams, body)), nme.apply), args) =>
|
||||
// perform beta-reduction; this helps keep view applications small
|
||||
withNeedLift(true) {
|
||||
mainTransform(new TreeSubstituter(vparams map (.symbol), args).transform(body))
|
||||
}
|
||||
|
||||
case Apply(fn, args) =>
|
||||
if (settings.noassertions.value &&
|
||||
fn.symbol != null &&
|
||||
(fn.symbol.name == nme.assert_ || fn.symbol.name == nme.assume_) &&
|
||||
fn.symbol.owner == PredefModule.moduleClass) {
|
||||
Literal(()).setPos(tree.pos).setType(UnitClass.tpe)
|
||||
} else {
|
||||
withNeedLift(true) {
|
||||
val formals = fn.tpe.paramTypes;
|
||||
copy.Apply(tree, transform(fn), transformTrees(transformArgs(tree.pos, args, formals)))
|
||||
}
|
||||
}
|
||||
|
||||
case Assign(Select(_, _), _) =>
|
||||
withNeedLift(true) { super.transform(tree) }
|
||||
|
||||
case Try(block, catches, finalizer) =>
|
||||
if (needTryLift) {
|
||||
if (settings.debug.value)
|
||||
log("lifting try at: " + unit.position(tree.pos));
|
||||
|
||||
val sym = currentOwner.newMethod(tree.pos, unit.fresh.newName("liftedTry"));
|
||||
sym.setInfo(MethodType(List(), tree.tpe));
|
||||
new ChangeOwnerTraverser(currentOwner, sym).traverse(tree);
|
||||
|
||||
transform(typed(atPos(tree.pos)(
|
||||
Block(List(DefDef(sym, List(List()), tree)),
|
||||
Apply(Ident(sym), Nil)))))
|
||||
} else
|
||||
super.transform(tree)
|
||||
|
||||
case CaseDef(pat, guard, body) =>
|
||||
inPattern = true;
|
||||
val pat1 = transform(pat);
|
||||
inPattern = false;
|
||||
copy.CaseDef(tree, pat1, transform(guard), transform(body))
|
||||
|
||||
case fun @ Function(_, _) =>
|
||||
mainTransform(transformFunction(fun))
|
||||
|
||||
case Template(_, _) =>
|
||||
withInConstructorFlag(0) { super.transform(tree) }
|
||||
|
||||
case _ =>
|
||||
val tree1 = super.transform(tree);
|
||||
if (isByNameRef(tree1))
|
||||
typed(atPos(tree1.pos)(
|
||||
Apply(Select(tree1 setType functionType(List(), tree1.tpe), nme.apply), List())))
|
||||
else tree1;
|
||||
}
|
||||
} setType uncurryTreeType(tree.tpe);
|
||||
|
||||
def postTransform(tree: Tree): Tree = atPhase(phase.next) {
|
||||
def applyUnary(tree: Tree): Tree =
|
||||
if (tree.symbol.isMethod && (!tree.tpe.isInstanceOf[PolyType] || tree.tpe.typeParams.isEmpty)) {
|
||||
if (!tree.tpe.isInstanceOf[MethodType]) tree.tpe = MethodType(List(), tree.tpe);
|
||||
atPos(tree.pos)(Apply(tree, List()) setType tree.tpe.resultType)
|
||||
} else if (tree.isType && !tree.isInstanceOf[TypeTree]) {
|
||||
TypeTree(tree.tpe) setPos tree.pos
|
||||
} else {
|
||||
tree
|
||||
}
|
||||
tree match {
|
||||
case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
|
||||
copy.DefDef(tree, mods, name, tparams, List(List.flatten(vparamss)), tpt, rhs);
|
||||
case Try(body, catches, finalizer) =>
|
||||
if (catches forall treeInfo.isCatchCase) tree
|
||||
else {
|
||||
val exname = unit.fresh.newName("ex$");
|
||||
val cases =
|
||||
if (catches exists treeInfo.isDefaultCase) catches
|
||||
else catches ::: List(CaseDef(Ident(nme.WILDCARD), EmptyTree, Throw(Ident(exname))));
|
||||
val catchall =
|
||||
atPos(tree.pos) {
|
||||
CaseDef(
|
||||
Bind(exname, Ident(nme.WILDCARD)),
|
||||
EmptyTree,
|
||||
Match(Ident(exname), cases))
|
||||
}
|
||||
if (settings.debug.value) log("rewrote try: " + catches + " ==> " + catchall);
|
||||
val catches1 = typer.atOwner(currentOwner).typedCases(
|
||||
tree, List(catchall), ThrowableClass.tpe, WildcardType);
|
||||
copy.Try(tree, body, catches1, finalizer)
|
||||
}
|
||||
case Apply(Apply(fn, args), args1) =>
|
||||
copy.Apply(tree, fn, args ::: args1)
|
||||
case Ident(name) =>
|
||||
if (name == nme.WILDCARD_STAR.toTypeName)
|
||||
unit.error(tree.pos, " argument does not correspond to `*'-parameter");
|
||||
applyUnary(tree);
|
||||
case Select(_, _) =>
|
||||
applyUnary(tree)
|
||||
case TypeApply(_, _) =>
|
||||
applyUnary(tree)
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val resetAttrs = new Traverser {
|
||||
override def traverse(tree: Tree): unit = tree match {
|
||||
case EmptyTree | TypeTree() =>
|
||||
;
|
||||
case _ =>
|
||||
if (tree.hasSymbol) tree.symbol = NoSymbol;
|
||||
tree.tpe = null;
|
||||
super.traverse(tree)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,330 +1,330 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import symtab.Flags._;
|
||||
import scala.tools.nsc.util.Position;
|
||||
|
||||
[_trait_] abstract class Contexts: Analyzer {
|
||||
import global._;
|
||||
|
||||
val NoContext = new Context {
|
||||
override def implicitss: List[List[ImplicitInfo]] = List();
|
||||
}
|
||||
NoContext.enclClass = NoContext;
|
||||
|
||||
val startContext = {
|
||||
import definitions._;
|
||||
var sc = NoContext.make(
|
||||
Template(List(), List()) setSymbol NoSymbol setType NoType,
|
||||
definitions.RootClass,
|
||||
definitions.RootClass.info.decls);
|
||||
def addImport(pkg: Symbol): unit = {
|
||||
val qual = gen.mkStableRef(pkg);
|
||||
sc = sc.makeNewImport(
|
||||
Import(qual, List(Pair(nme.WILDCARD, null)))
|
||||
setSymbol NoSymbol.newImport(Position.NOPOS).setInfo(ImportType(qual))
|
||||
setType NoType);
|
||||
sc.depth = sc.depth + 1
|
||||
}
|
||||
if (!settings.noimports.value) {
|
||||
addImport(JavaLangPackage);
|
||||
addImport(ScalaPackage);
|
||||
if (!settings.nopredefs.value)
|
||||
addImport(PredefModule);
|
||||
}
|
||||
sc
|
||||
}
|
||||
|
||||
def resetContexts: unit = {
|
||||
var sc = startContext;
|
||||
while (sc != NoContext) {
|
||||
sc.tree match {
|
||||
case Import(qual, _) => qual.tpe = singleType(qual.symbol.owner.thisType, qual.symbol);
|
||||
case _ =>
|
||||
}
|
||||
sc = sc.outer
|
||||
}
|
||||
}
|
||||
|
||||
class Context {
|
||||
var unit: CompilationUnit = _;
|
||||
var tree: Tree = _; // Tree associated with this context
|
||||
var owner: Symbol = NoSymbol; // The current owner
|
||||
var scope: Scope = _; // The current scope
|
||||
var outer: Context = _; // The next outer context
|
||||
var enclClass: Context = _; // The next outer context whose tree is a
|
||||
// template or package definition
|
||||
var variance: int = _; // Variance relative to enclosing class.
|
||||
private var _undetparams: List[Symbol] = List(); // Undetermined type parameters
|
||||
var depth: int = 0;
|
||||
var imports: List[ImportInfo] = List();
|
||||
|
||||
var prefix: Type = NoPrefix;
|
||||
var inConstructorSuffix = false; // are we in a secondary constructor
|
||||
// after the this constructor call?
|
||||
var reportAmbiguousErrors = false;
|
||||
var reportGeneralErrors = false;
|
||||
var checking = false;
|
||||
|
||||
var savedTypeBounds: List[Pair[Symbol, Type]] = List();
|
||||
|
||||
def undetparams = _undetparams;
|
||||
def undetparams_=(ps: List[Symbol]) = {
|
||||
//System.out.println("undetparams = " + ps);//debug
|
||||
_undetparams = ps
|
||||
}
|
||||
|
||||
def make(unit: CompilationUnit, tree: Tree, owner: Symbol, scope: Scope, imports: List[ImportInfo]): Context = {
|
||||
val c = new Context;
|
||||
c.unit = unit;
|
||||
c.tree = tree;
|
||||
c.owner = owner;
|
||||
c.scope = scope;
|
||||
tree match {
|
||||
case Template(_, _) | PackageDef(_, _) =>
|
||||
c.enclClass = c;
|
||||
c.prefix = skolemizedThisType(this.tree, this.prefix, c.owner);
|
||||
c.inConstructorSuffix = false;
|
||||
case _ =>
|
||||
c.enclClass = this.enclClass;
|
||||
c.prefix = if (c.owner != this.owner && c.owner.isTerm) NoPrefix else this.prefix;
|
||||
c.inConstructorSuffix = this.inConstructorSuffix;
|
||||
}
|
||||
c.variance = this.variance;
|
||||
c.depth = if (scope == this.scope) this.depth else this.depth + 1;
|
||||
c.imports = imports;
|
||||
c.reportAmbiguousErrors = this.reportAmbiguousErrors;
|
||||
c.reportGeneralErrors = this.reportGeneralErrors;
|
||||
c.checking = this.checking;
|
||||
c.outer = this;
|
||||
c
|
||||
}
|
||||
|
||||
def make(unit: CompilationUnit): Context = {
|
||||
val c = make(unit, EmptyTree, owner, scope, imports);
|
||||
c.reportAmbiguousErrors = true;
|
||||
c.reportGeneralErrors = true;
|
||||
c
|
||||
}
|
||||
|
||||
def makeNewImport(imp: Import): Context =
|
||||
make(unit, imp, owner, scope, new ImportInfo(imp, depth) :: imports);
|
||||
|
||||
def make(tree: Tree, owner: Symbol, scope: Scope): Context =
|
||||
make(unit, tree, owner, scope, imports);
|
||||
|
||||
def makeNewScope(tree: Tree, owner: Symbol): Context =
|
||||
make(tree, owner, new Scope(scope));
|
||||
|
||||
def make(tree: Tree, owner: Symbol): Context =
|
||||
make(tree, owner, scope);
|
||||
|
||||
def make(tree: Tree): Context =
|
||||
make(tree, owner);
|
||||
|
||||
def makeImplicit(reportAmbiguousErrors: boolean) = {
|
||||
val c = make(tree);
|
||||
c.reportAmbiguousErrors = reportAmbiguousErrors;
|
||||
c.reportGeneralErrors = false;
|
||||
c
|
||||
}
|
||||
|
||||
def makeConstructorContext = {
|
||||
val baseContext = enclClass.outer;
|
||||
val argContext = baseContext.makeNewScope(tree, owner);
|
||||
for (val sym <- scope.toList) argContext.scope enter sym;
|
||||
argContext
|
||||
}
|
||||
|
||||
def makeConstructorSuffixContext = {
|
||||
val c = make(tree);
|
||||
c.inConstructorSuffix = true;
|
||||
c
|
||||
}
|
||||
|
||||
def skolemizedThisType(encl: Tree, pre: Type, clazz: Symbol): Type = if (settings.Xgadt.value) {
|
||||
encl match {
|
||||
case ClassDef(_, _, tparamdefs, _, _) =>
|
||||
System.out.println("sktt " + clazz);
|
||||
if (!tparamdefs.isEmpty || pre.isInstanceOf[SingleType]) {
|
||||
val tparams = clazz.unsafeTypeParams;
|
||||
val tskolems = tparamdefs map (.symbol);
|
||||
System.out.println("sktt2 " + tparams + " " + tskolems);
|
||||
val self = clazz.newThisSkolem setInfo clazz.typeOfThis.substSym(tparams, tskolems);
|
||||
singleType(pre, self)
|
||||
} else clazz.thisType
|
||||
case _ =>
|
||||
clazz.thisType
|
||||
}
|
||||
} else clazz.thisType;
|
||||
|
||||
def error(pos: int, msg: String): unit =
|
||||
if (reportGeneralErrors)
|
||||
unit.error(pos, if (checking) "**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg)
|
||||
else
|
||||
throw new TypeError(msg);
|
||||
|
||||
def ambiguousError(pos: int, pre: Type, sym1: Symbol, sym2: Symbol, rest: String): unit = {
|
||||
val msg =
|
||||
("ambiguous reference to overloaded definition,\n" +
|
||||
"both " + sym1 + sym1.locationString + " of type " + pre.memberType(sym1) +
|
||||
"\nand " + sym2 + sym2.locationString + " of type " + pre.memberType(sym2) +
|
||||
"\nmatch " + rest);
|
||||
if (reportAmbiguousErrors) unit.error(pos, msg)
|
||||
else throw new TypeError(msg);
|
||||
}
|
||||
|
||||
def outerContext(clazz: Symbol): Context = {
|
||||
var c = this;
|
||||
while (c != NoContext && c.owner != clazz) c = c.outer.enclClass;
|
||||
c
|
||||
}
|
||||
|
||||
def isLocal(): boolean = tree match {
|
||||
case Block(_,_) => true
|
||||
case PackageDef(_, _) => false
|
||||
case EmptyTree => false
|
||||
case _ => outer.isLocal()
|
||||
}
|
||||
|
||||
def nextEnclosing(p: Context => boolean): Context =
|
||||
if (this == NoContext || p(this)) this else outer.nextEnclosing(p);
|
||||
|
||||
override def toString(): String = {
|
||||
if (this == NoContext) "NoContext";
|
||||
else owner.toString() + " @ " + tree.getClass() + " " + tree.toString() + ", scope = " + scope.hashCode() + " " + scope.toList + "\n:: " + outer.toString()
|
||||
}
|
||||
|
||||
/** Is `sym' accessible as a member of tree `site' with type `pre' in current context?
|
||||
*/
|
||||
def isAccessible(sym: Symbol, pre: Type, superAccess: boolean): boolean = {
|
||||
|
||||
/** Are we inside definition of `owner'? */
|
||||
def accessWithin(owner: Symbol): boolean = {
|
||||
var c = this;
|
||||
while (c != NoContext && c.owner != owner) {
|
||||
if (c.outer == null) assert(false, "accessWithin(" + owner + ") " + c);//debug
|
||||
if (c.outer.enclClass == null) assert(false, "accessWithin(" + owner + ") " + c);//debug
|
||||
c = c.outer.enclClass;
|
||||
}
|
||||
c != NoContext
|
||||
}
|
||||
|
||||
/** Is `clazz' a subclass of an enclosing class? */
|
||||
def isSubClassOfEnclosing(clazz: Symbol): boolean = {
|
||||
var c = this;
|
||||
while (c != NoContext && !clazz.isSubClass(c.owner)) c = c.outer.enclClass;
|
||||
c != NoContext;
|
||||
}
|
||||
|
||||
(pre == NoPrefix
|
||||
||
|
||||
(!sym.hasFlag(PRIVATE | PROTECTED))
|
||||
||
|
||||
accessWithin(sym.owner) && (!sym.hasFlag(LOCAL) || pre =:= sym.owner.thisType)
|
||||
||
|
||||
(!sym.hasFlag(PRIVATE) &&
|
||||
(superAccess ||
|
||||
(pre.widen.symbol.isSubClass(sym.owner) && isSubClassOfEnclosing(pre.widen.symbol)))))
|
||||
}
|
||||
|
||||
def pushTypeBounds(sym: Symbol): unit = {
|
||||
savedTypeBounds = Pair(sym, sym.info) :: savedTypeBounds
|
||||
}
|
||||
|
||||
def restoreTypeBounds: unit = {
|
||||
for (val Pair(sym, info) <- savedTypeBounds) {
|
||||
System.out.println("resetting " + sym + " to " + info);
|
||||
sym.setInfo(info);
|
||||
}
|
||||
savedTypeBounds = List()
|
||||
}
|
||||
|
||||
private var implicitsCache: List[List[ImplicitInfo]] = null;
|
||||
private var implicitsRun: CompilerRun = NoRun;
|
||||
|
||||
private def collectImplicits(syms: List[Symbol], pre: Type): List[ImplicitInfo] =
|
||||
for (val sym <- syms; sym.hasFlag(IMPLICIT) && isAccessible(sym, pre, false))
|
||||
yield ImplicitInfo(sym.name, pre.memberType(sym), sym);
|
||||
|
||||
private def collectImplicitImports(imp: ImportInfo): List[ImplicitInfo] = {
|
||||
val pre = imp.qual.tpe;
|
||||
def collect(sels: List[Pair[Name, Name]]): List[ImplicitInfo] = sels match {
|
||||
case List() => List()
|
||||
case List(Pair(nme.WILDCARD, _)) => collectImplicits(pre.implicitMembers, pre)
|
||||
case Pair(from, to) :: sels1 =>
|
||||
var impls = collect(sels1) filter (info => info.name != from);
|
||||
if (to != nme.WILDCARD) {
|
||||
val sym = imp.importedSymbol(to);
|
||||
if (sym.hasFlag(IMPLICIT)) impls = ImplicitInfo(to, pre.memberType(sym), sym) :: impls;
|
||||
}
|
||||
impls
|
||||
}
|
||||
if (settings.debug.value) log("collect implicit imports " + imp + "=" + collect(imp.tree.selectors));//debug
|
||||
collect(imp.tree.selectors)
|
||||
}
|
||||
|
||||
def implicitss: List[List[ImplicitInfo]] = {
|
||||
if (implicitsRun != currentRun) {
|
||||
implicitsRun = currentRun;
|
||||
val newImplicits: List[ImplicitInfo] =
|
||||
if (owner != outer.owner && owner.isClass && !owner.isPackageClass) {
|
||||
if (!owner.isInitialized) return outer.implicitss;
|
||||
if (settings.debug.value) log("collect member implicits " + owner + ", implicit members = " + owner.thisType.implicitMembers);//debug
|
||||
collectImplicits(owner.thisType.implicitMembers, owner.thisType)
|
||||
} else if (scope != outer.scope && !owner.isPackageClass) {
|
||||
if (settings.debug.value) log("collect local implicits " + scope.toList);//debug
|
||||
collectImplicits(scope.toList, NoPrefix)
|
||||
} else if (imports != outer.imports) {
|
||||
assert(imports.tail == outer.imports);
|
||||
collectImplicitImports(imports.head)
|
||||
} else List();
|
||||
implicitsCache = if (newImplicits.isEmpty) outer.implicitss
|
||||
else newImplicits :: outer.implicitss;
|
||||
}
|
||||
implicitsCache
|
||||
}
|
||||
}
|
||||
|
||||
class ImportInfo(val tree: Import, val depth: int) {
|
||||
|
||||
/** The prefix expression */
|
||||
def qual: Tree = tree.symbol.info match {
|
||||
case ImportType(expr) => expr
|
||||
case _ => throw new FatalError("symbol " + tree.symbol + " has bad type: " + tree.symbol.info);//debug
|
||||
}
|
||||
|
||||
/** Is name imported explicitly, not via wildcard? */
|
||||
def isExplicitImport(name: Name): boolean =
|
||||
tree.selectors exists (._2.==(name.toTermName));
|
||||
|
||||
/** The symbol with name `name' imported from import clause `tree'.
|
||||
*/
|
||||
def importedSymbol(name: Name): Symbol = {
|
||||
var result: Symbol = NoSymbol;
|
||||
var renamed = false;
|
||||
var selectors = tree.selectors;
|
||||
while (selectors != Nil && result == NoSymbol) {
|
||||
if (selectors.head._2 == name.toTermName)
|
||||
result = qual.tpe.member(
|
||||
if (name.isTypeName) selectors.head._1.toTypeName else selectors.head._1);
|
||||
else if (selectors.head._1 == name.toTermName)
|
||||
renamed = true
|
||||
else if (selectors.head._1 == nme.WILDCARD && !renamed)
|
||||
result = qual.tpe.member(name);
|
||||
selectors = selectors.tail
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
override def toString() = tree.toString();
|
||||
}
|
||||
|
||||
case class ImplicitInfo(val name: Name, val tpe: Type, val sym: Symbol);
|
||||
|
||||
case class ImportType(expr: Tree) extends Type;
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import symtab.Flags._;
|
||||
import scala.tools.nsc.util.Position;
|
||||
|
||||
[_trait_] abstract class Contexts: Analyzer {
|
||||
import global._;
|
||||
|
||||
val NoContext = new Context {
|
||||
override def implicitss: List[List[ImplicitInfo]] = List();
|
||||
}
|
||||
NoContext.enclClass = NoContext;
|
||||
|
||||
val startContext = {
|
||||
import definitions._;
|
||||
var sc = NoContext.make(
|
||||
Template(List(), List()) setSymbol NoSymbol setType NoType,
|
||||
definitions.RootClass,
|
||||
definitions.RootClass.info.decls);
|
||||
def addImport(pkg: Symbol): unit = {
|
||||
val qual = gen.mkStableRef(pkg);
|
||||
sc = sc.makeNewImport(
|
||||
Import(qual, List(Pair(nme.WILDCARD, null)))
|
||||
setSymbol NoSymbol.newImport(Position.NOPOS).setInfo(ImportType(qual))
|
||||
setType NoType);
|
||||
sc.depth = sc.depth + 1
|
||||
}
|
||||
if (!settings.noimports.value) {
|
||||
addImport(JavaLangPackage);
|
||||
addImport(ScalaPackage);
|
||||
if (!settings.nopredefs.value)
|
||||
addImport(PredefModule);
|
||||
}
|
||||
sc
|
||||
}
|
||||
|
||||
def resetContexts: unit = {
|
||||
var sc = startContext;
|
||||
while (sc != NoContext) {
|
||||
sc.tree match {
|
||||
case Import(qual, _) => qual.tpe = singleType(qual.symbol.owner.thisType, qual.symbol);
|
||||
case _ =>
|
||||
}
|
||||
sc = sc.outer
|
||||
}
|
||||
}
|
||||
|
||||
class Context {
|
||||
var unit: CompilationUnit = _;
|
||||
var tree: Tree = _; // Tree associated with this context
|
||||
var owner: Symbol = NoSymbol; // The current owner
|
||||
var scope: Scope = _; // The current scope
|
||||
var outer: Context = _; // The next outer context
|
||||
var enclClass: Context = _; // The next outer context whose tree is a
|
||||
// template or package definition
|
||||
var variance: int = _; // Variance relative to enclosing class.
|
||||
private var _undetparams: List[Symbol] = List(); // Undetermined type parameters
|
||||
var depth: int = 0;
|
||||
var imports: List[ImportInfo] = List();
|
||||
|
||||
var prefix: Type = NoPrefix;
|
||||
var inConstructorSuffix = false; // are we in a secondary constructor
|
||||
// after the this constructor call?
|
||||
var reportAmbiguousErrors = false;
|
||||
var reportGeneralErrors = false;
|
||||
var checking = false;
|
||||
|
||||
var savedTypeBounds: List[Pair[Symbol, Type]] = List();
|
||||
|
||||
def undetparams = _undetparams;
|
||||
def undetparams_=(ps: List[Symbol]) = {
|
||||
//System.out.println("undetparams = " + ps);//debug
|
||||
_undetparams = ps
|
||||
}
|
||||
|
||||
def make(unit: CompilationUnit, tree: Tree, owner: Symbol, scope: Scope, imports: List[ImportInfo]): Context = {
|
||||
val c = new Context;
|
||||
c.unit = unit;
|
||||
c.tree = tree;
|
||||
c.owner = owner;
|
||||
c.scope = scope;
|
||||
tree match {
|
||||
case Template(_, _) | PackageDef(_, _) =>
|
||||
c.enclClass = c;
|
||||
c.prefix = skolemizedThisType(this.tree, this.prefix, c.owner);
|
||||
c.inConstructorSuffix = false;
|
||||
case _ =>
|
||||
c.enclClass = this.enclClass;
|
||||
c.prefix = if (c.owner != this.owner && c.owner.isTerm) NoPrefix else this.prefix;
|
||||
c.inConstructorSuffix = this.inConstructorSuffix;
|
||||
}
|
||||
c.variance = this.variance;
|
||||
c.depth = if (scope == this.scope) this.depth else this.depth + 1;
|
||||
c.imports = imports;
|
||||
c.reportAmbiguousErrors = this.reportAmbiguousErrors;
|
||||
c.reportGeneralErrors = this.reportGeneralErrors;
|
||||
c.checking = this.checking;
|
||||
c.outer = this;
|
||||
c
|
||||
}
|
||||
|
||||
def make(unit: CompilationUnit): Context = {
|
||||
val c = make(unit, EmptyTree, owner, scope, imports);
|
||||
c.reportAmbiguousErrors = true;
|
||||
c.reportGeneralErrors = true;
|
||||
c
|
||||
}
|
||||
|
||||
def makeNewImport(imp: Import): Context =
|
||||
make(unit, imp, owner, scope, new ImportInfo(imp, depth) :: imports);
|
||||
|
||||
def make(tree: Tree, owner: Symbol, scope: Scope): Context =
|
||||
make(unit, tree, owner, scope, imports);
|
||||
|
||||
def makeNewScope(tree: Tree, owner: Symbol): Context =
|
||||
make(tree, owner, new Scope(scope));
|
||||
|
||||
def make(tree: Tree, owner: Symbol): Context =
|
||||
make(tree, owner, scope);
|
||||
|
||||
def make(tree: Tree): Context =
|
||||
make(tree, owner);
|
||||
|
||||
def makeImplicit(reportAmbiguousErrors: boolean) = {
|
||||
val c = make(tree);
|
||||
c.reportAmbiguousErrors = reportAmbiguousErrors;
|
||||
c.reportGeneralErrors = false;
|
||||
c
|
||||
}
|
||||
|
||||
def makeConstructorContext = {
|
||||
val baseContext = enclClass.outer;
|
||||
val argContext = baseContext.makeNewScope(tree, owner);
|
||||
for (val sym <- scope.toList) argContext.scope enter sym;
|
||||
argContext
|
||||
}
|
||||
|
||||
def makeConstructorSuffixContext = {
|
||||
val c = make(tree);
|
||||
c.inConstructorSuffix = true;
|
||||
c
|
||||
}
|
||||
|
||||
def skolemizedThisType(encl: Tree, pre: Type, clazz: Symbol): Type = if (settings.Xgadt.value) {
|
||||
encl match {
|
||||
case ClassDef(_, _, tparamdefs, _, _) =>
|
||||
System.out.println("sktt " + clazz);
|
||||
if (!tparamdefs.isEmpty || pre.isInstanceOf[SingleType]) {
|
||||
val tparams = clazz.unsafeTypeParams;
|
||||
val tskolems = tparamdefs map (.symbol);
|
||||
System.out.println("sktt2 " + tparams + " " + tskolems);
|
||||
val self = clazz.newThisSkolem setInfo clazz.typeOfThis.substSym(tparams, tskolems);
|
||||
singleType(pre, self)
|
||||
} else clazz.thisType
|
||||
case _ =>
|
||||
clazz.thisType
|
||||
}
|
||||
} else clazz.thisType;
|
||||
|
||||
def error(pos: int, msg: String): unit =
|
||||
if (reportGeneralErrors)
|
||||
unit.error(pos, if (checking) "**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg)
|
||||
else
|
||||
throw new TypeError(msg);
|
||||
|
||||
def ambiguousError(pos: int, pre: Type, sym1: Symbol, sym2: Symbol, rest: String): unit = {
|
||||
val msg =
|
||||
("ambiguous reference to overloaded definition,\n" +
|
||||
"both " + sym1 + sym1.locationString + " of type " + pre.memberType(sym1) +
|
||||
"\nand " + sym2 + sym2.locationString + " of type " + pre.memberType(sym2) +
|
||||
"\nmatch " + rest);
|
||||
if (reportAmbiguousErrors) unit.error(pos, msg)
|
||||
else throw new TypeError(msg);
|
||||
}
|
||||
|
||||
def outerContext(clazz: Symbol): Context = {
|
||||
var c = this;
|
||||
while (c != NoContext && c.owner != clazz) c = c.outer.enclClass;
|
||||
c
|
||||
}
|
||||
|
||||
def isLocal(): boolean = tree match {
|
||||
case Block(_,_) => true
|
||||
case PackageDef(_, _) => false
|
||||
case EmptyTree => false
|
||||
case _ => outer.isLocal()
|
||||
}
|
||||
|
||||
def nextEnclosing(p: Context => boolean): Context =
|
||||
if (this == NoContext || p(this)) this else outer.nextEnclosing(p);
|
||||
|
||||
override def toString(): String = {
|
||||
if (this == NoContext) "NoContext";
|
||||
else owner.toString() + " @ " + tree.getClass() + " " + tree.toString() + ", scope = " + scope.hashCode() + " " + scope.toList + "\n:: " + outer.toString()
|
||||
}
|
||||
|
||||
/** Is `sym' accessible as a member of tree `site' with type `pre' in current context?
|
||||
*/
|
||||
def isAccessible(sym: Symbol, pre: Type, superAccess: boolean): boolean = {
|
||||
|
||||
/** Are we inside definition of `owner'? */
|
||||
def accessWithin(owner: Symbol): boolean = {
|
||||
var c = this;
|
||||
while (c != NoContext && c.owner != owner) {
|
||||
if (c.outer == null) assert(false, "accessWithin(" + owner + ") " + c);//debug
|
||||
if (c.outer.enclClass == null) assert(false, "accessWithin(" + owner + ") " + c);//debug
|
||||
c = c.outer.enclClass;
|
||||
}
|
||||
c != NoContext
|
||||
}
|
||||
|
||||
/** Is `clazz' a subclass of an enclosing class? */
|
||||
def isSubClassOfEnclosing(clazz: Symbol): boolean = {
|
||||
var c = this;
|
||||
while (c != NoContext && !clazz.isSubClass(c.owner)) c = c.outer.enclClass;
|
||||
c != NoContext;
|
||||
}
|
||||
|
||||
(pre == NoPrefix
|
||||
||
|
||||
(!sym.hasFlag(PRIVATE | PROTECTED))
|
||||
||
|
||||
accessWithin(sym.owner) && (!sym.hasFlag(LOCAL) || pre =:= sym.owner.thisType)
|
||||
||
|
||||
(!sym.hasFlag(PRIVATE) &&
|
||||
(superAccess ||
|
||||
(pre.widen.symbol.isSubClass(sym.owner) && isSubClassOfEnclosing(pre.widen.symbol)))))
|
||||
}
|
||||
|
||||
def pushTypeBounds(sym: Symbol): unit = {
|
||||
savedTypeBounds = Pair(sym, sym.info) :: savedTypeBounds
|
||||
}
|
||||
|
||||
def restoreTypeBounds: unit = {
|
||||
for (val Pair(sym, info) <- savedTypeBounds) {
|
||||
System.out.println("resetting " + sym + " to " + info);
|
||||
sym.setInfo(info);
|
||||
}
|
||||
savedTypeBounds = List()
|
||||
}
|
||||
|
||||
private var implicitsCache: List[List[ImplicitInfo]] = null;
|
||||
private var implicitsRun: CompilerRun = NoRun;
|
||||
|
||||
private def collectImplicits(syms: List[Symbol], pre: Type): List[ImplicitInfo] =
|
||||
for (val sym <- syms; sym.hasFlag(IMPLICIT) && isAccessible(sym, pre, false))
|
||||
yield ImplicitInfo(sym.name, pre.memberType(sym), sym);
|
||||
|
||||
private def collectImplicitImports(imp: ImportInfo): List[ImplicitInfo] = {
|
||||
val pre = imp.qual.tpe;
|
||||
def collect(sels: List[Pair[Name, Name]]): List[ImplicitInfo] = sels match {
|
||||
case List() => List()
|
||||
case List(Pair(nme.WILDCARD, _)) => collectImplicits(pre.implicitMembers, pre)
|
||||
case Pair(from, to) :: sels1 =>
|
||||
var impls = collect(sels1) filter (info => info.name != from);
|
||||
if (to != nme.WILDCARD) {
|
||||
val sym = imp.importedSymbol(to);
|
||||
if (sym.hasFlag(IMPLICIT)) impls = ImplicitInfo(to, pre.memberType(sym), sym) :: impls;
|
||||
}
|
||||
impls
|
||||
}
|
||||
if (settings.debug.value) log("collect implicit imports " + imp + "=" + collect(imp.tree.selectors));//debug
|
||||
collect(imp.tree.selectors)
|
||||
}
|
||||
|
||||
def implicitss: List[List[ImplicitInfo]] = {
|
||||
if (implicitsRun != currentRun) {
|
||||
implicitsRun = currentRun;
|
||||
val newImplicits: List[ImplicitInfo] =
|
||||
if (owner != outer.owner && owner.isClass && !owner.isPackageClass) {
|
||||
if (!owner.isInitialized) return outer.implicitss;
|
||||
if (settings.debug.value) log("collect member implicits " + owner + ", implicit members = " + owner.thisType.implicitMembers);//debug
|
||||
collectImplicits(owner.thisType.implicitMembers, owner.thisType)
|
||||
} else if (scope != outer.scope && !owner.isPackageClass) {
|
||||
if (settings.debug.value) log("collect local implicits " + scope.toList);//debug
|
||||
collectImplicits(scope.toList, NoPrefix)
|
||||
} else if (imports != outer.imports) {
|
||||
assert(imports.tail == outer.imports);
|
||||
collectImplicitImports(imports.head)
|
||||
} else List();
|
||||
implicitsCache = if (newImplicits.isEmpty) outer.implicitss
|
||||
else newImplicits :: outer.implicitss;
|
||||
}
|
||||
implicitsCache
|
||||
}
|
||||
}
|
||||
|
||||
class ImportInfo(val tree: Import, val depth: int) {
|
||||
|
||||
/** The prefix expression */
|
||||
def qual: Tree = tree.symbol.info match {
|
||||
case ImportType(expr) => expr
|
||||
case _ => throw new FatalError("symbol " + tree.symbol + " has bad type: " + tree.symbol.info);//debug
|
||||
}
|
||||
|
||||
/** Is name imported explicitly, not via wildcard? */
|
||||
def isExplicitImport(name: Name): boolean =
|
||||
tree.selectors exists (._2.==(name.toTermName));
|
||||
|
||||
/** The symbol with name `name' imported from import clause `tree'.
|
||||
*/
|
||||
def importedSymbol(name: Name): Symbol = {
|
||||
var result: Symbol = NoSymbol;
|
||||
var renamed = false;
|
||||
var selectors = tree.selectors;
|
||||
while (selectors != Nil && result == NoSymbol) {
|
||||
if (selectors.head._2 == name.toTermName)
|
||||
result = qual.tpe.member(
|
||||
if (name.isTypeName) selectors.head._1.toTypeName else selectors.head._1);
|
||||
else if (selectors.head._1 == name.toTermName)
|
||||
renamed = true
|
||||
else if (selectors.head._1 == nme.WILDCARD && !renamed)
|
||||
result = qual.tpe.member(name);
|
||||
selectors = selectors.tail
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
override def toString() = tree.toString();
|
||||
}
|
||||
|
||||
case class ImplicitInfo(val name: Name, val tpe: Type, val sym: Symbol);
|
||||
|
||||
case class ImportType(expr: Tree) extends Type;
|
||||
}
|
||||
|
|
|
@ -1,73 +1,73 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import util.ListBuffer;
|
||||
import symtab.Flags._;
|
||||
|
||||
[_trait_] abstract class EtaExpansion: Analyzer {
|
||||
|
||||
import global._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** Expand partial function applications of type `type'.
|
||||
*
|
||||
* p.f(es_1)...(es_n)
|
||||
* ==> {
|
||||
* private synthetic val eta$f = p.f // if p is not stable
|
||||
* ...
|
||||
* private synthetic val eta$e_i = e_i // if e_i is not stable
|
||||
* ...
|
||||
*
|
||||
* (ps_1 => ... => ps_m => eta$f([es_1])...([es_m])(ps_1)...(ps_m))
|
||||
* }
|
||||
* tree is already attributed
|
||||
*/
|
||||
def etaExpand(tree: Tree): Tree = {
|
||||
val tpe = tree.tpe;
|
||||
var cnt = 0;
|
||||
def freshName() = { cnt = cnt + 1; newTermName("eta$" + cnt) }
|
||||
val defs = new ListBuffer[Tree];
|
||||
|
||||
/** Append to `defs' value definitions for all non-stable subexpressions
|
||||
* of the function application `tree' */
|
||||
def liftoutPrefix(tree: Tree): Tree = {
|
||||
def liftout(tree: Tree): Tree =
|
||||
if (treeInfo.isPureExpr(tree)) tree
|
||||
else {
|
||||
val vname: Name = freshName();
|
||||
defs += atPos(tree.pos)(ValDef(Modifiers(SYNTHETIC), vname, TypeTree(), tree));
|
||||
Ident(vname) setPos tree.pos
|
||||
}
|
||||
tree match {
|
||||
case Apply(fn, args) =>
|
||||
copy.Apply(tree, liftoutPrefix(fn), List.mapConserve(args)(liftout)) setType null
|
||||
case TypeApply(fn, args) =>
|
||||
copy.TypeApply(tree, liftoutPrefix(fn), args) setType null
|
||||
case Select(qual, name) =>
|
||||
copy.Select(tree, liftout(qual), name) setSymbol NoSymbol setType null
|
||||
case Ident(name) =>
|
||||
tree
|
||||
}
|
||||
}
|
||||
|
||||
/** Eta-expand lifted tree */
|
||||
def expand(tree: Tree, tpe: Type): Tree = tpe match {
|
||||
case mt: ImplicitMethodType =>
|
||||
tree
|
||||
case MethodType(formals, restpe) =>
|
||||
val params = formals map (formal =>
|
||||
ValDef(Modifiers(SYNTHETIC | PARAM), freshName(), TypeTree().setType(formal), EmptyTree));
|
||||
val args = params map (param => Ident(param.name));
|
||||
atPos(tree.pos)(Function(params, expand(Apply(tree, args), restpe)))
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
|
||||
val tree1 = liftoutPrefix(tree);
|
||||
atPos(tree.pos)(Block(defs.toList, expand(tree1, tpe)))
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import util.ListBuffer;
|
||||
import symtab.Flags._;
|
||||
|
||||
[_trait_] abstract class EtaExpansion: Analyzer {
|
||||
|
||||
import global._;
|
||||
import posAssigner.atPos;
|
||||
|
||||
/** Expand partial function applications of type `type'.
|
||||
*
|
||||
* p.f(es_1)...(es_n)
|
||||
* ==> {
|
||||
* private synthetic val eta$f = p.f // if p is not stable
|
||||
* ...
|
||||
* private synthetic val eta$e_i = e_i // if e_i is not stable
|
||||
* ...
|
||||
*
|
||||
* (ps_1 => ... => ps_m => eta$f([es_1])...([es_m])(ps_1)...(ps_m))
|
||||
* }
|
||||
* tree is already attributed
|
||||
*/
|
||||
def etaExpand(tree: Tree): Tree = {
|
||||
val tpe = tree.tpe;
|
||||
var cnt = 0;
|
||||
def freshName() = { cnt = cnt + 1; newTermName("eta$" + cnt) }
|
||||
val defs = new ListBuffer[Tree];
|
||||
|
||||
/** Append to `defs' value definitions for all non-stable subexpressions
|
||||
* of the function application `tree' */
|
||||
def liftoutPrefix(tree: Tree): Tree = {
|
||||
def liftout(tree: Tree): Tree =
|
||||
if (treeInfo.isPureExpr(tree)) tree
|
||||
else {
|
||||
val vname: Name = freshName();
|
||||
defs += atPos(tree.pos)(ValDef(Modifiers(SYNTHETIC), vname, TypeTree(), tree));
|
||||
Ident(vname) setPos tree.pos
|
||||
}
|
||||
tree match {
|
||||
case Apply(fn, args) =>
|
||||
copy.Apply(tree, liftoutPrefix(fn), List.mapConserve(args)(liftout)) setType null
|
||||
case TypeApply(fn, args) =>
|
||||
copy.TypeApply(tree, liftoutPrefix(fn), args) setType null
|
||||
case Select(qual, name) =>
|
||||
copy.Select(tree, liftout(qual), name) setSymbol NoSymbol setType null
|
||||
case Ident(name) =>
|
||||
tree
|
||||
}
|
||||
}
|
||||
|
||||
/** Eta-expand lifted tree */
|
||||
def expand(tree: Tree, tpe: Type): Tree = tpe match {
|
||||
case mt: ImplicitMethodType =>
|
||||
tree
|
||||
case MethodType(formals, restpe) =>
|
||||
val params = formals map (formal =>
|
||||
ValDef(Modifiers(SYNTHETIC | PARAM), freshName(), TypeTree().setType(formal), EmptyTree));
|
||||
val args = params map (param => Ident(param.name));
|
||||
atPos(tree.pos)(Function(params, expand(Apply(tree, args), restpe)))
|
||||
case _ =>
|
||||
tree
|
||||
}
|
||||
|
||||
val tree1 = liftoutPrefix(tree);
|
||||
atPos(tree.pos)(Block(defs.toList, expand(tree1, tpe)))
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,133 +1,133 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import symtab.Flags._;
|
||||
import util.ListBuffer;
|
||||
|
||||
/**
|
||||
* - caseArity, caseElement implementations added to case classes
|
||||
* - equals, and hashCode and toString methods are added to case classes,
|
||||
* unless they are defined in the class or a baseclass
|
||||
* different from java.lang.Object
|
||||
* - toString method is added to case objects,
|
||||
* unless they are defined in the class or a baseclass
|
||||
* different from java.lang.Object
|
||||
*/
|
||||
[_trait_] abstract class SyntheticMethods: Analyzer {
|
||||
import global._; // the global environment
|
||||
import definitions._; // standard classes and methods
|
||||
import typer.{typed}; // methods to type trees
|
||||
|
||||
def addSyntheticMethods(templ: Template, clazz: Symbol): Template = {
|
||||
|
||||
def hasImplementation(name: Name): boolean = {
|
||||
val sym = clazz.info.nonPrivateMember(name);
|
||||
(sym.isTerm &&
|
||||
(sym.owner == clazz ||
|
||||
!(ObjectClass isSubClass sym.owner) && !(sym hasFlag DEFERRED)))
|
||||
}
|
||||
|
||||
def syntheticMethod(name: Name, flags: int, tpe: Type) =
|
||||
newSyntheticMethod(name, flags | OVERRIDE, tpe);
|
||||
|
||||
def newSyntheticMethod(name: Name, flags: int, tpe: Type) = {
|
||||
val method = clazz.newMethod(clazz.pos, name) setFlag (flags) setInfo tpe;
|
||||
clazz.info.decls.enter(method);
|
||||
method
|
||||
}
|
||||
|
||||
def caseElementMethod: Tree = {
|
||||
val method = syntheticMethod(
|
||||
nme.caseElement, FINAL, MethodType(List(IntClass.tpe), AnyClass.tpe));
|
||||
val caseFields = clazz.caseFieldAccessors map gen.mkRef;
|
||||
typed(
|
||||
DefDef(method, vparamss =>
|
||||
if (caseFields.isEmpty) Literal(Constant(null))
|
||||
else {
|
||||
var i = caseFields.length;
|
||||
var cases = List(CaseDef(Ident(nme.WILDCARD), EmptyTree, Literal(Constant(null))));
|
||||
for (val field <- caseFields.reverse) {
|
||||
i = i - 1; cases = CaseDef(Literal(Constant(i)), EmptyTree, field) :: cases
|
||||
}
|
||||
Match(Ident(vparamss.head.head), cases)
|
||||
}))
|
||||
}
|
||||
|
||||
def caseArityMethod: Tree = {
|
||||
val method = syntheticMethod(nme.caseArity, FINAL, PolyType(List(), IntClass.tpe));
|
||||
typed(DefDef(method, vparamss => Literal(Constant(clazz.caseFieldAccessors.length))))
|
||||
}
|
||||
|
||||
def caseNameMethod: Tree = {
|
||||
val method = syntheticMethod(nme.caseName, FINAL, PolyType(List(), StringClass.tpe));
|
||||
typed(DefDef(method, vparamss => Literal(Constant(clazz.name.decode))))
|
||||
}
|
||||
|
||||
def moduleToStringMethod: Tree = {
|
||||
val method = syntheticMethod(nme.toString_, FINAL, MethodType(List(), StringClass.tpe));
|
||||
typed(DefDef(method, vparamss => Literal(Constant(clazz.name.decode))))
|
||||
}
|
||||
|
||||
def tagMethod: Tree = {
|
||||
val method = syntheticMethod(nme.tag, FINAL, MethodType(List(), IntClass.tpe));
|
||||
typed(DefDef(method, vparamss => Literal(Constant(clazz.tag))))
|
||||
}
|
||||
|
||||
def forwardingMethod(name: Name): Tree = {
|
||||
val target = getMember(ScalaRunTimeModule, "_" + name);
|
||||
val method = syntheticMethod(
|
||||
name, 0, MethodType(target.tpe.paramTypes.tail, target.tpe.resultType));
|
||||
typed(DefDef(method, vparamss =>
|
||||
Apply(gen.mkRef(target), This(clazz) :: (vparamss.head map Ident))));
|
||||
}
|
||||
|
||||
val SerializableAttr = definitions.SerializableAttr;
|
||||
|
||||
def isSerializable(clazz: Symbol): Boolean = {
|
||||
clazz.attributes.exists(p => p match {
|
||||
case Pair(SerializableAttr, _) => true;
|
||||
case _ => false
|
||||
})
|
||||
}
|
||||
|
||||
def readResolveMethod: Tree = {
|
||||
// !!! the synthetic method "readResolve" should be private,
|
||||
// but then it is renamed !!!
|
||||
val method = newSyntheticMethod(nme.readResolve, PROTECTED,
|
||||
MethodType(List(), ObjectClass.tpe));
|
||||
typed(DefDef(method, vparamss => gen.mkRef(clazz.sourceModule)))
|
||||
}
|
||||
|
||||
val ts = new ListBuffer[Tree];
|
||||
if ((clazz hasFlag CASE) && !phase.erasedTypes) {
|
||||
// case classes are implicitly declared serializable
|
||||
clazz.attributes = Pair(SerializableAttr, List()) :: clazz.attributes;
|
||||
|
||||
ts += tagMethod;
|
||||
if (clazz.isModuleClass) {
|
||||
if (!hasImplementation(nme.toString_)) ts += moduleToStringMethod;
|
||||
} else {
|
||||
if (!hasImplementation(nme.hashCode_)) ts += forwardingMethod(nme.hashCode_);
|
||||
if (!hasImplementation(nme.toString_)) ts += forwardingMethod(nme.toString_);
|
||||
if (!hasImplementation(nme.equals_)) ts += forwardingMethod(nme.equals_);
|
||||
}
|
||||
if (!hasImplementation(nme.caseElement)) ts += caseElementMethod;
|
||||
if (!hasImplementation(nme.caseArity)) ts += caseArityMethod;
|
||||
if (!hasImplementation(nme.caseName)) ts += caseNameMethod;
|
||||
}
|
||||
if (!phase.erasedTypes && clazz.isModuleClass && isSerializable(clazz)) {
|
||||
// If you serialize a singleton and then deserialize it twice,
|
||||
// you will have two instances of your singleton, unless you implement
|
||||
// the readResolve() method (see http://www.javaworld.com/javaworld/
|
||||
// jw-04-2003/jw-0425-designpatterns_p.html)
|
||||
if (!hasImplementation(nme.readResolve)) ts += readResolveMethod;
|
||||
}
|
||||
val synthetics = ts.toList;
|
||||
copy.Template(
|
||||
templ, templ.parents, if (synthetics.isEmpty) templ.body else templ.body ::: synthetics)
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import symtab.Flags._;
|
||||
import util.ListBuffer;
|
||||
|
||||
/**
|
||||
* - caseArity, caseElement implementations added to case classes
|
||||
* - equals, and hashCode and toString methods are added to case classes,
|
||||
* unless they are defined in the class or a baseclass
|
||||
* different from java.lang.Object
|
||||
* - toString method is added to case objects,
|
||||
* unless they are defined in the class or a baseclass
|
||||
* different from java.lang.Object
|
||||
*/
|
||||
[_trait_] abstract class SyntheticMethods: Analyzer {
|
||||
import global._; // the global environment
|
||||
import definitions._; // standard classes and methods
|
||||
import typer.{typed}; // methods to type trees
|
||||
|
||||
def addSyntheticMethods(templ: Template, clazz: Symbol): Template = {
|
||||
|
||||
def hasImplementation(name: Name): boolean = {
|
||||
val sym = clazz.info.nonPrivateMember(name);
|
||||
(sym.isTerm &&
|
||||
(sym.owner == clazz ||
|
||||
!(ObjectClass isSubClass sym.owner) && !(sym hasFlag DEFERRED)))
|
||||
}
|
||||
|
||||
def syntheticMethod(name: Name, flags: int, tpe: Type) =
|
||||
newSyntheticMethod(name, flags | OVERRIDE, tpe);
|
||||
|
||||
def newSyntheticMethod(name: Name, flags: int, tpe: Type) = {
|
||||
val method = clazz.newMethod(clazz.pos, name) setFlag (flags) setInfo tpe;
|
||||
clazz.info.decls.enter(method);
|
||||
method
|
||||
}
|
||||
|
||||
def caseElementMethod: Tree = {
|
||||
val method = syntheticMethod(
|
||||
nme.caseElement, FINAL, MethodType(List(IntClass.tpe), AnyClass.tpe));
|
||||
val caseFields = clazz.caseFieldAccessors map gen.mkRef;
|
||||
typed(
|
||||
DefDef(method, vparamss =>
|
||||
if (caseFields.isEmpty) Literal(Constant(null))
|
||||
else {
|
||||
var i = caseFields.length;
|
||||
var cases = List(CaseDef(Ident(nme.WILDCARD), EmptyTree, Literal(Constant(null))));
|
||||
for (val field <- caseFields.reverse) {
|
||||
i = i - 1; cases = CaseDef(Literal(Constant(i)), EmptyTree, field) :: cases
|
||||
}
|
||||
Match(Ident(vparamss.head.head), cases)
|
||||
}))
|
||||
}
|
||||
|
||||
def caseArityMethod: Tree = {
|
||||
val method = syntheticMethod(nme.caseArity, FINAL, PolyType(List(), IntClass.tpe));
|
||||
typed(DefDef(method, vparamss => Literal(Constant(clazz.caseFieldAccessors.length))))
|
||||
}
|
||||
|
||||
def caseNameMethod: Tree = {
|
||||
val method = syntheticMethod(nme.caseName, FINAL, PolyType(List(), StringClass.tpe));
|
||||
typed(DefDef(method, vparamss => Literal(Constant(clazz.name.decode))))
|
||||
}
|
||||
|
||||
def moduleToStringMethod: Tree = {
|
||||
val method = syntheticMethod(nme.toString_, FINAL, MethodType(List(), StringClass.tpe));
|
||||
typed(DefDef(method, vparamss => Literal(Constant(clazz.name.decode))))
|
||||
}
|
||||
|
||||
def tagMethod: Tree = {
|
||||
val method = syntheticMethod(nme.tag, FINAL, MethodType(List(), IntClass.tpe));
|
||||
typed(DefDef(method, vparamss => Literal(Constant(clazz.tag))))
|
||||
}
|
||||
|
||||
def forwardingMethod(name: Name): Tree = {
|
||||
val target = getMember(ScalaRunTimeModule, "_" + name);
|
||||
val method = syntheticMethod(
|
||||
name, 0, MethodType(target.tpe.paramTypes.tail, target.tpe.resultType));
|
||||
typed(DefDef(method, vparamss =>
|
||||
Apply(gen.mkRef(target), This(clazz) :: (vparamss.head map Ident))));
|
||||
}
|
||||
|
||||
val SerializableAttr = definitions.SerializableAttr;
|
||||
|
||||
def isSerializable(clazz: Symbol): Boolean = {
|
||||
clazz.attributes.exists(p => p match {
|
||||
case Pair(SerializableAttr, _) => true;
|
||||
case _ => false
|
||||
})
|
||||
}
|
||||
|
||||
def readResolveMethod: Tree = {
|
||||
// !!! the synthetic method "readResolve" should be private,
|
||||
// but then it is renamed !!!
|
||||
val method = newSyntheticMethod(nme.readResolve, PROTECTED,
|
||||
MethodType(List(), ObjectClass.tpe));
|
||||
typed(DefDef(method, vparamss => gen.mkRef(clazz.sourceModule)))
|
||||
}
|
||||
|
||||
val ts = new ListBuffer[Tree];
|
||||
if ((clazz hasFlag CASE) && !phase.erasedTypes) {
|
||||
// case classes are implicitly declared serializable
|
||||
clazz.attributes = Pair(SerializableAttr, List()) :: clazz.attributes;
|
||||
|
||||
ts += tagMethod;
|
||||
if (clazz.isModuleClass) {
|
||||
if (!hasImplementation(nme.toString_)) ts += moduleToStringMethod;
|
||||
} else {
|
||||
if (!hasImplementation(nme.hashCode_)) ts += forwardingMethod(nme.hashCode_);
|
||||
if (!hasImplementation(nme.toString_)) ts += forwardingMethod(nme.toString_);
|
||||
if (!hasImplementation(nme.equals_)) ts += forwardingMethod(nme.equals_);
|
||||
}
|
||||
if (!hasImplementation(nme.caseElement)) ts += caseElementMethod;
|
||||
if (!hasImplementation(nme.caseArity)) ts += caseArityMethod;
|
||||
if (!hasImplementation(nme.caseName)) ts += caseNameMethod;
|
||||
}
|
||||
if (!phase.erasedTypes && clazz.isModuleClass && isSerializable(clazz)) {
|
||||
// If you serialize a singleton and then deserialize it twice,
|
||||
// you will have two instances of your singleton, unless you implement
|
||||
// the readResolve() method (see http://www.javaworld.com/javaworld/
|
||||
// jw-04-2003/jw-0425-designpatterns_p.html)
|
||||
if (!hasImplementation(nme.readResolve)) ts += readResolveMethod;
|
||||
}
|
||||
val synthetics = ts.toList;
|
||||
copy.Template(
|
||||
templ, templ.parents, if (synthetics.isEmpty) templ.body else templ.body ::: synthetics)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,139 +1,139 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import scala.tools.nsc.util.Position;
|
||||
import scala.tools.nsc.reporters.AbstractReporter;
|
||||
import symtab.Flags._;
|
||||
|
||||
abstract class TreeCheckers extends Analyzer {
|
||||
|
||||
import global._;
|
||||
|
||||
val tpeOfTree = new scala.collection.mutable.HashMap[Tree, Type];
|
||||
|
||||
def checkTrees: unit = {
|
||||
System.out.println("[consistency check at start of phase " + phase + "]");
|
||||
for (val unit <- currentRun.units) check(unit);
|
||||
}
|
||||
|
||||
def check(unit: CompilationUnit): unit = {
|
||||
val areporter = if (reporter.isInstanceOf[AbstractReporter]) reporter.asInstanceOf[AbstractReporter] else null;
|
||||
|
||||
val curPrompt = if (areporter != null) {
|
||||
val ret = areporter.prompt;
|
||||
areporter.prompt = true;
|
||||
ret;
|
||||
} else false;
|
||||
|
||||
val context = startContext.make(unit);
|
||||
context.checking = true;
|
||||
tpeOfTree.clear;
|
||||
val checker = new TreeChecker(context);
|
||||
checker.precheck.traverse(unit.body);
|
||||
checker.typed(unit.body);
|
||||
checker.postcheck.traverse(unit.body);
|
||||
if (areporter != null)
|
||||
areporter.prompt = curPrompt;
|
||||
}
|
||||
|
||||
override def newTyper(context: Context): Typer = new TreeChecker(context);
|
||||
|
||||
class TreeChecker(context0: Context) extends Typer(context0) {
|
||||
|
||||
import infer._;
|
||||
|
||||
override def typed(tree: Tree, mode: int, pt: Type): Tree = {
|
||||
//System.out.println("**** checking " + tree);//debug
|
||||
tree match {
|
||||
case EmptyTree | TypeTree() =>
|
||||
;
|
||||
case _ =>
|
||||
if (!tpeOfTree.contains(tree)) {
|
||||
tpeOfTree.update(tree, tree.tpe);
|
||||
tree.tpe = null
|
||||
}
|
||||
val newtree = super.typed(tree, mode, pt);
|
||||
if ((newtree ne tree) && !newtree.isInstanceOf[Literal])
|
||||
error(tree.pos, "trees differ\n old: " + tree + " [" + tree.getClass() + "]\n new: " +
|
||||
newtree + " [" + newtree.getClass() + "]");
|
||||
}
|
||||
tree
|
||||
}
|
||||
override def typed(tree: Tree) = super.typed(tree); // doto remove for new compiler
|
||||
|
||||
object precheck extends Traverser {
|
||||
override def traverse(tree: Tree): unit =
|
||||
try {
|
||||
tree match {
|
||||
case DefDef(_, _, _, _, _, _) =>
|
||||
if (tree.symbol.hasFlag(ACCESSOR) &&
|
||||
!tree.symbol.hasFlag(DEFERRED) &&
|
||||
!tree.symbol.tpe.resultType.isInstanceOf[ConstantType]) {
|
||||
assert(tree.symbol.accessed != NoSymbol);
|
||||
assert(tree.symbol.accessed.getter(tree.symbol.owner) == tree.symbol ||
|
||||
tree.symbol.accessed.setter(tree.symbol.owner) == tree.symbol);
|
||||
}
|
||||
case ValDef(_, _, _, _) =>
|
||||
if (tree.symbol.hasGetter) {
|
||||
assert(tree.symbol.getter(tree.symbol.owner) != NoSymbol)
|
||||
}
|
||||
case Apply(_, args) =>
|
||||
assert(args forall (EmptyTree !=))
|
||||
case Select(_, _) =>
|
||||
assert(tree.symbol != NoSymbol, tree);
|
||||
case This(_) =>
|
||||
if (!(tree.symbol.isStatic && (tree.symbol hasFlag MODULE))) {
|
||||
var o = currentOwner;
|
||||
while (o != tree.symbol) {
|
||||
o = o.owner;
|
||||
assert(o != NoSymbol, tree)
|
||||
}
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
if (tree.pos == Position.NOPOS && tree != EmptyTree) {
|
||||
error(tree.pos, "tree without position: " + tree)
|
||||
} else if (tree.tpe == null && phase.id >= currentRun.typerPhase.id) {
|
||||
error(tree.pos, "tree without type: " + tree);
|
||||
} else if (tree.isDef && tree.symbol.owner != currentOwner) {
|
||||
var owner = currentOwner;
|
||||
while (owner.isTerm && !owner.isMethod && tree.symbol.owner != owner)
|
||||
owner = owner.owner;
|
||||
if (tree.symbol.owner != owner) {
|
||||
error(tree.pos, "" + tree.symbol + " has wrong owner: " + tree.symbol.owner +
|
||||
tree.symbol.owner.locationString + ", should be: " +
|
||||
currentOwner + currentOwner.locationString)
|
||||
}
|
||||
} else {
|
||||
super.traverse(tree)
|
||||
}
|
||||
} catch {
|
||||
case ex: Throwable =>
|
||||
if (settings.debug.value)
|
||||
System.out.println("exception when traversing " + tree);
|
||||
throw(ex)
|
||||
}
|
||||
}
|
||||
|
||||
object postcheck extends Traverser {
|
||||
override def traverse(tree: Tree): unit = tree match {
|
||||
case EmptyTree | TypeTree() =>
|
||||
;
|
||||
case _ =>
|
||||
tpeOfTree.get(tree) match {
|
||||
case Some(oldtpe) =>
|
||||
if (!(oldtpe =:= tree.tpe))
|
||||
error(tree.pos, "types differ\n old: " + oldtpe + "\n new: " + tree.tpe +
|
||||
"\n tree: " + tree);
|
||||
tree.tpe = oldtpe;
|
||||
super.traverse(tree)
|
||||
case None =>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import scala.tools.nsc.util.Position;
|
||||
import scala.tools.nsc.reporters.AbstractReporter;
|
||||
import symtab.Flags._;
|
||||
|
||||
abstract class TreeCheckers extends Analyzer {
|
||||
|
||||
import global._;
|
||||
|
||||
val tpeOfTree = new scala.collection.mutable.HashMap[Tree, Type];
|
||||
|
||||
def checkTrees: unit = {
|
||||
System.out.println("[consistency check at start of phase " + phase + "]");
|
||||
for (val unit <- currentRun.units) check(unit);
|
||||
}
|
||||
|
||||
def check(unit: CompilationUnit): unit = {
|
||||
val areporter = if (reporter.isInstanceOf[AbstractReporter]) reporter.asInstanceOf[AbstractReporter] else null;
|
||||
|
||||
val curPrompt = if (areporter != null) {
|
||||
val ret = areporter.prompt;
|
||||
areporter.prompt = true;
|
||||
ret;
|
||||
} else false;
|
||||
|
||||
val context = startContext.make(unit);
|
||||
context.checking = true;
|
||||
tpeOfTree.clear;
|
||||
val checker = new TreeChecker(context);
|
||||
checker.precheck.traverse(unit.body);
|
||||
checker.typed(unit.body);
|
||||
checker.postcheck.traverse(unit.body);
|
||||
if (areporter != null)
|
||||
areporter.prompt = curPrompt;
|
||||
}
|
||||
|
||||
override def newTyper(context: Context): Typer = new TreeChecker(context);
|
||||
|
||||
class TreeChecker(context0: Context) extends Typer(context0) {
|
||||
|
||||
import infer._;
|
||||
|
||||
override def typed(tree: Tree, mode: int, pt: Type): Tree = {
|
||||
//System.out.println("**** checking " + tree);//debug
|
||||
tree match {
|
||||
case EmptyTree | TypeTree() =>
|
||||
;
|
||||
case _ =>
|
||||
if (!tpeOfTree.contains(tree)) {
|
||||
tpeOfTree.update(tree, tree.tpe);
|
||||
tree.tpe = null
|
||||
}
|
||||
val newtree = super.typed(tree, mode, pt);
|
||||
if ((newtree ne tree) && !newtree.isInstanceOf[Literal])
|
||||
error(tree.pos, "trees differ\n old: " + tree + " [" + tree.getClass() + "]\n new: " +
|
||||
newtree + " [" + newtree.getClass() + "]");
|
||||
}
|
||||
tree
|
||||
}
|
||||
override def typed(tree: Tree) = super.typed(tree); // doto remove for new compiler
|
||||
|
||||
object precheck extends Traverser {
|
||||
override def traverse(tree: Tree): unit =
|
||||
try {
|
||||
tree match {
|
||||
case DefDef(_, _, _, _, _, _) =>
|
||||
if (tree.symbol.hasFlag(ACCESSOR) &&
|
||||
!tree.symbol.hasFlag(DEFERRED) &&
|
||||
!tree.symbol.tpe.resultType.isInstanceOf[ConstantType]) {
|
||||
assert(tree.symbol.accessed != NoSymbol);
|
||||
assert(tree.symbol.accessed.getter(tree.symbol.owner) == tree.symbol ||
|
||||
tree.symbol.accessed.setter(tree.symbol.owner) == tree.symbol);
|
||||
}
|
||||
case ValDef(_, _, _, _) =>
|
||||
if (tree.symbol.hasGetter) {
|
||||
assert(tree.symbol.getter(tree.symbol.owner) != NoSymbol)
|
||||
}
|
||||
case Apply(_, args) =>
|
||||
assert(args forall (EmptyTree !=))
|
||||
case Select(_, _) =>
|
||||
assert(tree.symbol != NoSymbol, tree);
|
||||
case This(_) =>
|
||||
if (!(tree.symbol.isStatic && (tree.symbol hasFlag MODULE))) {
|
||||
var o = currentOwner;
|
||||
while (o != tree.symbol) {
|
||||
o = o.owner;
|
||||
assert(o != NoSymbol, tree)
|
||||
}
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
if (tree.pos == Position.NOPOS && tree != EmptyTree) {
|
||||
error(tree.pos, "tree without position: " + tree)
|
||||
} else if (tree.tpe == null && phase.id >= currentRun.typerPhase.id) {
|
||||
error(tree.pos, "tree without type: " + tree);
|
||||
} else if (tree.isDef && tree.symbol.owner != currentOwner) {
|
||||
var owner = currentOwner;
|
||||
while (owner.isTerm && !owner.isMethod && tree.symbol.owner != owner)
|
||||
owner = owner.owner;
|
||||
if (tree.symbol.owner != owner) {
|
||||
error(tree.pos, "" + tree.symbol + " has wrong owner: " + tree.symbol.owner +
|
||||
tree.symbol.owner.locationString + ", should be: " +
|
||||
currentOwner + currentOwner.locationString)
|
||||
}
|
||||
} else {
|
||||
super.traverse(tree)
|
||||
}
|
||||
} catch {
|
||||
case ex: Throwable =>
|
||||
if (settings.debug.value)
|
||||
System.out.println("exception when traversing " + tree);
|
||||
throw(ex)
|
||||
}
|
||||
}
|
||||
|
||||
object postcheck extends Traverser {
|
||||
override def traverse(tree: Tree): unit = tree match {
|
||||
case EmptyTree | TypeTree() =>
|
||||
;
|
||||
case _ =>
|
||||
tpeOfTree.get(tree) match {
|
||||
case Some(oldtpe) =>
|
||||
if (!(oldtpe =:= tree.tpe))
|
||||
error(tree.pos, "types differ\n old: " + oldtpe + "\n new: " + tree.tpe +
|
||||
"\n tree: " + tree);
|
||||
tree.tpe = oldtpe;
|
||||
super.traverse(tree)
|
||||
case None =>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,83 +1,83 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import symtab.Flags._;
|
||||
|
||||
/** Variances form a lattice, 0 <= COVARIANT <= Variances, 0 <= CONTRAVARIANT <= VARIANCES
|
||||
*/
|
||||
[_trait_] abstract class Variances {
|
||||
|
||||
val global: Global;
|
||||
import global._;
|
||||
|
||||
/** Convert variance to string */
|
||||
private def varianceString(variance: int): String =
|
||||
if (variance == COVARIANT) "covariant"
|
||||
else if (variance == CONTRAVARIANT) "contravariant"
|
||||
else "invariant";
|
||||
|
||||
/** Flip between covariant and contravariant */
|
||||
private def flip(v: int): int = {
|
||||
if (v == COVARIANT) CONTRAVARIANT;
|
||||
else if (v == CONTRAVARIANT) COVARIANT;
|
||||
else v
|
||||
}
|
||||
|
||||
private def compose(v1: int, v2: int) =
|
||||
if (v1 == 0) 0
|
||||
else if (v1 == CONTRAVARIANT) flip(v2)
|
||||
else v2;
|
||||
|
||||
/** Map everything below VARIANCES to 0 */
|
||||
private def cut(v: int): int =
|
||||
if (v == VARIANCES) v else 0;
|
||||
|
||||
/** Compute variance of type parameter `tparam' in types of all symbols `sym'. */
|
||||
def varianceInSyms(syms: List[Symbol])(tparam: Symbol): int =
|
||||
(VARIANCES /: syms) ((v, sym) => v & varianceInSym(sym)(tparam));
|
||||
|
||||
/** Compute variance of type parameter `tparam' in type of symbol `sym'. */
|
||||
def varianceInSym(sym: Symbol)(tparam: Symbol): int =
|
||||
if (sym.isAliasType) cut(varianceInType(sym.info)(tparam))
|
||||
else varianceInType(sym.info)(tparam);
|
||||
|
||||
/** Compute variance of type parameter `tparam' in all types `tps'. */
|
||||
def varianceInTypes(tps: List[Type])(tparam: Symbol): int =
|
||||
(VARIANCES /: tps) ((v, tp) => v & varianceInType(tp)(tparam));
|
||||
|
||||
/** Compute variance of type parameter `tparam' in all type arguments
|
||||
* `tps' which correspond to formal type parameters `tparams1'. */
|
||||
def varianceInArgs(tps: List[Type], tparams1: List[Symbol])(tparam: Symbol): int = {
|
||||
var v: int = VARIANCES;
|
||||
for (val Pair(tp, tparam1) <- tps zip tparams1) {
|
||||
val v1 = varianceInType(tp)(tparam);
|
||||
v = v & (if (tparam1.hasFlag(COVARIANT)) v1
|
||||
else if (tparam1.hasFlag(CONTRAVARIANT)) flip(v1)
|
||||
else cut(v1))
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
/** Compute variance of type parameter `tparam' in type `tp'. */
|
||||
def varianceInType(tp: Type)(tparam: Symbol): int = tp match {
|
||||
case ErrorType | WildcardType | NoType | NoPrefix | ThisType(_) | ConstantType(_) =>
|
||||
VARIANCES
|
||||
case SingleType(pre, sym) =>
|
||||
cut(varianceInType(pre)(tparam))
|
||||
case TypeRef(pre, sym, args) =>
|
||||
if (sym == tparam) COVARIANT
|
||||
else varianceInType(pre)(tparam) & varianceInArgs(args, sym.typeParams)(tparam)
|
||||
case TypeBounds(lo, hi) =>
|
||||
flip(varianceInType(lo)(tparam)) & varianceInType(hi)(tparam)
|
||||
case RefinedType(parents, defs) =>
|
||||
varianceInTypes(parents)(tparam) & varianceInSyms(defs.toList)(tparam)
|
||||
case MethodType(formals, restpe) =>
|
||||
flip(varianceInTypes(formals)(tparam)) & varianceInType(restpe)(tparam)
|
||||
case PolyType(tparams, restpe) =>
|
||||
flip(varianceInSyms(tparams)(tparam)) & varianceInType(restpe)(tparam)
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.typechecker;
|
||||
|
||||
import symtab.Flags._;
|
||||
|
||||
/** Variances form a lattice, 0 <= COVARIANT <= Variances, 0 <= CONTRAVARIANT <= VARIANCES
|
||||
*/
|
||||
[_trait_] abstract class Variances {
|
||||
|
||||
val global: Global;
|
||||
import global._;
|
||||
|
||||
/** Convert variance to string */
|
||||
private def varianceString(variance: int): String =
|
||||
if (variance == COVARIANT) "covariant"
|
||||
else if (variance == CONTRAVARIANT) "contravariant"
|
||||
else "invariant";
|
||||
|
||||
/** Flip between covariant and contravariant */
|
||||
private def flip(v: int): int = {
|
||||
if (v == COVARIANT) CONTRAVARIANT;
|
||||
else if (v == CONTRAVARIANT) COVARIANT;
|
||||
else v
|
||||
}
|
||||
|
||||
private def compose(v1: int, v2: int) =
|
||||
if (v1 == 0) 0
|
||||
else if (v1 == CONTRAVARIANT) flip(v2)
|
||||
else v2;
|
||||
|
||||
/** Map everything below VARIANCES to 0 */
|
||||
private def cut(v: int): int =
|
||||
if (v == VARIANCES) v else 0;
|
||||
|
||||
/** Compute variance of type parameter `tparam' in types of all symbols `sym'. */
|
||||
def varianceInSyms(syms: List[Symbol])(tparam: Symbol): int =
|
||||
(VARIANCES /: syms) ((v, sym) => v & varianceInSym(sym)(tparam));
|
||||
|
||||
/** Compute variance of type parameter `tparam' in type of symbol `sym'. */
|
||||
def varianceInSym(sym: Symbol)(tparam: Symbol): int =
|
||||
if (sym.isAliasType) cut(varianceInType(sym.info)(tparam))
|
||||
else varianceInType(sym.info)(tparam);
|
||||
|
||||
/** Compute variance of type parameter `tparam' in all types `tps'. */
|
||||
def varianceInTypes(tps: List[Type])(tparam: Symbol): int =
|
||||
(VARIANCES /: tps) ((v, tp) => v & varianceInType(tp)(tparam));
|
||||
|
||||
/** Compute variance of type parameter `tparam' in all type arguments
|
||||
* `tps' which correspond to formal type parameters `tparams1'. */
|
||||
def varianceInArgs(tps: List[Type], tparams1: List[Symbol])(tparam: Symbol): int = {
|
||||
var v: int = VARIANCES;
|
||||
for (val Pair(tp, tparam1) <- tps zip tparams1) {
|
||||
val v1 = varianceInType(tp)(tparam);
|
||||
v = v & (if (tparam1.hasFlag(COVARIANT)) v1
|
||||
else if (tparam1.hasFlag(CONTRAVARIANT)) flip(v1)
|
||||
else cut(v1))
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
/** Compute variance of type parameter `tparam' in type `tp'. */
|
||||
def varianceInType(tp: Type)(tparam: Symbol): int = tp match {
|
||||
case ErrorType | WildcardType | NoType | NoPrefix | ThisType(_) | ConstantType(_) =>
|
||||
VARIANCES
|
||||
case SingleType(pre, sym) =>
|
||||
cut(varianceInType(pre)(tparam))
|
||||
case TypeRef(pre, sym, args) =>
|
||||
if (sym == tparam) COVARIANT
|
||||
else varianceInType(pre)(tparam) & varianceInArgs(args, sym.typeParams)(tparam)
|
||||
case TypeBounds(lo, hi) =>
|
||||
flip(varianceInType(lo)(tparam)) & varianceInType(hi)(tparam)
|
||||
case RefinedType(parents, defs) =>
|
||||
varianceInTypes(parents)(tparam) & varianceInSyms(defs.toList)(tparam)
|
||||
case MethodType(formals, restpe) =>
|
||||
flip(varianceInTypes(formals)(tparam)) & varianceInType(restpe)(tparam)
|
||||
case PolyType(tparams, restpe) =>
|
||||
flip(varianceInSyms(tparams)(tparam)) & varianceInType(restpe)(tparam)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,58 +1,58 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.util;
|
||||
|
||||
class HashSet[T <: AnyRef](initialCapacity: int) extends Set[T] {
|
||||
|
||||
private var capacity = initialCapacity;
|
||||
private var used = 0;
|
||||
private var table = new Array[Object](capacity);
|
||||
|
||||
def size: int = used;
|
||||
|
||||
def findEntry(x: T): T = {
|
||||
var h = x.hashCode() % capacity;
|
||||
var entry = table(h);
|
||||
while (entry != null && entry != x) {
|
||||
h = (h + 1) % capacity;
|
||||
entry = table(h)
|
||||
}
|
||||
entry.asInstanceOf[T]
|
||||
}
|
||||
|
||||
def addEntry(x: T): unit = {
|
||||
if (used >= (capacity >> 2)) growTable;
|
||||
used = used + 1;
|
||||
var h = x.hashCode() % capacity;
|
||||
while (table(h) != null) {
|
||||
h = (h + 1) % capacity
|
||||
}
|
||||
table(h) = x
|
||||
}
|
||||
|
||||
def elements = new Iterator[T] {
|
||||
private var i = 0;
|
||||
def hasNext: boolean = {
|
||||
while (i < capacity && table(i) == null) i = i + 1;
|
||||
i < capacity
|
||||
}
|
||||
def next: T =
|
||||
if (hasNext) { i = i + 1; table(i - 1).asInstanceOf[T] }
|
||||
else null
|
||||
}
|
||||
|
||||
private def growTable: unit = {
|
||||
val oldtable = table;
|
||||
capacity = capacity * 2;
|
||||
table = new Array[Object](capacity);
|
||||
var i = 0;
|
||||
while (i < oldtable.length) {
|
||||
val entry = oldtable(i);
|
||||
if (entry != null) addEntry(entry.asInstanceOf[T]);
|
||||
i = i + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.util;
|
||||
|
||||
class HashSet[T <: AnyRef](initialCapacity: int) extends Set[T] {
|
||||
|
||||
private var capacity = initialCapacity;
|
||||
private var used = 0;
|
||||
private var table = new Array[Object](capacity);
|
||||
|
||||
def size: int = used;
|
||||
|
||||
def findEntry(x: T): T = {
|
||||
var h = x.hashCode() % capacity;
|
||||
var entry = table(h);
|
||||
while (entry != null && entry != x) {
|
||||
h = (h + 1) % capacity;
|
||||
entry = table(h)
|
||||
}
|
||||
entry.asInstanceOf[T]
|
||||
}
|
||||
|
||||
def addEntry(x: T): unit = {
|
||||
if (used >= (capacity >> 2)) growTable;
|
||||
used = used + 1;
|
||||
var h = x.hashCode() % capacity;
|
||||
while (table(h) != null) {
|
||||
h = (h + 1) % capacity
|
||||
}
|
||||
table(h) = x
|
||||
}
|
||||
|
||||
def elements = new Iterator[T] {
|
||||
private var i = 0;
|
||||
def hasNext: boolean = {
|
||||
while (i < capacity && table(i) == null) i = i + 1;
|
||||
i < capacity
|
||||
}
|
||||
def next: T =
|
||||
if (hasNext) { i = i + 1; table(i - 1).asInstanceOf[T] }
|
||||
else null
|
||||
}
|
||||
|
||||
private def growTable: unit = {
|
||||
val oldtable = table;
|
||||
capacity = capacity * 2;
|
||||
table = new Array[Object](capacity);
|
||||
var i = 0;
|
||||
while (i < oldtable.length) {
|
||||
val entry = oldtable(i);
|
||||
if (entry != null) addEntry(entry.asInstanceOf[T]);
|
||||
i = i + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2004, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** $Id$
|
||||
\* */
|
||||
|
||||
package scala.tools.nsc.util;
|
||||
|
||||
/** This position uses offset in character buffer rather than line column relationship.
|
||||
* @author Sean McDirmid
|
||||
*/
|
||||
object Position {
|
||||
val NOPOS = -1;
|
||||
val FIRSTPOS = 0;
|
||||
val NOLINE = 0;
|
||||
val FIRSTLINE = 1;
|
||||
|
||||
def line(source : SourceFile, offset : Int) = (new Position(source, offset)).line;
|
||||
}
|
||||
|
||||
|
||||
class Position( val source : SourceFile, val offset: Int) {
|
||||
import Position._;
|
||||
|
||||
private val tabInc = 8;
|
||||
|
||||
def this(sourceName : String) = this(new SourceFile(sourceName, new Array[Char](0)), Position.NOPOS);
|
||||
def this(sourceName : String, _offset : Int) = this(new SourceFile(sourceName, new Array[Char](0)), _offset);
|
||||
|
||||
def hasOffset = offset != NOPOS;
|
||||
|
||||
def line: Int = if (hasOffset) source.offsetToLine(offset) + FIRSTLINE else NOLINE;
|
||||
// for display purposes only.
|
||||
def column: Int = if (hasOffset) {
|
||||
var column = 1;
|
||||
|
||||
// find beginning offset for line
|
||||
val line = source.offsetToLine (offset);
|
||||
var coffset = source. lineToOffset(line);
|
||||
var continue = true;
|
||||
while (continue) {
|
||||
if (coffset == offset) continue = false;
|
||||
else if (source.content(coffset) == '\t') column = ((column - 1) / tabInc * tabInc) + tabInc + 1;
|
||||
else column = column + 1;
|
||||
coffset = coffset + 1;
|
||||
}
|
||||
column;
|
||||
} else 0;
|
||||
|
||||
|
||||
def dbgString =
|
||||
if (!hasOffset) "NOP"
|
||||
else if (offset >= source.content.length) "OB-" + offset else {
|
||||
val ret = "offset=" + offset + " line=" + line;
|
||||
var add = "";
|
||||
while (offset + add.length() < source.content.length &&
|
||||
add.length() < 10) add = add + source.content(offset + add.length());
|
||||
ret + " c[0..9]=\"" + add + "\"";
|
||||
}
|
||||
|
||||
|
||||
|
||||
def lineContent: String = if (hasOffset) source.lineToString(line - FIRSTLINE) else "NO_LINE";
|
||||
|
||||
/** Returns a string representation of the encoded position. */
|
||||
override def toString(): String = {
|
||||
val sb = new StringBuffer();
|
||||
sb.append(source.file.getPath());
|
||||
if (hasOffset) {
|
||||
sb.append(line);
|
||||
sb.append(':');
|
||||
sb.append(column);
|
||||
}
|
||||
sb.toString();
|
||||
}
|
||||
}
|
||||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2004, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** $Id$
|
||||
\* */
|
||||
|
||||
package scala.tools.nsc.util;
|
||||
|
||||
/** This position uses offset in character buffer rather than line column relationship.
|
||||
* @author Sean McDirmid
|
||||
*/
|
||||
object Position {
|
||||
val NOPOS = -1;
|
||||
val FIRSTPOS = 0;
|
||||
val NOLINE = 0;
|
||||
val FIRSTLINE = 1;
|
||||
|
||||
def line(source : SourceFile, offset : Int) = (new Position(source, offset)).line;
|
||||
}
|
||||
|
||||
|
||||
class Position( val source : SourceFile, val offset: Int) {
|
||||
import Position._;
|
||||
|
||||
private val tabInc = 8;
|
||||
|
||||
def this(sourceName : String) = this(new SourceFile(sourceName, new Array[Char](0)), Position.NOPOS);
|
||||
def this(sourceName : String, _offset : Int) = this(new SourceFile(sourceName, new Array[Char](0)), _offset);
|
||||
|
||||
def hasOffset = offset != NOPOS;
|
||||
|
||||
def line: Int = if (hasOffset) source.offsetToLine(offset) + FIRSTLINE else NOLINE;
|
||||
// for display purposes only.
|
||||
def column: Int = if (hasOffset) {
|
||||
var column = 1;
|
||||
|
||||
// find beginning offset for line
|
||||
val line = source.offsetToLine (offset);
|
||||
var coffset = source. lineToOffset(line);
|
||||
var continue = true;
|
||||
while (continue) {
|
||||
if (coffset == offset) continue = false;
|
||||
else if (source.content(coffset) == '\t') column = ((column - 1) / tabInc * tabInc) + tabInc + 1;
|
||||
else column = column + 1;
|
||||
coffset = coffset + 1;
|
||||
}
|
||||
column;
|
||||
} else 0;
|
||||
|
||||
|
||||
def dbgString =
|
||||
if (!hasOffset) "NOP"
|
||||
else if (offset >= source.content.length) "OB-" + offset else {
|
||||
val ret = "offset=" + offset + " line=" + line;
|
||||
var add = "";
|
||||
while (offset + add.length() < source.content.length &&
|
||||
add.length() < 10) add = add + source.content(offset + add.length());
|
||||
ret + " c[0..9]=\"" + add + "\"";
|
||||
}
|
||||
|
||||
|
||||
|
||||
def lineContent: String = if (hasOffset) source.lineToString(line - FIRSTLINE) else "NO_LINE";
|
||||
|
||||
/** Returns a string representation of the encoded position. */
|
||||
override def toString(): String = {
|
||||
val sb = new StringBuffer();
|
||||
sb.append(source.file.getPath());
|
||||
if (hasOffset) {
|
||||
sb.append(line);
|
||||
sb.append(':');
|
||||
sb.append(column);
|
||||
}
|
||||
sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.util;
|
||||
|
||||
/** A common trait for lightweight sets.
|
||||
*/
|
||||
abstract class Set[T <: AnyRef] {
|
||||
|
||||
def findEntry(x: T): T;
|
||||
|
||||
def addEntry(x: T): unit;
|
||||
|
||||
def elements: Iterator[T];
|
||||
|
||||
def contains(x: T): boolean =
|
||||
findEntry(x) != null;
|
||||
|
||||
def toList = elements.toList;
|
||||
|
||||
}
|
||||
/* NSC -- new scala compiler
|
||||
* Copyright 2005 LAMP/EPFL
|
||||
* @author Martin Odersky
|
||||
*/
|
||||
// $Id$
|
||||
package scala.tools.nsc.util;
|
||||
|
||||
/** A common trait for lightweight sets.
|
||||
*/
|
||||
abstract class Set[T <: AnyRef] {
|
||||
|
||||
def findEntry(x: T): T;
|
||||
|
||||
def addEntry(x: T): unit;
|
||||
|
||||
def elements: Iterator[T];
|
||||
|
||||
def contains(x: T): boolean =
|
||||
findEntry(x) != null;
|
||||
|
||||
def toList = elements.toList;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,136 +1,136 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2004, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** $Id$
|
||||
\* */
|
||||
|
||||
package scala.tools.nsc.util;
|
||||
import scala.tools.util.AbstractFile;
|
||||
import scala.tools.util.CharArrayFile;
|
||||
|
||||
/** Uses positions that are offsets rather than line/column pairs.
|
||||
*
|
||||
* @author Sean McDirmid
|
||||
*/
|
||||
object SourceFile {
|
||||
val LF : Char = 0x0A;
|
||||
val FF : Char = 0x0C;
|
||||
val CR : Char = 0x0D;
|
||||
val SU : Char = 0x1A;
|
||||
def isLineBreak(c : Char) = c == LF || c == FF || c == CR || c == SU;
|
||||
}
|
||||
|
||||
|
||||
class SourceFile(_file : AbstractFile, _content : Array[Char]) {
|
||||
import SourceFile._;
|
||||
|
||||
|
||||
val file = _file;
|
||||
val content = normalize(_content);
|
||||
|
||||
def getContent() = content;
|
||||
|
||||
def getFile() = file;
|
||||
|
||||
def this(sourceName: String, content : Array[Char]) =
|
||||
this(new CharArrayFile(sourceName, content), content);
|
||||
|
||||
def isLineBreak(idx : Int) = if (!SourceFile.isLineBreak(content(idx))) false;
|
||||
else if (content(idx) == CR && idx + 1 < content.length && content(idx + 1) == LF) false;
|
||||
else true;
|
||||
|
||||
|
||||
def position(offset : Int) = new Position(this, offset);
|
||||
def position(line : Int, column : Int) = new Position(this, lineToOffset(line) + column);
|
||||
|
||||
// constants
|
||||
|
||||
// NOTE: all indexes are based on zero!!!!
|
||||
override def toString(): String = file.getName() /* + ":" + content.length */ ;
|
||||
|
||||
|
||||
def dbg(offset : Int) = (new Position(this, offset)).dbgString;
|
||||
|
||||
|
||||
object line {
|
||||
var index = 0;
|
||||
var offset = 0;
|
||||
|
||||
def find(toFind : Int, isIndex : Boolean) : Int = {
|
||||
if (toFind == 0) return 0;
|
||||
|
||||
if (!isIndex) assert(toFind != Position.NOPOS);
|
||||
if ( isIndex) assert(toFind > Position.NOLINE - Position.FIRSTLINE);
|
||||
|
||||
if (!isIndex && (toFind >= content.length)) throw new Error(toFind + " not valid offset in " + file.getName() + ":" + content.length);
|
||||
|
||||
def get(isIndex : Boolean) = if (isIndex) index else offset;
|
||||
|
||||
val isBackward = toFind <= get(isIndex);
|
||||
val increment = if (isBackward) -1 else + 1;
|
||||
val oneIfBackward = if (isBackward) +1 else 0;
|
||||
|
||||
// System.err.println("FIND-0: " + toFind + " " + isIndex);
|
||||
|
||||
while (true) {
|
||||
// System.err.println("FIND-1: " + offset + " " + index);
|
||||
|
||||
if (!isIndex && offset == toFind) return index;
|
||||
if ( isBackward && offset <= 0) throw new Error(offset + " " + index + " " + toFind + " " + isIndex);
|
||||
offset = offset + increment;
|
||||
if (!isBackward) assert(offset < content.length);
|
||||
|
||||
if (isLineBreak(offset + (if (isBackward) 0 else -1))) {
|
||||
index = index + increment;
|
||||
if (isIndex && index + oneIfBackward == toFind)
|
||||
return offset + oneIfBackward;
|
||||
}
|
||||
}
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
def offsetToLine(offset : Int) : Int = line.find(offset, false);
|
||||
def lineToOffset(index : Int) : Int = line.find(index , true);
|
||||
|
||||
def beginsWith(offset : Int, text : String): Boolean = {
|
||||
var idx = 0;
|
||||
while (idx < text.length()) {
|
||||
if (offset + idx >= content.length) return false;
|
||||
if (content(offset + idx) != text.charAt(idx)) return false;
|
||||
idx = idx + 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
def path = getFile().getPath();
|
||||
|
||||
def skipWhitespace(offset : Int): Int =
|
||||
if (Character.isWhitespace(content(offset))) skipWhitespace(offset + 1) else offset;
|
||||
|
||||
|
||||
def lineToString(index : Int) = {
|
||||
var offset = lineToOffset(index);
|
||||
val buf = new StringBuffer();
|
||||
while (!isLineBreak(offset) && offset < content.length) {
|
||||
buf.append(content(offset));
|
||||
offset = offset + 1;
|
||||
}
|
||||
buf.toString();
|
||||
}
|
||||
|
||||
|
||||
private def normalize(input : Array[char]): Array[char] =
|
||||
if (input.length > 0 && input(input.length - 1) == SU) input;
|
||||
else {
|
||||
val content = new Array[char](input.length + 1);
|
||||
System.arraycopy(input, 0, content, 0, input.length);
|
||||
content(input.length) = SU;
|
||||
content;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2004, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
** $Id$
|
||||
\* */
|
||||
|
||||
package scala.tools.nsc.util;
|
||||
import scala.tools.util.AbstractFile;
|
||||
import scala.tools.util.CharArrayFile;
|
||||
|
||||
/** Uses positions that are offsets rather than line/column pairs.
|
||||
*
|
||||
* @author Sean McDirmid
|
||||
*/
|
||||
object SourceFile {
|
||||
val LF : Char = 0x0A;
|
||||
val FF : Char = 0x0C;
|
||||
val CR : Char = 0x0D;
|
||||
val SU : Char = 0x1A;
|
||||
def isLineBreak(c : Char) = c == LF || c == FF || c == CR || c == SU;
|
||||
}
|
||||
|
||||
|
||||
class SourceFile(_file : AbstractFile, _content : Array[Char]) {
|
||||
import SourceFile._;
|
||||
|
||||
|
||||
val file = _file;
|
||||
val content = normalize(_content);
|
||||
|
||||
def getContent() = content;
|
||||
|
||||
def getFile() = file;
|
||||
|
||||
def this(sourceName: String, content : Array[Char]) =
|
||||
this(new CharArrayFile(sourceName, content), content);
|
||||
|
||||
def isLineBreak(idx : Int) = if (!SourceFile.isLineBreak(content(idx))) false;
|
||||
else if (content(idx) == CR && idx + 1 < content.length && content(idx + 1) == LF) false;
|
||||
else true;
|
||||
|
||||
|
||||
def position(offset : Int) = new Position(this, offset);
|
||||
def position(line : Int, column : Int) = new Position(this, lineToOffset(line) + column);
|
||||
|
||||
// constants
|
||||
|
||||
// NOTE: all indexes are based on zero!!!!
|
||||
override def toString(): String = file.getName() /* + ":" + content.length */ ;
|
||||
|
||||
|
||||
def dbg(offset : Int) = (new Position(this, offset)).dbgString;
|
||||
|
||||
|
||||
object line {
|
||||
var index = 0;
|
||||
var offset = 0;
|
||||
|
||||
def find(toFind : Int, isIndex : Boolean) : Int = {
|
||||
if (toFind == 0) return 0;
|
||||
|
||||
if (!isIndex) assert(toFind != Position.NOPOS);
|
||||
if ( isIndex) assert(toFind > Position.NOLINE - Position.FIRSTLINE);
|
||||
|
||||
if (!isIndex && (toFind >= content.length)) throw new Error(toFind + " not valid offset in " + file.getName() + ":" + content.length);
|
||||
|
||||
def get(isIndex : Boolean) = if (isIndex) index else offset;
|
||||
|
||||
val isBackward = toFind <= get(isIndex);
|
||||
val increment = if (isBackward) -1 else + 1;
|
||||
val oneIfBackward = if (isBackward) +1 else 0;
|
||||
|
||||
// System.err.println("FIND-0: " + toFind + " " + isIndex);
|
||||
|
||||
while (true) {
|
||||
// System.err.println("FIND-1: " + offset + " " + index);
|
||||
|
||||
if (!isIndex && offset == toFind) return index;
|
||||
if ( isBackward && offset <= 0) throw new Error(offset + " " + index + " " + toFind + " " + isIndex);
|
||||
offset = offset + increment;
|
||||
if (!isBackward) assert(offset < content.length);
|
||||
|
||||
if (isLineBreak(offset + (if (isBackward) 0 else -1))) {
|
||||
index = index + increment;
|
||||
if (isIndex && index + oneIfBackward == toFind)
|
||||
return offset + oneIfBackward;
|
||||
}
|
||||
}
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
def offsetToLine(offset : Int) : Int = line.find(offset, false);
|
||||
def lineToOffset(index : Int) : Int = line.find(index , true);
|
||||
|
||||
def beginsWith(offset : Int, text : String): Boolean = {
|
||||
var idx = 0;
|
||||
while (idx < text.length()) {
|
||||
if (offset + idx >= content.length) return false;
|
||||
if (content(offset + idx) != text.charAt(idx)) return false;
|
||||
idx = idx + 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
def path = getFile().getPath();
|
||||
|
||||
def skipWhitespace(offset : Int): Int =
|
||||
if (Character.isWhitespace(content(offset))) skipWhitespace(offset + 1) else offset;
|
||||
|
||||
|
||||
def lineToString(index : Int) = {
|
||||
var offset = lineToOffset(index);
|
||||
val buf = new StringBuffer();
|
||||
while (!isLineBreak(offset) && offset < content.length) {
|
||||
buf.append(content(offset));
|
||||
offset = offset + 1;
|
||||
}
|
||||
buf.toString();
|
||||
}
|
||||
|
||||
|
||||
private def normalize(input : Array[char]): Array[char] =
|
||||
if (input.length > 0 && input(input.length - 1) == SU) input;
|
||||
else {
|
||||
val content = new Array[char](input.length + 1);
|
||||
System.arraycopy(input, 0, content, 0, input.length);
|
||||
content(input.length) = SU;
|
||||
content;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -447,18 +447,18 @@ class Scanner(_unit: CompilationUnit) extends TokenData {
|
|||
}
|
||||
return;
|
||||
case _ =>
|
||||
if (Character.isUnicodeIdentifierStart(ch)) {
|
||||
putChar(ch);
|
||||
nextch();
|
||||
getIdentRest;
|
||||
if (Character.isUnicodeIdentifierStart(ch)) {
|
||||
putChar(ch);
|
||||
nextch();
|
||||
getIdentRest;
|
||||
}
|
||||
else if (isSpecial(ch)) {
|
||||
putChar(ch);
|
||||
getOperatorRest;
|
||||
else if (isSpecial(ch)) {
|
||||
putChar(ch);
|
||||
getOperatorRest;
|
||||
}
|
||||
else {
|
||||
syntaxError("illegal character");
|
||||
nextch();
|
||||
else {
|
||||
syntaxError("illegal character");
|
||||
nextch();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -525,20 +525,20 @@ class Scanner(_unit: CompilationUnit) extends TokenData {
|
|||
|
||||
// Identifiers ---------------------------------------------------------------
|
||||
|
||||
def isIdentStart(c: char): boolean =
|
||||
('A' <= c && c <= 'Z') ||
|
||||
('a' <= c && c <= 'a') ||
|
||||
(c == '_') || (c == '$') ||
|
||||
Character.isUnicodeIdentifierStart(c);
|
||||
|
||||
def isIdentPart(c: char) =
|
||||
isIdentStart(c) ||
|
||||
('0' <= c && c <= '9') ||
|
||||
Character.isUnicodeIdentifierPart(c);
|
||||
|
||||
def isSpecial(c: char) = {
|
||||
val chtp = Character.getType(c);
|
||||
chtp == Character.MATH_SYMBOL || chtp == Character.OTHER_SYMBOL;
|
||||
def isIdentStart(c: char): boolean =
|
||||
('A' <= c && c <= 'Z') ||
|
||||
('a' <= c && c <= 'a') ||
|
||||
(c == '_') || (c == '$') ||
|
||||
Character.isUnicodeIdentifierStart(c);
|
||||
|
||||
def isIdentPart(c: char) =
|
||||
isIdentStart(c) ||
|
||||
('0' <= c && c <= '9') ||
|
||||
Character.isUnicodeIdentifierPart(c);
|
||||
|
||||
def isSpecial(c: char) = {
|
||||
val chtp = Character.getType(c);
|
||||
chtp == Character.MATH_SYMBOL || chtp == Character.OTHER_SYMBOL;
|
||||
}
|
||||
|
||||
private def getIdentRest: Unit = {
|
||||
|
@ -995,3 +995,4 @@ class Scanner(_unit: CompilationUnit) extends TokenData {
|
|||
}
|
||||
|
||||
} // package
|
||||
|
||||
|
|
|
@ -1,81 +1,81 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Scala highlighter written by Stephane Micheloud, scala.epfl.ch
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Language: Scala
|
||||
Filter: Scala files (*.scala)|*.scala
|
||||
Description: Scala highlighter written by Stephane Micheloud - scala.epfl.ch
|
||||
HelpFile:
|
||||
CaseSensitive: 1
|
||||
LineComment: //
|
||||
BlockCommentBeg: /*
|
||||
BlockCommentEnd: */
|
||||
BlockAutoindent: 0
|
||||
BlockBegStr: {
|
||||
BlockEndStr: }
|
||||
IdentifierBegChars: a..z A..Z _ `
|
||||
IdentifierChars: a..z A..Z _ 0..9 `
|
||||
NumConstBegChars: 0..9 +-
|
||||
NumConstChars: 0..9 a..f A..F x X .
|
||||
EscapeChar: \
|
||||
|
||||
// keywords (see Scala specification, section 1.1)
|
||||
KeyWords1: abstract case catch class def do else extends false
|
||||
final finally for if implicit import match requires
|
||||
new null object override package private protected
|
||||
return sealed super this throw trait true try type
|
||||
val var while with yield
|
||||
|
||||
// special characters (see Scala specification, section 1.1)
|
||||
KeyWords2: _ : = => <- <: >: # @
|
||||
|
||||
// standard library objects and classes (see Scala API documentation)
|
||||
KeyWords3: Any AnyVal Application Array ArrayBuffer Atom
|
||||
Attribute
|
||||
BitSet Boolean Buffer Byte
|
||||
Cell Char Comment Console Double
|
||||
Elem EntityRef Enumeration Float
|
||||
HashMap HashSet HashTable History
|
||||
Int Iterable Iterator
|
||||
ListMap ListSet Long List Location
|
||||
Map Message MetaData MultiMap
|
||||
Nil Node NodeBuffer NodeSeq None Null Option
|
||||
Ordered Predef Queue
|
||||
ScalaObject Scriptable Seq Set Short Some Stack
|
||||
Stream Symbol
|
||||
Text TextBuffer Tree TreeMap TreeSet
|
||||
Unit XML
|
||||
|
||||
// standard attribute classes
|
||||
KeyWords4: cloneable serializable transcient volatile
|
||||
|
||||
KeyWords5:
|
||||
|
||||
StringBegChar: "
|
||||
StringEndChar: "
|
||||
MultilineStrings: 0
|
||||
UsePreprocessor: 0
|
||||
CurrLineHighlighted: 1
|
||||
|
||||
// 1st value is foreground color, 2nd value is background color
|
||||
// (see color list in vbScript.chl) and 3rd value (optional) represents
|
||||
// font attribute (B=bold, I=italic, U=underline, S=strike out)
|
||||
SpaceCol: clWindowText clWindow
|
||||
Keyword1Col: clBlack clWindow B
|
||||
Keyword2Col: clBlack clWindow
|
||||
Keyword3Col: clMaroon clWindow B
|
||||
Keyword4Col: clBlue clWindow B
|
||||
Keyword5Col: clMaroon clWindow B
|
||||
IdentifierCol: clWindowText clWindow
|
||||
CommentCol: clGreen clWindow I
|
||||
NumberCol: clNavy clWindow B
|
||||
StringCol: clRed clWindow
|
||||
SymbolCol: clWindowText clWindow
|
||||
PreprocessorCol: clBlue clWindow
|
||||
SelectionCol: clWhite clNavy
|
||||
CurrentLineCol: clBlack clYellow
|
||||
MatchedBracesCol: clWindowText clWindow
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Scala highlighter written by Stephane Micheloud, scala.epfl.ch
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Language: Scala
|
||||
Filter: Scala files (*.scala)|*.scala
|
||||
Description: Scala highlighter written by Stephane Micheloud - scala.epfl.ch
|
||||
HelpFile:
|
||||
CaseSensitive: 1
|
||||
LineComment: //
|
||||
BlockCommentBeg: /*
|
||||
BlockCommentEnd: */
|
||||
BlockAutoindent: 0
|
||||
BlockBegStr: {
|
||||
BlockEndStr: }
|
||||
IdentifierBegChars: a..z A..Z _ `
|
||||
IdentifierChars: a..z A..Z _ 0..9 `
|
||||
NumConstBegChars: 0..9 +-
|
||||
NumConstChars: 0..9 a..f A..F x X .
|
||||
EscapeChar: \
|
||||
|
||||
// keywords (see Scala specification, section 1.1)
|
||||
KeyWords1: abstract case catch class def do else extends false
|
||||
final finally for if implicit import match requires
|
||||
new null object override package private protected
|
||||
return sealed super this throw trait true try type
|
||||
val var while with yield
|
||||
|
||||
// special characters (see Scala specification, section 1.1)
|
||||
KeyWords2: _ : = => <- <: >: # @
|
||||
|
||||
// standard library objects and classes (see Scala API documentation)
|
||||
KeyWords3: Any AnyVal Application Array ArrayBuffer Atom
|
||||
Attribute
|
||||
BitSet Boolean Buffer Byte
|
||||
Cell Char Comment Console Double
|
||||
Elem EntityRef Enumeration Float
|
||||
HashMap HashSet HashTable History
|
||||
Int Iterable Iterator
|
||||
ListMap ListSet Long List Location
|
||||
Map Message MetaData MultiMap
|
||||
Nil Node NodeBuffer NodeSeq None Null Option
|
||||
Ordered Predef Queue
|
||||
ScalaObject Scriptable Seq Set Short Some Stack
|
||||
Stream Symbol
|
||||
Text TextBuffer Tree TreeMap TreeSet
|
||||
Unit XML
|
||||
|
||||
// standard attribute classes
|
||||
KeyWords4: cloneable serializable transcient volatile
|
||||
|
||||
KeyWords5:
|
||||
|
||||
StringBegChar: "
|
||||
StringEndChar: "
|
||||
MultilineStrings: 0
|
||||
UsePreprocessor: 0
|
||||
CurrLineHighlighted: 1
|
||||
|
||||
// 1st value is foreground color, 2nd value is background color
|
||||
// (see color list in vbScript.chl) and 3rd value (optional) represents
|
||||
// font attribute (B=bold, I=italic, U=underline, S=strike out)
|
||||
SpaceCol: clWindowText clWindow
|
||||
Keyword1Col: clBlack clWindow B
|
||||
Keyword2Col: clBlack clWindow
|
||||
Keyword3Col: clMaroon clWindow B
|
||||
Keyword4Col: clBlue clWindow B
|
||||
Keyword5Col: clMaroon clWindow B
|
||||
IdentifierCol: clWindowText clWindow
|
||||
CommentCol: clGreen clWindow I
|
||||
NumberCol: clNavy clWindow B
|
||||
StringCol: clRed clWindow
|
||||
SymbolCol: clWindowText clWindow
|
||||
PreprocessorCol: clBlue clWindow
|
||||
SelectionCol: clWhite clNavy
|
||||
CurrentLineCol: clBlack clYellow
|
||||
MatchedBracesCol: clWindowText clWindow
|
||||
|
||||
OverrideTxtFgColor: 0
|
|
@ -1,24 +1,24 @@
|
|||
* Introduction
|
||||
|
||||
This directory contains an additional highlighter (.chl) for
|
||||
Scala programs.
|
||||
|
||||
More information about ConTEXT (Windows only) is available from:
|
||||
|
||||
http://www.context.cx/
|
||||
|
||||
* Installation
|
||||
|
||||
Copy the file "Scala.chl" to the following location:
|
||||
|
||||
<ConTEXT_instdir>/Highlighters/
|
||||
|
||||
Restart the ConTEXT text editor.
|
||||
|
||||
* Thanks
|
||||
|
||||
Scala.chl was contributed by Stephane Micheloud (scala.epfl.ch)
|
||||
|
||||
* Version
|
||||
|
||||
$Id$
|
||||
* Introduction
|
||||
|
||||
This directory contains an additional highlighter (.chl) for
|
||||
Scala programs.
|
||||
|
||||
More information about ConTEXT (Windows only) is available from:
|
||||
|
||||
http://www.context.cx/
|
||||
|
||||
* Installation
|
||||
|
||||
Copy the file "Scala.chl" to the following location:
|
||||
|
||||
<ConTEXT_instdir>/Highlighters/
|
||||
|
||||
Restart the ConTEXT text editor.
|
||||
|
||||
* Thanks
|
||||
|
||||
Scala.chl was contributed by Stephane Micheloud (scala.epfl.ch)
|
||||
|
||||
* Version
|
||||
|
||||
$Id$
|
||||
|
|
|
@ -1,75 +1,75 @@
|
|||
[class | Scala class template]
|
||||
class |MyClass {
|
||||
|
||||
}
|
||||
|
||||
[def | function definition]
|
||||
def |myFunc(): = {
|
||||
}
|
||||
|
||||
[exit | System.exit]
|
||||
System.exit(|);
|
||||
|
||||
[for | for comprehensions]
|
||||
for (val i <- |) {}
|
||||
|
||||
[if | if expression]
|
||||
if (|) {
|
||||
|
||||
}
|
||||
|
||||
[ife | if-else expression]
|
||||
if (|) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
[main | Scala program template]
|
||||
object |Main {
|
||||
|
||||
/** Code documentation here */
|
||||
def main(args: Array[String]): Unit = {
|
||||
/* multi-line and semi-line comments here */
|
||||
// one-line comments here
|
||||
Console.println("Hello, world");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[match | match expression]
|
||||
| match {
|
||||
case =>
|
||||
case _ =>
|
||||
}
|
||||
|
||||
[Pair | Pair object]
|
||||
Pair(|, )
|
||||
|
||||
[println | Console.println]
|
||||
Console.println(|);
|
||||
|
||||
[trait | Scala trait template]
|
||||
trait |MyTrait {
|
||||
}
|
||||
|
||||
[try | try-catch block]
|
||||
try {
|
||||
|
|
||||
}
|
||||
catch {
|
||||
case e: Exception =>
|
||||
Console.println("Unexpected exception");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
[val | value definition]
|
||||
val | = ;
|
||||
|
||||
[while | while block]
|
||||
var i=0;
|
||||
while (i < |) {
|
||||
|
||||
i = i + 1;
|
||||
}
|
||||
[class | Scala class template]
|
||||
class |MyClass {
|
||||
|
||||
}
|
||||
|
||||
[def | function definition]
|
||||
def |myFunc(): = {
|
||||
}
|
||||
|
||||
[exit | System.exit]
|
||||
System.exit(|);
|
||||
|
||||
[for | for comprehensions]
|
||||
for (val i <- |) {}
|
||||
|
||||
[if | if expression]
|
||||
if (|) {
|
||||
|
||||
}
|
||||
|
||||
[ife | if-else expression]
|
||||
if (|) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
[main | Scala program template]
|
||||
object |Main {
|
||||
|
||||
/** Code documentation here */
|
||||
def main(args: Array[String]): Unit = {
|
||||
/* multi-line and semi-line comments here */
|
||||
// one-line comments here
|
||||
Console.println("Hello, world");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[match | match expression]
|
||||
| match {
|
||||
case =>
|
||||
case _ =>
|
||||
}
|
||||
|
||||
[Pair | Pair object]
|
||||
Pair(|, )
|
||||
|
||||
[println | Console.println]
|
||||
Console.println(|);
|
||||
|
||||
[trait | Scala trait template]
|
||||
trait |MyTrait {
|
||||
}
|
||||
|
||||
[try | try-catch block]
|
||||
try {
|
||||
|
|
||||
}
|
||||
catch {
|
||||
case e: Exception =>
|
||||
Console.println("Unexpected exception");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
[val | value definition]
|
||||
val | = ;
|
||||
|
||||
[while | while block]
|
||||
var i=0;
|
||||
while (i < |) {
|
||||
|
||||
i = i + 1;
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
* Introduction
|
||||
|
||||
This directory contains an additional syntax definition file (.syn) for
|
||||
Scala programs.
|
||||
|
||||
More information about TextPad (Windows only) is available from:
|
||||
|
||||
http://www.textpad.com/
|
||||
|
||||
* Installation
|
||||
|
||||
Copy the file "scala.syn" to the following location:
|
||||
|
||||
<TextPad_instdir>/system/
|
||||
|
||||
Start the TextPad text editor with NO opened files. Select the entry
|
||||
"New Document Class.." from the menu "Configure" and follow the
|
||||
instructions. For example:
|
||||
|
||||
Document class name : Scala
|
||||
Class members : *.scala
|
||||
Syntax definition file : scala.syn
|
||||
Enable syntax highlighting: yes
|
||||
|
||||
From that point on, loading a file whose name ends in ".scala" automatically
|
||||
turns Scala mode on.
|
||||
|
||||
* Thanks
|
||||
|
||||
scala.syn was contributed by Moez A. Abdel-Gawad (moez@cs.rice.edu)
|
||||
|
||||
* Version
|
||||
|
||||
$Id$
|
||||
* Introduction
|
||||
|
||||
This directory contains an additional syntax definition file (.syn) for
|
||||
Scala programs.
|
||||
|
||||
More information about TextPad (Windows only) is available from:
|
||||
|
||||
http://www.textpad.com/
|
||||
|
||||
* Installation
|
||||
|
||||
Copy the file "scala.syn" to the following location:
|
||||
|
||||
<TextPad_instdir>/system/
|
||||
|
||||
Start the TextPad text editor with NO opened files. Select the entry
|
||||
"New Document Class.." from the menu "Configure" and follow the
|
||||
instructions. For example:
|
||||
|
||||
Document class name : Scala
|
||||
Class members : *.scala
|
||||
Syntax definition file : scala.syn
|
||||
Enable syntax highlighting: yes
|
||||
|
||||
From that point on, loading a file whose name ends in ".scala" automatically
|
||||
turns Scala mode on.
|
||||
|
||||
* Thanks
|
||||
|
||||
scala.syn was contributed by Moez A. Abdel-Gawad (moez@cs.rice.edu)
|
||||
|
||||
* Version
|
||||
|
||||
$Id$
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,25 +1,25 @@
|
|||
* Introduction
|
||||
|
||||
This directory contains an additional wordlist file (.txt) for
|
||||
Scala programs.
|
||||
|
||||
More information about UltraEdit (Windows only) is available from:
|
||||
|
||||
http://www.ultraedit.com/
|
||||
|
||||
* Installation
|
||||
|
||||
In the dialog window "UltraEdit Configuration" (menu "Advanced" ->
|
||||
entry "Configuration..") click on the tab "Syntax Highlighting" and
|
||||
then on the "Open" button to edit the file "wordlist.txt".
|
||||
|
||||
Copy the contents of file "scala.txt" to the end of the file
|
||||
"wordlist.txt" und change the text label '/L20"Scala"' to the next
|
||||
available value (e.g. '/L10"Scala").
|
||||
|
||||
From that point on, loading a file whose name ends in ".scala" automatically
|
||||
turns Scala mode on.
|
||||
|
||||
* Version
|
||||
|
||||
$Id$
|
||||
* Introduction
|
||||
|
||||
This directory contains an additional wordlist file (.txt) for
|
||||
Scala programs.
|
||||
|
||||
More information about UltraEdit (Windows only) is available from:
|
||||
|
||||
http://www.ultraedit.com/
|
||||
|
||||
* Installation
|
||||
|
||||
In the dialog window "UltraEdit Configuration" (menu "Advanced" ->
|
||||
entry "Configuration..") click on the tab "Syntax Highlighting" and
|
||||
then on the "Open" button to edit the file "wordlist.txt".
|
||||
|
||||
Copy the contents of file "scala.txt" to the end of the file
|
||||
"wordlist.txt" und change the text label '/L20"Scala"' to the next
|
||||
available value (e.g. '/L10"Scala").
|
||||
|
||||
From that point on, loading a file whose name ends in ".scala" automatically
|
||||
turns Scala mode on.
|
||||
|
||||
* Version
|
||||
|
||||
$Id$
|
||||
|
|
|
@ -1,485 +1,485 @@
|
|||
/L20"Scala" Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ File Extensions = SCALA
|
||||
/Delimiters = ~!@%^&*()-+=|\/{}[]:;"'<> , .?
|
||||
/Function String = "%[ ^t]++[ps][a-zA-Z]+ [a-z,A-Z,0-9]+ ^(*(*)^)*{$"
|
||||
/Function String 1 = "%[ ^t]++[ps][a-zA-Z]+ [a-z,A-Z,0-9]+ ^(*(*)^)[ ^t]++$"
|
||||
/Indent Strings = "{"
|
||||
/Unindent Strings = "}"
|
||||
|
||||
/C1"Keywords"
|
||||
abstract
|
||||
case catch class
|
||||
def do
|
||||
else extends
|
||||
false final finally for
|
||||
if implicit import
|
||||
match
|
||||
new null
|
||||
object override
|
||||
package private protected
|
||||
return
|
||||
sealed super
|
||||
this trait try true type
|
||||
val var
|
||||
with while
|
||||
yield
|
||||
|
||||
/C2"Scala Classes"
|
||||
Buffer BufferedIterator
|
||||
Cell Char
|
||||
DefaultMapModel Double DoubleLinkedList
|
||||
GBTree
|
||||
HashMap HashSet HashTable History
|
||||
ImmutableMapAdaptor ImmutableSetAdaptor Int Iterable Iterator
|
||||
LinkedList List ListMap ListSet Long
|
||||
Map MapWrapper Monitor MutableList
|
||||
Nil None
|
||||
ObservableMap ObservableSet ObservableUpdate Option Ord
|
||||
Pair PartialFunction
|
||||
Queue
|
||||
Seq Set Short SingleLinkedList Some Stream StructuralEquality Subscriber Symbol
|
||||
Tuple1 Tuple2 Tuple3 Tuple4 Tuple5 Tuple6 Tuple7 Tuple8 Tuple9
|
||||
Unit
|
||||
|
||||
/C3"Java Classes"
|
||||
ARG_IN ARG_INOUT ARG_OUT ASCII AVT AVTPart AVTPartSimple AVTPartXPath AWTError AWTEvent AWTEventListener AWTEventListenerProxy AWTEventMulticaster AWTException AWTKeyStroke
|
||||
AWTPermission AbstractAction AbstractActionPropertyChangeListener AbstractBorder AbstractButton AbstractCellEditor AbstractCollection AbstractColorChooserPanel
|
||||
AbstractDocument AbstractFilter AbstractInterruptibleChannel AbstractLayoutCache AbstractList AbstractListModel AbstractMap AbstractMethodError AbstractPreferences
|
||||
AbstractSelectableChannel AbstractSelectionKey AbstractSelector AbstractSequentialList AbstractSet AbstractSpinnerModel AbstractTableModel AbstractUndoableEdit AbstractView
|
||||
AbstractWriter AccessControlContext AccessControlException AccessController AccessException Accessible AccessibleAction AccessibleBundle AccessibleComponent AccessibleContext
|
||||
AccessibleEditableText AccessibleExtendedComponent AccessibleExtendedTable AccessibleHTML AccessibleHyperlink AccessibleHypertext AccessibleIcon AccessibleKeyBinding
|
||||
AccessibleObject AccessibleRelation AccessibleRelationSet AccessibleResourceBundle AccessibleRole AccessibleSelection AccessibleState AccessibleStateSet AccessibleTable
|
||||
AccessibleTableModelChange AccessibleText AccessibleValue AccountExpiredException Acl AclEntry AclNotFoundException Action ActionEvent ActionListener ActionMap
|
||||
ActionMapUIResource Activatable ActivateFailedException ActivationDesc ActivationException ActivationGroup ActivationGroupDesc ActivationGroupID ActivationID
|
||||
ActivationInstantiator ActivationMonitor ActivationSystem Activator ActivatorHelper ActivatorHolder ActivatorOperations ActiveEvent ActiveObjectMap AdapterActivator
|
||||
AdapterActivatorOperations AdapterAlreadyExists AdapterAlreadyExistsHelper AdapterInactive AdapterInactiveHelper AdapterNonExistent AdapterNonExistentHelper AddressHelper
|
||||
AddressingDispositionException AddressingDispositionHelper Adjustable AdjustmentEvent AdjustmentListener Adler32 AdobeMarkerSegment AffineTransform AffineTransformOp
|
||||
AlgorithmParameterGenerator AlgorithmParameterGeneratorSpi AlgorithmParameterSpec AlgorithmParameters AlgorithmParametersSpi AllPermission AlphaComposite AlreadyBound
|
||||
AlreadyBoundException AlreadyBoundHelper AlreadyBoundHolder AlreadyConnectedException AlternateIIOPAddressComponent AncestorEvent AncestorListener AncestorNotifier
|
||||
AncestorStepPattern And Annotation Any AnyHolder AnyImpl AnyImplHelper AnySeqHelper AnySeqHolder AppConfigurationEntry Applet AppletContext AppletInitializer AppletStub
|
||||
ApplicationException Arc2D ArcIterator Area AreaAveragingScaleFilter Arg ArithmeticException Array ArrayIndexOutOfBoundsException ArrayList ArrayStoreException Arrays
|
||||
AssertionError AssertionStatusDirectives AsyncBoxView AsynchInvoke AsynchronousCloseException AttList Attr Attribute AttributeDecl AttributeException AttributeInUseException
|
||||
AttributeIterator AttributeList AttributeListImpl AttributeModificationException AttributeNode AttributeNode1 AttributeSet AttributeSetUtilities AttributeValue
|
||||
AttributedCharacterIterator AttributedString Attributes AttributesEx AttributesExImpl AttributesImpl AudioClip AuthPermission AuthenticationException
|
||||
AuthenticationNotSupportedException Authenticator Autoscroll Autoscroller AxesWalker Axis
|
||||
BAD_CONTEXT BAD_INV_ORDER BAD_OPERATION BAD_PARAM BAD_POLICY BAD_POLICY_TYPE BAD_POLICY_VALUE BAD_TYPECODE BRView BackingStoreException BadKind BadLocationException
|
||||
BadServerDefinition BadServerDefinitionHelper BadServerDefinitionHolder BadServerIdHandler BandCombineOp BandedSampleModel Base64 BasicArrowButton BasicAttribute
|
||||
BasicAttributes BasicBorders BasicButtonListener BasicButtonUI BasicCheckBoxMenuItemUI BasicCheckBoxUI BasicColorChooserUI BasicComboBoxEditor BasicComboBoxRenderer
|
||||
BasicComboBoxUI BasicComboPopup BasicDesktopIconUI BasicDesktopPaneUI BasicDirectoryModel BasicDragGestureRecognizer BasicDropTargetListener BasicEditorPaneUI
|
||||
BasicFileChooserUI BasicFormattedTextFieldUI BasicGraphicsUtils BasicHTML BasicIconFactory BasicInternalFrameTitlePane BasicInternalFrameUI BasicLabelUI BasicListUI
|
||||
BasicLookAndFeel BasicMenuBarUI BasicMenuItemUI BasicMenuUI BasicOptionPaneUI BasicPanelUI BasicPasswordFieldUI BasicPermission BasicPopupMenuSeparatorUI BasicPopupMenuUI
|
||||
BasicProgressBarUI BasicRadioButtonMenuItemUI BasicRadioButtonUI BasicRootPaneUI BasicScrollBarUI BasicScrollPaneUI BasicSeparatorUI BasicSliderUI BasicSpinnerUI
|
||||
BasicSplitPaneDivider BasicSplitPaneUI BasicStroke BasicTabbedPaneUI BasicTableHeaderUI BasicTableUI BasicTextAreaUI BasicTextFieldUI BasicTextPaneUI BasicTextUI
|
||||
BasicToggleButtonUI BasicToolBarSeparatorUI BasicToolBarUI BasicToolTipUI BasicTransferable BasicTreeUI BasicViewportUI BatchUpdateException BeanContext BeanContextChild
|
||||
BeanContextChildComponentProxy BeanContextChildSupport BeanContextContainerProxy BeanContextEvent BeanContextMembershipEvent BeanContextMembershipListener BeanContextProxy
|
||||
BeanContextServiceAvailableEvent BeanContextServiceProvider BeanContextServiceProviderBeanInfo BeanContextServiceRevokedEvent BeanContextServiceRevokedListener
|
||||
BeanContextServices BeanContextServicesListener BeanContextServicesSupport BeanContextSupport BeanDescriptor BeanInfo Beans BevelBorder Bidi BigDecimal BigInteger
|
||||
BinaryRefAddr BindException Binding BindingHelper BindingHolder BindingIterator BindingIteratorHelper BindingIteratorHolder BindingIteratorImpl BindingIteratorOperations
|
||||
BindingIteratorPOA BindingListHelper BindingListHolder BindingType BindingTypeHelper BindingTypeHolder BitSet BitSieve Bits Blob BlockView Book Bool BoolStack Boolean
|
||||
BooleanHolder BooleanSeqHelper BooleanSeqHolder BootStrapActivation BootstrapServer Border BorderFactory BorderLayout BorderUIResource BoundedRangeModel Bounds Box BoxLayout
|
||||
BoxView BoxedValueHelper BreakDictionary BreakIterator Buffer BufferCapabilities BufferManagerFactory BufferManagerRead BufferManagerReadGrow BufferManagerReadStream
|
||||
BufferManagerWrite BufferManagerWriteCollect BufferManagerWriteGrow BufferManagerWriteStream BufferOverflowException BufferQueue BufferStrategy BufferUnderflowException
|
||||
BufferedImage BufferedImageFilter BufferedImageOp BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Button ButtonGroup ButtonModel ButtonPeer ButtonUI
|
||||
Byte ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteBufferAsCharBufferB ByteBufferAsCharBufferL ByteBufferAsCharBufferRB ByteBufferAsCharBufferRL
|
||||
ByteBufferAsDoubleBufferB ByteBufferAsDoubleBufferL ByteBufferAsDoubleBufferRB ByteBufferAsDoubleBufferRL ByteBufferAsFloatBufferB ByteBufferAsFloatBufferL
|
||||
ByteBufferAsFloatBufferRB ByteBufferAsFloatBufferRL ByteBufferAsIntBufferB ByteBufferAsIntBufferL ByteBufferAsIntBufferRB ByteBufferAsIntBufferRL ByteBufferAsLongBufferB
|
||||
ByteBufferAsLongBufferL ByteBufferAsLongBufferRB ByteBufferAsLongBufferRL ByteBufferAsShortBufferB ByteBufferAsShortBufferL ByteBufferAsShortBufferRB ByteBufferAsShortBufferRL
|
||||
ByteBufferWithInfo ByteChannel ByteHolder ByteLookupTable ByteOrder
|
||||
CDATASection CDREncapsCodec CDRInputStream CDRInputStreamBase CDRInputStream_1_0 CDRInputStream_1_1 CDRInputStream_1_2 CDROutputStream CDROutputStreamBase
|
||||
CDROutputStream_1_0 CDROutputStream_1_1 CDROutputStream_1_2 CDataNode CMMException COMM_FAILURE COMMarkerSegment CORBAObjectImpl CRC32 CRL CRLException CRLSelector CSS
|
||||
CSS2Properties CSSCharsetRule CSSFontFaceRule CSSImportRule CSSMediaRule CSSPageRule CSSParser CSSPrimitiveValue CSSRule CSSRuleList CSSStyleDeclaration CSSStyleRule
|
||||
CSSStyleSheet CSSUnknownRule CSSValue CSSValueList CTX_RESTRICT_SCOPE CacheTable CachedCodeBase Calendar CallableStatement Callback CallbackHandler CancelRequestMessage
|
||||
CancelRequestMessage_1_0 CancelRequestMessage_1_1 CancelRequestMessage_1_2 CancelablePrintJob CancelledKeyException CannotProceed CannotProceedException CannotProceedHelper
|
||||
CannotProceedHolder CannotRedoException CannotUndoException Canvas CanvasPeer CardLayout Caret CaretEvent CaretListener CellEditor CellEditorListener CellRendererPane
|
||||
CenterLayout CertPath CertPathBuilder CertPathBuilderException CertPathBuilderResult CertPathBuilderSpi CertPathParameters CertPathValidator CertPathValidatorException
|
||||
CertPathValidatorResult CertPathValidatorSpi CertSelector CertStore CertStoreException CertStoreParameters CertStoreSpi Certificate CertificateEncodingException
|
||||
CertificateException CertificateExpiredException CertificateFactory CertificateFactorySpi CertificateNotYetValidException CertificateParsingException ChangeEvent
|
||||
ChangeListener ChangedCharSetException Channel ChannelBinding Channels CharArrayIterator CharArrayReader CharArrayWriter CharBuffer CharConversionException CharHolder CharInfo
|
||||
CharKey CharSeqHelper CharSeqHolder CharSequence CharSet Character CharacterBreakData CharacterCodingException CharacterData CharacterIterator CharacterIteratorFieldDelegate
|
||||
Charset CharsetDecoder CharsetEncoder CharsetProvider Checkbox CheckboxGroup CheckboxMenuItem CheckboxMenuItemPeer CheckboxPeer CheckedInputStream CheckedOutputStream
|
||||
Checksum ChildIterator ChildTestIterator Choice ChoiceCallback ChoiceFormat ChoicePeer Chromaticity ChunkedIntArray Class ClassCastException ClassCircularityError ClassDesc
|
||||
ClassFormatError ClassLoader ClassNotFoundException ClientDelegate ClientGIOP ClientRequest ClientRequestImpl ClientRequestInfo ClientRequestInfoImpl
|
||||
ClientRequestInfoOperations ClientRequestInterceptor ClientRequestInterceptorOperations ClientResponse ClientResponseImpl ClientSC ClientSubcontract Clipboard ClipboardOwner
|
||||
Clob CloneNotSupportedException Cloneable ClonerToResultTree ClosedByInterruptException ClosedChannelException ClosedSelectorException Closure CodeSetCache
|
||||
CodeSetComponentInfo CodeSetConversion CodeSetServiceContext CodeSets CodeSetsComponent CodeSource Codec CodecFactory CodecFactoryHelper CodecFactoryImpl
|
||||
CodecFactoryOperations CodecOperations CoderMalfunctionError CoderResult CodingErrorAction CollationElementIterator CollationKey CollationRules Collator Collection
|
||||
CollectionCertStoreParameters Collections Color ColorChooserComponentFactory ColorChooserUI ColorConvertOp ColorModel ColorPaintContext ColorSelectionModel ColorSpace
|
||||
ColorSupported ColorUIResource ComboBoxEditor ComboBoxModel ComboBoxUI ComboPopup CommandHandler Comment CommentNode CommentView CommunicationException Comparable Comparator
|
||||
Compiler CompletionStatus CompletionStatusHelper Component ComponentAdapter ComponentColorModel ComponentEvent ComponentIdHelper ComponentInputMap ComponentInputMapUIResource
|
||||
ComponentListener ComponentOrientation ComponentPeer ComponentSampleModel ComponentUI ComponentView Composite CompositeContext CompositeName CompositeView CompoundBorder
|
||||
CompoundEdit CompoundName Compression ConcurrentModificationException Condition Conditional ConfigFile Configuration ConfigurationException ConfirmationCallback
|
||||
ConnectException ConnectIOException Connection ConnectionEvent ConnectionEventListener ConnectionPendingException ConnectionPool ConnectionPoolDataSource ConnectionPoolManager
|
||||
ConnectionTable ConsoleHandler Constant Constants Constructor Container ContainerAdapter ContainerEvent ContainerListener ContainerOrderFocusTraversalPolicy ContainerPeer
|
||||
ContentHandler ContentHandlerFactory ContentModel ContentModelState Context ContextImpl ContextList ContextListImpl ContextMatchStepPattern ContextNodeList
|
||||
ContextNotEmptyException ContextualRenderedImageFactory ContinuationContext ContinuationDirContext Control ControlFactory ConvolveOp CookieHolder Copies CopiesSupported
|
||||
CorbaLoc CorbaName CorbaResourceUtil CoroutineManager CoroutineParser CoroutineSAXFilterTest CoroutineSAXParser CoroutineSAXParser_Xerces Counter CountersTable
|
||||
CredentialExpiredException CropImageFilter Crypt CubicCurve2D CubicIterator Currency CurrencyData Current CurrentHelper CurrentHolder CurrentOperations Cursor CustomMarshal
|
||||
CustomStringPool CustomValue Customizer
|
||||
DATA_CONVERSION DGC DHTMarkerSegment DOM2DTM DOM2Helper DOMBuilder DOMException DOMHelper DOMImplementation DOMImplementationCSS DOMImplementationImpl DOMLocator DOMOrder
|
||||
DOMResult DOMSerializer DOMSource DQTMarkerSegment DRIMarkerSegment DSAKey DSAKeyPairGenerator DSAParameterSpec DSAParams DSAPrivateKey DSAPrivateKeySpec DSAPublicKey
|
||||
DSAPublicKeySpec DTD DTDConstants DTDHandler DTM DTMAxisIterator DTMAxisIteratorBase DTMAxisTraverser DTMConfigurationException DTMDOMException DTMDefaultBase
|
||||
DTMDefaultBaseIterators DTMDefaultBaseTraversers DTMDocument DTMDocumentImpl DTMException DTMFilter DTMIterator DTMManager DTMManagerDefault DTMNamedNodeMap DTMNodeIterator
|
||||
DTMNodeList DTMNodeProxy DTMSafeStringPool DTMStringPool DTMTreeWalker DTMWSFilter DataBuffer DataBufferByte DataBufferDouble DataBufferFloat DataBufferInt DataBufferShort
|
||||
DataBufferUShort DataFlavor DataFormatException DataInput DataInputStream DataNode DataOutput DataOutputStream DataSource DataTruncation DatabaseMetaData DatagramChannel
|
||||
DatagramPacket DatagramSocket DatagramSocketImpl DatagramSocketImplFactory Date DateFormat DateFormatSymbols DateFormatter DateTimeAtCompleted DateTimeAtCreation
|
||||
DateTimeAtProcessing DateTimeSyntax DebugGraphics DebugGraphicsFilter DebugGraphicsInfo DebugGraphicsObserver DecimalFormat DecimalFormatProperties DecimalFormatSymbols
|
||||
DecimalToRoman DeclHandler DefaultBoundedRangeModel DefaultButtonModel DefaultCaret DefaultCellEditor DefaultColorSelectionModel DefaultComboBoxModel DefaultConnectionPool
|
||||
DefaultDesktopManager DefaultEditorKit DefaultErrorHandler DefaultFocusManager DefaultFocusTraversalPolicy DefaultFormatter DefaultFormatterFactory DefaultHSBChooserPanel
|
||||
DefaultHandler DefaultHighlighter DefaultKeyboardFocusManager DefaultListCellRenderer DefaultListModel DefaultListSelectionModel DefaultMenuLayout DefaultMetalTheme
|
||||
DefaultMutableTreeNode DefaultPersistenceDelegate DefaultPreviewPanel DefaultRGBChooserPanel DefaultSingleSelectionModel DefaultSocketFactory DefaultStyledDocument
|
||||
DefaultSwatchChooserPanel DefaultTableCellRenderer DefaultTableColumnModel DefaultTableModel DefaultTextUI DefaultTreeCellEditor DefaultTreeCellRenderer DefaultTreeModel
|
||||
DefaultTreeSelectionModel DefaultValidationErrorHandler DefinitionKind DefinitionKindHelper Deflater DeflaterOutputStream Delegate DelegateImpl DelegatingDefaultFocusManager
|
||||
DelegationPermission DescendantIterator DesignMode DesktopIconUI DesktopManager DesktopPaneUI Destination DestroyFailedException Destroyable Dialog DialogCallbackHandler
|
||||
DialogPeer Dictionary DictionaryBasedBreakIterator DigestException DigestInputStream DigestOutputStream DigitList DigraphNode Dimension Dimension2D DimensionUIResource
|
||||
DirContext DirObjectFactory DirStateFactory DirectByteBuffer DirectByteBufferR DirectCharBufferRS DirectCharBufferRU DirectCharBufferS DirectCharBufferU DirectColorModel
|
||||
DirectDoubleBufferRS DirectDoubleBufferRU DirectDoubleBufferS DirectDoubleBufferU DirectFloatBufferRS DirectFloatBufferRU DirectFloatBufferS DirectFloatBufferU
|
||||
DirectIntBufferRS DirectIntBufferRU DirectIntBufferS DirectIntBufferU DirectLongBufferRS DirectLongBufferRU DirectLongBufferS DirectLongBufferU DirectShortBufferRS
|
||||
DirectShortBufferRU DirectShortBufferS DirectShortBufferU DirectoryManager DisplayMode Div DnDConstants DnDEventMulticaster Doc DocAttribute DocAttributeSet DocFlavor
|
||||
DocPrintJob Doctype Document DocumentBuilder DocumentBuilderFactory DocumentBuilderFactoryImpl DocumentBuilderImpl DocumentCSS DocumentEvent DocumentEx DocumentFilter
|
||||
DocumentFragment DocumentHandler DocumentListener DocumentName DocumentParser DocumentStyle DocumentTraversal DocumentType DocumentView DomEx DomainCombiner DomainManager
|
||||
DomainManagerOperations Double DoubleBuffer DoubleHolder DoubleSeqHelper DoubleSeqHolder DragGestureEvent DragGestureListener DragGestureRecognizer DragSource
|
||||
DragSourceAdapter DragSourceContext DragSourceContextPeer DragSourceDragEvent DragSourceDropEvent DragSourceEvent DragSourceListener DragSourceMotionListener Driver
|
||||
DriverManager DriverPropertyInfo DropTarget DropTargetAdapter DropTargetContext DropTargetContextPeer DropTargetDragEvent DropTargetDropEvent DropTargetEvent DropTargetListener
|
||||
DropTargetPeer DuplicateName DuplicateNameHelper DuplicateServiceContext DynAny DynAnyBasicImpl DynAnyCollectionImpl DynAnyComplexImpl DynAnyConstructedImpl DynAnyFactory
|
||||
DynAnyFactoryHelper DynAnyFactoryImpl DynAnyFactoryOperations DynAnyHelper DynAnyImpl DynAnyOperations DynAnySeqHelper DynAnyUtil DynArray DynArrayHelper DynArrayImpl
|
||||
DynArrayOperations DynEnum DynEnumHelper DynEnumImpl DynEnumOperations DynFixed DynFixedHelper DynFixedImpl DynFixedOperations DynSequence DynSequenceHelper DynSequenceImpl
|
||||
DynSequenceOperations DynStruct DynStructHelper DynStructImpl DynStructOperations DynUnion DynUnionHelper DynUnionImpl DynUnionOperations DynValue DynValueBox DynValueBoxImpl
|
||||
DynValueBoxOperations DynValueCommon DynValueCommonImpl DynValueCommonOperations DynValueHelper DynValueImpl DynValueOperations DynamicImplementation
|
||||
ENCODING_CDR_ENCAPS EOFException EditableView EditorKit ElemApplyImport ElemApplyTemplates ElemAttribute ElemAttributeSet ElemCallTemplate ElemChoose ElemComment ElemCopy
|
||||
ElemCopyOf ElemDesc ElemElement ElemEmpty ElemExtensionCall ElemExtensionDecl ElemExtensionScript ElemFallback ElemForEach ElemIf ElemLiteralResult ElemMessage ElemNumber
|
||||
ElemOtherwise ElemPI ElemParam ElemSort ElemTemplate ElemTemplateElement ElemText ElemTextLiteral ElemUnknown ElemUse ElemValueOf ElemVariable ElemWhen ElemWithParam
|
||||
Element ElementCSSInlineStyle ElementDecl ElementEx ElementFactory ElementIterator ElementNode ElementNode2 ElementValidator Ellipse2D EllipseIterator EmptyBorder
|
||||
EmptyStackException EncapsInputStream EncapsOutputStream EncodedKeySpec Encoder Encoding EncodingInfo Encodings EndOfInputException EndPoint EndPointImpl EndPointInfo
|
||||
EndPointInfoHelper EndPointInfoHolder EndSelectionEvent EndpointInfoListHelper EndpointInfoListHolder Entity EntityDecl EntityReference EntityResolver EntryPair EntryPoint
|
||||
EnumSyntax Enumeration Environment EnvironmentCheck EnvironmentImpl Equals Error ErrorHandler ErrorListener ErrorManager EtchedBorder Event EventContext EventDirContext
|
||||
EventDispatchThread EventException EventHandler EventListener EventListenerList EventListenerProxy EventObject EventQueue EventSetDescriptor EventTarget Exception
|
||||
ExceptionInInitializerError ExceptionList ExceptionListImpl ExceptionListener ExpandVetoException ExpandedNameTable ExportException Expression ExpressionContext
|
||||
ExtendedRequest ExtendedResponse ExtensionHandler ExtensionHandlerGeneral ExtensionHandlerJava ExtensionHandlerJavaClass ExtensionHandlerJavaPackage Extensions
|
||||
ExtensionsTable ExternalEntity Externalizable
|
||||
FREE_MEM FVDCodeBaseImpl FactoryConfigurationError FactoryEnumeration FactoryFinder FailedLoginException FastStringBuffer FeatureDescriptor Fidelity Field FieldNameHelper
|
||||
FieldPosition FieldView File FileCacheImageInputStream FileCacheImageOutputStream FileChannel FileChooserUI FileDescriptor FileDialog FileDialogPeer FileFilter
|
||||
FileHandler FileImageInputStream FileImageInputStreamSpi FileImageOutputStream FileImageOutputStreamSpi FileInputStream FileLock FileLockInterruptionException FileNameMap
|
||||
FileNotFoundException FileOutputStream FilePermission FileReader FileSystem FileSystemView FileView FileWriter FilenameFilter Filter FilterExprWalker FilterInputStream
|
||||
FilterOutputStream FilterReader FilterWriter FilteredImageSource FinalReference Finalizer Finishings FixedHeightLayoutCache FixedHolder FlatteningPathIterator FlavorException
|
||||
FlavorMap FlavorTable Float FloatBuffer FloatHolder FloatSeqHelper FloatSeqHolder FloatingDecimal FlowLayout FlowView FocusAdapter FocusEvent FocusListener FocusManager
|
||||
FocusTraversalPolicy Font FontFormatException FontMetrics FontPeer FontRenderContext FontUIResource FormView Format FormatMismatch FormatMismatchHelper Formatter
|
||||
ForwardException ForwardRequest ForwardRequestHelper FoundIndex FragmentMessage FragmentMessage_1_1 FragmentMessage_1_2 Frame FramePeer FrameSetView FrameView FreezableList
|
||||
FuncBoolean FuncCeiling FuncConcat FuncContains FuncCount FuncCurrent FuncDoclocation FuncDocument FuncExtElementAvailable FuncExtFunction FuncExtFunctionAvailable FuncFalse
|
||||
FuncFloor FuncFormatNumb FuncGenerateId FuncId FuncKey FuncLang FuncLast FuncLoader FuncLocalPart FuncNamespace FuncNormalizeSpace FuncNot FuncNumber FuncPosition FuncQname
|
||||
FuncRound FuncStartsWith FuncString FuncStringLength FuncSubstring FuncSubstringAfter FuncSubstringBefore FuncSum FuncSystemProperty FuncTranslate FuncTrue
|
||||
FuncUnparsedEntityURI Function Function2Args Function3Args FunctionDef1Arg FunctionMultiArgs FunctionOneArg FunctionPattern FunctionTable Future
|
||||
GIFImageMetadata GIFImageMetadataFormat GIFImageMetadataFormatResources GIFImageReader GIFImageReaderSpi GIFStreamMetadata GIFStreamMetadataFormat
|
||||
GIFStreamMetadataFormatResources GIOPImpl GIOPVersion GSSContext GSSCredential GSSException GSSManager GSSName GSSUtil GZIPInputStream GZIPOutputStream GapContent GapVector
|
||||
GatheringByteChannel GeneralPath GeneralPathIterator GeneralSecurityException GenerateEvent GenericIdEncapsulation GenericPOAClientSC GenericPOAServerSC GenericTaggedComponent
|
||||
GenericTaggedProfile GetEndPointInfoAgainException GetORBPropertiesFileAction GlyphJustificationInfo GlyphMetrics GlyphPainter1 GlyphPainter2 GlyphVector GlyphView
|
||||
GradientPaint GradientPaintContext GraphicAttribute Graphics Graphics2D GraphicsCallback GraphicsConfigTemplate GraphicsConfiguration GraphicsDevice GraphicsEnvironment
|
||||
GraphicsWrapper GrayFilter GregorianCalendar GridBagConstraints GridBagLayout GridLayout Group Gt Gte Guard GuardedObject
|
||||
HRuleView HTML HTMLAnchorElement HTMLAppletElement HTMLAreaElement HTMLBRElement HTMLBaseElement HTMLBaseFontElement HTMLBodyElement HTMLButtonElement HTMLCollection
|
||||
HTMLDListElement HTMLDOMImplementation HTMLDirectoryElement HTMLDivElement HTMLDocument HTMLEditorKit HTMLElement HTMLFieldSetElement HTMLFontElement HTMLFormElement
|
||||
HTMLFrameElement HTMLFrameHyperlinkEvent HTMLFrameSetElement HTMLHRElement HTMLHeadElement HTMLHeadingElement HTMLHtmlElement HTMLIFrameElement HTMLImageElement
|
||||
HTMLInputElement HTMLIsIndexElement HTMLLIElement HTMLLabelElement HTMLLegendElement HTMLLinkElement HTMLMapElement HTMLMenuElement HTMLMetaElement HTMLModElement
|
||||
HTMLOListElement HTMLObjectElement HTMLOptGroupElement HTMLOptionElement HTMLParagraphElement HTMLParamElement HTMLPreElement HTMLQuoteElement HTMLScriptElement
|
||||
HTMLSelectElement HTMLStyleElement HTMLTableCaptionElement HTMLTableCellElement HTMLTableColElement HTMLTableElement HTMLTableRowElement HTMLTableSectionElement
|
||||
HTMLTextAreaElement HTMLTitleElement HTMLUListElement HTMLWriter Handler HandlerBase HasControls HashAttributeSet HashDocAttributeSet HashMap HashPrintJobAttributeSet
|
||||
HashPrintRequestAttributeSet HashPrintServiceAttributeSet HashSet Hashtable HeadlessException HeapByteBuffer HeapByteBufferR HeapCharBuffer HeapCharBufferR HeapDoubleBuffer
|
||||
HeapDoubleBufferR HeapFloatBuffer HeapFloatBufferR HeapIntBuffer HeapIntBufferR HeapLongBuffer HeapLongBufferR HeapShortBuffer HeapShortBufferR HexOutputStream
|
||||
HiddenTagView HierarchyBoundsAdapter HierarchyBoundsListener HierarchyEvent HierarchyListener Highlighter HostInfo HttpURLConnection HyperlinkEvent HyperlinkListener
|
||||
ICC_ColorSpace ICC_Profile ICC_ProfileGray ICC_ProfileRGB IDLEntity IDLType IDLTypeHelper IDLTypeOperations ID_ASSIGNMENT_POLICY_ID ID_UNIQUENESS_POLICY_ID IIOByteBuffer
|
||||
IIOException IIOImage IIOInvalidTreeException IIOMetadata IIOMetadataController IIOMetadataFormat IIOMetadataFormatImpl IIOMetadataNode IIOPAddress IIOPAddressBase
|
||||
IIOPAddressFutureImpl IIOPAddressImpl IIOPConnection IIOPInputStream IIOPInputStream_1_3 IIOPInputStream_1_3_1 IIOPOutputStream IIOPOutputStream_1_3 IIOPOutputStream_1_3_1
|
||||
IIOPProfile IIOPProfileTemplate IIOP_CLEAR_TEXT IIOParam IIOParamController IIOReadProgressListener IIOReadUpdateListener IIOReadWarningListener IIORegistry IIOServiceProvider
|
||||
IIOWriteProgressListener IIOWriteWarningListener IMPLICIT_ACTIVATION_POLICY_ID IMP_LIMIT INITIALIZE INSObjectKeyEntry INSObjectKeyMap INSSubcontract INTERNAL INTF_REPOS
|
||||
INVALID_TRANSACTION INV_FLAG INV_IDENT INV_OBJREF INV_POLICY IOException IOR IORAddressingInfo IORAddressingInfoHelper IORHelper IORHolder IORInfo IORInfoExt IORInfoImpl
|
||||
IORInfoOperations IORInterceptor IORInterceptorOperations IORTemplate IRObject IRObjectOperations Icon IconUIResource IconView IdAssignmentPolicy IdAssignmentPolicyImpl
|
||||
IdAssignmentPolicyOperations IdAssignmentPolicyValue IdEncapsulation IdEncapsulationBase IdEncapsulationContainerBase IdEncapsulationFactory IdEncapsulationFactoryFinder
|
||||
IdUniquenessPolicy IdUniquenessPolicyImpl IdUniquenessPolicyOperations IdUniquenessPolicyValue Identifiable IdentifiableContainerBase IdentifierHelper Identity
|
||||
IdentityHashMap IdentityHashtable IdentityScope IllegalAccessError IllegalAccessException IllegalArgumentException IllegalBlockingModeException IllegalCharsetNameException
|
||||
IllegalComponentStateException IllegalMonitorStateException IllegalPathStateException IllegalSelectorException IllegalStateException IllegalThreadStateException Image
|
||||
ImageCapabilities ImageConsumer ImageFilter ImageFormatException ImageGraphicAttribute ImageIO ImageIcon ImageInputStream ImageInputStreamImpl ImageInputStreamSpi
|
||||
ImageObserver ImageOutputStream ImageOutputStreamImpl ImageOutputStreamSpi ImageProducer ImageReadParam ImageReader ImageReaderSpi ImageReaderWriterSpi ImageTranscoder
|
||||
ImageTranscoderSpi ImageTypeSpecifier ImageView ImageWriteParam ImageWriter ImageWriterSpi ImagingOpException ImplicitActivationPolicy ImplicitActivationPolicyImpl
|
||||
ImplicitActivationPolicyOperations ImplicitActivationPolicyValue IncompatibleClassChangeError InconsistentTypeCode InconsistentTypeCodeHelper IncrementalSAXSource
|
||||
IncrementalSAXSource_Filter IncrementalSAXSource_Xerces IndexColorModel IndexOutOfBoundsException IndexedPropertyDescriptor IndirectionException Inet4Address Inet6Address
|
||||
InetAddress InetSocketAddress Inflater InflaterInputStream InheritableThreadLocal InitialContext InitialContextFactory InitialContextFactoryBuilder InitialDirContext
|
||||
InitialLdapContext InitialNameService InitialNameServiceHelper InitialNameServiceHolder InitialNameServiceOperations InitialNamingClient InitialNamingImpl
|
||||
InlineView InputContext InputEntity InputEvent InputMap InputMapUIResource InputMethod InputMethodContext InputMethodDescriptor InputMethodEvent InputMethodHighlight
|
||||
InputMethodListener InputMethodRequests InputSource InputStream InputStreamAdapter InputStreamHook InputStreamImageInputStreamSpi InputStreamReader InputSubset InputVerifier
|
||||
Insets InsetsUIResource InstantiationError InstantiationException InsufficientResourcesException IntBuffer IntHolder IntStack IntVector Integer IntegerSyntax
|
||||
InterOperableNamingImpl Interceptor InterceptorInvoker InterceptorList InterceptorOperations InternalBindingKey InternalBindingValue InternalEntity InternalError
|
||||
InternalFrameAdapter InternalFrameEvent InternalFrameFocusTraversalPolicy InternalFrameListener InternalFrameUI InternalRuntimeForwardRequest InternationalFormatter
|
||||
InterruptedException InterruptedIOException InterruptedNamingException InterruptibleChannel IntrospectionException Introspector Invalid InvalidAddress InvalidAddressHelper
|
||||
InvalidAddressHolder InvalidAlgorithmParameterException InvalidAttributeIdentifierException InvalidAttributeValueException InvalidAttributesException InvalidClassException
|
||||
InvalidDnDOperationException InvalidKeyException InvalidKeySpecException InvalidMarkException InvalidName InvalidNameException InvalidNameHelper InvalidNameHolder
|
||||
InvalidORBid InvalidORBidHelper InvalidORBidHolder InvalidObjectException InvalidParameterException InvalidParameterSpecException InvalidPolicy InvalidPolicyHelper
|
||||
InvalidPreferencesFormatException InvalidSearchControlsException InvalidSearchFilterException InvalidSeq InvalidSlot InvalidSlotHelper InvalidTypeForEncoding
|
||||
InvalidTypeForEncodingHelper InvalidValue InvalidValueHelper InvocationEvent InvocationHandler InvocationInfo InvocationTargetException InvokeHandler IsindexView
|
||||
IstringHelper ItemEvent ItemListener ItemSelectable Iterator IteratorPool
|
||||
JApplet JButton JCheckBox JCheckBoxMenuItem JColorChooser JComboBox JComponent JDKBridge JDKClassLoader JDesktopPane JDialog JEditorPane JFIFMarkerSegment JFileChooser
|
||||
JFormattedTextField JFrame JIDLObjectKeyTemplate JInternalFrame JLabel JLayeredPane JList JMenu JMenuBar JMenuItem JOptionPane JPEG JPEGBuffer JPEGCodec JPEGDecodeParam
|
||||
JPEGEncodeParam JPEGHuffmanTable JPEGImageDecoder JPEGImageEncoder JPEGImageMetadataFormat JPEGImageMetadataFormatResources JPEGImageReadParam JPEGImageReader
|
||||
JPEGImageReaderResources JPEGImageReaderSpi JPEGImageWriteParam JPEGImageWriter JPEGImageWriterResources JPEGImageWriterSpi JPEGMetadata JPEGMetadataFormat
|
||||
JPEGMetadataFormatResources JPEGQTable JPEGStreamMetadataFormat JPEGStreamMetadataFormatResources JPanel JPasswordField JPopupMenu JProgressBar JRadioButton
|
||||
JRadioButtonMenuItem JRootPane JScrollBar JScrollPane JSeparator JSlider JSpinner JSplitPane JTabbedPane JTable JTableHeader JTextArea JTextComponent JTextField JTextPane
|
||||
JToggleButton JToolBar JToolTip JTree JViewport JWindow JarEntry JarException JarFile JarInputStream JarOutputStream JarURLConnection JarVerifier JavaCodebaseComponent
|
||||
JavaUtils JndiLoginModule JobAttributes JobHoldUntil JobImpressions JobImpressionsCompleted JobImpressionsSupported JobKOctets JobKOctetsProcessed JobKOctetsSupported
|
||||
JobMediaSheets JobMediaSheetsCompleted JobMediaSheetsSupported JobMessageFromOperator JobName JobOriginatingUserName JobPriority JobPrioritySupported JobSheets
|
||||
JobState JobStateReason JobStateReasons
|
||||
KerberosKey KerberosPrincipal KerberosTicket Kernel Key KeyAdapter KeyAddr KeyDeclaration KeyEvent KeyEventDispatcher KeyEventPostProcessor KeyException KeyFactory
|
||||
KeyFactorySpi KeyImpl KeyIterator KeyListener KeyManagementException KeyManager KeyPair KeyPairGenerator KeyPairGeneratorSpi KeyRefIterator KeySpec KeyStore KeyStoreException
|
||||
KeyStoreLoginModule KeyStoreSpi KeyStroke KeyTable KeyWalker KeyboardFocusManager KeyboardManager Keymap Keywords Krb5LoginModule
|
||||
LDAPCertStoreParameters LIFESPAN_POLICY_ID LOCATION_FORWARD Label LabelPeer LabelUI LabelView LanguageCallback LastOwnerException LayeredHighlighter LayoutComparator
|
||||
LayoutFocusTraversalPolicy LayoutManager LayoutManager2 LayoutQueue LdapContext LdapReferralException Lease LegacyGlueFocusTraversalPolicy LegacyHookGetFields
|
||||
LegacyHookPutFields Level Lexer LexicalHandler LibraryManager LifespanPolicy LifespanPolicyImpl LifespanPolicyOperations LifespanPolicyValue LightweightPeer
|
||||
LimitExceededException Line2D LineBorder LineBreakData LineBreakMeasurer LineIterator LineMetrics LineNumberInputStream LineNumberReader LineView LinkException
|
||||
LinkLoopException LinkRef LinkStyle LinkageError LinkedHashMap LinkedHashSet LinkedList List ListCellRenderer ListDataEvent ListDataListener ListIterator ListModel ListPeer
|
||||
ListResourceBundle ListSelectionEvent ListSelectionListener ListSelectionModel ListUI ListView ListenerThread LoaderHandler LocPathIterator LocalClientRequestImpl
|
||||
LocalClientResponseImpl LocalObject LocalServerRequestImpl LocalServerResponseImpl Locale LocateRegistry LocateReplyMessage LocateReplyMessage_1_0 LocateReplyMessage_1_1
|
||||
LocateReplyMessage_1_2 LocateRequestMessage LocateRequestMessage_1_0 LocateRequestMessage_1_1 LocateRequestMessage_1_2 Locator LocatorHelper LocatorHolder LocatorImpl
|
||||
LocatorOperations Lock LogManager LogRecord LogStream Logger LoggingPermission LoginContext LoginException LoginModule Long LongBuffer LongHolder LongLongSeqHelper
|
||||
LongLongSeqHolder LongSeqHelper LongSeqHolder LookAndFeel LookupOp LookupTable Lt Lte
|
||||
MARSHAL MalformedInputException MalformedLinkException MalformedURLException Manifest Map MappedByteBuffer MarkAndResetHandler MarkerSegment MarshalException
|
||||
MarshalInputStream MarshalOutputStream MarshalledObject MaskFormatter MatchPatternIterator Matcher Math MatteBorder Media MediaList MediaName MediaPrintableArea MediaSize
|
||||
MediaSizeName MediaTracker MediaTray Member MemoryCache MemoryCacheImageInputStream MemoryCacheImageOutputStream MemoryHandler MemoryImageSource Menu MenuBar MenuBarPeer
|
||||
MenuBarUI MenuComponent MenuComponentPeer MenuContainer MenuDragMouseEvent MenuDragMouseListener MenuElement MenuEvent MenuItem MenuItemPeer MenuItemUI MenuKeyEvent
|
||||
MenuKeyListener MenuListener MenuPeer MenuSelectionManager MenuShortcut MergeCollation Message MessageBase MessageCatalog MessageDigest MessageDigestSpi MessageFormat
|
||||
MessageMediator MessageProp Message_1_0 Message_1_1 Message_1_2 MetaData MetalBorders MetalBumps MetalButtonUI MetalCheckBoxIcon MetalCheckBoxUI MetalComboBoxButton
|
||||
MetalComboBoxEditor MetalComboBoxIcon MetalComboBoxUI MetalDesktopIconUI MetalFileChooserUI MetalIconFactory MetalInternalFrameTitlePane MetalInternalFrameUI
|
||||
MetalLabelUI MetalLookAndFeel MetalPopupMenuSeparatorUI MetalProgressBarUI MetalRadioButtonUI MetalRootPaneUI MetalScrollBarUI MetalScrollButton MetalScrollPaneUI
|
||||
MetalSeparatorUI MetalSliderUI MetalSplitPaneDivider MetalSplitPaneUI MetalTabbedPaneUI MetalTextFieldUI MetalTheme MetalTitlePane MetalToggleButtonUI MetalToolBarUI
|
||||
MetalToolTipUI MetalTreeUI MetalUtils Method MethodDescriptor MethodResolver MimeType MimeTypeParameterList MimeTypeParseException MinimalHTMLWriter MinorCodes
|
||||
Minus MissingResourceException MockAttributeSet Mod ModificationItem Modifier MotifBorders MotifButtonListener MotifButtonUI MotifCheckBoxMenuItemUI MotifCheckBoxUI
|
||||
MotifComboBoxRenderer MotifComboBoxUI MotifDesktopIconUI MotifDesktopPaneUI MotifEditorPaneUI MotifFileChooserUI MotifGraphicsUtils MotifIconFactory
|
||||
MotifInternalFrameTitlePane MotifInternalFrameUI MotifLabelUI MotifLookAndFeel MotifMenuBarUI MotifMenuItemUI MotifMenuMouseListener MotifMenuMouseMotionListener MotifMenuUI
|
||||
MotifOptionPaneUI MotifPasswordFieldUI MotifPopupMenuSeparatorUI MotifPopupMenuUI MotifProgressBarUI MotifRadioButtonMenuItemUI MotifRadioButtonUI MotifScrollBarButton
|
||||
MotifScrollBarUI MotifScrollPaneUI MotifSeparatorUI MotifSliderUI MotifSplitPaneDivider MotifSplitPaneUI MotifTabbedPaneUI MotifTextAreaUI MotifTextFieldUI MotifTextPaneUI
|
||||
MotifTextUI MotifToggleButtonUI MotifTreeCellRenderer MotifTreeUI MouseAdapter MouseDragGestureRecognizer MouseEvent MouseInputAdapter MouseInputListener MouseListener
|
||||
MouseMotionAdapter MouseMotionListener MouseWheelEvent MouseWheelListener MsgMgr Mult MultiButtonUI MultiColorChooserUI MultiComboBoxUI MultiDesktopIconUI MultiDesktopPaneUI
|
||||
MultiDoc MultiDocPrintJob MultiDocPrintService MultiFileChooserUI MultiInternalFrameUI MultiLabelUI MultiListUI MultiLookAndFeel MultiMenuBarUI MultiMenuItemUI
|
||||
MultiOptionPaneUI MultiPanelUI MultiPixelPackedSampleModel MultiPopupMenuUI MultiProgressBarUI MultiRootPaneUI MultiScrollBarUI MultiScrollPaneUI MultiSeparatorUI
|
||||
MultiSliderUI MultiSpinnerUI MultiSplitPaneUI MultiTabbedPaneUI MultiTableHeaderUI MultiTableUI MultiTextUI MultiToolBarUI MultiToolTipUI MultiTreeUI MultiUIDefaults
|
||||
MultiViewportUI MulticastSocket MultipleComponentProfileHelper MultipleComponentProfileHolder MultipleDocumentHandling MultipleMaster MutableAttrListImpl MutableAttributeSet
|
||||
MutableBigInteger MutableComboBoxModel MutableTreeNode MutationEvent MuxingAttributeSet
|
||||
NO_IMPLEMENT NO_MEMORY NO_PERMISSION NO_RESOURCES NO_RESPONSE NSInfo NSORB NTDomainPrincipal NTLoginModule NTNumericCredential NTSid NTSidDomainPrincipal NTSidGroupPrincipal
|
||||
NTSidPrimaryGroupPrincipal NTSidUserPrincipal NTSystem NTUserPrincipal NVList NVListImpl Name NameAlreadyBound NameAlreadyBoundException NameAlreadyBoundHelper
|
||||
NameAlreadyBoundHolder NameCallback NameClassPair NameComponent NameComponentHelper NameComponentHolder NameDynAnyPair NameDynAnyPairHelper NameDynAnyPairSeqHelper
|
||||
NameGenerator NameHelper NameHolder NameImpl NameNotFoundException NameParser NameServer NameService NameServiceStartThread NameSpace NameValuePair NameValuePairHelper
|
||||
NameValuePairSeqHelper NamedNodeMap NamedValue NamedValueImpl NamedWeakReference NamespaceAlias NamespaceChangeListener NamespaceSupport NamespaceSupport2 NamespacedNode
|
||||
Naming NamingContext NamingContextDataStore NamingContextExt NamingContextExtHelper NamingContextExtHolder NamingContextExtOperations NamingContextExtPOA NamingContextHelper
|
||||
NamingContextHolder NamingContextImpl NamingContextOperations NamingContextPOA NamingEnumeration NamingEvent NamingException NamingExceptionEvent NamingListener NamingManager
|
||||
NamingSecurityException NamingUtils NativeLibLoader NavigationFilter Neg NegativeArraySizeException NetPermission NetworkInterface NewInstance NewObjectKeyTemplateBase
|
||||
NoClassDefFoundError NoConnectionPendingException NoContext NoContextHelper NoFramesView NoInitialContextException NoPermissionException NoRouteToHostException NoServant
|
||||
NoServantHelper NoSuchAlgorithmException NoSuchAttributeException NoSuchElementException NoSuchEndPoint NoSuchEndPointHelper NoSuchEndPointHolder NoSuchFieldError
|
||||
NoSuchFieldException NoSuchMethodError NoSuchMethodException NoSuchObjectException NoSuchProviderException NoSuchServiceContext Node NodeBase NodeChangeEvent
|
||||
NodeChangeListener NodeConsumer NodeEx NodeFilter NodeInfo NodeIterator NodeList NodeLocator NodeSet NodeSetDTM NodeSortKey NodeSorter NodeTest NodeTestFilter NodeVector
|
||||
NonReadableChannelException NonWritableChannelException NoninvertibleTransformException NotActiveException NotBoundException NotContextException NotEmpty NotEmptyHelper
|
||||
NotEmptyHolder NotEquals NotFound NotFoundHelper NotFoundHolder NotFoundReason NotFoundReasonHelper NotFoundReasonHolder NotOwnerException NotSerializableException
|
||||
NotYetBoundException NotYetConnectedException Notation NullPointerException Number NumberFormat NumberFormatException NumberFormatter NumberOfDocuments NumberOfInterveningJobs
|
||||
NumberUp NumberUpSupported NumeratorFormatter NumericShaper
|
||||
OBJECT_NOT_EXIST OBJ_ADAPTER OMGVMCID ORB ORBAlreadyRegistered ORBAlreadyRegisteredHelper ORBAlreadyRegisteredHolder ORBClassLoader ORBConstants ORBD ORBInitInfo
|
||||
ORBInitInfoImpl ORBInitInfoOperations ORBInitializer ORBInitializerOperations ORBPortInfo ORBPortInfoHelper ORBPortInfoHolder ORBPortInfoListHelper ORBPortInfoListHolder
|
||||
ORBProperties ORBSingleton ORBSocketFactory ORBThread ORBTypeComponent ORBUtility ORBVersion ORBVersionFactory ORBVersionImpl ORBVersionServiceContext ORBidHelper
|
||||
ORBidListHelper ORBidListHolder OSFCodeSetRegistry ObjID Object ObjectAlreadyActive ObjectAlreadyActiveHelper ObjectArray ObjectChangeListener ObjectFactory
|
||||
ObjectFactoryBuilder ObjectHelper ObjectHolder ObjectId ObjectIdHelper ObjectIds ObjectImpl ObjectInput ObjectInputStream ObjectInputValidation ObjectKey ObjectKeyFactory
|
||||
ObjectKeyTemplate ObjectKeyTemplateBase ObjectNotActive ObjectNotActiveHelper ObjectOutput ObjectOutputStream ObjectPool ObjectStreamClass ObjectStreamClassCorbaExt
|
||||
ObjectStreamClassUtil_1_3 ObjectStreamClass_1_3_1 ObjectStreamConstants ObjectStreamException ObjectStreamField ObjectView Observable Observer OctetSeqHelper OctetSeqHolder
|
||||
Oid OldJIDLObjectKeyTemplate OldObjectKeyTemplateBase OldPOAObjectKeyTemplate OneStepIterator OneStepIteratorForward OpCodes OpMap OpenType Operation
|
||||
OperationNotSupportedException Option OptionComboBoxModel OptionListModel OptionPaneUI OptionalDataException Or OrientationRequested OutOfMemoryError OutputDeviceAssigned
|
||||
OutputKeys OutputProperties OutputStream OutputStreamHook OutputStreamImageOutputStreamSpi OutputStreamWriter OverlappingFileLockException OverlayLayout Owner
|
||||
PDLOverrideSupported PERSIST_STORE PICurrent PINode PIORB PKCS8EncodedKeySpec PKIXBuilderParameters PKIXCertPathBuilderResult PKIXCertPathChecker PKIXCertPathValidatorResult
|
||||
PKIXParameters PNGImageReader PNGImageReaderSpi PNGImageWriter PNGImageWriterSpi PNGMetadata PNGMetadataFormat PNGMetadataFormatResources POA POACurrent POADestroyed POAHelper
|
||||
POAId POAIdArray POAIdBase POAIdPOAView POAImpl POAManager POAManagerImpl POAManagerOperations POANameHelper POANameHolder POAORB POAObjectKeyTemplate POAOperations
|
||||
POAPolicyCombinationValidator POAView PRIVATE_MEMBER PSSParameterSpec PUBLIC_MEMBER Package PackagePrefixChecker PackedColorModel PageAttributes PageFormat PageRanges Pageable
|
||||
PagesPerMinute PagesPerMinuteColor Paint PaintContext PaintEvent Panel PanelPeer PanelUI Paper ParagraphView Parameter ParameterBlock ParameterDescriptor ParameterMetaData
|
||||
ParameterMode ParameterModeHelper ParameterModeHolder ParentNode ParseContext ParseException ParsePosition Parser Parser2 ParserAdapter ParserConfigurationException
|
||||
ParserDelegator ParserFactory PartialResultException PartiallyOrderedSet PasswordAuthentication PasswordCallback PasswordView PathIterator Pattern PatternEntry
|
||||
PatternSyntaxException Permission PermissionCollection Permissions PersistenceDelegate PersistentBindingIterator PhantomReference Pipe PipeDocument PipedInputStream
|
||||
PipedOutputStream PipedReader PipedWriter PixelGrabber PixelInterleavedSampleModel PlainDatagramSocketImpl PlainDocument PlainSocketImpl PlainView Plus Point Point2D
|
||||
Policies PoliciesComponent Policy PolicyError PolicyErrorCodeHelper PolicyErrorHelper PolicyErrorHolder PolicyFactory PolicyFactoryOperations PolicyFile PolicyHelper
|
||||
PolicyHolder PolicyListHelper PolicyListHolder PolicyNode PolicyOperations PolicyParser PolicyQualifierInfo PolicyTypeHelper Polygon PooledConnection Popup PopupFactory
|
||||
PopupMenu PopupMenuEvent PopupMenuListener PopupMenuPeer PopupMenuUI PortUnreachableException PortableRemoteObject PortableRemoteObjectDelegate Position PredicatedNodeTest
|
||||
PreferenceChangeEvent PreferenceChangeListener Preferences PreferencesFactory PrefixResolver PrefixResolverDefault PreparedStatement PresentationDirection Principal
|
||||
PrincipalComparator PrincipalHolder PrincipalImpl PrintEvent PrintException PrintGraphics PrintJob PrintJobAdapter PrintJobAttribute PrintJobAttributeEvent
|
||||
PrintJobAttributeListener PrintJobAttributeSet PrintJobEvent PrintJobListener PrintQuality PrintRequestAttribute PrintRequestAttributeSet PrintService PrintServiceAttribute
|
||||
PrintServiceAttributeEvent PrintServiceAttributeListener PrintServiceAttributeSet PrintServiceLookup PrintStream PrintTraceListener PrintWriter Printable PrinterAbortException
|
||||
PrinterException PrinterGraphics PrinterIOException PrinterInfo PrinterIsAcceptingJobs PrinterJob PrinterLocation PrinterMakeAndModel PrinterMessageFromOperator
|
||||
PrinterMoreInfo PrinterMoreInfoManufacturer PrinterName PrinterResolution PrinterState PrinterStateReason PrinterStateReasons PrinterURI PrivateCredentialPermission PrivateKey
|
||||
PrivilegedAction PrivilegedActionException PrivilegedExceptionAction Process ProcessMonitorThread ProcessingInstruction ProcessorAttributeSet ProcessorCharacters
|
||||
ProcessorDecimalFormat ProcessorGlobalParamDecl ProcessorGlobalVariableDecl ProcessorImport ProcessorInclude ProcessorKey ProcessorLRE ProcessorNamespaceAlias
|
||||
ProcessorOutputElem ProcessorPreserveSpace ProcessorStripSpace ProcessorStylesheetDoc ProcessorStylesheetElement ProcessorTemplate ProcessorTemplateElem ProcessorText
|
||||
ProcessorUnknown ProfileAddr ProfileDataException ProfileIdHelper ProgressBarUI ProgressMonitor ProgressMonitorInputStream Properties PropertyChangeEvent
|
||||
PropertyChangeListener PropertyChangeListenerProxy PropertyChangeSupport PropertyDescriptor PropertyEditor PropertyEditorManager PropertyEditorSupport PropertyPermission
|
||||
PropertyResourceBundle PropertyVetoException ProtectionDomain ProtocolException Provider ProviderException Proxy PsuedoNames PublicKey PushbackInputStream PushbackReader
|
||||
QName QuadCurve2D QuadIterator QueryParameter QueuedEvents QueuedJobCount Quo
|
||||
RAFImageInputStreamSpi RAFImageOutputStreamSpi RBCollationTables RBTableBuilder REQUEST_PROCESSING_POLICY_ID RGBColor RGBImageFilter RMIClassLoader RMIClassLoaderSpi
|
||||
RMIClientSocketFactory RMIFailureHandler RMISecurityException RMISecurityManager RMIServerSocketFactory RMISocketFactory RSAKey RSAKeyGenParameterSpec
|
||||
RSAMultiPrimePrivateCrtKey RSAMultiPrimePrivateCrtKeySpec RSAOtherPrimeInfo RSAPrivateCrtKey RSAPrivateCrtKeySpec RSAPrivateKey RSAPrivateKeySpec RSAPublicKey
|
||||
RSAPublicKeySpec RTFAttribute RTFAttributes RTFEditorKit RTFGenerator RTFParser RTFReader Random RandomAccess RandomAccessFile Raster RasterFormatException RasterOp
|
||||
RawCharacterHandler ReadOnlyBufferException ReadableByteChannel Reader ReaderThread Rect RectIterator Rectangle Rectangle2D RectangularShape Redirect Ref RefAddr Reference
|
||||
ReferenceAddr ReferenceQueue ReferenceUriSchemesSupported Referenceable ReferralException ReflectAccess ReflectPermission RefreshFailedException Refreshable
|
||||
RegisterableService Registry RegistryHandler RemarshalException Remote RemoteCall RemoteException RemoteObject RemoteRef RemoteServer RemoteStub RenderContext RenderableImage
|
||||
RenderableImageOp RenderableImageProducer RenderedImage RenderedImageFactory Renderer RenderingHints RepIdDelegator RepIdDelegator_1_3 RepIdDelegator_1_3_1 RepaintManager
|
||||
ReplicateScaleFilter ReplyMessage ReplyMessage_1_0 ReplyMessage_1_1 ReplyMessage_1_2 Repository RepositoryHelper RepositoryHolder RepositoryId RepositoryIdCache
|
||||
RepositoryIdCache_1_3 RepositoryIdCache_1_3_1 RepositoryIdFactory RepositoryIdHelper RepositoryIdInterface RepositoryIdStrings RepositoryIdUtility RepositoryId_1_3
|
||||
RepositoryId_1_3_1 RepositoryImpl RepositoryOperations Request RequestCanceledException RequestHandler RequestImpl RequestInfo RequestInfoExt RequestInfoImpl
|
||||
RequestInfoOperations RequestMessage RequestMessage_1_0 RequestMessage_1_1 RequestMessage_1_2 RequestProcessingPolicy RequestProcessingPolicyImpl
|
||||
RequestProcessingPolicyOperations RequestProcessingPolicyValue RequestProcessor RequestingUserName RescaleOp ResolutionSyntax ResolveResult Resolver ResourceBundle
|
||||
ResourceBundleEnumeration ResourceLoader ResourceManager Response ResponseHandler RestorableInputStream Result ResultNameSpace ResultSet ResultSetMetaData ResultTreeHandler
|
||||
ReverseAxesWalker Robot RobotPeer RootPaneContainer RootPaneUI RoundRectIterator RoundRectangle2D RowFilter RowMapper RowSet RowSetEvent RowSetInternal RowSetListener
|
||||
RowSetMetaData RowSetReader RowSetWriter RuleBasedBreakIterator RuleBasedCollator RunTime RunTimeOperations Runnable Runtime RuntimeException RuntimePermission
|
||||
SAX2DTM SAXException SAXNotRecognizedException SAXNotSupportedException SAXParseException SAXParser SAXParserFactory SAXParserFactoryImpl SAXParserImpl SAXResult SAXSource
|
||||
SAXSourceLocator SAXTransformerFactory SERVANT_RETENTION_POLICY_ID SOFMarkerSegment SOSMarkerSegment SQLData SQLDocument SQLErrorDocument SQLException SQLInput SQLOutput
|
||||
SQLPermission SQLWarning SUCCESSFUL SUNVMCID SYNC_WITH_TRANSPORT SYSTEM_EXCEPTION SampleModel Savepoint ScatteringByteChannel SchemaViolationException ScrollBarUI ScrollPane
|
||||
ScrollPaneAdjustable ScrollPaneConstants ScrollPaneLayout ScrollPanePeer ScrollPaneUI Scrollable Scrollbar ScrollbarPeer SearchControls SearchResult SecureClassLoader
|
||||
SecureRandom SecureRandomSpi Security SecurityException SecurityManager SecurityPermission Segment SegmentCache SelectableChannel SelectionEvent SelectionKey Selector
|
||||
SelectorProvider SelfIteratorNoPredicate SendingContextServiceContext SentEvent SentenceBreakData SeparatorUI SequenceInputStream SequencedEvent Serializable
|
||||
SerializableLocatorImpl SerializablePermission SerializationTester Serializer SerializerFactory SerializerSwitcher SerializerToHTML SerializerToText SerializerToXML Servant
|
||||
ServantActivator ServantActivatorHelper ServantActivatorOperations ServantActivatorPOA ServantAlreadyActive ServantAlreadyActiveHelper ServantCachePOAClientSC
|
||||
ServantCachingPolicy ServantLocator ServantLocatorHelper ServantLocatorOperations ServantLocatorPOA ServantManager ServantManagerImpl ServantManagerOperations ServantNotActive
|
||||
ServantNotActiveHelper ServantObject ServantRetentionPolicy ServantRetentionPolicyImpl ServantRetentionPolicyOperations ServantRetentionPolicyValue Server ServerAlreadyActive
|
||||
ServerAlreadyActiveHelper ServerAlreadyActiveHolder ServerAlreadyInstalled ServerAlreadyInstalledHelper ServerAlreadyInstalledHolder ServerAlreadyRegistered
|
||||
ServerAlreadyRegisteredHelper ServerAlreadyRegisteredHolder ServerAlreadyUninstalled ServerAlreadyUninstalledHelper ServerAlreadyUninstalledHolder ServerCloneException
|
||||
ServerDef ServerDefHelper ServerDefHolder ServerDelegate ServerError ServerException ServerGIOP ServerHeldDown ServerHeldDownHelper ServerHeldDownHolder ServerHelper
|
||||
ServerHolder ServerIdHelper ServerIdsHelper ServerIdsHolder ServerLocation ServerLocationHelper ServerLocationHolder ServerLocationPerORB ServerLocationPerORBHelper
|
||||
ServerLocationPerORBHolder ServerMain ServerManager ServerManagerHelper ServerManagerHolder ServerManagerImpl ServerManagerOperations ServerNotActive ServerNotActiveException
|
||||
ServerNotActiveHelper ServerNotActiveHolder ServerNotRegistered ServerNotRegisteredHelper ServerNotRegisteredHolder ServerOperations ServerRef ServerRequest ServerRequestImpl
|
||||
ServerRequestInfo ServerRequestInfoImpl ServerRequestInfoOperations ServerRequestInterceptor ServerRequestInterceptorOperations ServerResponse ServerResponseImpl
|
||||
ServerRuntimeException ServerSocket ServerSocketChannel ServerSubcontract ServerTableEntry ServerTool ServiceContext ServiceContextData ServiceContextHelper
|
||||
ServiceContextHolder ServiceContextListHelper ServiceContextListHolder ServiceContextRegistry ServiceContexts ServiceDetail ServiceDetailHelper ServiceIdHelper
|
||||
ServiceInformation ServiceInformationHelper ServiceInformationHolder ServicePermission ServiceRegistry ServiceUI ServiceUIFactory ServiceUnavailableException Set
|
||||
SetOfIntegerSyntax SetOverrideType SetOverrideTypeHelper Severity Shape ShapeGraphicAttribute SheetCollate Short ShortBuffer ShortHolder ShortLookupTable ShortSeqHelper
|
||||
ShortSeqHolder Shutdown ShutdownUtilDelegate Sides Signature SignatureException SignatureSpi SignedMutableBigInteger SignedObject Signer SimpleAttributeSet SimpleBeanInfo
|
||||
SimpleDateFormat SimpleDoc SimpleElementFactory SimpleFormatter SimpleHashtable SimpleTextBoundary SimpleTimeZone SinglePixelPackedSampleModel SingleSelectionModel
|
||||
Size2DSyntax SizeLimitExceededException SizeRequirements SizeSequence Skeleton SkeletonMismatchException SkeletonNotFoundException SliderUI SlotTable SlotTableStack
|
||||
SmartGridLayout Socket SocketAddress SocketChannel SocketException SocketHandler SocketImpl SocketImplFactory SocketInputStream SocketOptions SocketOutputStream
|
||||
SocketPermission SocketSecurityException SocketTimeoutException SocksConsts SocksSocketImpl SocksSocketImplFactory SoftBevelBorder SoftReference SolarisLoginModule
|
||||
SolarisNumericGroupPrincipal SolarisNumericUserPrincipal SolarisPrincipal SolarisSystem SortedMap SortedSet SortingFocusTraversalPolicy Source SourceLocator SourceTree
|
||||
SourceTreeManager SpecialMapping SpecialMethod SpinnerDateModel SpinnerListModel SpinnerModel SpinnerNumberModel SpinnerUI SplitPaneUI Spring SpringLayout Stack StackGuard
|
||||
StackOverflowError StackTraceElement StandardIIOPProfileTemplate StandardMetadataFormat StandardMetadataFormatResources StartTlsRequest StartTlsResponse State StateEdit
|
||||
StateEditable StateFactory StateInvariantError Statement StepPattern StopParseException StreamCorruptedException StreamHandler StreamPrintService StreamPrintServiceFactory
|
||||
StreamResult StreamSource StreamTokenizer Streamable StreamableValue StrictMath String StringBuffer StringBufferInputStream StringBufferPool StringCharBuffer
|
||||
StringCharacterIterator StringCoding StringContent StringHolder StringIndexOutOfBoundsException StringNameHelper StringReader StringRefAddr StringSelection StringSeqHelper
|
||||
StringSeqHolder StringToIntTable StringToStringTable StringToStringTableVector StringTokenizer StringValueHelper StringVector StringWriter Stroke Struct StructMember
|
||||
StructMemberHelper Stub StubDelegate StubDelegateImpl StubNotFoundException Style StyleConstants StyleContext StyleSheet StyleSheetList StyledDocument StyledEditorKit
|
||||
StyledParagraph Stylesheet StylesheetComposed StylesheetHandler StylesheetPIHandler StylesheetRoot SubContextList SubImageInputStream SuballocatedByteVector
|
||||
SuballocatedIntVector SubcontractList SubcontractRegistry SubcontractResponseHandler Subject SubjectCodeSource SubjectDomainCombiner SupportedValuesAttribute SwingConstants
|
||||
SwingGraphics SwingPropertyChangeSupport SwingUtilities SyncFailedException SyncScopeHelper SynthesisException SyntheticImage System SystemColor SystemEventQueueUtilities
|
||||
SystemException SystemFlavorMap SystemIDResolver
|
||||
TAG_ALTERNATE_IIOP_ADDRESS TAG_CODE_SETS TAG_INTERNET_IOP TAG_JAVA_CODEBASE TAG_MULTIPLE_COMPONENTS TAG_ORB_TYPE TAG_POLICIES TCKind TCPPortHelper TCUtility THREAD_POLICY_ID
|
||||
TRANSACTION_REQUIRED TRANSACTION_ROLLEDBACK TRANSIENT TRANSPORT_RETRY TabExpander TabSet TabStop TabableView TabbedPaneUI TableCellEditor TableCellRenderer TableColumn
|
||||
TableColumnModel TableColumnModelEvent TableColumnModelListener TableHeaderUI TableModel TableModelEvent TableModelListener TableUI TableView TagElement TagStack
|
||||
TaggedComponent TaggedComponentBase TaggedComponentFactories TaggedComponentFactoryFinder TaggedComponentHelper TaggedComponentHolder TaggedProfile TaggedProfileFactoryFinder
|
||||
TaggedProfileHelper TaggedProfileHolder TaggedProfileTemplate TargetAddress TargetAddressHelper TemplateList TemplateSubPatternAssociation Templates TemplatesHandler
|
||||
Terminator TestDTM TestDTMNodes TestDriver Text TextAction TextArea TextAreaDocument TextAreaPeer TextAttribute TextBoundaryData TextCallbackHandler TextComponent
|
||||
TextComponentPeer TextEvent TextField TextFieldPeer TextHitInfo TextInputCallback TextJustifier TextLayout TextLayoutStrategy TextLine TextListener TextMeasurer TextNode
|
||||
TextOutputCallback TextSyntax TextUI TexturePaint TexturePaintContext Thread ThreadCurrentStack ThreadDeath ThreadGroup ThreadLocal ThreadPolicy ThreadPolicyImpl
|
||||
ThreadPolicyOperations ThreadPolicyValue ThreadPool Throwable Tie TileObserver Time TimeLimitExceededException TimeZone Timer TimerQueue TimerTask Timestamp TitledBorder
|
||||
TooManyListenersException ToolBarUI ToolTipManager ToolTipUI Toolkit TrAXFilter TraceListener TraceListenerEx TraceManager TracerEvent TransactionService TransferHandler
|
||||
Transferable TransformAttribute TransformSnapshot TransformSnapshotImpl TransformState Transformer TransformerClient TransformerConfigurationException TransformerException
|
||||
TransformerFactory TransformerFactoryConfigurationError TransformerFactoryImpl TransformerHandler TransformerHandlerImpl TransformerIdentityImpl TransformerImpl
|
||||
TransientBindingIterator TransientNameServer TransientNameService TransientNamingContext TransientObjectManager Transparency TreeCellEditor TreeCellRenderer
|
||||
TreeExpansionEvent TreeExpansionListener TreeMap TreeModel TreeModelEvent TreeModelListener TreeNode TreePath TreeSelectionEvent TreeSelectionListener TreeSelectionModel
|
||||
TreeSet TreeUI TreeWalker TreeWalker2Result TreeWillExpandListener Trie TruncatedFileException TrustAnchor TypeCode TypeCodeFactory TypeCodeHolder TypeCodeImpl
|
||||
TypeCodeImplHelper TypeMismatch TypeMismatchException TypeMismatchHelper Types
|
||||
UEInfoServiceContext UID UIDefaults UIEvent UIManager UIResource ULongLongSeqHelper ULongLongSeqHolder ULongSeqHelper ULongSeqHolder UNKNOWN UNSUPPORTED_POLICY
|
||||
UNSUPPORTED_POLICY_VALUE URI URIException URIResolver URISyntax URISyntaxException URL URLClassLoader URLConnection URLDecoder URLEncoder URLStreamHandler
|
||||
URLStreamHandlerFactory URLStringHelper USER_EXCEPTION UShortSeqHelper UShortSeqHolder UTFDataFormatException UnImplNode UnaryOperation UndeclaredThrowableException
|
||||
UndoManager UndoableEdit UndoableEditEvent UndoableEditListener UndoableEditSupport UnexpectedException UnicastRemoteObject UnicodeClassMapping UnionMember UnionMemberHelper
|
||||
UnionPathIterator UnionPattern UnixLoginModule UnixNumericGroupPrincipal UnixNumericUserPrincipal UnixPrincipal UnixSystem UnknownEncoding UnknownEncodingHelper UnknownError
|
||||
UnknownException UnknownGroupException UnknownHostException UnknownObjectException UnknownServiceContext UnknownServiceException UnknownType UnknownUserException
|
||||
UnknownUserExceptionHelper UnknownUserExceptionHolder UnmappableCharacterException UnmarshalException UnmodifiableSetException UnrecoverableKeyException Unreferenced
|
||||
UnresolvedAddressException UnresolvedPermission UnresolvedPermissionCollection UnsatisfiedLinkError UnsolicitedNotification UnsolicitedNotificationEvent
|
||||
UnsolicitedNotificationListener UnsupportedAddressTypeException UnsupportedCallbackException UnsupportedCharsetException UnsupportedClassVersionError
|
||||
UnsupportedEncodingException UnsupportedFlavorException UnsupportedLookAndFeelException UnsupportedOperationException UserException Util UtilDelegate Utilities Utility
|
||||
VMID VM_ABSTRACT VM_CUSTOM VM_NONE VM_TRUNCATABLE ValidatingParser ValueBase ValueBaseHelper ValueBaseHolder ValueFactory ValueHandler ValueHandlerImpl ValueHandlerImpl_1_3
|
||||
ValueHandlerImpl_1_3_1 ValueMember ValueMemberHelper ValueUtility Variable VariableHeightLayoutCache VariableStack Vector VerifyError Version VersionHelper VersionHelper12
|
||||
VersionSpecHelper VetoableChangeListener VetoableChangeListenerProxy VetoableChangeSupport View ViewCSS ViewFactory ViewportLayout ViewportUI VirtualMachineError Visibility
|
||||
VisibilityHelper Void VolatileImage
|
||||
WCharSeqHelper WCharSeqHolder WStringSeqHelper WStringSeqHolder WStringValueHelper WalkerFactory WalkingIterator WalkingIteratorSorted WeakHashMap WeakReference WhiteSpaceInfo
|
||||
WhitespaceStrippingElementMatcher Win32FileSystem Win32Process WinNTFileSystem Window WindowAdapter WindowConstants WindowEvent WindowFocusListener WindowListener WindowPeer
|
||||
WindowStateListener WindowsBorders WindowsButtonListener WindowsButtonUI WindowsCheckBoxMenuItemUI WindowsCheckBoxUI WindowsComboBoxUI WindowsDesktopIconUI
|
||||
WindowsDesktopManager WindowsDesktopPaneUI WindowsEditorPaneUI WindowsFileChooserUI WindowsGraphicsUtils WindowsIconFactory WindowsInternalFrameTitlePane
|
||||
WindowsInternalFrameUI WindowsLabelUI WindowsListUI WindowsLookAndFeel WindowsMenuBarUI WindowsMenuItemUI WindowsMenuUI WindowsOptionPaneUI WindowsPasswordFieldUI
|
||||
WindowsPopupFactory WindowsPopupMenuUI WindowsPopupWindow WindowsPreferences WindowsPreferencesFactory WindowsProgressBarUI WindowsRadioButtonMenuItemUI WindowsRadioButtonUI
|
||||
WindowsRootPaneUI WindowsScrollBarUI WindowsScrollPaneUI WindowsSeparatorUI WindowsSliderUI WindowsSpinnerUI WindowsSplitPaneDivider WindowsSplitPaneUI WindowsTabbedPaneUI
|
||||
WindowsTableHeaderUI WindowsTableUI WindowsTextAreaUI WindowsTextFieldUI WindowsTextPaneUI WindowsTextUI WindowsToggleButtonUI WindowsToolBarUI WindowsTreeUI WindowsUtils
|
||||
WireObjectKeyTemplate WordBreakData WordBreakTable Work WrappedPlainView WrappedRuntimeException WritableByteChannel WritableRaster WritableRenderedImage WriteAbortedException
|
||||
Writeable Writer WriterToASCI WriterToUTF8 WriterToUTF8Buffered WrongAdapter WrongAdapterHelper WrongNumberArgsException WrongParserException WrongPolicy WrongPolicyHelper
|
||||
WrongTransaction WrongTransactionHelper WrongTransactionHolder
|
||||
X500Principal X500PrivateCredential X509CRL X509CRLEntry X509CRLSelector X509CertSelector X509Certificate X509EncodedKeySpec X509Extension XAConnection XADataSource XBoolean
|
||||
XBooleanStatic XConnection XMLCharacterRecognizer XMLDecoder XMLEncoder XMLFilter XMLFilterImpl XMLFormatter XMLNSDecl XMLReader XMLReaderAdapter XMLReaderFactory
|
||||
XMLReaderImpl XMLString XMLStringFactory XMLStringFactoryImpl XNodeSet XNodeSetForDOM XNull XNumber XObject XObjectFactory XPATHErrorResourceBundle XPATHErrorResources
|
||||
XPATHErrorResources_de XPATHErrorResources_en XPATHErrorResources_es XPATHErrorResources_fr XPATHErrorResources_it XPATHErrorResources_ja XPATHErrorResources_ko
|
||||
XPATHErrorResources_sv XPATHErrorResources_zh_CN XPATHErrorResources_zh_TW XPath XPathAPI XPathContext XPathDumper XPathException XPathFactory XPathParser
|
||||
XPathProcessorException XRTreeFrag XRTreeFragSelectWrapper XResourceBundle XResourceBundleBase XResources_cy XResources_de XResources_el XResources_en XResources_es
|
||||
XResources_fr XResources_he XResources_hy XResources_it XResources_ja_JP_A XResources_ja_JP_HA XResources_ja_JP_HI XResources_ja_JP_I XResources_ka XResources_ko
|
||||
XResources_sv XResources_zh_CN XResources_zh_TW XSLInfiniteLoopException XSLMessages XSLProcessorContext XSLProcessorVersion XSLTAttributeDef XSLTElementDef
|
||||
XSLTElementProcessor XSLTErrorResources XSLTErrorResources_de XSLTErrorResources_es XSLTErrorResources_fr XSLTErrorResources_it XSLTErrorResources_ja
|
||||
XSLTErrorResources_ko XSLTErrorResources_sv XSLTErrorResources_zh_CN XSLTErrorResources_zh_TW XSLTProcessorApplet XSLTSchema XString XStringForChars XStringForFSB
|
||||
XUnresolvedVariable XalanProperties XmlChars XmlDocument XmlDocumentBuilder XmlDocumentBuilderNS XmlNames XmlReader XmlSupport XmlWritable XmlWriteContext
|
||||
ZipConstants ZipEntry ZipException ZipFile ZipInputStream ZipOutputStream ZoneView
|
||||
_ActivatorImplBase _ActivatorStub _BindingIteratorImplBase _BindingIteratorStub _DynAnyFactoryStub _DynAnyStub _DynArrayStub _DynEnumStub _DynFixedStub _DynSequenceStub
|
||||
_DynStructStub _DynUnionStub _DynValueStub _IDLTypeStub _InitialNameServiceImplBase _InitialNameServiceStub _LocatorImplBase _LocatorStub _NamingContextExtStub
|
||||
_NamingContextImplBase _NamingContextStub _PolicyStub _Remote_Stub _RepositoryImplBase _RepositoryStub _ServantActivatorStub _ServantLocatorStub _ServerImplBase
|
||||
_ServerManagerImplBase _ServerManagerStub _ServerStub
|
||||
|
||||
/C4"Packages"
|
||||
Activation ActivationIDL
|
||||
CORBA CORBA_2_3 CodecFactoryPackage CodecPackage CosNaming CurrentPackage
|
||||
DynAnyFactoryPackage DynAnyPackage Dynamic DynamicAny
|
||||
IOP InitialNameServicePackage Interceptors
|
||||
LocatorPackage
|
||||
Messaging
|
||||
NamingContextExtPackage NamingContextPackage
|
||||
ORBInitInfoPackage ORBPackage
|
||||
PCosNaming POA POAManagerPackage POAPackage PortableInterceptor PortableServer
|
||||
RepositoryPackage
|
||||
SendingContext ServantLocatorPackage
|
||||
TypeCodePackage
|
||||
accessibility acl activation apache applet attribute auth awt axes
|
||||
basic beancontext beans border
|
||||
callback cert channels charset client codec collection color colorchooser com common compiler concurrent connection corba core crimson css
|
||||
datatransfer dgc directory dnd dom dom2dtm dtm
|
||||
event events ext extension extensions
|
||||
filechooser font functions
|
||||
geom gif
|
||||
helpers html
|
||||
ietf iiop im image imageio immutable interceptor interfaces internal io ior
|
||||
jar java javax jaxp jgss jpeg
|
||||
kerberos
|
||||
lang launcher ldap lib logging login
|
||||
math messages metadata metal module motif multi mutable
|
||||
naming net nio
|
||||
objects omg operations orbutil org
|
||||
parser parsers patterns peer plaf plugins png portable prefs print processor
|
||||
ref reflect reflection regex registry renderable res rmi rtf runtime
|
||||
sax sax2dtm scala se security serialize server spec spi sql standard stream stub stylesheets sun sunw swing synthetic
|
||||
table templates text trace transform transformer traversal tree
|
||||
undo util utils
|
||||
views
|
||||
w3c windows
|
||||
x500 xalan xml xpath xslt
|
||||
zip
|
||||
|
||||
/C5"Operators"
|
||||
|
|
||||
^
|
||||
&
|
||||
<: <
|
||||
>: >
|
||||
=> == =
|
||||
!
|
||||
:: :
|
||||
+
|
||||
-
|
||||
*
|
||||
// /
|
||||
%
|
||||
|
||||
/C6"Separs"
|
||||
[
|
||||
]
|
||||
(
|
||||
)
|
||||
,
|
||||
;
|
||||
{
|
||||
}
|
||||
/L20"Scala" Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ File Extensions = SCALA
|
||||
/Delimiters = ~!@%^&*()-+=|\/{}[]:;"'<> , .?
|
||||
/Function String = "%[ ^t]++[ps][a-zA-Z]+ [a-z,A-Z,0-9]+ ^(*(*)^)*{$"
|
||||
/Function String 1 = "%[ ^t]++[ps][a-zA-Z]+ [a-z,A-Z,0-9]+ ^(*(*)^)[ ^t]++$"
|
||||
/Indent Strings = "{"
|
||||
/Unindent Strings = "}"
|
||||
|
||||
/C1"Keywords"
|
||||
abstract
|
||||
case catch class
|
||||
def do
|
||||
else extends
|
||||
false final finally for
|
||||
if implicit import
|
||||
match
|
||||
new null
|
||||
object override
|
||||
package private protected
|
||||
return
|
||||
sealed super
|
||||
this trait try true type
|
||||
val var
|
||||
with while
|
||||
yield
|
||||
|
||||
/C2"Scala Classes"
|
||||
Buffer BufferedIterator
|
||||
Cell Char
|
||||
DefaultMapModel Double DoubleLinkedList
|
||||
GBTree
|
||||
HashMap HashSet HashTable History
|
||||
ImmutableMapAdaptor ImmutableSetAdaptor Int Iterable Iterator
|
||||
LinkedList List ListMap ListSet Long
|
||||
Map MapWrapper Monitor MutableList
|
||||
Nil None
|
||||
ObservableMap ObservableSet ObservableUpdate Option Ord
|
||||
Pair PartialFunction
|
||||
Queue
|
||||
Seq Set Short SingleLinkedList Some Stream StructuralEquality Subscriber Symbol
|
||||
Tuple1 Tuple2 Tuple3 Tuple4 Tuple5 Tuple6 Tuple7 Tuple8 Tuple9
|
||||
Unit
|
||||
|
||||
/C3"Java Classes"
|
||||
ARG_IN ARG_INOUT ARG_OUT ASCII AVT AVTPart AVTPartSimple AVTPartXPath AWTError AWTEvent AWTEventListener AWTEventListenerProxy AWTEventMulticaster AWTException AWTKeyStroke
|
||||
AWTPermission AbstractAction AbstractActionPropertyChangeListener AbstractBorder AbstractButton AbstractCellEditor AbstractCollection AbstractColorChooserPanel
|
||||
AbstractDocument AbstractFilter AbstractInterruptibleChannel AbstractLayoutCache AbstractList AbstractListModel AbstractMap AbstractMethodError AbstractPreferences
|
||||
AbstractSelectableChannel AbstractSelectionKey AbstractSelector AbstractSequentialList AbstractSet AbstractSpinnerModel AbstractTableModel AbstractUndoableEdit AbstractView
|
||||
AbstractWriter AccessControlContext AccessControlException AccessController AccessException Accessible AccessibleAction AccessibleBundle AccessibleComponent AccessibleContext
|
||||
AccessibleEditableText AccessibleExtendedComponent AccessibleExtendedTable AccessibleHTML AccessibleHyperlink AccessibleHypertext AccessibleIcon AccessibleKeyBinding
|
||||
AccessibleObject AccessibleRelation AccessibleRelationSet AccessibleResourceBundle AccessibleRole AccessibleSelection AccessibleState AccessibleStateSet AccessibleTable
|
||||
AccessibleTableModelChange AccessibleText AccessibleValue AccountExpiredException Acl AclEntry AclNotFoundException Action ActionEvent ActionListener ActionMap
|
||||
ActionMapUIResource Activatable ActivateFailedException ActivationDesc ActivationException ActivationGroup ActivationGroupDesc ActivationGroupID ActivationID
|
||||
ActivationInstantiator ActivationMonitor ActivationSystem Activator ActivatorHelper ActivatorHolder ActivatorOperations ActiveEvent ActiveObjectMap AdapterActivator
|
||||
AdapterActivatorOperations AdapterAlreadyExists AdapterAlreadyExistsHelper AdapterInactive AdapterInactiveHelper AdapterNonExistent AdapterNonExistentHelper AddressHelper
|
||||
AddressingDispositionException AddressingDispositionHelper Adjustable AdjustmentEvent AdjustmentListener Adler32 AdobeMarkerSegment AffineTransform AffineTransformOp
|
||||
AlgorithmParameterGenerator AlgorithmParameterGeneratorSpi AlgorithmParameterSpec AlgorithmParameters AlgorithmParametersSpi AllPermission AlphaComposite AlreadyBound
|
||||
AlreadyBoundException AlreadyBoundHelper AlreadyBoundHolder AlreadyConnectedException AlternateIIOPAddressComponent AncestorEvent AncestorListener AncestorNotifier
|
||||
AncestorStepPattern And Annotation Any AnyHolder AnyImpl AnyImplHelper AnySeqHelper AnySeqHolder AppConfigurationEntry Applet AppletContext AppletInitializer AppletStub
|
||||
ApplicationException Arc2D ArcIterator Area AreaAveragingScaleFilter Arg ArithmeticException Array ArrayIndexOutOfBoundsException ArrayList ArrayStoreException Arrays
|
||||
AssertionError AssertionStatusDirectives AsyncBoxView AsynchInvoke AsynchronousCloseException AttList Attr Attribute AttributeDecl AttributeException AttributeInUseException
|
||||
AttributeIterator AttributeList AttributeListImpl AttributeModificationException AttributeNode AttributeNode1 AttributeSet AttributeSetUtilities AttributeValue
|
||||
AttributedCharacterIterator AttributedString Attributes AttributesEx AttributesExImpl AttributesImpl AudioClip AuthPermission AuthenticationException
|
||||
AuthenticationNotSupportedException Authenticator Autoscroll Autoscroller AxesWalker Axis
|
||||
BAD_CONTEXT BAD_INV_ORDER BAD_OPERATION BAD_PARAM BAD_POLICY BAD_POLICY_TYPE BAD_POLICY_VALUE BAD_TYPECODE BRView BackingStoreException BadKind BadLocationException
|
||||
BadServerDefinition BadServerDefinitionHelper BadServerDefinitionHolder BadServerIdHandler BandCombineOp BandedSampleModel Base64 BasicArrowButton BasicAttribute
|
||||
BasicAttributes BasicBorders BasicButtonListener BasicButtonUI BasicCheckBoxMenuItemUI BasicCheckBoxUI BasicColorChooserUI BasicComboBoxEditor BasicComboBoxRenderer
|
||||
BasicComboBoxUI BasicComboPopup BasicDesktopIconUI BasicDesktopPaneUI BasicDirectoryModel BasicDragGestureRecognizer BasicDropTargetListener BasicEditorPaneUI
|
||||
BasicFileChooserUI BasicFormattedTextFieldUI BasicGraphicsUtils BasicHTML BasicIconFactory BasicInternalFrameTitlePane BasicInternalFrameUI BasicLabelUI BasicListUI
|
||||
BasicLookAndFeel BasicMenuBarUI BasicMenuItemUI BasicMenuUI BasicOptionPaneUI BasicPanelUI BasicPasswordFieldUI BasicPermission BasicPopupMenuSeparatorUI BasicPopupMenuUI
|
||||
BasicProgressBarUI BasicRadioButtonMenuItemUI BasicRadioButtonUI BasicRootPaneUI BasicScrollBarUI BasicScrollPaneUI BasicSeparatorUI BasicSliderUI BasicSpinnerUI
|
||||
BasicSplitPaneDivider BasicSplitPaneUI BasicStroke BasicTabbedPaneUI BasicTableHeaderUI BasicTableUI BasicTextAreaUI BasicTextFieldUI BasicTextPaneUI BasicTextUI
|
||||
BasicToggleButtonUI BasicToolBarSeparatorUI BasicToolBarUI BasicToolTipUI BasicTransferable BasicTreeUI BasicViewportUI BatchUpdateException BeanContext BeanContextChild
|
||||
BeanContextChildComponentProxy BeanContextChildSupport BeanContextContainerProxy BeanContextEvent BeanContextMembershipEvent BeanContextMembershipListener BeanContextProxy
|
||||
BeanContextServiceAvailableEvent BeanContextServiceProvider BeanContextServiceProviderBeanInfo BeanContextServiceRevokedEvent BeanContextServiceRevokedListener
|
||||
BeanContextServices BeanContextServicesListener BeanContextServicesSupport BeanContextSupport BeanDescriptor BeanInfo Beans BevelBorder Bidi BigDecimal BigInteger
|
||||
BinaryRefAddr BindException Binding BindingHelper BindingHolder BindingIterator BindingIteratorHelper BindingIteratorHolder BindingIteratorImpl BindingIteratorOperations
|
||||
BindingIteratorPOA BindingListHelper BindingListHolder BindingType BindingTypeHelper BindingTypeHolder BitSet BitSieve Bits Blob BlockView Book Bool BoolStack Boolean
|
||||
BooleanHolder BooleanSeqHelper BooleanSeqHolder BootStrapActivation BootstrapServer Border BorderFactory BorderLayout BorderUIResource BoundedRangeModel Bounds Box BoxLayout
|
||||
BoxView BoxedValueHelper BreakDictionary BreakIterator Buffer BufferCapabilities BufferManagerFactory BufferManagerRead BufferManagerReadGrow BufferManagerReadStream
|
||||
BufferManagerWrite BufferManagerWriteCollect BufferManagerWriteGrow BufferManagerWriteStream BufferOverflowException BufferQueue BufferStrategy BufferUnderflowException
|
||||
BufferedImage BufferedImageFilter BufferedImageOp BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Button ButtonGroup ButtonModel ButtonPeer ButtonUI
|
||||
Byte ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteBufferAsCharBufferB ByteBufferAsCharBufferL ByteBufferAsCharBufferRB ByteBufferAsCharBufferRL
|
||||
ByteBufferAsDoubleBufferB ByteBufferAsDoubleBufferL ByteBufferAsDoubleBufferRB ByteBufferAsDoubleBufferRL ByteBufferAsFloatBufferB ByteBufferAsFloatBufferL
|
||||
ByteBufferAsFloatBufferRB ByteBufferAsFloatBufferRL ByteBufferAsIntBufferB ByteBufferAsIntBufferL ByteBufferAsIntBufferRB ByteBufferAsIntBufferRL ByteBufferAsLongBufferB
|
||||
ByteBufferAsLongBufferL ByteBufferAsLongBufferRB ByteBufferAsLongBufferRL ByteBufferAsShortBufferB ByteBufferAsShortBufferL ByteBufferAsShortBufferRB ByteBufferAsShortBufferRL
|
||||
ByteBufferWithInfo ByteChannel ByteHolder ByteLookupTable ByteOrder
|
||||
CDATASection CDREncapsCodec CDRInputStream CDRInputStreamBase CDRInputStream_1_0 CDRInputStream_1_1 CDRInputStream_1_2 CDROutputStream CDROutputStreamBase
|
||||
CDROutputStream_1_0 CDROutputStream_1_1 CDROutputStream_1_2 CDataNode CMMException COMM_FAILURE COMMarkerSegment CORBAObjectImpl CRC32 CRL CRLException CRLSelector CSS
|
||||
CSS2Properties CSSCharsetRule CSSFontFaceRule CSSImportRule CSSMediaRule CSSPageRule CSSParser CSSPrimitiveValue CSSRule CSSRuleList CSSStyleDeclaration CSSStyleRule
|
||||
CSSStyleSheet CSSUnknownRule CSSValue CSSValueList CTX_RESTRICT_SCOPE CacheTable CachedCodeBase Calendar CallableStatement Callback CallbackHandler CancelRequestMessage
|
||||
CancelRequestMessage_1_0 CancelRequestMessage_1_1 CancelRequestMessage_1_2 CancelablePrintJob CancelledKeyException CannotProceed CannotProceedException CannotProceedHelper
|
||||
CannotProceedHolder CannotRedoException CannotUndoException Canvas CanvasPeer CardLayout Caret CaretEvent CaretListener CellEditor CellEditorListener CellRendererPane
|
||||
CenterLayout CertPath CertPathBuilder CertPathBuilderException CertPathBuilderResult CertPathBuilderSpi CertPathParameters CertPathValidator CertPathValidatorException
|
||||
CertPathValidatorResult CertPathValidatorSpi CertSelector CertStore CertStoreException CertStoreParameters CertStoreSpi Certificate CertificateEncodingException
|
||||
CertificateException CertificateExpiredException CertificateFactory CertificateFactorySpi CertificateNotYetValidException CertificateParsingException ChangeEvent
|
||||
ChangeListener ChangedCharSetException Channel ChannelBinding Channels CharArrayIterator CharArrayReader CharArrayWriter CharBuffer CharConversionException CharHolder CharInfo
|
||||
CharKey CharSeqHelper CharSeqHolder CharSequence CharSet Character CharacterBreakData CharacterCodingException CharacterData CharacterIterator CharacterIteratorFieldDelegate
|
||||
Charset CharsetDecoder CharsetEncoder CharsetProvider Checkbox CheckboxGroup CheckboxMenuItem CheckboxMenuItemPeer CheckboxPeer CheckedInputStream CheckedOutputStream
|
||||
Checksum ChildIterator ChildTestIterator Choice ChoiceCallback ChoiceFormat ChoicePeer Chromaticity ChunkedIntArray Class ClassCastException ClassCircularityError ClassDesc
|
||||
ClassFormatError ClassLoader ClassNotFoundException ClientDelegate ClientGIOP ClientRequest ClientRequestImpl ClientRequestInfo ClientRequestInfoImpl
|
||||
ClientRequestInfoOperations ClientRequestInterceptor ClientRequestInterceptorOperations ClientResponse ClientResponseImpl ClientSC ClientSubcontract Clipboard ClipboardOwner
|
||||
Clob CloneNotSupportedException Cloneable ClonerToResultTree ClosedByInterruptException ClosedChannelException ClosedSelectorException Closure CodeSetCache
|
||||
CodeSetComponentInfo CodeSetConversion CodeSetServiceContext CodeSets CodeSetsComponent CodeSource Codec CodecFactory CodecFactoryHelper CodecFactoryImpl
|
||||
CodecFactoryOperations CodecOperations CoderMalfunctionError CoderResult CodingErrorAction CollationElementIterator CollationKey CollationRules Collator Collection
|
||||
CollectionCertStoreParameters Collections Color ColorChooserComponentFactory ColorChooserUI ColorConvertOp ColorModel ColorPaintContext ColorSelectionModel ColorSpace
|
||||
ColorSupported ColorUIResource ComboBoxEditor ComboBoxModel ComboBoxUI ComboPopup CommandHandler Comment CommentNode CommentView CommunicationException Comparable Comparator
|
||||
Compiler CompletionStatus CompletionStatusHelper Component ComponentAdapter ComponentColorModel ComponentEvent ComponentIdHelper ComponentInputMap ComponentInputMapUIResource
|
||||
ComponentListener ComponentOrientation ComponentPeer ComponentSampleModel ComponentUI ComponentView Composite CompositeContext CompositeName CompositeView CompoundBorder
|
||||
CompoundEdit CompoundName Compression ConcurrentModificationException Condition Conditional ConfigFile Configuration ConfigurationException ConfirmationCallback
|
||||
ConnectException ConnectIOException Connection ConnectionEvent ConnectionEventListener ConnectionPendingException ConnectionPool ConnectionPoolDataSource ConnectionPoolManager
|
||||
ConnectionTable ConsoleHandler Constant Constants Constructor Container ContainerAdapter ContainerEvent ContainerListener ContainerOrderFocusTraversalPolicy ContainerPeer
|
||||
ContentHandler ContentHandlerFactory ContentModel ContentModelState Context ContextImpl ContextList ContextListImpl ContextMatchStepPattern ContextNodeList
|
||||
ContextNotEmptyException ContextualRenderedImageFactory ContinuationContext ContinuationDirContext Control ControlFactory ConvolveOp CookieHolder Copies CopiesSupported
|
||||
CorbaLoc CorbaName CorbaResourceUtil CoroutineManager CoroutineParser CoroutineSAXFilterTest CoroutineSAXParser CoroutineSAXParser_Xerces Counter CountersTable
|
||||
CredentialExpiredException CropImageFilter Crypt CubicCurve2D CubicIterator Currency CurrencyData Current CurrentHelper CurrentHolder CurrentOperations Cursor CustomMarshal
|
||||
CustomStringPool CustomValue Customizer
|
||||
DATA_CONVERSION DGC DHTMarkerSegment DOM2DTM DOM2Helper DOMBuilder DOMException DOMHelper DOMImplementation DOMImplementationCSS DOMImplementationImpl DOMLocator DOMOrder
|
||||
DOMResult DOMSerializer DOMSource DQTMarkerSegment DRIMarkerSegment DSAKey DSAKeyPairGenerator DSAParameterSpec DSAParams DSAPrivateKey DSAPrivateKeySpec DSAPublicKey
|
||||
DSAPublicKeySpec DTD DTDConstants DTDHandler DTM DTMAxisIterator DTMAxisIteratorBase DTMAxisTraverser DTMConfigurationException DTMDOMException DTMDefaultBase
|
||||
DTMDefaultBaseIterators DTMDefaultBaseTraversers DTMDocument DTMDocumentImpl DTMException DTMFilter DTMIterator DTMManager DTMManagerDefault DTMNamedNodeMap DTMNodeIterator
|
||||
DTMNodeList DTMNodeProxy DTMSafeStringPool DTMStringPool DTMTreeWalker DTMWSFilter DataBuffer DataBufferByte DataBufferDouble DataBufferFloat DataBufferInt DataBufferShort
|
||||
DataBufferUShort DataFlavor DataFormatException DataInput DataInputStream DataNode DataOutput DataOutputStream DataSource DataTruncation DatabaseMetaData DatagramChannel
|
||||
DatagramPacket DatagramSocket DatagramSocketImpl DatagramSocketImplFactory Date DateFormat DateFormatSymbols DateFormatter DateTimeAtCompleted DateTimeAtCreation
|
||||
DateTimeAtProcessing DateTimeSyntax DebugGraphics DebugGraphicsFilter DebugGraphicsInfo DebugGraphicsObserver DecimalFormat DecimalFormatProperties DecimalFormatSymbols
|
||||
DecimalToRoman DeclHandler DefaultBoundedRangeModel DefaultButtonModel DefaultCaret DefaultCellEditor DefaultColorSelectionModel DefaultComboBoxModel DefaultConnectionPool
|
||||
DefaultDesktopManager DefaultEditorKit DefaultErrorHandler DefaultFocusManager DefaultFocusTraversalPolicy DefaultFormatter DefaultFormatterFactory DefaultHSBChooserPanel
|
||||
DefaultHandler DefaultHighlighter DefaultKeyboardFocusManager DefaultListCellRenderer DefaultListModel DefaultListSelectionModel DefaultMenuLayout DefaultMetalTheme
|
||||
DefaultMutableTreeNode DefaultPersistenceDelegate DefaultPreviewPanel DefaultRGBChooserPanel DefaultSingleSelectionModel DefaultSocketFactory DefaultStyledDocument
|
||||
DefaultSwatchChooserPanel DefaultTableCellRenderer DefaultTableColumnModel DefaultTableModel DefaultTextUI DefaultTreeCellEditor DefaultTreeCellRenderer DefaultTreeModel
|
||||
DefaultTreeSelectionModel DefaultValidationErrorHandler DefinitionKind DefinitionKindHelper Deflater DeflaterOutputStream Delegate DelegateImpl DelegatingDefaultFocusManager
|
||||
DelegationPermission DescendantIterator DesignMode DesktopIconUI DesktopManager DesktopPaneUI Destination DestroyFailedException Destroyable Dialog DialogCallbackHandler
|
||||
DialogPeer Dictionary DictionaryBasedBreakIterator DigestException DigestInputStream DigestOutputStream DigitList DigraphNode Dimension Dimension2D DimensionUIResource
|
||||
DirContext DirObjectFactory DirStateFactory DirectByteBuffer DirectByteBufferR DirectCharBufferRS DirectCharBufferRU DirectCharBufferS DirectCharBufferU DirectColorModel
|
||||
DirectDoubleBufferRS DirectDoubleBufferRU DirectDoubleBufferS DirectDoubleBufferU DirectFloatBufferRS DirectFloatBufferRU DirectFloatBufferS DirectFloatBufferU
|
||||
DirectIntBufferRS DirectIntBufferRU DirectIntBufferS DirectIntBufferU DirectLongBufferRS DirectLongBufferRU DirectLongBufferS DirectLongBufferU DirectShortBufferRS
|
||||
DirectShortBufferRU DirectShortBufferS DirectShortBufferU DirectoryManager DisplayMode Div DnDConstants DnDEventMulticaster Doc DocAttribute DocAttributeSet DocFlavor
|
||||
DocPrintJob Doctype Document DocumentBuilder DocumentBuilderFactory DocumentBuilderFactoryImpl DocumentBuilderImpl DocumentCSS DocumentEvent DocumentEx DocumentFilter
|
||||
DocumentFragment DocumentHandler DocumentListener DocumentName DocumentParser DocumentStyle DocumentTraversal DocumentType DocumentView DomEx DomainCombiner DomainManager
|
||||
DomainManagerOperations Double DoubleBuffer DoubleHolder DoubleSeqHelper DoubleSeqHolder DragGestureEvent DragGestureListener DragGestureRecognizer DragSource
|
||||
DragSourceAdapter DragSourceContext DragSourceContextPeer DragSourceDragEvent DragSourceDropEvent DragSourceEvent DragSourceListener DragSourceMotionListener Driver
|
||||
DriverManager DriverPropertyInfo DropTarget DropTargetAdapter DropTargetContext DropTargetContextPeer DropTargetDragEvent DropTargetDropEvent DropTargetEvent DropTargetListener
|
||||
DropTargetPeer DuplicateName DuplicateNameHelper DuplicateServiceContext DynAny DynAnyBasicImpl DynAnyCollectionImpl DynAnyComplexImpl DynAnyConstructedImpl DynAnyFactory
|
||||
DynAnyFactoryHelper DynAnyFactoryImpl DynAnyFactoryOperations DynAnyHelper DynAnyImpl DynAnyOperations DynAnySeqHelper DynAnyUtil DynArray DynArrayHelper DynArrayImpl
|
||||
DynArrayOperations DynEnum DynEnumHelper DynEnumImpl DynEnumOperations DynFixed DynFixedHelper DynFixedImpl DynFixedOperations DynSequence DynSequenceHelper DynSequenceImpl
|
||||
DynSequenceOperations DynStruct DynStructHelper DynStructImpl DynStructOperations DynUnion DynUnionHelper DynUnionImpl DynUnionOperations DynValue DynValueBox DynValueBoxImpl
|
||||
DynValueBoxOperations DynValueCommon DynValueCommonImpl DynValueCommonOperations DynValueHelper DynValueImpl DynValueOperations DynamicImplementation
|
||||
ENCODING_CDR_ENCAPS EOFException EditableView EditorKit ElemApplyImport ElemApplyTemplates ElemAttribute ElemAttributeSet ElemCallTemplate ElemChoose ElemComment ElemCopy
|
||||
ElemCopyOf ElemDesc ElemElement ElemEmpty ElemExtensionCall ElemExtensionDecl ElemExtensionScript ElemFallback ElemForEach ElemIf ElemLiteralResult ElemMessage ElemNumber
|
||||
ElemOtherwise ElemPI ElemParam ElemSort ElemTemplate ElemTemplateElement ElemText ElemTextLiteral ElemUnknown ElemUse ElemValueOf ElemVariable ElemWhen ElemWithParam
|
||||
Element ElementCSSInlineStyle ElementDecl ElementEx ElementFactory ElementIterator ElementNode ElementNode2 ElementValidator Ellipse2D EllipseIterator EmptyBorder
|
||||
EmptyStackException EncapsInputStream EncapsOutputStream EncodedKeySpec Encoder Encoding EncodingInfo Encodings EndOfInputException EndPoint EndPointImpl EndPointInfo
|
||||
EndPointInfoHelper EndPointInfoHolder EndSelectionEvent EndpointInfoListHelper EndpointInfoListHolder Entity EntityDecl EntityReference EntityResolver EntryPair EntryPoint
|
||||
EnumSyntax Enumeration Environment EnvironmentCheck EnvironmentImpl Equals Error ErrorHandler ErrorListener ErrorManager EtchedBorder Event EventContext EventDirContext
|
||||
EventDispatchThread EventException EventHandler EventListener EventListenerList EventListenerProxy EventObject EventQueue EventSetDescriptor EventTarget Exception
|
||||
ExceptionInInitializerError ExceptionList ExceptionListImpl ExceptionListener ExpandVetoException ExpandedNameTable ExportException Expression ExpressionContext
|
||||
ExtendedRequest ExtendedResponse ExtensionHandler ExtensionHandlerGeneral ExtensionHandlerJava ExtensionHandlerJavaClass ExtensionHandlerJavaPackage Extensions
|
||||
ExtensionsTable ExternalEntity Externalizable
|
||||
FREE_MEM FVDCodeBaseImpl FactoryConfigurationError FactoryEnumeration FactoryFinder FailedLoginException FastStringBuffer FeatureDescriptor Fidelity Field FieldNameHelper
|
||||
FieldPosition FieldView File FileCacheImageInputStream FileCacheImageOutputStream FileChannel FileChooserUI FileDescriptor FileDialog FileDialogPeer FileFilter
|
||||
FileHandler FileImageInputStream FileImageInputStreamSpi FileImageOutputStream FileImageOutputStreamSpi FileInputStream FileLock FileLockInterruptionException FileNameMap
|
||||
FileNotFoundException FileOutputStream FilePermission FileReader FileSystem FileSystemView FileView FileWriter FilenameFilter Filter FilterExprWalker FilterInputStream
|
||||
FilterOutputStream FilterReader FilterWriter FilteredImageSource FinalReference Finalizer Finishings FixedHeightLayoutCache FixedHolder FlatteningPathIterator FlavorException
|
||||
FlavorMap FlavorTable Float FloatBuffer FloatHolder FloatSeqHelper FloatSeqHolder FloatingDecimal FlowLayout FlowView FocusAdapter FocusEvent FocusListener FocusManager
|
||||
FocusTraversalPolicy Font FontFormatException FontMetrics FontPeer FontRenderContext FontUIResource FormView Format FormatMismatch FormatMismatchHelper Formatter
|
||||
ForwardException ForwardRequest ForwardRequestHelper FoundIndex FragmentMessage FragmentMessage_1_1 FragmentMessage_1_2 Frame FramePeer FrameSetView FrameView FreezableList
|
||||
FuncBoolean FuncCeiling FuncConcat FuncContains FuncCount FuncCurrent FuncDoclocation FuncDocument FuncExtElementAvailable FuncExtFunction FuncExtFunctionAvailable FuncFalse
|
||||
FuncFloor FuncFormatNumb FuncGenerateId FuncId FuncKey FuncLang FuncLast FuncLoader FuncLocalPart FuncNamespace FuncNormalizeSpace FuncNot FuncNumber FuncPosition FuncQname
|
||||
FuncRound FuncStartsWith FuncString FuncStringLength FuncSubstring FuncSubstringAfter FuncSubstringBefore FuncSum FuncSystemProperty FuncTranslate FuncTrue
|
||||
FuncUnparsedEntityURI Function Function2Args Function3Args FunctionDef1Arg FunctionMultiArgs FunctionOneArg FunctionPattern FunctionTable Future
|
||||
GIFImageMetadata GIFImageMetadataFormat GIFImageMetadataFormatResources GIFImageReader GIFImageReaderSpi GIFStreamMetadata GIFStreamMetadataFormat
|
||||
GIFStreamMetadataFormatResources GIOPImpl GIOPVersion GSSContext GSSCredential GSSException GSSManager GSSName GSSUtil GZIPInputStream GZIPOutputStream GapContent GapVector
|
||||
GatheringByteChannel GeneralPath GeneralPathIterator GeneralSecurityException GenerateEvent GenericIdEncapsulation GenericPOAClientSC GenericPOAServerSC GenericTaggedComponent
|
||||
GenericTaggedProfile GetEndPointInfoAgainException GetORBPropertiesFileAction GlyphJustificationInfo GlyphMetrics GlyphPainter1 GlyphPainter2 GlyphVector GlyphView
|
||||
GradientPaint GradientPaintContext GraphicAttribute Graphics Graphics2D GraphicsCallback GraphicsConfigTemplate GraphicsConfiguration GraphicsDevice GraphicsEnvironment
|
||||
GraphicsWrapper GrayFilter GregorianCalendar GridBagConstraints GridBagLayout GridLayout Group Gt Gte Guard GuardedObject
|
||||
HRuleView HTML HTMLAnchorElement HTMLAppletElement HTMLAreaElement HTMLBRElement HTMLBaseElement HTMLBaseFontElement HTMLBodyElement HTMLButtonElement HTMLCollection
|
||||
HTMLDListElement HTMLDOMImplementation HTMLDirectoryElement HTMLDivElement HTMLDocument HTMLEditorKit HTMLElement HTMLFieldSetElement HTMLFontElement HTMLFormElement
|
||||
HTMLFrameElement HTMLFrameHyperlinkEvent HTMLFrameSetElement HTMLHRElement HTMLHeadElement HTMLHeadingElement HTMLHtmlElement HTMLIFrameElement HTMLImageElement
|
||||
HTMLInputElement HTMLIsIndexElement HTMLLIElement HTMLLabelElement HTMLLegendElement HTMLLinkElement HTMLMapElement HTMLMenuElement HTMLMetaElement HTMLModElement
|
||||
HTMLOListElement HTMLObjectElement HTMLOptGroupElement HTMLOptionElement HTMLParagraphElement HTMLParamElement HTMLPreElement HTMLQuoteElement HTMLScriptElement
|
||||
HTMLSelectElement HTMLStyleElement HTMLTableCaptionElement HTMLTableCellElement HTMLTableColElement HTMLTableElement HTMLTableRowElement HTMLTableSectionElement
|
||||
HTMLTextAreaElement HTMLTitleElement HTMLUListElement HTMLWriter Handler HandlerBase HasControls HashAttributeSet HashDocAttributeSet HashMap HashPrintJobAttributeSet
|
||||
HashPrintRequestAttributeSet HashPrintServiceAttributeSet HashSet Hashtable HeadlessException HeapByteBuffer HeapByteBufferR HeapCharBuffer HeapCharBufferR HeapDoubleBuffer
|
||||
HeapDoubleBufferR HeapFloatBuffer HeapFloatBufferR HeapIntBuffer HeapIntBufferR HeapLongBuffer HeapLongBufferR HeapShortBuffer HeapShortBufferR HexOutputStream
|
||||
HiddenTagView HierarchyBoundsAdapter HierarchyBoundsListener HierarchyEvent HierarchyListener Highlighter HostInfo HttpURLConnection HyperlinkEvent HyperlinkListener
|
||||
ICC_ColorSpace ICC_Profile ICC_ProfileGray ICC_ProfileRGB IDLEntity IDLType IDLTypeHelper IDLTypeOperations ID_ASSIGNMENT_POLICY_ID ID_UNIQUENESS_POLICY_ID IIOByteBuffer
|
||||
IIOException IIOImage IIOInvalidTreeException IIOMetadata IIOMetadataController IIOMetadataFormat IIOMetadataFormatImpl IIOMetadataNode IIOPAddress IIOPAddressBase
|
||||
IIOPAddressFutureImpl IIOPAddressImpl IIOPConnection IIOPInputStream IIOPInputStream_1_3 IIOPInputStream_1_3_1 IIOPOutputStream IIOPOutputStream_1_3 IIOPOutputStream_1_3_1
|
||||
IIOPProfile IIOPProfileTemplate IIOP_CLEAR_TEXT IIOParam IIOParamController IIOReadProgressListener IIOReadUpdateListener IIOReadWarningListener IIORegistry IIOServiceProvider
|
||||
IIOWriteProgressListener IIOWriteWarningListener IMPLICIT_ACTIVATION_POLICY_ID IMP_LIMIT INITIALIZE INSObjectKeyEntry INSObjectKeyMap INSSubcontract INTERNAL INTF_REPOS
|
||||
INVALID_TRANSACTION INV_FLAG INV_IDENT INV_OBJREF INV_POLICY IOException IOR IORAddressingInfo IORAddressingInfoHelper IORHelper IORHolder IORInfo IORInfoExt IORInfoImpl
|
||||
IORInfoOperations IORInterceptor IORInterceptorOperations IORTemplate IRObject IRObjectOperations Icon IconUIResource IconView IdAssignmentPolicy IdAssignmentPolicyImpl
|
||||
IdAssignmentPolicyOperations IdAssignmentPolicyValue IdEncapsulation IdEncapsulationBase IdEncapsulationContainerBase IdEncapsulationFactory IdEncapsulationFactoryFinder
|
||||
IdUniquenessPolicy IdUniquenessPolicyImpl IdUniquenessPolicyOperations IdUniquenessPolicyValue Identifiable IdentifiableContainerBase IdentifierHelper Identity
|
||||
IdentityHashMap IdentityHashtable IdentityScope IllegalAccessError IllegalAccessException IllegalArgumentException IllegalBlockingModeException IllegalCharsetNameException
|
||||
IllegalComponentStateException IllegalMonitorStateException IllegalPathStateException IllegalSelectorException IllegalStateException IllegalThreadStateException Image
|
||||
ImageCapabilities ImageConsumer ImageFilter ImageFormatException ImageGraphicAttribute ImageIO ImageIcon ImageInputStream ImageInputStreamImpl ImageInputStreamSpi
|
||||
ImageObserver ImageOutputStream ImageOutputStreamImpl ImageOutputStreamSpi ImageProducer ImageReadParam ImageReader ImageReaderSpi ImageReaderWriterSpi ImageTranscoder
|
||||
ImageTranscoderSpi ImageTypeSpecifier ImageView ImageWriteParam ImageWriter ImageWriterSpi ImagingOpException ImplicitActivationPolicy ImplicitActivationPolicyImpl
|
||||
ImplicitActivationPolicyOperations ImplicitActivationPolicyValue IncompatibleClassChangeError InconsistentTypeCode InconsistentTypeCodeHelper IncrementalSAXSource
|
||||
IncrementalSAXSource_Filter IncrementalSAXSource_Xerces IndexColorModel IndexOutOfBoundsException IndexedPropertyDescriptor IndirectionException Inet4Address Inet6Address
|
||||
InetAddress InetSocketAddress Inflater InflaterInputStream InheritableThreadLocal InitialContext InitialContextFactory InitialContextFactoryBuilder InitialDirContext
|
||||
InitialLdapContext InitialNameService InitialNameServiceHelper InitialNameServiceHolder InitialNameServiceOperations InitialNamingClient InitialNamingImpl
|
||||
InlineView InputContext InputEntity InputEvent InputMap InputMapUIResource InputMethod InputMethodContext InputMethodDescriptor InputMethodEvent InputMethodHighlight
|
||||
InputMethodListener InputMethodRequests InputSource InputStream InputStreamAdapter InputStreamHook InputStreamImageInputStreamSpi InputStreamReader InputSubset InputVerifier
|
||||
Insets InsetsUIResource InstantiationError InstantiationException InsufficientResourcesException IntBuffer IntHolder IntStack IntVector Integer IntegerSyntax
|
||||
InterOperableNamingImpl Interceptor InterceptorInvoker InterceptorList InterceptorOperations InternalBindingKey InternalBindingValue InternalEntity InternalError
|
||||
InternalFrameAdapter InternalFrameEvent InternalFrameFocusTraversalPolicy InternalFrameListener InternalFrameUI InternalRuntimeForwardRequest InternationalFormatter
|
||||
InterruptedException InterruptedIOException InterruptedNamingException InterruptibleChannel IntrospectionException Introspector Invalid InvalidAddress InvalidAddressHelper
|
||||
InvalidAddressHolder InvalidAlgorithmParameterException InvalidAttributeIdentifierException InvalidAttributeValueException InvalidAttributesException InvalidClassException
|
||||
InvalidDnDOperationException InvalidKeyException InvalidKeySpecException InvalidMarkException InvalidName InvalidNameException InvalidNameHelper InvalidNameHolder
|
||||
InvalidORBid InvalidORBidHelper InvalidORBidHolder InvalidObjectException InvalidParameterException InvalidParameterSpecException InvalidPolicy InvalidPolicyHelper
|
||||
InvalidPreferencesFormatException InvalidSearchControlsException InvalidSearchFilterException InvalidSeq InvalidSlot InvalidSlotHelper InvalidTypeForEncoding
|
||||
InvalidTypeForEncodingHelper InvalidValue InvalidValueHelper InvocationEvent InvocationHandler InvocationInfo InvocationTargetException InvokeHandler IsindexView
|
||||
IstringHelper ItemEvent ItemListener ItemSelectable Iterator IteratorPool
|
||||
JApplet JButton JCheckBox JCheckBoxMenuItem JColorChooser JComboBox JComponent JDKBridge JDKClassLoader JDesktopPane JDialog JEditorPane JFIFMarkerSegment JFileChooser
|
||||
JFormattedTextField JFrame JIDLObjectKeyTemplate JInternalFrame JLabel JLayeredPane JList JMenu JMenuBar JMenuItem JOptionPane JPEG JPEGBuffer JPEGCodec JPEGDecodeParam
|
||||
JPEGEncodeParam JPEGHuffmanTable JPEGImageDecoder JPEGImageEncoder JPEGImageMetadataFormat JPEGImageMetadataFormatResources JPEGImageReadParam JPEGImageReader
|
||||
JPEGImageReaderResources JPEGImageReaderSpi JPEGImageWriteParam JPEGImageWriter JPEGImageWriterResources JPEGImageWriterSpi JPEGMetadata JPEGMetadataFormat
|
||||
JPEGMetadataFormatResources JPEGQTable JPEGStreamMetadataFormat JPEGStreamMetadataFormatResources JPanel JPasswordField JPopupMenu JProgressBar JRadioButton
|
||||
JRadioButtonMenuItem JRootPane JScrollBar JScrollPane JSeparator JSlider JSpinner JSplitPane JTabbedPane JTable JTableHeader JTextArea JTextComponent JTextField JTextPane
|
||||
JToggleButton JToolBar JToolTip JTree JViewport JWindow JarEntry JarException JarFile JarInputStream JarOutputStream JarURLConnection JarVerifier JavaCodebaseComponent
|
||||
JavaUtils JndiLoginModule JobAttributes JobHoldUntil JobImpressions JobImpressionsCompleted JobImpressionsSupported JobKOctets JobKOctetsProcessed JobKOctetsSupported
|
||||
JobMediaSheets JobMediaSheetsCompleted JobMediaSheetsSupported JobMessageFromOperator JobName JobOriginatingUserName JobPriority JobPrioritySupported JobSheets
|
||||
JobState JobStateReason JobStateReasons
|
||||
KerberosKey KerberosPrincipal KerberosTicket Kernel Key KeyAdapter KeyAddr KeyDeclaration KeyEvent KeyEventDispatcher KeyEventPostProcessor KeyException KeyFactory
|
||||
KeyFactorySpi KeyImpl KeyIterator KeyListener KeyManagementException KeyManager KeyPair KeyPairGenerator KeyPairGeneratorSpi KeyRefIterator KeySpec KeyStore KeyStoreException
|
||||
KeyStoreLoginModule KeyStoreSpi KeyStroke KeyTable KeyWalker KeyboardFocusManager KeyboardManager Keymap Keywords Krb5LoginModule
|
||||
LDAPCertStoreParameters LIFESPAN_POLICY_ID LOCATION_FORWARD Label LabelPeer LabelUI LabelView LanguageCallback LastOwnerException LayeredHighlighter LayoutComparator
|
||||
LayoutFocusTraversalPolicy LayoutManager LayoutManager2 LayoutQueue LdapContext LdapReferralException Lease LegacyGlueFocusTraversalPolicy LegacyHookGetFields
|
||||
LegacyHookPutFields Level Lexer LexicalHandler LibraryManager LifespanPolicy LifespanPolicyImpl LifespanPolicyOperations LifespanPolicyValue LightweightPeer
|
||||
LimitExceededException Line2D LineBorder LineBreakData LineBreakMeasurer LineIterator LineMetrics LineNumberInputStream LineNumberReader LineView LinkException
|
||||
LinkLoopException LinkRef LinkStyle LinkageError LinkedHashMap LinkedHashSet LinkedList List ListCellRenderer ListDataEvent ListDataListener ListIterator ListModel ListPeer
|
||||
ListResourceBundle ListSelectionEvent ListSelectionListener ListSelectionModel ListUI ListView ListenerThread LoaderHandler LocPathIterator LocalClientRequestImpl
|
||||
LocalClientResponseImpl LocalObject LocalServerRequestImpl LocalServerResponseImpl Locale LocateRegistry LocateReplyMessage LocateReplyMessage_1_0 LocateReplyMessage_1_1
|
||||
LocateReplyMessage_1_2 LocateRequestMessage LocateRequestMessage_1_0 LocateRequestMessage_1_1 LocateRequestMessage_1_2 Locator LocatorHelper LocatorHolder LocatorImpl
|
||||
LocatorOperations Lock LogManager LogRecord LogStream Logger LoggingPermission LoginContext LoginException LoginModule Long LongBuffer LongHolder LongLongSeqHelper
|
||||
LongLongSeqHolder LongSeqHelper LongSeqHolder LookAndFeel LookupOp LookupTable Lt Lte
|
||||
MARSHAL MalformedInputException MalformedLinkException MalformedURLException Manifest Map MappedByteBuffer MarkAndResetHandler MarkerSegment MarshalException
|
||||
MarshalInputStream MarshalOutputStream MarshalledObject MaskFormatter MatchPatternIterator Matcher Math MatteBorder Media MediaList MediaName MediaPrintableArea MediaSize
|
||||
MediaSizeName MediaTracker MediaTray Member MemoryCache MemoryCacheImageInputStream MemoryCacheImageOutputStream MemoryHandler MemoryImageSource Menu MenuBar MenuBarPeer
|
||||
MenuBarUI MenuComponent MenuComponentPeer MenuContainer MenuDragMouseEvent MenuDragMouseListener MenuElement MenuEvent MenuItem MenuItemPeer MenuItemUI MenuKeyEvent
|
||||
MenuKeyListener MenuListener MenuPeer MenuSelectionManager MenuShortcut MergeCollation Message MessageBase MessageCatalog MessageDigest MessageDigestSpi MessageFormat
|
||||
MessageMediator MessageProp Message_1_0 Message_1_1 Message_1_2 MetaData MetalBorders MetalBumps MetalButtonUI MetalCheckBoxIcon MetalCheckBoxUI MetalComboBoxButton
|
||||
MetalComboBoxEditor MetalComboBoxIcon MetalComboBoxUI MetalDesktopIconUI MetalFileChooserUI MetalIconFactory MetalInternalFrameTitlePane MetalInternalFrameUI
|
||||
MetalLabelUI MetalLookAndFeel MetalPopupMenuSeparatorUI MetalProgressBarUI MetalRadioButtonUI MetalRootPaneUI MetalScrollBarUI MetalScrollButton MetalScrollPaneUI
|
||||
MetalSeparatorUI MetalSliderUI MetalSplitPaneDivider MetalSplitPaneUI MetalTabbedPaneUI MetalTextFieldUI MetalTheme MetalTitlePane MetalToggleButtonUI MetalToolBarUI
|
||||
MetalToolTipUI MetalTreeUI MetalUtils Method MethodDescriptor MethodResolver MimeType MimeTypeParameterList MimeTypeParseException MinimalHTMLWriter MinorCodes
|
||||
Minus MissingResourceException MockAttributeSet Mod ModificationItem Modifier MotifBorders MotifButtonListener MotifButtonUI MotifCheckBoxMenuItemUI MotifCheckBoxUI
|
||||
MotifComboBoxRenderer MotifComboBoxUI MotifDesktopIconUI MotifDesktopPaneUI MotifEditorPaneUI MotifFileChooserUI MotifGraphicsUtils MotifIconFactory
|
||||
MotifInternalFrameTitlePane MotifInternalFrameUI MotifLabelUI MotifLookAndFeel MotifMenuBarUI MotifMenuItemUI MotifMenuMouseListener MotifMenuMouseMotionListener MotifMenuUI
|
||||
MotifOptionPaneUI MotifPasswordFieldUI MotifPopupMenuSeparatorUI MotifPopupMenuUI MotifProgressBarUI MotifRadioButtonMenuItemUI MotifRadioButtonUI MotifScrollBarButton
|
||||
MotifScrollBarUI MotifScrollPaneUI MotifSeparatorUI MotifSliderUI MotifSplitPaneDivider MotifSplitPaneUI MotifTabbedPaneUI MotifTextAreaUI MotifTextFieldUI MotifTextPaneUI
|
||||
MotifTextUI MotifToggleButtonUI MotifTreeCellRenderer MotifTreeUI MouseAdapter MouseDragGestureRecognizer MouseEvent MouseInputAdapter MouseInputListener MouseListener
|
||||
MouseMotionAdapter MouseMotionListener MouseWheelEvent MouseWheelListener MsgMgr Mult MultiButtonUI MultiColorChooserUI MultiComboBoxUI MultiDesktopIconUI MultiDesktopPaneUI
|
||||
MultiDoc MultiDocPrintJob MultiDocPrintService MultiFileChooserUI MultiInternalFrameUI MultiLabelUI MultiListUI MultiLookAndFeel MultiMenuBarUI MultiMenuItemUI
|
||||
MultiOptionPaneUI MultiPanelUI MultiPixelPackedSampleModel MultiPopupMenuUI MultiProgressBarUI MultiRootPaneUI MultiScrollBarUI MultiScrollPaneUI MultiSeparatorUI
|
||||
MultiSliderUI MultiSpinnerUI MultiSplitPaneUI MultiTabbedPaneUI MultiTableHeaderUI MultiTableUI MultiTextUI MultiToolBarUI MultiToolTipUI MultiTreeUI MultiUIDefaults
|
||||
MultiViewportUI MulticastSocket MultipleComponentProfileHelper MultipleComponentProfileHolder MultipleDocumentHandling MultipleMaster MutableAttrListImpl MutableAttributeSet
|
||||
MutableBigInteger MutableComboBoxModel MutableTreeNode MutationEvent MuxingAttributeSet
|
||||
NO_IMPLEMENT NO_MEMORY NO_PERMISSION NO_RESOURCES NO_RESPONSE NSInfo NSORB NTDomainPrincipal NTLoginModule NTNumericCredential NTSid NTSidDomainPrincipal NTSidGroupPrincipal
|
||||
NTSidPrimaryGroupPrincipal NTSidUserPrincipal NTSystem NTUserPrincipal NVList NVListImpl Name NameAlreadyBound NameAlreadyBoundException NameAlreadyBoundHelper
|
||||
NameAlreadyBoundHolder NameCallback NameClassPair NameComponent NameComponentHelper NameComponentHolder NameDynAnyPair NameDynAnyPairHelper NameDynAnyPairSeqHelper
|
||||
NameGenerator NameHelper NameHolder NameImpl NameNotFoundException NameParser NameServer NameService NameServiceStartThread NameSpace NameValuePair NameValuePairHelper
|
||||
NameValuePairSeqHelper NamedNodeMap NamedValue NamedValueImpl NamedWeakReference NamespaceAlias NamespaceChangeListener NamespaceSupport NamespaceSupport2 NamespacedNode
|
||||
Naming NamingContext NamingContextDataStore NamingContextExt NamingContextExtHelper NamingContextExtHolder NamingContextExtOperations NamingContextExtPOA NamingContextHelper
|
||||
NamingContextHolder NamingContextImpl NamingContextOperations NamingContextPOA NamingEnumeration NamingEvent NamingException NamingExceptionEvent NamingListener NamingManager
|
||||
NamingSecurityException NamingUtils NativeLibLoader NavigationFilter Neg NegativeArraySizeException NetPermission NetworkInterface NewInstance NewObjectKeyTemplateBase
|
||||
NoClassDefFoundError NoConnectionPendingException NoContext NoContextHelper NoFramesView NoInitialContextException NoPermissionException NoRouteToHostException NoServant
|
||||
NoServantHelper NoSuchAlgorithmException NoSuchAttributeException NoSuchElementException NoSuchEndPoint NoSuchEndPointHelper NoSuchEndPointHolder NoSuchFieldError
|
||||
NoSuchFieldException NoSuchMethodError NoSuchMethodException NoSuchObjectException NoSuchProviderException NoSuchServiceContext Node NodeBase NodeChangeEvent
|
||||
NodeChangeListener NodeConsumer NodeEx NodeFilter NodeInfo NodeIterator NodeList NodeLocator NodeSet NodeSetDTM NodeSortKey NodeSorter NodeTest NodeTestFilter NodeVector
|
||||
NonReadableChannelException NonWritableChannelException NoninvertibleTransformException NotActiveException NotBoundException NotContextException NotEmpty NotEmptyHelper
|
||||
NotEmptyHolder NotEquals NotFound NotFoundHelper NotFoundHolder NotFoundReason NotFoundReasonHelper NotFoundReasonHolder NotOwnerException NotSerializableException
|
||||
NotYetBoundException NotYetConnectedException Notation NullPointerException Number NumberFormat NumberFormatException NumberFormatter NumberOfDocuments NumberOfInterveningJobs
|
||||
NumberUp NumberUpSupported NumeratorFormatter NumericShaper
|
||||
OBJECT_NOT_EXIST OBJ_ADAPTER OMGVMCID ORB ORBAlreadyRegistered ORBAlreadyRegisteredHelper ORBAlreadyRegisteredHolder ORBClassLoader ORBConstants ORBD ORBInitInfo
|
||||
ORBInitInfoImpl ORBInitInfoOperations ORBInitializer ORBInitializerOperations ORBPortInfo ORBPortInfoHelper ORBPortInfoHolder ORBPortInfoListHelper ORBPortInfoListHolder
|
||||
ORBProperties ORBSingleton ORBSocketFactory ORBThread ORBTypeComponent ORBUtility ORBVersion ORBVersionFactory ORBVersionImpl ORBVersionServiceContext ORBidHelper
|
||||
ORBidListHelper ORBidListHolder OSFCodeSetRegistry ObjID Object ObjectAlreadyActive ObjectAlreadyActiveHelper ObjectArray ObjectChangeListener ObjectFactory
|
||||
ObjectFactoryBuilder ObjectHelper ObjectHolder ObjectId ObjectIdHelper ObjectIds ObjectImpl ObjectInput ObjectInputStream ObjectInputValidation ObjectKey ObjectKeyFactory
|
||||
ObjectKeyTemplate ObjectKeyTemplateBase ObjectNotActive ObjectNotActiveHelper ObjectOutput ObjectOutputStream ObjectPool ObjectStreamClass ObjectStreamClassCorbaExt
|
||||
ObjectStreamClassUtil_1_3 ObjectStreamClass_1_3_1 ObjectStreamConstants ObjectStreamException ObjectStreamField ObjectView Observable Observer OctetSeqHelper OctetSeqHolder
|
||||
Oid OldJIDLObjectKeyTemplate OldObjectKeyTemplateBase OldPOAObjectKeyTemplate OneStepIterator OneStepIteratorForward OpCodes OpMap OpenType Operation
|
||||
OperationNotSupportedException Option OptionComboBoxModel OptionListModel OptionPaneUI OptionalDataException Or OrientationRequested OutOfMemoryError OutputDeviceAssigned
|
||||
OutputKeys OutputProperties OutputStream OutputStreamHook OutputStreamImageOutputStreamSpi OutputStreamWriter OverlappingFileLockException OverlayLayout Owner
|
||||
PDLOverrideSupported PERSIST_STORE PICurrent PINode PIORB PKCS8EncodedKeySpec PKIXBuilderParameters PKIXCertPathBuilderResult PKIXCertPathChecker PKIXCertPathValidatorResult
|
||||
PKIXParameters PNGImageReader PNGImageReaderSpi PNGImageWriter PNGImageWriterSpi PNGMetadata PNGMetadataFormat PNGMetadataFormatResources POA POACurrent POADestroyed POAHelper
|
||||
POAId POAIdArray POAIdBase POAIdPOAView POAImpl POAManager POAManagerImpl POAManagerOperations POANameHelper POANameHolder POAORB POAObjectKeyTemplate POAOperations
|
||||
POAPolicyCombinationValidator POAView PRIVATE_MEMBER PSSParameterSpec PUBLIC_MEMBER Package PackagePrefixChecker PackedColorModel PageAttributes PageFormat PageRanges Pageable
|
||||
PagesPerMinute PagesPerMinuteColor Paint PaintContext PaintEvent Panel PanelPeer PanelUI Paper ParagraphView Parameter ParameterBlock ParameterDescriptor ParameterMetaData
|
||||
ParameterMode ParameterModeHelper ParameterModeHolder ParentNode ParseContext ParseException ParsePosition Parser Parser2 ParserAdapter ParserConfigurationException
|
||||
ParserDelegator ParserFactory PartialResultException PartiallyOrderedSet PasswordAuthentication PasswordCallback PasswordView PathIterator Pattern PatternEntry
|
||||
PatternSyntaxException Permission PermissionCollection Permissions PersistenceDelegate PersistentBindingIterator PhantomReference Pipe PipeDocument PipedInputStream
|
||||
PipedOutputStream PipedReader PipedWriter PixelGrabber PixelInterleavedSampleModel PlainDatagramSocketImpl PlainDocument PlainSocketImpl PlainView Plus Point Point2D
|
||||
Policies PoliciesComponent Policy PolicyError PolicyErrorCodeHelper PolicyErrorHelper PolicyErrorHolder PolicyFactory PolicyFactoryOperations PolicyFile PolicyHelper
|
||||
PolicyHolder PolicyListHelper PolicyListHolder PolicyNode PolicyOperations PolicyParser PolicyQualifierInfo PolicyTypeHelper Polygon PooledConnection Popup PopupFactory
|
||||
PopupMenu PopupMenuEvent PopupMenuListener PopupMenuPeer PopupMenuUI PortUnreachableException PortableRemoteObject PortableRemoteObjectDelegate Position PredicatedNodeTest
|
||||
PreferenceChangeEvent PreferenceChangeListener Preferences PreferencesFactory PrefixResolver PrefixResolverDefault PreparedStatement PresentationDirection Principal
|
||||
PrincipalComparator PrincipalHolder PrincipalImpl PrintEvent PrintException PrintGraphics PrintJob PrintJobAdapter PrintJobAttribute PrintJobAttributeEvent
|
||||
PrintJobAttributeListener PrintJobAttributeSet PrintJobEvent PrintJobListener PrintQuality PrintRequestAttribute PrintRequestAttributeSet PrintService PrintServiceAttribute
|
||||
PrintServiceAttributeEvent PrintServiceAttributeListener PrintServiceAttributeSet PrintServiceLookup PrintStream PrintTraceListener PrintWriter Printable PrinterAbortException
|
||||
PrinterException PrinterGraphics PrinterIOException PrinterInfo PrinterIsAcceptingJobs PrinterJob PrinterLocation PrinterMakeAndModel PrinterMessageFromOperator
|
||||
PrinterMoreInfo PrinterMoreInfoManufacturer PrinterName PrinterResolution PrinterState PrinterStateReason PrinterStateReasons PrinterURI PrivateCredentialPermission PrivateKey
|
||||
PrivilegedAction PrivilegedActionException PrivilegedExceptionAction Process ProcessMonitorThread ProcessingInstruction ProcessorAttributeSet ProcessorCharacters
|
||||
ProcessorDecimalFormat ProcessorGlobalParamDecl ProcessorGlobalVariableDecl ProcessorImport ProcessorInclude ProcessorKey ProcessorLRE ProcessorNamespaceAlias
|
||||
ProcessorOutputElem ProcessorPreserveSpace ProcessorStripSpace ProcessorStylesheetDoc ProcessorStylesheetElement ProcessorTemplate ProcessorTemplateElem ProcessorText
|
||||
ProcessorUnknown ProfileAddr ProfileDataException ProfileIdHelper ProgressBarUI ProgressMonitor ProgressMonitorInputStream Properties PropertyChangeEvent
|
||||
PropertyChangeListener PropertyChangeListenerProxy PropertyChangeSupport PropertyDescriptor PropertyEditor PropertyEditorManager PropertyEditorSupport PropertyPermission
|
||||
PropertyResourceBundle PropertyVetoException ProtectionDomain ProtocolException Provider ProviderException Proxy PsuedoNames PublicKey PushbackInputStream PushbackReader
|
||||
QName QuadCurve2D QuadIterator QueryParameter QueuedEvents QueuedJobCount Quo
|
||||
RAFImageInputStreamSpi RAFImageOutputStreamSpi RBCollationTables RBTableBuilder REQUEST_PROCESSING_POLICY_ID RGBColor RGBImageFilter RMIClassLoader RMIClassLoaderSpi
|
||||
RMIClientSocketFactory RMIFailureHandler RMISecurityException RMISecurityManager RMIServerSocketFactory RMISocketFactory RSAKey RSAKeyGenParameterSpec
|
||||
RSAMultiPrimePrivateCrtKey RSAMultiPrimePrivateCrtKeySpec RSAOtherPrimeInfo RSAPrivateCrtKey RSAPrivateCrtKeySpec RSAPrivateKey RSAPrivateKeySpec RSAPublicKey
|
||||
RSAPublicKeySpec RTFAttribute RTFAttributes RTFEditorKit RTFGenerator RTFParser RTFReader Random RandomAccess RandomAccessFile Raster RasterFormatException RasterOp
|
||||
RawCharacterHandler ReadOnlyBufferException ReadableByteChannel Reader ReaderThread Rect RectIterator Rectangle Rectangle2D RectangularShape Redirect Ref RefAddr Reference
|
||||
ReferenceAddr ReferenceQueue ReferenceUriSchemesSupported Referenceable ReferralException ReflectAccess ReflectPermission RefreshFailedException Refreshable
|
||||
RegisterableService Registry RegistryHandler RemarshalException Remote RemoteCall RemoteException RemoteObject RemoteRef RemoteServer RemoteStub RenderContext RenderableImage
|
||||
RenderableImageOp RenderableImageProducer RenderedImage RenderedImageFactory Renderer RenderingHints RepIdDelegator RepIdDelegator_1_3 RepIdDelegator_1_3_1 RepaintManager
|
||||
ReplicateScaleFilter ReplyMessage ReplyMessage_1_0 ReplyMessage_1_1 ReplyMessage_1_2 Repository RepositoryHelper RepositoryHolder RepositoryId RepositoryIdCache
|
||||
RepositoryIdCache_1_3 RepositoryIdCache_1_3_1 RepositoryIdFactory RepositoryIdHelper RepositoryIdInterface RepositoryIdStrings RepositoryIdUtility RepositoryId_1_3
|
||||
RepositoryId_1_3_1 RepositoryImpl RepositoryOperations Request RequestCanceledException RequestHandler RequestImpl RequestInfo RequestInfoExt RequestInfoImpl
|
||||
RequestInfoOperations RequestMessage RequestMessage_1_0 RequestMessage_1_1 RequestMessage_1_2 RequestProcessingPolicy RequestProcessingPolicyImpl
|
||||
RequestProcessingPolicyOperations RequestProcessingPolicyValue RequestProcessor RequestingUserName RescaleOp ResolutionSyntax ResolveResult Resolver ResourceBundle
|
||||
ResourceBundleEnumeration ResourceLoader ResourceManager Response ResponseHandler RestorableInputStream Result ResultNameSpace ResultSet ResultSetMetaData ResultTreeHandler
|
||||
ReverseAxesWalker Robot RobotPeer RootPaneContainer RootPaneUI RoundRectIterator RoundRectangle2D RowFilter RowMapper RowSet RowSetEvent RowSetInternal RowSetListener
|
||||
RowSetMetaData RowSetReader RowSetWriter RuleBasedBreakIterator RuleBasedCollator RunTime RunTimeOperations Runnable Runtime RuntimeException RuntimePermission
|
||||
SAX2DTM SAXException SAXNotRecognizedException SAXNotSupportedException SAXParseException SAXParser SAXParserFactory SAXParserFactoryImpl SAXParserImpl SAXResult SAXSource
|
||||
SAXSourceLocator SAXTransformerFactory SERVANT_RETENTION_POLICY_ID SOFMarkerSegment SOSMarkerSegment SQLData SQLDocument SQLErrorDocument SQLException SQLInput SQLOutput
|
||||
SQLPermission SQLWarning SUCCESSFUL SUNVMCID SYNC_WITH_TRANSPORT SYSTEM_EXCEPTION SampleModel Savepoint ScatteringByteChannel SchemaViolationException ScrollBarUI ScrollPane
|
||||
ScrollPaneAdjustable ScrollPaneConstants ScrollPaneLayout ScrollPanePeer ScrollPaneUI Scrollable Scrollbar ScrollbarPeer SearchControls SearchResult SecureClassLoader
|
||||
SecureRandom SecureRandomSpi Security SecurityException SecurityManager SecurityPermission Segment SegmentCache SelectableChannel SelectionEvent SelectionKey Selector
|
||||
SelectorProvider SelfIteratorNoPredicate SendingContextServiceContext SentEvent SentenceBreakData SeparatorUI SequenceInputStream SequencedEvent Serializable
|
||||
SerializableLocatorImpl SerializablePermission SerializationTester Serializer SerializerFactory SerializerSwitcher SerializerToHTML SerializerToText SerializerToXML Servant
|
||||
ServantActivator ServantActivatorHelper ServantActivatorOperations ServantActivatorPOA ServantAlreadyActive ServantAlreadyActiveHelper ServantCachePOAClientSC
|
||||
ServantCachingPolicy ServantLocator ServantLocatorHelper ServantLocatorOperations ServantLocatorPOA ServantManager ServantManagerImpl ServantManagerOperations ServantNotActive
|
||||
ServantNotActiveHelper ServantObject ServantRetentionPolicy ServantRetentionPolicyImpl ServantRetentionPolicyOperations ServantRetentionPolicyValue Server ServerAlreadyActive
|
||||
ServerAlreadyActiveHelper ServerAlreadyActiveHolder ServerAlreadyInstalled ServerAlreadyInstalledHelper ServerAlreadyInstalledHolder ServerAlreadyRegistered
|
||||
ServerAlreadyRegisteredHelper ServerAlreadyRegisteredHolder ServerAlreadyUninstalled ServerAlreadyUninstalledHelper ServerAlreadyUninstalledHolder ServerCloneException
|
||||
ServerDef ServerDefHelper ServerDefHolder ServerDelegate ServerError ServerException ServerGIOP ServerHeldDown ServerHeldDownHelper ServerHeldDownHolder ServerHelper
|
||||
ServerHolder ServerIdHelper ServerIdsHelper ServerIdsHolder ServerLocation ServerLocationHelper ServerLocationHolder ServerLocationPerORB ServerLocationPerORBHelper
|
||||
ServerLocationPerORBHolder ServerMain ServerManager ServerManagerHelper ServerManagerHolder ServerManagerImpl ServerManagerOperations ServerNotActive ServerNotActiveException
|
||||
ServerNotActiveHelper ServerNotActiveHolder ServerNotRegistered ServerNotRegisteredHelper ServerNotRegisteredHolder ServerOperations ServerRef ServerRequest ServerRequestImpl
|
||||
ServerRequestInfo ServerRequestInfoImpl ServerRequestInfoOperations ServerRequestInterceptor ServerRequestInterceptorOperations ServerResponse ServerResponseImpl
|
||||
ServerRuntimeException ServerSocket ServerSocketChannel ServerSubcontract ServerTableEntry ServerTool ServiceContext ServiceContextData ServiceContextHelper
|
||||
ServiceContextHolder ServiceContextListHelper ServiceContextListHolder ServiceContextRegistry ServiceContexts ServiceDetail ServiceDetailHelper ServiceIdHelper
|
||||
ServiceInformation ServiceInformationHelper ServiceInformationHolder ServicePermission ServiceRegistry ServiceUI ServiceUIFactory ServiceUnavailableException Set
|
||||
SetOfIntegerSyntax SetOverrideType SetOverrideTypeHelper Severity Shape ShapeGraphicAttribute SheetCollate Short ShortBuffer ShortHolder ShortLookupTable ShortSeqHelper
|
||||
ShortSeqHolder Shutdown ShutdownUtilDelegate Sides Signature SignatureException SignatureSpi SignedMutableBigInteger SignedObject Signer SimpleAttributeSet SimpleBeanInfo
|
||||
SimpleDateFormat SimpleDoc SimpleElementFactory SimpleFormatter SimpleHashtable SimpleTextBoundary SimpleTimeZone SinglePixelPackedSampleModel SingleSelectionModel
|
||||
Size2DSyntax SizeLimitExceededException SizeRequirements SizeSequence Skeleton SkeletonMismatchException SkeletonNotFoundException SliderUI SlotTable SlotTableStack
|
||||
SmartGridLayout Socket SocketAddress SocketChannel SocketException SocketHandler SocketImpl SocketImplFactory SocketInputStream SocketOptions SocketOutputStream
|
||||
SocketPermission SocketSecurityException SocketTimeoutException SocksConsts SocksSocketImpl SocksSocketImplFactory SoftBevelBorder SoftReference SolarisLoginModule
|
||||
SolarisNumericGroupPrincipal SolarisNumericUserPrincipal SolarisPrincipal SolarisSystem SortedMap SortedSet SortingFocusTraversalPolicy Source SourceLocator SourceTree
|
||||
SourceTreeManager SpecialMapping SpecialMethod SpinnerDateModel SpinnerListModel SpinnerModel SpinnerNumberModel SpinnerUI SplitPaneUI Spring SpringLayout Stack StackGuard
|
||||
StackOverflowError StackTraceElement StandardIIOPProfileTemplate StandardMetadataFormat StandardMetadataFormatResources StartTlsRequest StartTlsResponse State StateEdit
|
||||
StateEditable StateFactory StateInvariantError Statement StepPattern StopParseException StreamCorruptedException StreamHandler StreamPrintService StreamPrintServiceFactory
|
||||
StreamResult StreamSource StreamTokenizer Streamable StreamableValue StrictMath String StringBuffer StringBufferInputStream StringBufferPool StringCharBuffer
|
||||
StringCharacterIterator StringCoding StringContent StringHolder StringIndexOutOfBoundsException StringNameHelper StringReader StringRefAddr StringSelection StringSeqHelper
|
||||
StringSeqHolder StringToIntTable StringToStringTable StringToStringTableVector StringTokenizer StringValueHelper StringVector StringWriter Stroke Struct StructMember
|
||||
StructMemberHelper Stub StubDelegate StubDelegateImpl StubNotFoundException Style StyleConstants StyleContext StyleSheet StyleSheetList StyledDocument StyledEditorKit
|
||||
StyledParagraph Stylesheet StylesheetComposed StylesheetHandler StylesheetPIHandler StylesheetRoot SubContextList SubImageInputStream SuballocatedByteVector
|
||||
SuballocatedIntVector SubcontractList SubcontractRegistry SubcontractResponseHandler Subject SubjectCodeSource SubjectDomainCombiner SupportedValuesAttribute SwingConstants
|
||||
SwingGraphics SwingPropertyChangeSupport SwingUtilities SyncFailedException SyncScopeHelper SynthesisException SyntheticImage System SystemColor SystemEventQueueUtilities
|
||||
SystemException SystemFlavorMap SystemIDResolver
|
||||
TAG_ALTERNATE_IIOP_ADDRESS TAG_CODE_SETS TAG_INTERNET_IOP TAG_JAVA_CODEBASE TAG_MULTIPLE_COMPONENTS TAG_ORB_TYPE TAG_POLICIES TCKind TCPPortHelper TCUtility THREAD_POLICY_ID
|
||||
TRANSACTION_REQUIRED TRANSACTION_ROLLEDBACK TRANSIENT TRANSPORT_RETRY TabExpander TabSet TabStop TabableView TabbedPaneUI TableCellEditor TableCellRenderer TableColumn
|
||||
TableColumnModel TableColumnModelEvent TableColumnModelListener TableHeaderUI TableModel TableModelEvent TableModelListener TableUI TableView TagElement TagStack
|
||||
TaggedComponent TaggedComponentBase TaggedComponentFactories TaggedComponentFactoryFinder TaggedComponentHelper TaggedComponentHolder TaggedProfile TaggedProfileFactoryFinder
|
||||
TaggedProfileHelper TaggedProfileHolder TaggedProfileTemplate TargetAddress TargetAddressHelper TemplateList TemplateSubPatternAssociation Templates TemplatesHandler
|
||||
Terminator TestDTM TestDTMNodes TestDriver Text TextAction TextArea TextAreaDocument TextAreaPeer TextAttribute TextBoundaryData TextCallbackHandler TextComponent
|
||||
TextComponentPeer TextEvent TextField TextFieldPeer TextHitInfo TextInputCallback TextJustifier TextLayout TextLayoutStrategy TextLine TextListener TextMeasurer TextNode
|
||||
TextOutputCallback TextSyntax TextUI TexturePaint TexturePaintContext Thread ThreadCurrentStack ThreadDeath ThreadGroup ThreadLocal ThreadPolicy ThreadPolicyImpl
|
||||
ThreadPolicyOperations ThreadPolicyValue ThreadPool Throwable Tie TileObserver Time TimeLimitExceededException TimeZone Timer TimerQueue TimerTask Timestamp TitledBorder
|
||||
TooManyListenersException ToolBarUI ToolTipManager ToolTipUI Toolkit TrAXFilter TraceListener TraceListenerEx TraceManager TracerEvent TransactionService TransferHandler
|
||||
Transferable TransformAttribute TransformSnapshot TransformSnapshotImpl TransformState Transformer TransformerClient TransformerConfigurationException TransformerException
|
||||
TransformerFactory TransformerFactoryConfigurationError TransformerFactoryImpl TransformerHandler TransformerHandlerImpl TransformerIdentityImpl TransformerImpl
|
||||
TransientBindingIterator TransientNameServer TransientNameService TransientNamingContext TransientObjectManager Transparency TreeCellEditor TreeCellRenderer
|
||||
TreeExpansionEvent TreeExpansionListener TreeMap TreeModel TreeModelEvent TreeModelListener TreeNode TreePath TreeSelectionEvent TreeSelectionListener TreeSelectionModel
|
||||
TreeSet TreeUI TreeWalker TreeWalker2Result TreeWillExpandListener Trie TruncatedFileException TrustAnchor TypeCode TypeCodeFactory TypeCodeHolder TypeCodeImpl
|
||||
TypeCodeImplHelper TypeMismatch TypeMismatchException TypeMismatchHelper Types
|
||||
UEInfoServiceContext UID UIDefaults UIEvent UIManager UIResource ULongLongSeqHelper ULongLongSeqHolder ULongSeqHelper ULongSeqHolder UNKNOWN UNSUPPORTED_POLICY
|
||||
UNSUPPORTED_POLICY_VALUE URI URIException URIResolver URISyntax URISyntaxException URL URLClassLoader URLConnection URLDecoder URLEncoder URLStreamHandler
|
||||
URLStreamHandlerFactory URLStringHelper USER_EXCEPTION UShortSeqHelper UShortSeqHolder UTFDataFormatException UnImplNode UnaryOperation UndeclaredThrowableException
|
||||
UndoManager UndoableEdit UndoableEditEvent UndoableEditListener UndoableEditSupport UnexpectedException UnicastRemoteObject UnicodeClassMapping UnionMember UnionMemberHelper
|
||||
UnionPathIterator UnionPattern UnixLoginModule UnixNumericGroupPrincipal UnixNumericUserPrincipal UnixPrincipal UnixSystem UnknownEncoding UnknownEncodingHelper UnknownError
|
||||
UnknownException UnknownGroupException UnknownHostException UnknownObjectException UnknownServiceContext UnknownServiceException UnknownType UnknownUserException
|
||||
UnknownUserExceptionHelper UnknownUserExceptionHolder UnmappableCharacterException UnmarshalException UnmodifiableSetException UnrecoverableKeyException Unreferenced
|
||||
UnresolvedAddressException UnresolvedPermission UnresolvedPermissionCollection UnsatisfiedLinkError UnsolicitedNotification UnsolicitedNotificationEvent
|
||||
UnsolicitedNotificationListener UnsupportedAddressTypeException UnsupportedCallbackException UnsupportedCharsetException UnsupportedClassVersionError
|
||||
UnsupportedEncodingException UnsupportedFlavorException UnsupportedLookAndFeelException UnsupportedOperationException UserException Util UtilDelegate Utilities Utility
|
||||
VMID VM_ABSTRACT VM_CUSTOM VM_NONE VM_TRUNCATABLE ValidatingParser ValueBase ValueBaseHelper ValueBaseHolder ValueFactory ValueHandler ValueHandlerImpl ValueHandlerImpl_1_3
|
||||
ValueHandlerImpl_1_3_1 ValueMember ValueMemberHelper ValueUtility Variable VariableHeightLayoutCache VariableStack Vector VerifyError Version VersionHelper VersionHelper12
|
||||
VersionSpecHelper VetoableChangeListener VetoableChangeListenerProxy VetoableChangeSupport View ViewCSS ViewFactory ViewportLayout ViewportUI VirtualMachineError Visibility
|
||||
VisibilityHelper Void VolatileImage
|
||||
WCharSeqHelper WCharSeqHolder WStringSeqHelper WStringSeqHolder WStringValueHelper WalkerFactory WalkingIterator WalkingIteratorSorted WeakHashMap WeakReference WhiteSpaceInfo
|
||||
WhitespaceStrippingElementMatcher Win32FileSystem Win32Process WinNTFileSystem Window WindowAdapter WindowConstants WindowEvent WindowFocusListener WindowListener WindowPeer
|
||||
WindowStateListener WindowsBorders WindowsButtonListener WindowsButtonUI WindowsCheckBoxMenuItemUI WindowsCheckBoxUI WindowsComboBoxUI WindowsDesktopIconUI
|
||||
WindowsDesktopManager WindowsDesktopPaneUI WindowsEditorPaneUI WindowsFileChooserUI WindowsGraphicsUtils WindowsIconFactory WindowsInternalFrameTitlePane
|
||||
WindowsInternalFrameUI WindowsLabelUI WindowsListUI WindowsLookAndFeel WindowsMenuBarUI WindowsMenuItemUI WindowsMenuUI WindowsOptionPaneUI WindowsPasswordFieldUI
|
||||
WindowsPopupFactory WindowsPopupMenuUI WindowsPopupWindow WindowsPreferences WindowsPreferencesFactory WindowsProgressBarUI WindowsRadioButtonMenuItemUI WindowsRadioButtonUI
|
||||
WindowsRootPaneUI WindowsScrollBarUI WindowsScrollPaneUI WindowsSeparatorUI WindowsSliderUI WindowsSpinnerUI WindowsSplitPaneDivider WindowsSplitPaneUI WindowsTabbedPaneUI
|
||||
WindowsTableHeaderUI WindowsTableUI WindowsTextAreaUI WindowsTextFieldUI WindowsTextPaneUI WindowsTextUI WindowsToggleButtonUI WindowsToolBarUI WindowsTreeUI WindowsUtils
|
||||
WireObjectKeyTemplate WordBreakData WordBreakTable Work WrappedPlainView WrappedRuntimeException WritableByteChannel WritableRaster WritableRenderedImage WriteAbortedException
|
||||
Writeable Writer WriterToASCI WriterToUTF8 WriterToUTF8Buffered WrongAdapter WrongAdapterHelper WrongNumberArgsException WrongParserException WrongPolicy WrongPolicyHelper
|
||||
WrongTransaction WrongTransactionHelper WrongTransactionHolder
|
||||
X500Principal X500PrivateCredential X509CRL X509CRLEntry X509CRLSelector X509CertSelector X509Certificate X509EncodedKeySpec X509Extension XAConnection XADataSource XBoolean
|
||||
XBooleanStatic XConnection XMLCharacterRecognizer XMLDecoder XMLEncoder XMLFilter XMLFilterImpl XMLFormatter XMLNSDecl XMLReader XMLReaderAdapter XMLReaderFactory
|
||||
XMLReaderImpl XMLString XMLStringFactory XMLStringFactoryImpl XNodeSet XNodeSetForDOM XNull XNumber XObject XObjectFactory XPATHErrorResourceBundle XPATHErrorResources
|
||||
XPATHErrorResources_de XPATHErrorResources_en XPATHErrorResources_es XPATHErrorResources_fr XPATHErrorResources_it XPATHErrorResources_ja XPATHErrorResources_ko
|
||||
XPATHErrorResources_sv XPATHErrorResources_zh_CN XPATHErrorResources_zh_TW XPath XPathAPI XPathContext XPathDumper XPathException XPathFactory XPathParser
|
||||
XPathProcessorException XRTreeFrag XRTreeFragSelectWrapper XResourceBundle XResourceBundleBase XResources_cy XResources_de XResources_el XResources_en XResources_es
|
||||
XResources_fr XResources_he XResources_hy XResources_it XResources_ja_JP_A XResources_ja_JP_HA XResources_ja_JP_HI XResources_ja_JP_I XResources_ka XResources_ko
|
||||
XResources_sv XResources_zh_CN XResources_zh_TW XSLInfiniteLoopException XSLMessages XSLProcessorContext XSLProcessorVersion XSLTAttributeDef XSLTElementDef
|
||||
XSLTElementProcessor XSLTErrorResources XSLTErrorResources_de XSLTErrorResources_es XSLTErrorResources_fr XSLTErrorResources_it XSLTErrorResources_ja
|
||||
XSLTErrorResources_ko XSLTErrorResources_sv XSLTErrorResources_zh_CN XSLTErrorResources_zh_TW XSLTProcessorApplet XSLTSchema XString XStringForChars XStringForFSB
|
||||
XUnresolvedVariable XalanProperties XmlChars XmlDocument XmlDocumentBuilder XmlDocumentBuilderNS XmlNames XmlReader XmlSupport XmlWritable XmlWriteContext
|
||||
ZipConstants ZipEntry ZipException ZipFile ZipInputStream ZipOutputStream ZoneView
|
||||
_ActivatorImplBase _ActivatorStub _BindingIteratorImplBase _BindingIteratorStub _DynAnyFactoryStub _DynAnyStub _DynArrayStub _DynEnumStub _DynFixedStub _DynSequenceStub
|
||||
_DynStructStub _DynUnionStub _DynValueStub _IDLTypeStub _InitialNameServiceImplBase _InitialNameServiceStub _LocatorImplBase _LocatorStub _NamingContextExtStub
|
||||
_NamingContextImplBase _NamingContextStub _PolicyStub _Remote_Stub _RepositoryImplBase _RepositoryStub _ServantActivatorStub _ServantLocatorStub _ServerImplBase
|
||||
_ServerManagerImplBase _ServerManagerStub _ServerStub
|
||||
|
||||
/C4"Packages"
|
||||
Activation ActivationIDL
|
||||
CORBA CORBA_2_3 CodecFactoryPackage CodecPackage CosNaming CurrentPackage
|
||||
DynAnyFactoryPackage DynAnyPackage Dynamic DynamicAny
|
||||
IOP InitialNameServicePackage Interceptors
|
||||
LocatorPackage
|
||||
Messaging
|
||||
NamingContextExtPackage NamingContextPackage
|
||||
ORBInitInfoPackage ORBPackage
|
||||
PCosNaming POA POAManagerPackage POAPackage PortableInterceptor PortableServer
|
||||
RepositoryPackage
|
||||
SendingContext ServantLocatorPackage
|
||||
TypeCodePackage
|
||||
accessibility acl activation apache applet attribute auth awt axes
|
||||
basic beancontext beans border
|
||||
callback cert channels charset client codec collection color colorchooser com common compiler concurrent connection corba core crimson css
|
||||
datatransfer dgc directory dnd dom dom2dtm dtm
|
||||
event events ext extension extensions
|
||||
filechooser font functions
|
||||
geom gif
|
||||
helpers html
|
||||
ietf iiop im image imageio immutable interceptor interfaces internal io ior
|
||||
jar java javax jaxp jgss jpeg
|
||||
kerberos
|
||||
lang launcher ldap lib logging login
|
||||
math messages metadata metal module motif multi mutable
|
||||
naming net nio
|
||||
objects omg operations orbutil org
|
||||
parser parsers patterns peer plaf plugins png portable prefs print processor
|
||||
ref reflect reflection regex registry renderable res rmi rtf runtime
|
||||
sax sax2dtm scala se security serialize server spec spi sql standard stream stub stylesheets sun sunw swing synthetic
|
||||
table templates text trace transform transformer traversal tree
|
||||
undo util utils
|
||||
views
|
||||
w3c windows
|
||||
x500 xalan xml xpath xslt
|
||||
zip
|
||||
|
||||
/C5"Operators"
|
||||
|
|
||||
^
|
||||
&
|
||||
<: <
|
||||
>: >
|
||||
=> == =
|
||||
!
|
||||
:: :
|
||||
+
|
||||
-
|
||||
*
|
||||
// /
|
||||
%
|
||||
|
||||
/C6"Separs"
|
||||
[
|
||||
]
|
||||
(
|
||||
)
|
||||
,
|
||||
;
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
|
||||
if "%SCALA_HOME%" == "" goto error1
|
||||
if not exist "%SCALA_HOME%\VERSION-%VERSION%" goto error2
|
||||
|
||||
set ARGS=
|
||||
|
||||
:loop
|
||||
if '%1' == '' goto exec
|
||||
set ARGS=%ARGS% %1
|
||||
shift
|
||||
goto loop
|
||||
|
||||
:exec
|
||||
%COMMAND% %ARGS%
|
||||
goto end
|
||||
|
||||
:error1
|
||||
echo ERROR: environment variable SCALA_HOME is undefined. It should point to the directory containing the file "VERSION-%VERSION%".
|
||||
goto end
|
||||
|
||||
:error2
|
||||
echo ERROR: environment variable SCALA_HOME points to the wrong directory "%SCALA_HOME%". It should point to the directory containing the file "VERSION-%VERSION%".
|
||||
goto end
|
||||
|
||||
:end
|
||||
set VERSION=
|
||||
set COMMAND=
|
||||
|
||||
if "%OS%"=="Windows_NT" @endlocal
|
||||
|
||||
if "%SCALA_HOME%" == "" goto error1
|
||||
if not exist "%SCALA_HOME%\VERSION-%VERSION%" goto error2
|
||||
|
||||
set ARGS=
|
||||
|
||||
:loop
|
||||
if '%1' == '' goto exec
|
||||
set ARGS=%ARGS% %1
|
||||
shift
|
||||
goto loop
|
||||
|
||||
:exec
|
||||
%COMMAND% %ARGS%
|
||||
goto end
|
||||
|
||||
:error1
|
||||
echo ERROR: environment variable SCALA_HOME is undefined. It should point to the directory containing the file "VERSION-%VERSION%".
|
||||
goto end
|
||||
|
||||
:error2
|
||||
echo ERROR: environment variable SCALA_HOME points to the wrong directory "%SCALA_HOME%". It should point to the directory containing the file "VERSION-%VERSION%".
|
||||
goto end
|
||||
|
||||
:end
|
||||
set VERSION=
|
||||
set COMMAND=
|
||||
|
||||
if "%OS%"=="Windows_NT" @endlocal
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
@echo off
|
||||
|
||||
rem Copyright (C) 2002-2005 LAMP/EPFL
|
||||
rem
|
||||
rem This is free software; see the distribution for copying conditions.
|
||||
rem There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
rem PARTICULAR PURPOSE.
|
||||
|
||||
if "%OS%"=="Windows_NT" @setlocal
|
||||
|
||||
@echo off
|
||||
|
||||
rem Copyright (C) 2002-2005 LAMP/EPFL
|
||||
rem
|
||||
rem This is free software; see the distribution for copying conditions.
|
||||
rem There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
rem PARTICULAR PURPOSE.
|
||||
|
||||
if "%OS%"=="Windows_NT" @setlocal
|
||||
|
||||
|
|
|
@ -1,25 +1 @@
|
|||
* Introduction
|
||||
|
||||
This directory contains additional specification files (.pb*spec) for
|
||||
Scala programs.
|
||||
|
||||
More information about XCode (MacOSX) is available from:
|
||||
|
||||
http://www.apple.com/macosx/features/xcode/
|
||||
|
||||
* Installation
|
||||
|
||||
Copy the files "Specifications/Scala.*" to the following location:
|
||||
|
||||
/Library/Application support/Apple/Developer Tools/Specifications
|
||||
|
||||
From that point on, loading a file whose name ends in ".scala" automatically
|
||||
turns Scala mode on.
|
||||
|
||||
* Thanks
|
||||
|
||||
This feature was contributed by Pascal Perez (pascal.perez@epfl.ch)
|
||||
|
||||
* Version
|
||||
|
||||
$Id$
|
||||
* Introduction
This directory contains additional specification files (.pb*spec) for
Scala programs.
More information about XCode (MacOSX) is available from:
http://www.apple.com/macosx/features/xcode/
* Installation
Copy the files "Specifications/Scala.*" to the following location:
/Library/Application support/Apple/Developer Tools/Specifications
From that point on, loading a file whose name ends in ".scala" automatically
turns Scala mode on.
* Thanks
This feature was contributed by Pascal Perez (pascal.perez@epfl.ch)
* Version
$Id$
|
|
@ -1,16 +1 @@
|
|||
/**
|
||||
Scala source file specs.
|
||||
23rd of July 2005 - Pascal Perez (plperez@stanford.edu)
|
||||
*/
|
||||
|
||||
(
|
||||
{
|
||||
Identifier = sourcecode.scala;
|
||||
BasedOn = sourcecode;
|
||||
Name = "Scala Files";
|
||||
Extensions = (scala);
|
||||
MIMETypes = ("text/scala");
|
||||
ComputerLanguage = scala;
|
||||
IsTextFile = YES;
|
||||
}
|
||||
)
|
||||
/**
Scala source file specs.
23rd of July 2005 - Pascal Perez (plperez@stanford.edu)
*/
(
{
Identifier = sourcecode.scala;
BasedOn = sourcecode;
Name = "Scala Files";
Extensions = (scala);
MIMETypes = ("text/scala");
ComputerLanguage = scala;
IsTextFile = YES;
}
)
|
|
@ -1,107 +1 @@
|
|||
/**
|
||||
Scala language specification.
|
||||
23rd of July 2005 - Pascal Perez (plperez@stanford.edu)
|
||||
*/
|
||||
|
||||
(
|
||||
{
|
||||
Identifier = scala;
|
||||
Name = "Scala";
|
||||
Description = "Scala";
|
||||
BasedOn = "pbx_root_language";
|
||||
SourceScannerClassName = PBXJavaSourceScanner;
|
||||
SupportsIndentation = YES;
|
||||
Indentation = {
|
||||
};
|
||||
SyntaxColoring = {
|
||||
CaseSensitive = YES;
|
||||
UnicodeSymbols = YES;
|
||||
UnicodeEscapes = YES; // accept \uXXXX anywhere in a file, and return a single character (not yet supported!)
|
||||
IndexedSymbols = YES;
|
||||
CommentsCanBeNested = NO;
|
||||
IdentifierStartChars = "_";
|
||||
IdentifierChars = "_$";
|
||||
EscapeCharacter = "\\";
|
||||
String = (
|
||||
( "\"", "\"" )
|
||||
);
|
||||
Character = (
|
||||
( "'", "'" )
|
||||
);
|
||||
MultiLineComment = (
|
||||
( "/*", "*/" )
|
||||
);
|
||||
SingleLineComment = ( "//" );
|
||||
DocComment = "*";
|
||||
DocCommentKeywords = (
|
||||
"@author",
|
||||
"@beaninfo",
|
||||
"@deprecated",
|
||||
"@docRoot",
|
||||
"@exception",
|
||||
"@inheritDoc",
|
||||
"@link",
|
||||
"@linkplain",
|
||||
"@param",
|
||||
"@return",
|
||||
"@see",
|
||||
"@serial",
|
||||
"@serialData",
|
||||
"@serialField",
|
||||
"@since",
|
||||
"@throws",
|
||||
"@value",
|
||||
"@version"
|
||||
);
|
||||
Keywords = (
|
||||
"abstract",
|
||||
"case",
|
||||
"catch",
|
||||
"class",
|
||||
"def",
|
||||
"do",
|
||||
"else",
|
||||
"extends",
|
||||
"false",
|
||||
"final",
|
||||
"finally",
|
||||
"for",
|
||||
"if",
|
||||
"implicit",
|
||||
"import",
|
||||
"match",
|
||||
"new",
|
||||
"null",
|
||||
"object",
|
||||
"override",
|
||||
"package",
|
||||
"private",
|
||||
"protected",
|
||||
"return",
|
||||
"sealed",
|
||||
"super",
|
||||
"this",
|
||||
"throw",
|
||||
"trait",
|
||||
"try",
|
||||
"true",
|
||||
"type",
|
||||
"val",
|
||||
"var",
|
||||
"while",
|
||||
"with",
|
||||
"yield",
|
||||
"-",
|
||||
":",
|
||||
"=",
|
||||
"=>",
|
||||
"<-",
|
||||
"<:",
|
||||
">:",
|
||||
"#",
|
||||
"@"
|
||||
);
|
||||
};
|
||||
},
|
||||
)
|
||||
|
||||
/**
Scala language specification.
23rd of July 2005 - Pascal Perez (plperez@stanford.edu)
*/
(
{
Identifier = scala;
Name = "Scala";
Description = "Scala";
BasedOn = "pbx_root_language";
SourceScannerClassName = PBXJavaSourceScanner;
SupportsIndentation = YES;
Indentation = {
};
SyntaxColoring = {
CaseSensitive = YES;
UnicodeSymbols = YES;
UnicodeEscapes = YES; // accept \uXXXX anywhere in a file, and return a single character (not yet supported!)
IndexedSymbols = YES;
CommentsCanBeNested = NO;
IdentifierStartChars = "_";
IdentifierChars = "_$";
EscapeCharacter = "\\";
String = (
( "\"", "\"" )
);
Character = (
( "'", "'" )
);
MultiLineComment = (
( "/*", "*/" )
);
SingleLineComment = ( "//" );
DocComment = "*";
DocCommentKeywords = (
"@author",
"@beaninfo",
"@deprecated",
"@docRoot",
"@exception",
"@inheritDoc",
"@link",
"@linkplain",
"@param",
"@return",
"@see",
"@serial",
"@serialData",
"@serialField",
"@since",
"@throws",
"@value",
"@version"
);
Keywords = (
"abstract",
"case",
"catch",
"class",
"def",
"do",
"else",
"extends",
"false",
"final",
"finally",
"for",
"if",
"implicit",
"import",
"match",
"new",
"null",
"object",
"override",
"package",
"private",
"protected",
"return",
"sealed",
"super",
"this",
"throw",
"trait",
"try",
"true",
"type",
"val",
"var",
"while",
"with",
"yield",
"-",
":",
"=",
"=>",
"<-",
"<:",
">:",
"#",
"@"
);
};
},
)
|
|
@ -19,13 +19,13 @@ object Serialize {
|
|||
def write[A](o: A): Array[Byte] = { // throws Exception
|
||||
val ba = new java.io.ByteArrayOutputStream(512);
|
||||
val out = new java.io.ObjectOutputStream(ba);
|
||||
out.writeObject(o);
|
||||
out.writeObject(o);
|
||||
out.close();
|
||||
ba.toByteArray()
|
||||
}
|
||||
def read[A](buffer: Array[Byte]): A = { // throws Exception
|
||||
val in =
|
||||
new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer));
|
||||
new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer));
|
||||
in.readObject().asInstanceOf[A]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,143 +1,143 @@
|
|||
304.scala
|
||||
A.scala
|
||||
List1.scala
|
||||
MailBox.scala
|
||||
S1.scala
|
||||
S3.scala
|
||||
S5.scala
|
||||
S8.scala
|
||||
X.scala
|
||||
Z.scala
|
||||
abstract.scala
|
||||
aliases.scala
|
||||
arrays2.scala
|
||||
attributes.scala
|
||||
bug082.scala
|
||||
bug1.scala
|
||||
bug115.scala
|
||||
bug116.scala
|
||||
bug119.scala
|
||||
bug121.scala
|
||||
bug123.scala
|
||||
bug124.scala
|
||||
bug151.scala
|
||||
bug159.scala
|
||||
bug160.scala
|
||||
bug17.scala
|
||||
bug175.scala
|
||||
bug177.scala
|
||||
bug183.scala
|
||||
bug193.scala
|
||||
bug2.scala
|
||||
bug20.scala
|
||||
bug201.scala
|
||||
bug204.scala
|
||||
bug210.scala
|
||||
bug211.scala
|
||||
bug229.scala
|
||||
bug245.scala
|
||||
bug267.scala
|
||||
bug287.scala
|
||||
bug289.scala
|
||||
bug29.scala
|
||||
bug295.scala
|
||||
bug30.scala
|
||||
bug304.scala
|
||||
bug31.scala
|
||||
bug318.scala
|
||||
bug32.scala
|
||||
bug342.scala
|
||||
bug348plus.scala
|
||||
bug359.scala
|
||||
bug36.scala
|
||||
bug360.scala
|
||||
bug361.scala
|
||||
bug372.scala
|
||||
bug39.scala
|
||||
bug49.scala
|
||||
bug53.scala
|
||||
bug54.scala
|
||||
bug61.scala
|
||||
bug64.scala
|
||||
bug66.scala
|
||||
bug68.scala
|
||||
bug69.scala
|
||||
bug76.scala
|
||||
bug81.scala
|
||||
bug85.scala
|
||||
bug91.scala
|
||||
bug93.scala
|
||||
cls.scala
|
||||
cls1.scala
|
||||
clsrefine.scala
|
||||
compile.scala
|
||||
compound.scala
|
||||
constfold.scala
|
||||
context.scala
|
||||
eta.scala
|
||||
exceptions.scala
|
||||
expressions-current.scala
|
||||
gui.scala
|
||||
imports.scala
|
||||
infer.scala
|
||||
infer2.scala
|
||||
lambda.scala
|
||||
lambdalift.scala
|
||||
lambdalift1.scala
|
||||
localmodules.scala
|
||||
matthias1.scala
|
||||
matthias3.scala
|
||||
matthias4.scala
|
||||
matthias5.scala
|
||||
maxim1.scala
|
||||
michel1.scala
|
||||
michel2.scala
|
||||
michel3.scala
|
||||
michel4.scala
|
||||
michel5.scala
|
||||
michel6.scala
|
||||
mixins.scala
|
||||
modules.scala
|
||||
modules1.scala
|
||||
moduletrans.scala
|
||||
nested.scala
|
||||
null.scala
|
||||
orderedpoints.scala
|
||||
override.scala
|
||||
partialfun.scala
|
||||
patterns.scala
|
||||
patterns1.scala
|
||||
patterns2.scala
|
||||
patterns3.scala
|
||||
philippe1.scala
|
||||
philippe2.scala
|
||||
philippe3.scala
|
||||
philippe4.scala
|
||||
pmbug.scala
|
||||
propagate.scala
|
||||
rebind.scala
|
||||
refine.scala
|
||||
reftest.scala
|
||||
scall.bat
|
||||
scoping1.scala
|
||||
scoping2.scala
|
||||
scoping3.scala
|
||||
seqtest2.scala
|
||||
simplelists.scala
|
||||
stable.scala
|
||||
strings.scala
|
||||
test1.scala
|
||||
test2.scala
|
||||
test4.scala
|
||||
test4a.scala
|
||||
test4refine.scala
|
||||
test5.scala
|
||||
test5refine.scala
|
||||
testcast.scala
|
||||
thistype.scala
|
||||
thistypes.scala
|
||||
traits.scala
|
||||
valdefs.scala
|
||||
viewtest1.scala
|
||||
viewtest2.scala
|
||||
viewtest3.scala
|
||||
304.scala
|
||||
A.scala
|
||||
List1.scala
|
||||
MailBox.scala
|
||||
S1.scala
|
||||
S3.scala
|
||||
S5.scala
|
||||
S8.scala
|
||||
X.scala
|
||||
Z.scala
|
||||
abstract.scala
|
||||
aliases.scala
|
||||
arrays2.scala
|
||||
attributes.scala
|
||||
bug082.scala
|
||||
bug1.scala
|
||||
bug115.scala
|
||||
bug116.scala
|
||||
bug119.scala
|
||||
bug121.scala
|
||||
bug123.scala
|
||||
bug124.scala
|
||||
bug151.scala
|
||||
bug159.scala
|
||||
bug160.scala
|
||||
bug17.scala
|
||||
bug175.scala
|
||||
bug177.scala
|
||||
bug183.scala
|
||||
bug193.scala
|
||||
bug2.scala
|
||||
bug20.scala
|
||||
bug201.scala
|
||||
bug204.scala
|
||||
bug210.scala
|
||||
bug211.scala
|
||||
bug229.scala
|
||||
bug245.scala
|
||||
bug267.scala
|
||||
bug287.scala
|
||||
bug289.scala
|
||||
bug29.scala
|
||||
bug295.scala
|
||||
bug30.scala
|
||||
bug304.scala
|
||||
bug31.scala
|
||||
bug318.scala
|
||||
bug32.scala
|
||||
bug342.scala
|
||||
bug348plus.scala
|
||||
bug359.scala
|
||||
bug36.scala
|
||||
bug360.scala
|
||||
bug361.scala
|
||||
bug372.scala
|
||||
bug39.scala
|
||||
bug49.scala
|
||||
bug53.scala
|
||||
bug54.scala
|
||||
bug61.scala
|
||||
bug64.scala
|
||||
bug66.scala
|
||||
bug68.scala
|
||||
bug69.scala
|
||||
bug76.scala
|
||||
bug81.scala
|
||||
bug85.scala
|
||||
bug91.scala
|
||||
bug93.scala
|
||||
cls.scala
|
||||
cls1.scala
|
||||
clsrefine.scala
|
||||
compile.scala
|
||||
compound.scala
|
||||
constfold.scala
|
||||
context.scala
|
||||
eta.scala
|
||||
exceptions.scala
|
||||
expressions-current.scala
|
||||
gui.scala
|
||||
imports.scala
|
||||
infer.scala
|
||||
infer2.scala
|
||||
lambda.scala
|
||||
lambdalift.scala
|
||||
lambdalift1.scala
|
||||
localmodules.scala
|
||||
matthias1.scala
|
||||
matthias3.scala
|
||||
matthias4.scala
|
||||
matthias5.scala
|
||||
maxim1.scala
|
||||
michel1.scala
|
||||
michel2.scala
|
||||
michel3.scala
|
||||
michel4.scala
|
||||
michel5.scala
|
||||
michel6.scala
|
||||
mixins.scala
|
||||
modules.scala
|
||||
modules1.scala
|
||||
moduletrans.scala
|
||||
nested.scala
|
||||
null.scala
|
||||
orderedpoints.scala
|
||||
override.scala
|
||||
partialfun.scala
|
||||
patterns.scala
|
||||
patterns1.scala
|
||||
patterns2.scala
|
||||
patterns3.scala
|
||||
philippe1.scala
|
||||
philippe2.scala
|
||||
philippe3.scala
|
||||
philippe4.scala
|
||||
pmbug.scala
|
||||
propagate.scala
|
||||
rebind.scala
|
||||
refine.scala
|
||||
reftest.scala
|
||||
scall.bat
|
||||
scoping1.scala
|
||||
scoping2.scala
|
||||
scoping3.scala
|
||||
seqtest2.scala
|
||||
simplelists.scala
|
||||
stable.scala
|
||||
strings.scala
|
||||
test1.scala
|
||||
test2.scala
|
||||
test4.scala
|
||||
test4a.scala
|
||||
test4refine.scala
|
||||
test5.scala
|
||||
test5refine.scala
|
||||
testcast.scala
|
||||
thistype.scala
|
||||
thistypes.scala
|
||||
traits.scala
|
||||
valdefs.scala
|
||||
viewtest1.scala
|
||||
viewtest2.scala
|
||||
viewtest3.scala
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
object Main {
|
||||
|
||||
def min0[A](less: (A, A) => Boolean, xs: List[A]): Option[A] = xs match {
|
||||
case List() => None
|
||||
def min0[A](less: (A, A) => Boolean, xs: List[A]): Option[A] = xs match {
|
||||
case List() => None
|
||||
case List(x) => Some(x)
|
||||
// case x :: Nil => Some(x)
|
||||
case y :: ys => min0(less, ys) match {
|
||||
case Some(m) => if (less(y, m)) Some(y) else Some(m)
|
||||
}
|
||||
case Some(m) => if (less(y, m)) Some(y) else Some(m)
|
||||
}
|
||||
}
|
||||
|
||||
def min(xs: List[Int]) = min0((x: Int, y: Int) => x < y, xs);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
class Test {
|
||||
val fun: reflect.TypedCode[int => int] = x => x + 1;
|
||||
}
|
||||
class Test {
|
||||
val fun: reflect.TypedCode[int => int] = x => x + 1;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package mixins;
|
||||
|
||||
import scala.collection.mutable._;
|
||||
|
||||
class Collections extends HashSet[Int] with ObservableSet[Int,Collections] {
|
||||
override def +=(elem: Int): Unit = super.+=(elem);
|
||||
override def -=(elem: Int): Unit = super.-=(elem);
|
||||
override def clear: Unit = super.clear;
|
||||
|
||||
}
|
||||
|
||||
object collections extends Collections;
|
||||
|
||||
//class Collections1 extends HashSet[Int] with ObservableSet[Int,Collections1];
|
||||
//object collections1 extends Collections1;
|
||||
package mixins;
|
||||
|
||||
import scala.collection.mutable._;
|
||||
|
||||
class Collections extends HashSet[Int] with ObservableSet[Int,Collections] {
|
||||
override def +=(elem: Int): Unit = super.+=(elem);
|
||||
override def -=(elem: Int): Unit = super.-=(elem);
|
||||
override def clear: Unit = super.clear;
|
||||
|
||||
}
|
||||
|
||||
object collections extends Collections;
|
||||
|
||||
//class Collections1 extends HashSet[Int] with ObservableSet[Int,Collections1];
|
||||
//object collections1 extends Collections1;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
abstract class A { type T }
|
||||
|
||||
abstract class B { val xz: Any }
|
||||
|
||||
abstract class Test {
|
||||
var yy: A with B { type T; val xz: T } = null;
|
||||
var xx: A with B { type T; val xz: T } = null;
|
||||
xx = yy;
|
||||
}
|
||||
abstract class A { type T }
|
||||
|
||||
abstract class B { val xz: Any }
|
||||
|
||||
abstract class Test {
|
||||
var yy: A with B { type T; val xz: T } = null;
|
||||
var xx: A with B { type T; val xz: T } = null;
|
||||
xx = yy;
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
class Context {
|
||||
object symwrap extends SymbolWrapper {
|
||||
val context: Context.this.type = Context.this
|
||||
}
|
||||
object typewrap extends TypeWrapper {
|
||||
val context: Context.this.type = Context.this
|
||||
}
|
||||
object symbols extends symwrap.Symbols;
|
||||
object types extends typewrap.Types;
|
||||
}
|
||||
|
||||
abstract class SymbolWrapper {
|
||||
val context: Context;
|
||||
import context._;
|
||||
|
||||
class Symbols: context.symbols.type {
|
||||
abstract class Symbol {
|
||||
def typ: types.Type;
|
||||
def sym: Symbol = typ.sym;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class TypeWrapper {
|
||||
val context: Context;
|
||||
import context._;
|
||||
|
||||
class Types: context.types.type {
|
||||
abstract class Type {
|
||||
def sym: symbols.Symbol;
|
||||
def typ: Type = sym.typ;
|
||||
}
|
||||
}
|
||||
}
|
||||
class Context {
|
||||
object symwrap extends SymbolWrapper {
|
||||
val context: Context.this.type = Context.this
|
||||
}
|
||||
object typewrap extends TypeWrapper {
|
||||
val context: Context.this.type = Context.this
|
||||
}
|
||||
object symbols extends symwrap.Symbols;
|
||||
object types extends typewrap.Types;
|
||||
}
|
||||
|
||||
abstract class SymbolWrapper {
|
||||
val context: Context;
|
||||
import context._;
|
||||
|
||||
class Symbols: context.symbols.type {
|
||||
abstract class Symbol {
|
||||
def typ: types.Type;
|
||||
def sym: Symbol = typ.sym;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class TypeWrapper {
|
||||
val context: Context;
|
||||
import context._;
|
||||
|
||||
class Types: context.types.type {
|
||||
abstract class Type {
|
||||
def sym: symbols.Symbol;
|
||||
def typ: Type = sym.typ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,99 +1,99 @@
|
|||
object Geom {
|
||||
trait Shape;
|
||||
case class Point(x: int, y: int) extends Shape;
|
||||
case class Rectangle(ll: Point, ur: Point) extends Shape {
|
||||
def inset(delta: int) =
|
||||
Rectangle(Point(ll.x - delta, ll.y - delta), Point(ur.x + delta, ur.y + delta));
|
||||
}
|
||||
}
|
||||
|
||||
object Color {
|
||||
type Color = int;
|
||||
val black = 0x000000;
|
||||
val grey = 0x808080;
|
||||
}
|
||||
|
||||
trait Screen {
|
||||
type Color = int;
|
||||
def drawRect(r: Geom.Rectangle, c: Color): unit;
|
||||
def fillRect(r: Geom.Rectangle, c: Color): unit;
|
||||
}
|
||||
|
||||
object DummyScreen extends Screen {
|
||||
def drawRect(r: Geom.Rectangle, c: Color): unit =
|
||||
System.out.println("draw " + r + " with " + c);
|
||||
def fillRect(r: Geom.Rectangle, c: Color): unit =
|
||||
System.out.println("fill " + r + " with " + c);
|
||||
}
|
||||
|
||||
object GUI {
|
||||
|
||||
object Controller {
|
||||
def addMouseCtl(c: MouseCtl) = ()
|
||||
}
|
||||
|
||||
trait Glyph {
|
||||
def getRect: Geom.Rectangle;
|
||||
def setLoc(p: Geom.Point): unit;
|
||||
def draw() = System.out.println("draw " + this);
|
||||
}
|
||||
|
||||
class Label(scr: Screen, p: Geom.Point, name: String) extends Glyph {
|
||||
private var origin = p;
|
||||
def getRect = Geom.Rectangle(origin, origin).inset(10);
|
||||
def setLoc(p: Geom.Point) = { origin = p }
|
||||
}
|
||||
|
||||
trait Ctl {
|
||||
def getGlyph: Glyph;
|
||||
def enable(b: Boolean): this.type;
|
||||
}
|
||||
|
||||
trait MouseCtl extends Ctl {
|
||||
def mouseDown(p: Geom.Point): unit;
|
||||
}
|
||||
|
||||
abstract class Button(scr: Screen, p: Geom.Point, name: String)
|
||||
extends Glyph with MouseCtl {
|
||||
var enabled: boolean = false;
|
||||
val label = new Label(scr, p, name);
|
||||
|
||||
/* Glyph methods */
|
||||
override def draw(): unit = {
|
||||
if (enabled) scr.drawRect(getRect, Color.black)
|
||||
else scr.fillRect(getRect, Color.grey);
|
||||
label.draw();
|
||||
}
|
||||
def setLoc(p: Geom.Point) = label.setLoc(p);
|
||||
def getRect = label.getRect.inset(-2);
|
||||
|
||||
/* Ctl methods */
|
||||
def enable(b: boolean): this.type = { enabled = b; draw(); this }
|
||||
def getGlyph = label;
|
||||
final def mouseDown(p: Geom.Point): unit =
|
||||
if (enabled) doit() else System.out.println("button is disabled");
|
||||
|
||||
/* deferred method to be specified by client */
|
||||
def doit(): unit;
|
||||
}
|
||||
}
|
||||
|
||||
object GUIClient {
|
||||
|
||||
class Application {
|
||||
def quit() = System.out.println("application exited");
|
||||
}
|
||||
|
||||
class QuitButton (scr: Screen, p: Geom.Point, name: String, a: Application)
|
||||
extends GUI.Button(scr, p, name) {
|
||||
def doit(): unit = a.quit();
|
||||
}
|
||||
|
||||
def main(args: Array[String]) = {
|
||||
val b = new QuitButton(
|
||||
DummyScreen, Geom.Point(1, 1), "quit", new Application);
|
||||
b.draw();
|
||||
b.enable(true).mouseDown(Geom.Point(1, 2));
|
||||
}
|
||||
}
|
||||
|
||||
object Geom {
|
||||
trait Shape;
|
||||
case class Point(x: int, y: int) extends Shape;
|
||||
case class Rectangle(ll: Point, ur: Point) extends Shape {
|
||||
def inset(delta: int) =
|
||||
Rectangle(Point(ll.x - delta, ll.y - delta), Point(ur.x + delta, ur.y + delta));
|
||||
}
|
||||
}
|
||||
|
||||
object Color {
|
||||
type Color = int;
|
||||
val black = 0x000000;
|
||||
val grey = 0x808080;
|
||||
}
|
||||
|
||||
trait Screen {
|
||||
type Color = int;
|
||||
def drawRect(r: Geom.Rectangle, c: Color): unit;
|
||||
def fillRect(r: Geom.Rectangle, c: Color): unit;
|
||||
}
|
||||
|
||||
object DummyScreen extends Screen {
|
||||
def drawRect(r: Geom.Rectangle, c: Color): unit =
|
||||
System.out.println("draw " + r + " with " + c);
|
||||
def fillRect(r: Geom.Rectangle, c: Color): unit =
|
||||
System.out.println("fill " + r + " with " + c);
|
||||
}
|
||||
|
||||
object GUI {
|
||||
|
||||
object Controller {
|
||||
def addMouseCtl(c: MouseCtl) = ()
|
||||
}
|
||||
|
||||
trait Glyph {
|
||||
def getRect: Geom.Rectangle;
|
||||
def setLoc(p: Geom.Point): unit;
|
||||
def draw() = System.out.println("draw " + this);
|
||||
}
|
||||
|
||||
class Label(scr: Screen, p: Geom.Point, name: String) extends Glyph {
|
||||
private var origin = p;
|
||||
def getRect = Geom.Rectangle(origin, origin).inset(10);
|
||||
def setLoc(p: Geom.Point) = { origin = p }
|
||||
}
|
||||
|
||||
trait Ctl {
|
||||
def getGlyph: Glyph;
|
||||
def enable(b: Boolean): this.type;
|
||||
}
|
||||
|
||||
trait MouseCtl extends Ctl {
|
||||
def mouseDown(p: Geom.Point): unit;
|
||||
}
|
||||
|
||||
abstract class Button(scr: Screen, p: Geom.Point, name: String)
|
||||
extends Glyph with MouseCtl {
|
||||
var enabled: boolean = false;
|
||||
val label = new Label(scr, p, name);
|
||||
|
||||
/* Glyph methods */
|
||||
override def draw(): unit = {
|
||||
if (enabled) scr.drawRect(getRect, Color.black)
|
||||
else scr.fillRect(getRect, Color.grey);
|
||||
label.draw();
|
||||
}
|
||||
def setLoc(p: Geom.Point) = label.setLoc(p);
|
||||
def getRect = label.getRect.inset(-2);
|
||||
|
||||
/* Ctl methods */
|
||||
def enable(b: boolean): this.type = { enabled = b; draw(); this }
|
||||
def getGlyph = label;
|
||||
final def mouseDown(p: Geom.Point): unit =
|
||||
if (enabled) doit() else System.out.println("button is disabled");
|
||||
|
||||
/* deferred method to be specified by client */
|
||||
def doit(): unit;
|
||||
}
|
||||
}
|
||||
|
||||
object GUIClient {
|
||||
|
||||
class Application {
|
||||
def quit() = System.out.println("application exited");
|
||||
}
|
||||
|
||||
class QuitButton (scr: Screen, p: Geom.Point, name: String, a: Application)
|
||||
extends GUI.Button(scr, p, name) {
|
||||
def doit(): unit = a.quit();
|
||||
}
|
||||
|
||||
def main(args: Array[String]) = {
|
||||
val b = new QuitButton(
|
||||
DummyScreen, Geom.Point(1, 1), "quit", new Application);
|
||||
b.draw();
|
||||
b.enable(true).mouseDown(Geom.Point(1, 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
package mixins;
|
||||
abstract class Super {
|
||||
def foo: int;
|
||||
}
|
||||
trait Mixin extends Super {
|
||||
abstract override def foo = super.foo;
|
||||
}
|
||||
trait MixinSub extends Super with Mixin {
|
||||
abstract override def foo: int = super.foo;
|
||||
}
|
||||
trait MixinSubSub extends MixinSub {
|
||||
abstract override def foo = super.foo;
|
||||
}
|
||||
class Sub extends Super {
|
||||
def foo: int = 1
|
||||
}
|
||||
class Base extends Sub with MixinSubSub {
|
||||
override def foo = super.foo;
|
||||
}
|
||||
trait Mixin1 extends Sub with MixinSubSub {}
|
||||
class Base1 extends Mixin1 {}
|
||||
|
||||
package mixins;
|
||||
abstract class Super {
|
||||
def foo: int;
|
||||
}
|
||||
trait Mixin extends Super {
|
||||
abstract override def foo = super.foo;
|
||||
}
|
||||
trait MixinSub extends Super with Mixin {
|
||||
abstract override def foo: int = super.foo;
|
||||
}
|
||||
trait MixinSubSub extends MixinSub {
|
||||
abstract override def foo = super.foo;
|
||||
}
|
||||
class Sub extends Super {
|
||||
def foo: int = 1
|
||||
}
|
||||
class Base extends Sub with MixinSubSub {
|
||||
override def foo = super.foo;
|
||||
}
|
||||
trait Mixin1 extends Sub with MixinSubSub {}
|
||||
class Base1 extends Mixin1 {}
|
||||
|
||||
|
|
|
@ -1,138 +1,138 @@
|
|||
304.scala
|
||||
A.scala
|
||||
List1.scala
|
||||
MailBox.scala
|
||||
S1.scala
|
||||
S3.scala
|
||||
S5.scala
|
||||
S8.scala
|
||||
X.scala
|
||||
Z.scala
|
||||
abstract.scala
|
||||
aliases.scala
|
||||
arrays2.scala
|
||||
attributes.scala
|
||||
bug082.scala
|
||||
bug1.scala
|
||||
bug115.scala
|
||||
bug116.scala
|
||||
bug119.scala
|
||||
bug121.scala
|
||||
bug124.scala
|
||||
bug151.scala
|
||||
bug159.scala
|
||||
bug160.scala
|
||||
bug17.scala
|
||||
bug175.scala
|
||||
bug177.scala
|
||||
bug183.scala
|
||||
bug193.scala
|
||||
bug2.scala
|
||||
bug20.scala
|
||||
bug201.scala
|
||||
bug204.scala
|
||||
bug210.scala
|
||||
bug211.scala
|
||||
bug229.scala
|
||||
bug245.scala
|
||||
bug267.scala
|
||||
bug287.scala
|
||||
bug289.scala
|
||||
bug29.scala
|
||||
bug295.scala
|
||||
bug30.scala
|
||||
bug304.scala
|
||||
bug31.scala
|
||||
bug318.scala
|
||||
bug32.scala
|
||||
bug342.scala
|
||||
bug348plus.scala
|
||||
bug359.scala
|
||||
bug36.scala
|
||||
bug360.scala
|
||||
bug361.scala
|
||||
bug372.scala
|
||||
bug39.scala
|
||||
bug49.scala
|
||||
bug53.scala
|
||||
bug54.scala
|
||||
bug61.scala
|
||||
bug64.scala
|
||||
bug66.scala
|
||||
bug68.scala
|
||||
bug69.scala
|
||||
bug76.scala
|
||||
bug81.scala
|
||||
bug91.scala
|
||||
bug93.scala
|
||||
cls.scala
|
||||
cls1.scala
|
||||
clsrefine.scala
|
||||
compile.scala
|
||||
compound.scala
|
||||
constfold.scala
|
||||
eta.scala
|
||||
expressions-current.scala
|
||||
gui.scala
|
||||
imports.scala
|
||||
infer.scala
|
||||
infer2.scala
|
||||
lambda.scala
|
||||
lambdalift.scala
|
||||
lambdalift1.scala
|
||||
localmodules.scala
|
||||
matthias1.scala
|
||||
matthias3.scala
|
||||
matthias4.scala
|
||||
matthias5.scala
|
||||
maxim1.scala
|
||||
michel1.scala
|
||||
michel2.scala
|
||||
michel3.scala
|
||||
michel4.scala
|
||||
michel5.scala
|
||||
michel6.scala
|
||||
mixins.scala
|
||||
modules.scala
|
||||
modules1.scala
|
||||
moduletrans.scala
|
||||
nested.scala
|
||||
null.scala
|
||||
orderedpoints.scala
|
||||
override.scala
|
||||
partialfun.scala
|
||||
patterns.scala
|
||||
patterns1.scala
|
||||
patterns2.scala
|
||||
patterns3.scala
|
||||
philippe1.scala
|
||||
philippe2.scala
|
||||
philippe3.scala
|
||||
philippe4.scala
|
||||
pmbug.scala
|
||||
propagate.scala
|
||||
rebind.scala
|
||||
refine.scala
|
||||
reftest.scala
|
||||
scoping1.scala
|
||||
scoping2.scala
|
||||
scoping3.scala
|
||||
seqtest2.scala
|
||||
simplelists.scala
|
||||
stable.scala
|
||||
strings.scala
|
||||
test1.scala
|
||||
test2.scala
|
||||
test4.scala
|
||||
test4a.scala
|
||||
test4refine.scala
|
||||
test5.scala
|
||||
test5refine.scala
|
||||
testcast.scala
|
||||
thistype.scala
|
||||
thistypes.scala
|
||||
traits.scala
|
||||
valdefs.scala
|
||||
viewtest1.scala
|
||||
viewtest2.scala
|
||||
viewtest3.scala
|
||||
304.scala
|
||||
A.scala
|
||||
List1.scala
|
||||
MailBox.scala
|
||||
S1.scala
|
||||
S3.scala
|
||||
S5.scala
|
||||
S8.scala
|
||||
X.scala
|
||||
Z.scala
|
||||
abstract.scala
|
||||
aliases.scala
|
||||
arrays2.scala
|
||||
attributes.scala
|
||||
bug082.scala
|
||||
bug1.scala
|
||||
bug115.scala
|
||||
bug116.scala
|
||||
bug119.scala
|
||||
bug121.scala
|
||||
bug124.scala
|
||||
bug151.scala
|
||||
bug159.scala
|
||||
bug160.scala
|
||||
bug17.scala
|
||||
bug175.scala
|
||||
bug177.scala
|
||||
bug183.scala
|
||||
bug193.scala
|
||||
bug2.scala
|
||||
bug20.scala
|
||||
bug201.scala
|
||||
bug204.scala
|
||||
bug210.scala
|
||||
bug211.scala
|
||||
bug229.scala
|
||||
bug245.scala
|
||||
bug267.scala
|
||||
bug287.scala
|
||||
bug289.scala
|
||||
bug29.scala
|
||||
bug295.scala
|
||||
bug30.scala
|
||||
bug304.scala
|
||||
bug31.scala
|
||||
bug318.scala
|
||||
bug32.scala
|
||||
bug342.scala
|
||||
bug348plus.scala
|
||||
bug359.scala
|
||||
bug36.scala
|
||||
bug360.scala
|
||||
bug361.scala
|
||||
bug372.scala
|
||||
bug39.scala
|
||||
bug49.scala
|
||||
bug53.scala
|
||||
bug54.scala
|
||||
bug61.scala
|
||||
bug64.scala
|
||||
bug66.scala
|
||||
bug68.scala
|
||||
bug69.scala
|
||||
bug76.scala
|
||||
bug81.scala
|
||||
bug91.scala
|
||||
bug93.scala
|
||||
cls.scala
|
||||
cls1.scala
|
||||
clsrefine.scala
|
||||
compile.scala
|
||||
compound.scala
|
||||
constfold.scala
|
||||
eta.scala
|
||||
expressions-current.scala
|
||||
gui.scala
|
||||
imports.scala
|
||||
infer.scala
|
||||
infer2.scala
|
||||
lambda.scala
|
||||
lambdalift.scala
|
||||
lambdalift1.scala
|
||||
localmodules.scala
|
||||
matthias1.scala
|
||||
matthias3.scala
|
||||
matthias4.scala
|
||||
matthias5.scala
|
||||
maxim1.scala
|
||||
michel1.scala
|
||||
michel2.scala
|
||||
michel3.scala
|
||||
michel4.scala
|
||||
michel5.scala
|
||||
michel6.scala
|
||||
mixins.scala
|
||||
modules.scala
|
||||
modules1.scala
|
||||
moduletrans.scala
|
||||
nested.scala
|
||||
null.scala
|
||||
orderedpoints.scala
|
||||
override.scala
|
||||
partialfun.scala
|
||||
patterns.scala
|
||||
patterns1.scala
|
||||
patterns2.scala
|
||||
patterns3.scala
|
||||
philippe1.scala
|
||||
philippe2.scala
|
||||
philippe3.scala
|
||||
philippe4.scala
|
||||
pmbug.scala
|
||||
propagate.scala
|
||||
rebind.scala
|
||||
refine.scala
|
||||
reftest.scala
|
||||
scoping1.scala
|
||||
scoping2.scala
|
||||
scoping3.scala
|
||||
seqtest2.scala
|
||||
simplelists.scala
|
||||
stable.scala
|
||||
strings.scala
|
||||
test1.scala
|
||||
test2.scala
|
||||
test4.scala
|
||||
test4a.scala
|
||||
test4refine.scala
|
||||
test5.scala
|
||||
test5refine.scala
|
||||
testcast.scala
|
||||
thistype.scala
|
||||
thistypes.scala
|
||||
traits.scala
|
||||
valdefs.scala
|
||||
viewtest1.scala
|
||||
viewtest2.scala
|
||||
viewtest3.scala
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
package test;
|
||||
|
||||
class Point1(x: int) extends Object with Ordered[Point1] {
|
||||
val xCoord = x;
|
||||
def compareTo [b >: Point1 <% Ordered[b]](that: b): int = that match {
|
||||
case that1: Point1 => this.xCoord.compareTo(that1.xCoord)
|
||||
case _ => -that.compareTo(this)
|
||||
}
|
||||
}
|
||||
class Point2(x: int, y: int) extends Point1(x) with Ordered[Point2] {}
|
||||
/*
|
||||
val yCoord = y;
|
||||
override def compareTo [b >: Point2 <% Ordered[b]](that: b): int = that match {
|
||||
case that1: Point2 =>
|
||||
val r = super.compareTo(that1);
|
||||
if (r == 0) this.yCoord.compareTo(that1.yCoord) else r
|
||||
case _ => -that.compareTo(this)
|
||||
}
|
||||
}
|
||||
object Test extends Application {
|
||||
val p1 = new Point1(1);
|
||||
val q1 = new Point1(2);
|
||||
System.out.println(p1 < q1);
|
||||
val p2 = new Point2(1, 2);
|
||||
val q2 = new Point2(1, 3);
|
||||
System.out.println(p2 < q2);
|
||||
System.out.println(p1 < q2);
|
||||
System.out.println(p2 < q1);
|
||||
}
|
||||
*/
|
||||
package test;
|
||||
|
||||
class Point1(x: int) extends Object with Ordered[Point1] {
|
||||
val xCoord = x;
|
||||
def compareTo [b >: Point1 <% Ordered[b]](that: b): int = that match {
|
||||
case that1: Point1 => this.xCoord.compareTo(that1.xCoord)
|
||||
case _ => -that.compareTo(this)
|
||||
}
|
||||
}
|
||||
class Point2(x: int, y: int) extends Point1(x) with Ordered[Point2] {}
|
||||
/*
|
||||
val yCoord = y;
|
||||
override def compareTo [b >: Point2 <% Ordered[b]](that: b): int = that match {
|
||||
case that1: Point2 =>
|
||||
val r = super.compareTo(that1);
|
||||
if (r == 0) this.yCoord.compareTo(that1.yCoord) else r
|
||||
case _ => -that.compareTo(this)
|
||||
}
|
||||
}
|
||||
object Test extends Application {
|
||||
val p1 = new Point1(1);
|
||||
val q1 = new Point1(2);
|
||||
System.out.println(p1 < q1);
|
||||
val p2 = new Point2(1, 2);
|
||||
val q2 = new Point2(1, 3);
|
||||
System.out.println(p2 < q2);
|
||||
System.out.println(p1 < q2);
|
||||
System.out.println(p2 < q1);
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
scalac -prompt A.scala;
|
||||
scalac -prompt IntSet.scala;
|
||||
scalac -prompt List1.scala;
|
||||
scalac -prompt Rational.scala;
|
||||
scalac -prompt X.scala;
|
||||
scalac -prompt Y.scala;
|
||||
scalac -prompt Z.scala;
|
||||
scalac -prompt abstract.scala;
|
||||
scalac -prompt cls.scala;
|
||||
scalac -prompt cls1.scala;
|
||||
scalac -prompt clsrefine.scala;
|
||||
scalac -prompt cours1.scala;
|
||||
scalac -prompt cours2.scala;
|
||||
scalac -prompt cours2a.scala;
|
||||
scalac -prompt cours2b.scala;
|
||||
scalac -prompt cours2c.scala;
|
||||
scalac -prompt eta.scala;
|
||||
scalac -prompt exceptions.scala;
|
||||
scalac -prompt imports.scala;
|
||||
scalac -prompt lambda.scala;
|
||||
scalac -prompt lambdalift.scala;
|
||||
scalac -prompt lambdalift1.scala;
|
||||
scalac -prompt matthias1.scala;
|
||||
scalac -prompt maxim1.scala;
|
||||
scalac -prompt michel1.scala;
|
||||
scalac -prompt michel2.scala;
|
||||
scalac -prompt michel3.scala;
|
||||
scalac -prompt michel4.scala;
|
||||
scalac -prompt michel5.scala;
|
||||
scalac -prompt modules.scala;
|
||||
scalac -prompt modules1.scala;
|
||||
scalac -prompt moduletrans.scala;
|
||||
scalac -prompt nested.scala;
|
||||
scalac -prompt override.scala;
|
||||
scalac -prompt patterns.scala;
|
||||
scalac -prompt patterns2.scala;
|
||||
scalac -prompt philippe1.scala;
|
||||
scalac -prompt philippe2.scala;
|
||||
scalac -prompt reftest.scala;
|
||||
scalac -prompt sort1.scala;
|
||||
scalac -prompt sqrt.scala;
|
||||
scalac -prompt stable.scala;
|
||||
scalac -prompt strings.scala;
|
||||
scalac -prompt test1.scala;
|
||||
scalac -prompt test2.scala;
|
||||
scalac -prompt test4.scala;
|
||||
scalac -prompt test4a.scala;
|
||||
scalac -prompt test4refine.scala;
|
||||
scalac -prompt test5.scala;
|
||||
scalac -prompt test5refine.scala;
|
||||
scalac -prompt A.scala;
|
||||
scalac -prompt IntSet.scala;
|
||||
scalac -prompt List1.scala;
|
||||
scalac -prompt Rational.scala;
|
||||
scalac -prompt X.scala;
|
||||
scalac -prompt Y.scala;
|
||||
scalac -prompt Z.scala;
|
||||
scalac -prompt abstract.scala;
|
||||
scalac -prompt cls.scala;
|
||||
scalac -prompt cls1.scala;
|
||||
scalac -prompt clsrefine.scala;
|
||||
scalac -prompt cours1.scala;
|
||||
scalac -prompt cours2.scala;
|
||||
scalac -prompt cours2a.scala;
|
||||
scalac -prompt cours2b.scala;
|
||||
scalac -prompt cours2c.scala;
|
||||
scalac -prompt eta.scala;
|
||||
scalac -prompt exceptions.scala;
|
||||
scalac -prompt imports.scala;
|
||||
scalac -prompt lambda.scala;
|
||||
scalac -prompt lambdalift.scala;
|
||||
scalac -prompt lambdalift1.scala;
|
||||
scalac -prompt matthias1.scala;
|
||||
scalac -prompt maxim1.scala;
|
||||
scalac -prompt michel1.scala;
|
||||
scalac -prompt michel2.scala;
|
||||
scalac -prompt michel3.scala;
|
||||
scalac -prompt michel4.scala;
|
||||
scalac -prompt michel5.scala;
|
||||
scalac -prompt modules.scala;
|
||||
scalac -prompt modules1.scala;
|
||||
scalac -prompt moduletrans.scala;
|
||||
scalac -prompt nested.scala;
|
||||
scalac -prompt override.scala;
|
||||
scalac -prompt patterns.scala;
|
||||
scalac -prompt patterns2.scala;
|
||||
scalac -prompt philippe1.scala;
|
||||
scalac -prompt philippe2.scala;
|
||||
scalac -prompt reftest.scala;
|
||||
scalac -prompt sort1.scala;
|
||||
scalac -prompt sqrt.scala;
|
||||
scalac -prompt stable.scala;
|
||||
scalac -prompt strings.scala;
|
||||
scalac -prompt test1.scala;
|
||||
scalac -prompt test2.scala;
|
||||
scalac -prompt test4.scala;
|
||||
scalac -prompt test4a.scala;
|
||||
scalac -prompt test4refine.scala;
|
||||
scalac -prompt test5.scala;
|
||||
scalac -prompt test5refine.scala;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
object Test {
|
||||
|
||||
class Ctl {
|
||||
def enable: this.type = { System.out.println("enable"); this }
|
||||
}
|
||||
|
||||
class MouseCtl extends Ctl {
|
||||
def mouseDown(x: int, y: int): unit = { System.out.println("mouse down"); }
|
||||
}
|
||||
|
||||
def main(args: Array[String]) =
|
||||
new MouseCtl().enable.mouseDown(1, 2);
|
||||
|
||||
}
|
||||
object Test {
|
||||
|
||||
class Ctl {
|
||||
def enable: this.type = { System.out.println("enable"); this }
|
||||
}
|
||||
|
||||
class MouseCtl extends Ctl {
|
||||
def mouseDown(x: int, y: int): unit = { System.out.println("mouse down"); }
|
||||
}
|
||||
|
||||
def main(args: Array[String]) =
|
||||
new MouseCtl().enable.mouseDown(1, 2);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
object Test {
|
||||
type Color = int;
|
||||
trait Shape {
|
||||
override def equals(other: Any) = true;
|
||||
}
|
||||
trait Bordered extends Shape {
|
||||
val thickness: int;
|
||||
override def equals(other: Any) = other match {
|
||||
case that: Bordered => this.thickness == that.thickness;
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
trait Colored extends Shape {
|
||||
val color: Color;
|
||||
override def equals(other: Any) = other match {
|
||||
case that: Colored => this.color == that.color;
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
trait BorderedColoredShape extends Shape with Bordered with Colored {
|
||||
override def equals(other: Any) = other match {
|
||||
case that: BorderedColoredShape =>
|
||||
super.equals(that) &&
|
||||
super[Bordered].equals(that) &&
|
||||
super[Colored].equals(that)
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
|
||||
val bcs1 = new BorderedColoredShape {
|
||||
val thickness = 1;
|
||||
val color = 0;
|
||||
}
|
||||
val bcs2 = new BorderedColoredShape {
|
||||
val thickness = 2;
|
||||
val color = 0;
|
||||
}
|
||||
System.out.println(bcs1 == bcs1);
|
||||
System.out.println(bcs1 == bcs2);
|
||||
}
|
||||
|
||||
|
||||
object Test {
|
||||
type Color = int;
|
||||
trait Shape {
|
||||
override def equals(other: Any) = true;
|
||||
}
|
||||
trait Bordered extends Shape {
|
||||
val thickness: int;
|
||||
override def equals(other: Any) = other match {
|
||||
case that: Bordered => this.thickness == that.thickness;
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
trait Colored extends Shape {
|
||||
val color: Color;
|
||||
override def equals(other: Any) = other match {
|
||||
case that: Colored => this.color == that.color;
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
trait BorderedColoredShape extends Shape with Bordered with Colored {
|
||||
override def equals(other: Any) = other match {
|
||||
case that: BorderedColoredShape =>
|
||||
super.equals(that) &&
|
||||
super[Bordered].equals(that) &&
|
||||
super[Colored].equals(that)
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
|
||||
val bcs1 = new BorderedColoredShape {
|
||||
val thickness = 1;
|
||||
val color = 0;
|
||||
}
|
||||
val bcs2 = new BorderedColoredShape {
|
||||
val thickness = 2;
|
||||
val color = 0;
|
||||
}
|
||||
System.out.println(bcs1 == bcs1);
|
||||
System.out.println(bcs1 == bcs2);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@ object Serialize {
|
|||
def write[A](o: A): Array[Byte] = { // throws Exception
|
||||
val ba = new java.io.ByteArrayOutputStream(512);
|
||||
val out = new java.io.ObjectOutputStream(ba);
|
||||
out.writeObject(o);
|
||||
out.writeObject(o);
|
||||
out.close();
|
||||
ba.toByteArray()
|
||||
}
|
||||
def read[A](buffer: Array[Byte]): A = { // throws Exception
|
||||
val in =
|
||||
new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer));
|
||||
new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer));
|
||||
in.readObject().asInstanceOf[A]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
object Test {
|
||||
abstract class C {
|
||||
type t;
|
||||
}
|
||||
def foo(x: C, y: x.t): Object = null;
|
||||
object Test {
|
||||
abstract class C {
|
||||
type t;
|
||||
}
|
||||
def foo(x: C, y: x.t): Object = null;
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
object Main {
|
||||
|
||||
def min0[A](less: (A, A) => Boolean, xs: List[A]): Option[A] = xs match {
|
||||
case List() => None
|
||||
def min0[A](less: (A, A) => Boolean, xs: List[A]): Option[A] = xs match {
|
||||
case List() => None
|
||||
case List(x) => Some(x)
|
||||
// case x :: Nil => Some(x)
|
||||
case y :: ys => min0(less, ys) match {
|
||||
case Some(m) => if (less(y, m)) Some(y) else Some(m)
|
||||
}
|
||||
case Some(m) => if (less(y, m)) Some(y) else Some(m)
|
||||
}
|
||||
}
|
||||
|
||||
def min(xs: List[Int]) = min0((x: Int, y: Int) => x < y, xs);
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package mixins;
|
||||
|
||||
import scala.collection.mutable._;
|
||||
|
||||
class Collections extends HashSet[Int] with ObservableSet[Int,Collections] {
|
||||
override def +=(elem: Int): Unit = super.+=(elem);
|
||||
override def -=(elem: Int): Unit = super.-=(elem);
|
||||
override def clear: Unit = super.clear;
|
||||
|
||||
}
|
||||
|
||||
object collections extends Collections;
|
||||
|
||||
//class Collections1 extends HashSet[Int] with ObservableSet[Int,Collections1];
|
||||
//object collections1 extends Collections1;
|
||||
package mixins;
|
||||
|
||||
import scala.collection.mutable._;
|
||||
|
||||
class Collections extends HashSet[Int] with ObservableSet[Int,Collections] {
|
||||
override def +=(elem: Int): Unit = super.+=(elem);
|
||||
override def -=(elem: Int): Unit = super.-=(elem);
|
||||
override def clear: Unit = super.clear;
|
||||
|
||||
}
|
||||
|
||||
object collections extends Collections;
|
||||
|
||||
//class Collections1 extends HashSet[Int] with ObservableSet[Int,Collections1];
|
||||
//object collections1 extends Collections1;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
abstract class A { type T }
|
||||
|
||||
abstract class B { val xz: Any }
|
||||
|
||||
abstract class Test {
|
||||
var yy: A with B { type T; val xz: T } = null;
|
||||
var xx: A with B { type T; val xz: T } = null;
|
||||
xx = yy;
|
||||
}
|
||||
abstract class A { type T }
|
||||
|
||||
abstract class B { val xz: Any }
|
||||
|
||||
abstract class Test {
|
||||
var yy: A with B { type T; val xz: T } = null;
|
||||
var xx: A with B { type T; val xz: T } = null;
|
||||
xx = yy;
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
class Context {
|
||||
object symwrap extends SymbolWrapper {
|
||||
val context: Context.this.type = Context.this
|
||||
}
|
||||
object typewrap extends TypeWrapper {
|
||||
val context: Context.this.type = Context.this
|
||||
}
|
||||
object symbols extends symwrap.Symbols;
|
||||
object types extends typewrap.Types;
|
||||
}
|
||||
|
||||
abstract class SymbolWrapper {
|
||||
val context: Context;
|
||||
import context._;
|
||||
|
||||
class Symbols: context.symbols.type {
|
||||
abstract class Symbol {
|
||||
def typ: types.Type;
|
||||
def sym: Symbol = typ.sym;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class TypeWrapper {
|
||||
val context: Context;
|
||||
import context._;
|
||||
|
||||
class Types: context.types.type {
|
||||
abstract class Type {
|
||||
def sym: symbols.Symbol;
|
||||
def typ: Type = sym.typ;
|
||||
}
|
||||
}
|
||||
}
|
||||
class Context {
|
||||
object symwrap extends SymbolWrapper {
|
||||
val context: Context.this.type = Context.this
|
||||
}
|
||||
object typewrap extends TypeWrapper {
|
||||
val context: Context.this.type = Context.this
|
||||
}
|
||||
object symbols extends symwrap.Symbols;
|
||||
object types extends typewrap.Types;
|
||||
}
|
||||
|
||||
abstract class SymbolWrapper {
|
||||
val context: Context;
|
||||
import context._;
|
||||
|
||||
class Symbols: context.symbols.type {
|
||||
abstract class Symbol {
|
||||
def typ: types.Type;
|
||||
def sym: Symbol = typ.sym;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class TypeWrapper {
|
||||
val context: Context;
|
||||
import context._;
|
||||
|
||||
class Types: context.types.type {
|
||||
abstract class Type {
|
||||
def sym: symbols.Symbol;
|
||||
def typ: Type = sym.typ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,99 +1,99 @@
|
|||
object Geom {
|
||||
trait Shape;
|
||||
case class Point(x: int, y: int) extends Shape;
|
||||
case class Rectangle(ll: Point, ur: Point) extends Shape {
|
||||
def inset(delta: int) =
|
||||
Rectangle(Point(ll.x - delta, ll.y - delta), Point(ur.x + delta, ur.y + delta));
|
||||
}
|
||||
}
|
||||
|
||||
object Color {
|
||||
type Color = int;
|
||||
val black = 0x000000;
|
||||
val grey = 0x808080;
|
||||
}
|
||||
|
||||
trait Screen {
|
||||
type Color = int;
|
||||
def drawRect(r: Geom.Rectangle, c: Color): unit;
|
||||
def fillRect(r: Geom.Rectangle, c: Color): unit;
|
||||
}
|
||||
|
||||
object DummyScreen extends Screen {
|
||||
def drawRect(r: Geom.Rectangle, c: Color): unit =
|
||||
System.out.println("draw " + r + " with " + c);
|
||||
def fillRect(r: Geom.Rectangle, c: Color): unit =
|
||||
System.out.println("fill " + r + " with " + c);
|
||||
}
|
||||
|
||||
object GUI {
|
||||
|
||||
object Controller {
|
||||
def addMouseCtl(c: MouseCtl) = ()
|
||||
}
|
||||
|
||||
trait Glyph {
|
||||
def getRect: Geom.Rectangle;
|
||||
def setLoc(p: Geom.Point): unit;
|
||||
def draw() = System.out.println("draw " + this);
|
||||
}
|
||||
|
||||
class Label(scr: Screen, p: Geom.Point, name: String) extends Glyph {
|
||||
private var origin = p;
|
||||
def getRect = Geom.Rectangle(origin, origin).inset(10);
|
||||
def setLoc(p: Geom.Point) = { origin = p }
|
||||
}
|
||||
|
||||
trait Ctl {
|
||||
def getGlyph: Glyph;
|
||||
def enable(b: Boolean): this.type;
|
||||
}
|
||||
|
||||
trait MouseCtl with Ctl {
|
||||
def mouseDown(p: Geom.Point): unit;
|
||||
}
|
||||
|
||||
abstract class Button(scr: Screen, p: Geom.Point, name: String)
|
||||
extends Glyph with MouseCtl {
|
||||
var enabled: boolean = false;
|
||||
val label = new Label(scr, p, name);
|
||||
|
||||
/* Glyph methods */
|
||||
override def draw(): unit = {
|
||||
if (enabled) scr.drawRect(getRect, Color.black)
|
||||
else scr.fillRect(getRect, Color.grey);
|
||||
label.draw();
|
||||
}
|
||||
def setLoc(p: Geom.Point) = label.setLoc(p);
|
||||
def getRect = label.getRect.inset(-2);
|
||||
|
||||
/* Ctl methods */
|
||||
def enable(b: boolean): this.type = { enabled = b; draw(); this }
|
||||
def getGlyph = label;
|
||||
final def mouseDown(p: Geom.Point): unit =
|
||||
if (enabled) doit() else System.out.println("button is disabled");
|
||||
|
||||
/* deferred method to be specified by client */
|
||||
def doit(): unit;
|
||||
}
|
||||
}
|
||||
|
||||
object GUIClient {
|
||||
|
||||
class Application {
|
||||
def quit() = System.out.println("application exited");
|
||||
}
|
||||
|
||||
class QuitButton (scr: Screen, p: Geom.Point, name: String, a: Application)
|
||||
extends GUI.Button(scr, p, name) {
|
||||
def doit(): unit = a.quit();
|
||||
}
|
||||
|
||||
def main(args: Array[String]) = {
|
||||
val b = new QuitButton(
|
||||
DummyScreen, Geom.Point(1, 1), "quit", new Application);
|
||||
b.draw();
|
||||
b.enable(true).mouseDown(Geom.Point(1, 2));
|
||||
}
|
||||
}
|
||||
|
||||
object Geom {
|
||||
trait Shape;
|
||||
case class Point(x: int, y: int) extends Shape;
|
||||
case class Rectangle(ll: Point, ur: Point) extends Shape {
|
||||
def inset(delta: int) =
|
||||
Rectangle(Point(ll.x - delta, ll.y - delta), Point(ur.x + delta, ur.y + delta));
|
||||
}
|
||||
}
|
||||
|
||||
object Color {
|
||||
type Color = int;
|
||||
val black = 0x000000;
|
||||
val grey = 0x808080;
|
||||
}
|
||||
|
||||
trait Screen {
|
||||
type Color = int;
|
||||
def drawRect(r: Geom.Rectangle, c: Color): unit;
|
||||
def fillRect(r: Geom.Rectangle, c: Color): unit;
|
||||
}
|
||||
|
||||
object DummyScreen extends Screen {
|
||||
def drawRect(r: Geom.Rectangle, c: Color): unit =
|
||||
System.out.println("draw " + r + " with " + c);
|
||||
def fillRect(r: Geom.Rectangle, c: Color): unit =
|
||||
System.out.println("fill " + r + " with " + c);
|
||||
}
|
||||
|
||||
object GUI {
|
||||
|
||||
object Controller {
|
||||
def addMouseCtl(c: MouseCtl) = ()
|
||||
}
|
||||
|
||||
trait Glyph {
|
||||
def getRect: Geom.Rectangle;
|
||||
def setLoc(p: Geom.Point): unit;
|
||||
def draw() = System.out.println("draw " + this);
|
||||
}
|
||||
|
||||
class Label(scr: Screen, p: Geom.Point, name: String) extends Glyph {
|
||||
private var origin = p;
|
||||
def getRect = Geom.Rectangle(origin, origin).inset(10);
|
||||
def setLoc(p: Geom.Point) = { origin = p }
|
||||
}
|
||||
|
||||
trait Ctl {
|
||||
def getGlyph: Glyph;
|
||||
def enable(b: Boolean): this.type;
|
||||
}
|
||||
|
||||
trait MouseCtl with Ctl {
|
||||
def mouseDown(p: Geom.Point): unit;
|
||||
}
|
||||
|
||||
abstract class Button(scr: Screen, p: Geom.Point, name: String)
|
||||
extends Glyph with MouseCtl {
|
||||
var enabled: boolean = false;
|
||||
val label = new Label(scr, p, name);
|
||||
|
||||
/* Glyph methods */
|
||||
override def draw(): unit = {
|
||||
if (enabled) scr.drawRect(getRect, Color.black)
|
||||
else scr.fillRect(getRect, Color.grey);
|
||||
label.draw();
|
||||
}
|
||||
def setLoc(p: Geom.Point) = label.setLoc(p);
|
||||
def getRect = label.getRect.inset(-2);
|
||||
|
||||
/* Ctl methods */
|
||||
def enable(b: boolean): this.type = { enabled = b; draw(); this }
|
||||
def getGlyph = label;
|
||||
final def mouseDown(p: Geom.Point): unit =
|
||||
if (enabled) doit() else System.out.println("button is disabled");
|
||||
|
||||
/* deferred method to be specified by client */
|
||||
def doit(): unit;
|
||||
}
|
||||
}
|
||||
|
||||
object GUIClient {
|
||||
|
||||
class Application {
|
||||
def quit() = System.out.println("application exited");
|
||||
}
|
||||
|
||||
class QuitButton (scr: Screen, p: Geom.Point, name: String, a: Application)
|
||||
extends GUI.Button(scr, p, name) {
|
||||
def doit(): unit = a.quit();
|
||||
}
|
||||
|
||||
def main(args: Array[String]) = {
|
||||
val b = new QuitButton(
|
||||
DummyScreen, Geom.Point(1, 1), "quit", new Application);
|
||||
b.draw();
|
||||
b.enable(true).mouseDown(Geom.Point(1, 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package mixins;
|
||||
abstract class Super {
|
||||
def foo: int;
|
||||
}
|
||||
abstract class Mixin extends Super {
|
||||
abstract override def foo = super.foo;
|
||||
}
|
||||
class Sub extends Super with Mixin {
|
||||
override def foo: int = 1;
|
||||
}
|
||||
abstract class Mixin1 extends Mixin {
|
||||
abstract override def foo = super.foo;
|
||||
}
|
||||
abstract class Base0 extends Super with Mixin {
|
||||
}
|
||||
class Base extends Sub with Mixin1 {
|
||||
}
|
||||
package mixins;
|
||||
abstract class Super {
|
||||
def foo: int;
|
||||
}
|
||||
abstract class Mixin extends Super {
|
||||
abstract override def foo = super.foo;
|
||||
}
|
||||
class Sub extends Super with Mixin {
|
||||
override def foo: int = 1;
|
||||
}
|
||||
abstract class Mixin1 extends Mixin {
|
||||
abstract override def foo = super.foo;
|
||||
}
|
||||
abstract class Base0 extends Super with Mixin {
|
||||
}
|
||||
class Base extends Sub with Mixin1 {
|
||||
}
|
||||
|
|
|
@ -1,138 +1,138 @@
|
|||
304.scala
|
||||
A.scala
|
||||
List1.scala
|
||||
MailBox.scala
|
||||
S1.scala
|
||||
S3.scala
|
||||
S5.scala
|
||||
S8.scala
|
||||
X.scala
|
||||
Z.scala
|
||||
abstract.scala
|
||||
aliases.scala
|
||||
arrays2.scala
|
||||
attributes.scala
|
||||
bug082.scala
|
||||
bug1.scala
|
||||
bug115.scala
|
||||
bug116.scala
|
||||
bug119.scala
|
||||
bug121.scala
|
||||
bug124.scala
|
||||
bug151.scala
|
||||
bug159.scala
|
||||
bug160.scala
|
||||
bug17.scala
|
||||
bug175.scala
|
||||
bug177.scala
|
||||
bug183.scala
|
||||
bug193.scala
|
||||
bug2.scala
|
||||
bug20.scala
|
||||
bug201.scala
|
||||
bug204.scala
|
||||
bug210.scala
|
||||
bug211.scala
|
||||
bug229.scala
|
||||
bug245.scala
|
||||
bug267.scala
|
||||
bug287.scala
|
||||
bug289.scala
|
||||
bug29.scala
|
||||
bug295.scala
|
||||
bug30.scala
|
||||
bug304.scala
|
||||
bug31.scala
|
||||
bug318.scala
|
||||
bug32.scala
|
||||
bug342.scala
|
||||
bug348plus.scala
|
||||
bug359.scala
|
||||
bug36.scala
|
||||
bug360.scala
|
||||
bug361.scala
|
||||
bug372.scala
|
||||
bug39.scala
|
||||
bug49.scala
|
||||
bug53.scala
|
||||
bug54.scala
|
||||
bug61.scala
|
||||
bug64.scala
|
||||
bug66.scala
|
||||
bug68.scala
|
||||
bug69.scala
|
||||
bug76.scala
|
||||
bug81.scala
|
||||
bug91.scala
|
||||
bug93.scala
|
||||
cls.scala
|
||||
cls1.scala
|
||||
clsrefine.scala
|
||||
compile.scala
|
||||
compound.scala
|
||||
constfold.scala
|
||||
eta.scala
|
||||
expressions-current.scala
|
||||
gui.scala
|
||||
imports.scala
|
||||
infer.scala
|
||||
infer2.scala
|
||||
lambda.scala
|
||||
lambdalift.scala
|
||||
lambdalift1.scala
|
||||
localmodules.scala
|
||||
matthias1.scala
|
||||
matthias3.scala
|
||||
matthias4.scala
|
||||
matthias5.scala
|
||||
maxim1.scala
|
||||
michel1.scala
|
||||
michel2.scala
|
||||
michel3.scala
|
||||
michel4.scala
|
||||
michel5.scala
|
||||
michel6.scala
|
||||
mixins.scala
|
||||
modules.scala
|
||||
modules1.scala
|
||||
moduletrans.scala
|
||||
nested.scala
|
||||
null.scala
|
||||
orderedpoints.scala
|
||||
override.scala
|
||||
partialfun.scala
|
||||
patterns.scala
|
||||
patterns1.scala
|
||||
patterns2.scala
|
||||
patterns3.scala
|
||||
philippe1.scala
|
||||
philippe2.scala
|
||||
philippe3.scala
|
||||
philippe4.scala
|
||||
pmbug.scala
|
||||
propagate.scala
|
||||
rebind.scala
|
||||
refine.scala
|
||||
reftest.scala
|
||||
scoping1.scala
|
||||
scoping2.scala
|
||||
scoping3.scala
|
||||
seqtest2.scala
|
||||
simplelists.scala
|
||||
stable.scala
|
||||
strings.scala
|
||||
test1.scala
|
||||
test2.scala
|
||||
test4.scala
|
||||
test4a.scala
|
||||
test4refine.scala
|
||||
test5.scala
|
||||
test5refine.scala
|
||||
testcast.scala
|
||||
thistype.scala
|
||||
thistypes.scala
|
||||
traits.scala
|
||||
valdefs.scala
|
||||
viewtest1.scala
|
||||
viewtest2.scala
|
||||
viewtest3.scala
|
||||
304.scala
|
||||
A.scala
|
||||
List1.scala
|
||||
MailBox.scala
|
||||
S1.scala
|
||||
S3.scala
|
||||
S5.scala
|
||||
S8.scala
|
||||
X.scala
|
||||
Z.scala
|
||||
abstract.scala
|
||||
aliases.scala
|
||||
arrays2.scala
|
||||
attributes.scala
|
||||
bug082.scala
|
||||
bug1.scala
|
||||
bug115.scala
|
||||
bug116.scala
|
||||
bug119.scala
|
||||
bug121.scala
|
||||
bug124.scala
|
||||
bug151.scala
|
||||
bug159.scala
|
||||
bug160.scala
|
||||
bug17.scala
|
||||
bug175.scala
|
||||
bug177.scala
|
||||
bug183.scala
|
||||
bug193.scala
|
||||
bug2.scala
|
||||
bug20.scala
|
||||
bug201.scala
|
||||
bug204.scala
|
||||
bug210.scala
|
||||
bug211.scala
|
||||
bug229.scala
|
||||
bug245.scala
|
||||
bug267.scala
|
||||
bug287.scala
|
||||
bug289.scala
|
||||
bug29.scala
|
||||
bug295.scala
|
||||
bug30.scala
|
||||
bug304.scala
|
||||
bug31.scala
|
||||
bug318.scala
|
||||
bug32.scala
|
||||
bug342.scala
|
||||
bug348plus.scala
|
||||
bug359.scala
|
||||
bug36.scala
|
||||
bug360.scala
|
||||
bug361.scala
|
||||
bug372.scala
|
||||
bug39.scala
|
||||
bug49.scala
|
||||
bug53.scala
|
||||
bug54.scala
|
||||
bug61.scala
|
||||
bug64.scala
|
||||
bug66.scala
|
||||
bug68.scala
|
||||
bug69.scala
|
||||
bug76.scala
|
||||
bug81.scala
|
||||
bug91.scala
|
||||
bug93.scala
|
||||
cls.scala
|
||||
cls1.scala
|
||||
clsrefine.scala
|
||||
compile.scala
|
||||
compound.scala
|
||||
constfold.scala
|
||||
eta.scala
|
||||
expressions-current.scala
|
||||
gui.scala
|
||||
imports.scala
|
||||
infer.scala
|
||||
infer2.scala
|
||||
lambda.scala
|
||||
lambdalift.scala
|
||||
lambdalift1.scala
|
||||
localmodules.scala
|
||||
matthias1.scala
|
||||
matthias3.scala
|
||||
matthias4.scala
|
||||
matthias5.scala
|
||||
maxim1.scala
|
||||
michel1.scala
|
||||
michel2.scala
|
||||
michel3.scala
|
||||
michel4.scala
|
||||
michel5.scala
|
||||
michel6.scala
|
||||
mixins.scala
|
||||
modules.scala
|
||||
modules1.scala
|
||||
moduletrans.scala
|
||||
nested.scala
|
||||
null.scala
|
||||
orderedpoints.scala
|
||||
override.scala
|
||||
partialfun.scala
|
||||
patterns.scala
|
||||
patterns1.scala
|
||||
patterns2.scala
|
||||
patterns3.scala
|
||||
philippe1.scala
|
||||
philippe2.scala
|
||||
philippe3.scala
|
||||
philippe4.scala
|
||||
pmbug.scala
|
||||
propagate.scala
|
||||
rebind.scala
|
||||
refine.scala
|
||||
reftest.scala
|
||||
scoping1.scala
|
||||
scoping2.scala
|
||||
scoping3.scala
|
||||
seqtest2.scala
|
||||
simplelists.scala
|
||||
stable.scala
|
||||
strings.scala
|
||||
test1.scala
|
||||
test2.scala
|
||||
test4.scala
|
||||
test4a.scala
|
||||
test4refine.scala
|
||||
test5.scala
|
||||
test5refine.scala
|
||||
testcast.scala
|
||||
thistype.scala
|
||||
thistypes.scala
|
||||
traits.scala
|
||||
valdefs.scala
|
||||
viewtest1.scala
|
||||
viewtest2.scala
|
||||
viewtest3.scala
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
package test;
|
||||
|
||||
class Point1(x: int) extends Object with Ordered[Point1] {
|
||||
val xCoord = x;
|
||||
def compareTo [b >: Point1 <% Ordered[b]](that: b): int = that match {
|
||||
case that1: Point1 => this.xCoord.compareTo(that1.xCoord)
|
||||
case _ => -that.compareTo(this)
|
||||
}
|
||||
}
|
||||
class Point2(x: int, y: int) extends Point1(x) with Ordered[Point2] {}
|
||||
/*
|
||||
val yCoord = y;
|
||||
override def compareTo [b >: Point2 <% Ordered[b]](that: b): int = that match {
|
||||
case that1: Point2 =>
|
||||
val r = super.compareTo(that1);
|
||||
if (r == 0) this.yCoord.compareTo(that1.yCoord) else r
|
||||
case _ => -that.compareTo(this)
|
||||
}
|
||||
}
|
||||
object Test extends Application {
|
||||
val p1 = new Point1(1);
|
||||
val q1 = new Point1(2);
|
||||
System.out.println(p1 < q1);
|
||||
val p2 = new Point2(1, 2);
|
||||
val q2 = new Point2(1, 3);
|
||||
System.out.println(p2 < q2);
|
||||
System.out.println(p1 < q2);
|
||||
System.out.println(p2 < q1);
|
||||
}
|
||||
*/
|
||||
package test;
|
||||
|
||||
class Point1(x: int) extends Object with Ordered[Point1] {
|
||||
val xCoord = x;
|
||||
def compareTo [b >: Point1 <% Ordered[b]](that: b): int = that match {
|
||||
case that1: Point1 => this.xCoord.compareTo(that1.xCoord)
|
||||
case _ => -that.compareTo(this)
|
||||
}
|
||||
}
|
||||
class Point2(x: int, y: int) extends Point1(x) with Ordered[Point2] {}
|
||||
/*
|
||||
val yCoord = y;
|
||||
override def compareTo [b >: Point2 <% Ordered[b]](that: b): int = that match {
|
||||
case that1: Point2 =>
|
||||
val r = super.compareTo(that1);
|
||||
if (r == 0) this.yCoord.compareTo(that1.yCoord) else r
|
||||
case _ => -that.compareTo(this)
|
||||
}
|
||||
}
|
||||
object Test extends Application {
|
||||
val p1 = new Point1(1);
|
||||
val q1 = new Point1(2);
|
||||
System.out.println(p1 < q1);
|
||||
val p2 = new Point2(1, 2);
|
||||
val q2 = new Point2(1, 3);
|
||||
System.out.println(p2 < q2);
|
||||
System.out.println(p1 < q2);
|
||||
System.out.println(p2 < q1);
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
scalac -prompt A.scala;
|
||||
scalac -prompt IntSet.scala;
|
||||
scalac -prompt List1.scala;
|
||||
scalac -prompt Rational.scala;
|
||||
scalac -prompt X.scala;
|
||||
scalac -prompt Y.scala;
|
||||
scalac -prompt Z.scala;
|
||||
scalac -prompt abstract.scala;
|
||||
scalac -prompt cls.scala;
|
||||
scalac -prompt cls1.scala;
|
||||
scalac -prompt clsrefine.scala;
|
||||
scalac -prompt cours1.scala;
|
||||
scalac -prompt cours2.scala;
|
||||
scalac -prompt cours2a.scala;
|
||||
scalac -prompt cours2b.scala;
|
||||
scalac -prompt cours2c.scala;
|
||||
scalac -prompt eta.scala;
|
||||
scalac -prompt exceptions.scala;
|
||||
scalac -prompt imports.scala;
|
||||
scalac -prompt lambda.scala;
|
||||
scalac -prompt lambdalift.scala;
|
||||
scalac -prompt lambdalift1.scala;
|
||||
scalac -prompt matthias1.scala;
|
||||
scalac -prompt maxim1.scala;
|
||||
scalac -prompt michel1.scala;
|
||||
scalac -prompt michel2.scala;
|
||||
scalac -prompt michel3.scala;
|
||||
scalac -prompt michel4.scala;
|
||||
scalac -prompt michel5.scala;
|
||||
scalac -prompt modules.scala;
|
||||
scalac -prompt modules1.scala;
|
||||
scalac -prompt moduletrans.scala;
|
||||
scalac -prompt nested.scala;
|
||||
scalac -prompt override.scala;
|
||||
scalac -prompt patterns.scala;
|
||||
scalac -prompt patterns2.scala;
|
||||
scalac -prompt philippe1.scala;
|
||||
scalac -prompt philippe2.scala;
|
||||
scalac -prompt reftest.scala;
|
||||
scalac -prompt sort1.scala;
|
||||
scalac -prompt sqrt.scala;
|
||||
scalac -prompt stable.scala;
|
||||
scalac -prompt strings.scala;
|
||||
scalac -prompt test1.scala;
|
||||
scalac -prompt test2.scala;
|
||||
scalac -prompt test4.scala;
|
||||
scalac -prompt test4a.scala;
|
||||
scalac -prompt test4refine.scala;
|
||||
scalac -prompt test5.scala;
|
||||
scalac -prompt test5refine.scala;
|
||||
scalac -prompt A.scala;
|
||||
scalac -prompt IntSet.scala;
|
||||
scalac -prompt List1.scala;
|
||||
scalac -prompt Rational.scala;
|
||||
scalac -prompt X.scala;
|
||||
scalac -prompt Y.scala;
|
||||
scalac -prompt Z.scala;
|
||||
scalac -prompt abstract.scala;
|
||||
scalac -prompt cls.scala;
|
||||
scalac -prompt cls1.scala;
|
||||
scalac -prompt clsrefine.scala;
|
||||
scalac -prompt cours1.scala;
|
||||
scalac -prompt cours2.scala;
|
||||
scalac -prompt cours2a.scala;
|
||||
scalac -prompt cours2b.scala;
|
||||
scalac -prompt cours2c.scala;
|
||||
scalac -prompt eta.scala;
|
||||
scalac -prompt exceptions.scala;
|
||||
scalac -prompt imports.scala;
|
||||
scalac -prompt lambda.scala;
|
||||
scalac -prompt lambdalift.scala;
|
||||
scalac -prompt lambdalift1.scala;
|
||||
scalac -prompt matthias1.scala;
|
||||
scalac -prompt maxim1.scala;
|
||||
scalac -prompt michel1.scala;
|
||||
scalac -prompt michel2.scala;
|
||||
scalac -prompt michel3.scala;
|
||||
scalac -prompt michel4.scala;
|
||||
scalac -prompt michel5.scala;
|
||||
scalac -prompt modules.scala;
|
||||
scalac -prompt modules1.scala;
|
||||
scalac -prompt moduletrans.scala;
|
||||
scalac -prompt nested.scala;
|
||||
scalac -prompt override.scala;
|
||||
scalac -prompt patterns.scala;
|
||||
scalac -prompt patterns2.scala;
|
||||
scalac -prompt philippe1.scala;
|
||||
scalac -prompt philippe2.scala;
|
||||
scalac -prompt reftest.scala;
|
||||
scalac -prompt sort1.scala;
|
||||
scalac -prompt sqrt.scala;
|
||||
scalac -prompt stable.scala;
|
||||
scalac -prompt strings.scala;
|
||||
scalac -prompt test1.scala;
|
||||
scalac -prompt test2.scala;
|
||||
scalac -prompt test4.scala;
|
||||
scalac -prompt test4a.scala;
|
||||
scalac -prompt test4refine.scala;
|
||||
scalac -prompt test5.scala;
|
||||
scalac -prompt test5refine.scala;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
object Test {
|
||||
|
||||
class Ctl {
|
||||
def enable: this.type = { System.out.println("enable"); this }
|
||||
}
|
||||
|
||||
class MouseCtl extends Ctl {
|
||||
def mouseDown(x: int, y: int): unit = { System.out.println("mouse down"); }
|
||||
}
|
||||
|
||||
def main(args: Array[String]) =
|
||||
new MouseCtl().enable.mouseDown(1, 2);
|
||||
|
||||
}
|
||||
object Test {
|
||||
|
||||
class Ctl {
|
||||
def enable: this.type = { System.out.println("enable"); this }
|
||||
}
|
||||
|
||||
class MouseCtl extends Ctl {
|
||||
def mouseDown(x: int, y: int): unit = { System.out.println("mouse down"); }
|
||||
}
|
||||
|
||||
def main(args: Array[String]) =
|
||||
new MouseCtl().enable.mouseDown(1, 2);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
object Test {
|
||||
type Color = int;
|
||||
trait Shape {
|
||||
override def equals(other: Any) = true;
|
||||
}
|
||||
trait Bordered extends Shape {
|
||||
val thickness: int;
|
||||
override def equals(other: Any) = other match {
|
||||
case that: Bordered => this.thickness == that.thickness;
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
trait Colored extends Shape {
|
||||
val color: Color;
|
||||
override def equals(other: Any) = other match {
|
||||
case that: Colored => this.color == that.color;
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
trait BorderedColoredShape extends Shape with Bordered with Colored {
|
||||
override def equals(other: Any) = other match {
|
||||
case that: BorderedColoredShape =>
|
||||
super.equals(that) &&
|
||||
super[Bordered].equals(that) &&
|
||||
super[Colored].equals(that)
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
|
||||
val bcs1 = new BorderedColoredShape {
|
||||
val thickness = 1;
|
||||
val color = 0;
|
||||
}
|
||||
val bcs2 = new BorderedColoredShape {
|
||||
val thickness = 2;
|
||||
val color = 0;
|
||||
}
|
||||
System.out.println(bcs1 == bcs1);
|
||||
System.out.println(bcs1 == bcs2);
|
||||
}
|
||||
|
||||
|
||||
object Test {
|
||||
type Color = int;
|
||||
trait Shape {
|
||||
override def equals(other: Any) = true;
|
||||
}
|
||||
trait Bordered extends Shape {
|
||||
val thickness: int;
|
||||
override def equals(other: Any) = other match {
|
||||
case that: Bordered => this.thickness == that.thickness;
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
trait Colored extends Shape {
|
||||
val color: Color;
|
||||
override def equals(other: Any) = other match {
|
||||
case that: Colored => this.color == that.color;
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
trait BorderedColoredShape extends Shape with Bordered with Colored {
|
||||
override def equals(other: Any) = other match {
|
||||
case that: BorderedColoredShape =>
|
||||
super.equals(that) &&
|
||||
super[Bordered].equals(that) &&
|
||||
super[Colored].equals(that)
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
|
||||
val bcs1 = new BorderedColoredShape {
|
||||
val thickness = 1;
|
||||
val color = 0;
|
||||
}
|
||||
val bcs2 = new BorderedColoredShape {
|
||||
val thickness = 2;
|
||||
val color = 0;
|
||||
}
|
||||
System.out.println(bcs1 == bcs1);
|
||||
System.out.println(bcs1 == bcs2);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue