summaryrefslogtreecommitdiff
path: root/sources/scalac
diff options
context:
space:
mode:
authorschinz <schinz@epfl.ch>2003-05-14 13:00:43 +0000
committerschinz <schinz@epfl.ch>2003-05-14 13:00:43 +0000
commitb9ff893fdfcca3f97c5c953ba46461cf623c4b14 (patch)
tree4eed3cc8c0cb82f09627e66ca7ba7b9f55187cb7 /sources/scalac
parentd5f8a13cd7ae79bf2de9543f319e3165c728f972 (diff)
downloadscala-b9ff893fdfcca3f97c5c953ba46461cf623c4b14.tar.gz
scala-b9ff893fdfcca3f97c5c953ba46461cf623c4b14.tar.bz2
scala-b9ff893fdfcca3f97c5c953ba46461cf623c4b14.zip
- modified mkParentConstr(s) to make it possibl...
- modified mkParentConstr(s) to make it possible to pass arguments to the parent constructor
Diffstat (limited to 'sources/scalac')
-rw-r--r--sources/scalac/ast/TreeGen.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/sources/scalac/ast/TreeGen.java b/sources/scalac/ast/TreeGen.java
index 5d11c4b1f1..12c6926769 100644
--- a/sources/scalac/ast/TreeGen.java
+++ b/sources/scalac/ast/TreeGen.java
@@ -179,27 +179,37 @@ public class TreeGen implements Kinds, Modifiers {
/** Build a tree to be used as a base class constructor for a template.
*/
- public Tree mkParentConstr(int pos, Type parentType) {
+ public Tree mkParentConstr(int pos, Type parentType, Tree[] parentArgs) {
switch (parentType) {
case TypeRef(Type pre, Symbol sym, Type[] args):
Tree ref = mkRef(pos, pre, sym.constructor());
Tree constr = (args.length == 0) ? ref
: TypeApply(ref, mkTypes(sym.pos, args));
- return Apply(constr, Tree.EMPTY_ARRAY);
+ return Apply(constr, parentArgs);
default:
throw global.fail("invalid parent type", parentType);
}
}
+ public Tree mkParentConstr(int pos, Type parentType) {
+ return mkParentConstr(pos, parentType, Tree.EMPTY_ARRAY);
+ }
+
/** Build an array of trees to be used as base classes for a template.
*/
- public Tree[] mkParentConstrs(int pos, Type[] parents) {
+ public Tree[] mkParentConstrs(int pos, Type[] parents, Tree[][] parentArgs) {
Tree[] constrs = new Tree[parents.length];
for (int i = 0; i < parents.length; ++i)
- constrs[i] = mkParentConstr(pos, parents[i]);
+ constrs[i] = (parentArgs == null ?
+ mkParentConstr(pos, parents[i])
+ : mkParentConstr(pos, parents[i], parentArgs[i]));
return constrs;
}
+ public Tree[] mkParentConstrs(int pos, Type[] parents) {
+ return mkParentConstrs(pos, parents, null);
+ }
+
/** Build parameter sections corresponding to type.
*/
public ValDef[][] mkParams(int pos, Type type) {
@@ -257,7 +267,7 @@ public class TreeGen implements Kinds, Modifiers {
.setSymbol(sym).setType(definitions.UNIT_TYPE);
}
- public Tree TypeDef(Symbol sym) {
+ public TypeDef TypeDef(Symbol sym) {
return TypeDef(sym.pos, sym);
}