summaryrefslogtreecommitdiff
path: root/sources/scalac/atree
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-11-05 17:06:39 +0000
committerpaltherr <paltherr@epfl.ch>2003-11-05 17:06:39 +0000
commit4063ce9617089a9f15c8783328df5fb7a2bb38df (patch)
tree51feaaa505c8878792b2c14b7e239c7ef6c36f14 /sources/scalac/atree
parent653445deeb91cc8a8cd35a40cb9b7736df613d10 (diff)
downloadscala-4063ce9617089a9f15c8783328df5fb7a2bb38df.tar.gz
scala-4063ce9617089a9f15c8783328df5fb7a2bb38df.tar.bz2
scala-4063ce9617089a9f15c8783328df5fb7a2bb38df.zip
- Added atree/AFunction.java
Diffstat (limited to 'sources/scalac/atree')
-rw-r--r--sources/scalac/atree/AFunction.java31
-rw-r--r--sources/scalac/atree/ATreePrinter.java19
2 files changed, 50 insertions, 0 deletions
diff --git a/sources/scalac/atree/AFunction.java b/sources/scalac/atree/AFunction.java
new file mode 100644
index 0000000000..55dee42179
--- /dev/null
+++ b/sources/scalac/atree/AFunction.java
@@ -0,0 +1,31 @@
+/* ____ ____ ____ ____ ______ *\
+** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
+** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
+** /_____/\____/\___/\____/____/ **
+\* */
+
+// $Id$
+
+package scalac.atree;
+
+import scalac.symtab.Symbol;
+
+/** This class represents an attributed function reference. */
+public class AFunction {
+
+ //########################################################################
+ // Public Cases
+
+ public case Method(ACode object, Symbol method, boolean isStatic);
+ public case Primitive(APrimitive primitive);
+
+ //########################################################################
+ // Public Methods
+
+ /** Returns a string representation of this function. */
+ public String toString() {
+ return new ATreePrinter().printFunction(this).toString();
+ }
+
+ //########################################################################
+}
diff --git a/sources/scalac/atree/ATreePrinter.java b/sources/scalac/atree/ATreePrinter.java
index 26ebdd46f5..2371be4702 100644
--- a/sources/scalac/atree/ATreePrinter.java
+++ b/sources/scalac/atree/ATreePrinter.java
@@ -368,6 +368,25 @@ public class ATreePrinter {
}
}
+ /** Prints the function. */
+ public ATreePrinter printFunction(AFunction function) {
+ switch (function) {
+ case Method(This(Symbol clasz), Symbol method, true):
+ printSymbol(clasz).print('.').print("super").print('.');
+ return printSymbol(method);
+ case Method(Void, Symbol method, true):
+ return printSymbol(method.owner()).print('.').printSymbol(method);
+ case Method(ACode object, Symbol method, boolean isStatic):
+ printCode(object).print('.');
+ if (isStatic) print("<static>").space();
+ return printSymbol(method);
+ case Primitive(APrimitive primitive):
+ return printPrimitive(primitive);
+ default:
+ throw Debug.abort("unknown case", function);
+ }
+ }
+
/** Prints the primitive. */
public ATreePrinter printPrimitive(APrimitive primitive) {
switch (primitive) {