summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-03-13 11:00:02 +0000
committerMartin Odersky <odersky@gmail.com>2003-03-13 11:00:02 +0000
commit766aece3147dcd211b5e46c92df2552ff5b87892 (patch)
tree95e6c3981510e2d2cf697f393323712b73991727 /sources
parentb078b78ebdb3b636b4006e478fca0a5d5b629a7c (diff)
downloadscala-766aece3147dcd211b5e46c92df2552ff5b87892.tar.gz
scala-766aece3147dcd211b5e46c92df2552ff5b87892.tar.bz2
scala-766aece3147dcd211b5e46c92df2552ff5b87892.zip
*** empty log message ***
Diffstat (limited to 'sources')
-rw-r--r--sources/examples/auction.scala3
-rw-r--r--sources/scala/List.scala2
-rw-r--r--sources/scala/Seq.scala8
-rw-r--r--sources/scalac/typechecker/Analyzer.java11
4 files changed, 19 insertions, 5 deletions
diff --git a/sources/examples/auction.scala b/sources/examples/auction.scala
index 9f96dc2984..2d00fca880 100644
--- a/sources/examples/auction.scala
+++ b/sources/examples/auction.scala
@@ -21,7 +21,8 @@ class Auction(seller: Actor, minBid: Int, closing: Date) extends Actor() {
val timeToShutdown = 36000000; // msec
val bidIncrement = 10;
- override def run() {
+ override def run() = execute;
+ def execute {
var maxBid = minBid - bidIncrement;
var maxBidder: Actor = _;
var running = true;
diff --git a/sources/scala/List.scala b/sources/scala/List.scala
index af9305b7fc..66f6cea807 100644
--- a/sources/scala/List.scala
+++ b/sources/scala/List.scala
@@ -127,6 +127,8 @@ trait List[a] extends Seq[a] {
* @return the element at position <code>n</code> in this list.
* @throws java.lang.RuntimeException if the list is too short.
*/
+ def apply(n: Int) = drop(n).head;
+
def at(n: Int) = drop(n).head;
/** Returns the list resulting from applying the given function <code>f</code> to each
diff --git a/sources/scala/Seq.scala b/sources/scala/Seq.scala
index aa6b7e32e0..6eb95d3318 100644
--- a/sources/scala/Seq.scala
+++ b/sources/scala/Seq.scala
@@ -1,7 +1,11 @@
package scala;
-trait Seq[a] {
+trait Seq[a] extends Function1[Int, a] {
def length: Int;
def elements: Iterator[a];
- def at(index: Int): a
+ def apply(index: Int): a;
+
+ /** @deprecated
+ */
+ def at(index: Int): a;
}
diff --git a/sources/scalac/typechecker/Analyzer.java b/sources/scalac/typechecker/Analyzer.java
index 38e8eb2b16..5f90933576 100644
--- a/sources/scalac/typechecker/Analyzer.java
+++ b/sources/scalac/typechecker/Analyzer.java
@@ -1094,10 +1094,16 @@ public class Analyzer extends Transformer implements Modifiers, Kinds {
return error(tree.pos, "not found: " + decode(name));
} else {
sym.flags |= ACCESSED;
- if (sym.owner().kind == CLASS)
+ if (sym.owner().kind == CLASS) {
pre = nextcontext.enclClass.owner.thisType();
- else
+ if (!sym.owner().isPackage()) {
+ tree = make.Select(
+ tree.pos, gen.mkStableId(tree.pos, pre), name);
+ //System.out.println(name + " :::> " + tree);//DEBUG
+ }
+ } else {
pre = Type.localThisType;
+ }
}
} else if (sym.kind != NONE && !sym.isPreloaded()) {
return error(tree.pos,
@@ -1867,6 +1873,7 @@ public class Analyzer extends Transformer implements Modifiers, Kinds {
new ValDef[][]{Tree.ExtValDef.EMPTY_ARRAY},
Tree.Empty,
templ);
+ //new TextTreePrinter().print(cd).println().end();//DEBUG
enterSym(cd);
cd = transform(cd);
Symbol clazz = cd.symbol();