diff options
author | paltherr <paltherr@epfl.ch> | 2003-04-16 13:45:19 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-04-16 13:45:19 +0000 |
commit | 84de17250fd622fb644dfed0bb49c0c9516e846e (patch) | |
tree | 38c6f0b2b9393678e516134167d009f662d3557a /sources/meta | |
parent | faf079fc790332aa63519d1817f63b95bc425679 (diff) | |
download | scala-84de17250fd622fb644dfed0bb49c0c9516e846e.tar.gz scala-84de17250fd622fb644dfed0bb49c0c9516e846e.tar.bz2 scala-84de17250fd622fb644dfed0bb49c0c9516e846e.zip |
- Added Function expander and template
Diffstat (limited to 'sources/meta')
-rw-r--r-- | sources/meta/scala/MetaFunction.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/sources/meta/scala/MetaFunction.java b/sources/meta/scala/MetaFunction.java new file mode 100644 index 0000000000..3bcf4cc4c6 --- /dev/null +++ b/sources/meta/scala/MetaFunction.java @@ -0,0 +1,59 @@ +/* ____ ____ ____ ____ ______ *\ +** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala ** +** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL ** +** /_____/\____/\___/\____/____/ ** +\* */ + +// $Id$ + +package meta.scala; + +import meta.java.AbstractJavaExpander; + +public class MetaFunction extends AbstractJavaExpander { + + //######################################################################## + // Public Fields + + public final int arity; + + //######################################################################## + // Public Constructors + + public MetaFunction(int arity) { + this.arity = arity; + } + + //######################################################################## + // Public Methods + + public String getTargetBaseName() { + return super.getTargetBaseName() + arity; + } + + public void printn() { + writer.print(arity); + } + + public void printClassScalaTParams() { + for (int i = 0; i < arity; i++) + writer.print("?A").print(i).print(", "); + writer.print("?R"); + } + + public void printApplyScalaSignature() { + writer.print("("); + for (int i = 0; i < arity; i++) + writer.print("?A").print(i).print(", "); + writer.print(") ?R"); + } + + public void printApplyJavaVParams() { + for (int i = 0; i < arity; i++) { + if (i > 0) writer.print(", "); + writer.print("java.lang.Object a").print(i); + } + } + + //######################################################################## +} |