summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-09-07 10:53:24 +0000
committerpaltherr <paltherr@epfl.ch>2003-09-07 10:53:24 +0000
commit97d8a84895c9fefeec108668d555f55eea665eb4 (patch)
tree3980eadb644e5eebc0859c9dedfc3ff8600b534a /sources
parent7e8533ec4275548c8fe13d78f8872b932a806956 (diff)
downloadscala-97d8a84895c9fefeec108668d555f55eea665eb4.tar.gz
scala-97d8a84895c9fefeec108668d555f55eea665eb4.tar.bz2
scala-97d8a84895c9fefeec108668d555f55eea665eb4.zip
- Added method mkIdents
- Added method mkTypeIdents - Removed method mkTypeIdent without pos - Added methods mkApply
Diffstat (limited to 'sources')
-rw-r--r--sources/scalac/ast/TreeGen.java47
1 files changed, 42 insertions, 5 deletions
diff --git a/sources/scalac/ast/TreeGen.java b/sources/scalac/ast/TreeGen.java
index 7ffcf347ea..d6f85f15f3 100644
--- a/sources/scalac/ast/TreeGen.java
+++ b/sources/scalac/ast/TreeGen.java
@@ -116,7 +116,27 @@ public class TreeGen implements Kinds, Modifiers, TypeTags {
}
}
- /** Build and attribute type ident node with given symbol.
+ /** Build and attribute ident nodes with given symbols.
+ */
+ public Tree[] mkIdents(int pos, Symbol[] syms) {
+ if (syms.length == 0) return Tree.EMPTY_ARRAY;
+ Tree[] trees = new Tree[syms.length];
+ for (int i = 0; i < trees.length; i++)
+ trees[i] = Ident(pos, syms[i]);
+ return trees;
+ }
+
+ /** Build and attribute type idents with given symbols.
+ */
+ public Tree[] mkTypeIdents(int pos, Symbol[] syms) {
+ if (syms.length == 0) return Tree.EMPTY_ARRAY;
+ Tree[] trees = new Tree[syms.length];
+ for (int i = 0; i < trees.length; i++)
+ trees[i] = mkTypeIdent(pos, syms[i]);
+ return trees;
+ }
+
+ /** Build and attribute type ident with given symbol.
*/
public Tree mkTypeIdent(int pos, Symbol sym) {
assert sym.kind == TYPE: Debug.show(sym);
@@ -124,10 +144,6 @@ public class TreeGen implements Kinds, Modifiers, TypeTags {
return mkType(pos, sym.nextType());
}
- public Tree mkTypeIdent(Symbol sym) {
- return Ident(sym.pos, sym);
- }
-
/** Build and attribute tree corresponding to given type.
*/
public Tree mkType(int pos, Type type) {
@@ -416,6 +432,27 @@ public class TreeGen implements Kinds, Modifiers, TypeTags {
return New(pos, pre, clazz, Type.EMPTY_ARRAY, args);
}
+ /** Build application with given function, type args and value
+ * args.
+ */
+ public Tree mkApply(int pos, Tree fn, Type[] targs, Tree[] args) {
+ if (targs.length != 0) fn = TypeApply(pos, fn, mkTypes(pos, targs));
+ return Apply(pos, fn, args);
+ }
+
+ public Tree mkApply(Tree fn, Type[] targs, Tree[] args) {
+ return mkApply(fn.pos, fn, targs, args);
+ }
+
+ public Tree mkApply(int pos, Tree fn, Tree[] targs, Tree[] args) {
+ if (targs.length != 0) fn = TypeApply(pos, fn, targs);
+ return Apply(pos, fn, args);
+ }
+
+ public Tree mkApply(Tree fn, Tree[] targs, Tree[] args) {
+ return mkApply(fn.pos, fn, targs, args);
+ }
+
/** Build and attribute application node with given function
* and argument trees.
*/