summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-04-14 15:42:35 +0000
committerpaltherr <paltherr@epfl.ch>2003-04-14 15:42:35 +0000
commit46b0b6bad4742ca1b5ccd86136ccb70aa8d255da (patch)
treeeb61f42e7bc0ea77c24960c9f26b56d14d58080a
parent2c230e23ac52420e946a661380ea0276c8adef0e (diff)
downloadscala-46b0b6bad4742ca1b5ccd86136ccb70aa8d255da.tar.gz
scala-46b0b6bad4742ca1b5ccd86136ccb70aa8d255da.tar.bz2
scala-46b0b6bad4742ca1b5ccd86136ccb70aa8d255da.zip
- Added automatic generation of DefaultTreeFact...
- Added automatic generation of DefaultTreeFactory.java Added automatic - generation of TreeFactory.java
-rw-r--r--config/list/compiler.lst3
-rw-r--r--sources/meta/GenerateAll.java2
-rw-r--r--sources/scalac/ast/TreeCreator.java291
-rw-r--r--sources/scalac/ast/TreeFactory.java153
4 files changed, 4 insertions, 445 deletions
diff --git a/config/list/compiler.lst b/config/list/compiler.lst
index fe5a6ec9d4..906177b92d 100644
--- a/config/list/compiler.lst
+++ b/config/list/compiler.lst
@@ -19,7 +19,9 @@ ast/parser/SourceRepresentation.java
ast/parser/Sourcefile.java
ast/parser/TokenData.java
ast/parser/Tokens.java
+
ast/AbstractTreeCopyFactory.java
+ast/DefaultTreeFactory.java
ast/LazyTreeFactory.java
ast/StrictTreeFactory.java
ast/SubstTransformer.java
@@ -27,7 +29,6 @@ ast/Transformer.java
ast/Traverser.java
ast/Tree.java
ast/TreeCopyFactory.java
-ast/TreeCreator.java
ast/TreeFactory.java
ast/TreeGen.java
ast/TreeInfo.java
diff --git a/sources/meta/GenerateAll.java b/sources/meta/GenerateAll.java
index 841eb5c5d3..ca8a77824f 100644
--- a/sources/meta/GenerateAll.java
+++ b/sources/meta/GenerateAll.java
@@ -27,6 +27,8 @@ public class GenerateAll extends AbstractMain {
// Public Constants
public static final AbstractFileExpander[] expanders = {
+ new meta.scalac.ast.MetaTreeFactory(),
+ new meta.scalac.ast.MetaDefaultTreeFactory(),
};
//########################################################################
diff --git a/sources/scalac/ast/TreeCreator.java b/sources/scalac/ast/TreeCreator.java
deleted file mode 100644
index 3c4acc2956..0000000000
--- a/sources/scalac/ast/TreeCreator.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-** **
-** $Id$
-\* */
-
-package scalac.ast;
-
-import Tree.*;
-import scalac.util.Name;
-
-
-public class DefaultTreeFactory implements TreeFactory {
-
- public Tree Bad(int pos) {
- Tree t = new ExtBad();
- t.pos = pos;
- return t;
- }
-
- public Tree ClassDef(int pos,
- int mods,
- Name name,
- TypeDef[] tparams,
- ValDef[][] vparams,
- Tree tpe,
- Template impl) {
- Tree t = new ExtClassDef(mods, name, tparams, vparams, tpe, impl);
- t.pos = pos;
- return t;
- }
-
- public Tree PackageDef(int pos,
- Tree packaged,
- Template impl) {
- Tree t = new PackageDef(packaged, impl);
- t.pos = pos;
- return t;
- }
-
- public Tree ModuleDef(int pos,
- int mods,
- Name name,
- Tree tpe,
- Template body) {
- Tree t = new ExtModuleDef(mods, name, tpe, body);
- t.pos = pos;
- return t;
- }
-
- public Tree ValDef(int pos,
- int mods,
- Name name,
- Tree tpe,
- Tree rhs) {
- Tree t = new ExtValDef(mods, name, tpe, rhs);
- t.pos = pos;
- return t;
- }
-
- public Tree PatDef(int pos,
- int mods,
- Tree pat,
- Tree rhs) {
- Tree t = new PatDef(mods, pat, rhs);
- t.pos = pos;
- return t;
- }
-
- public Tree DefDef(int pos,
- int mods,
- Name name,
- TypeDef[] tparams,
- ValDef[][] vparams,
- Tree tpe,
- Tree rhs) {
- Tree t = new ExtDefDef(mods, name, tparams, vparams, tpe, rhs);
- t.pos = pos;
- return t;
- }
-
-
- public Tree TypeDef(int pos,
- int mods,
- Name name,
- Tree rhs) {
- Tree t = new ExtTypeDef(mods, name, rhs);
- t.pos = pos;
- return t;
- }
-
- public Tree Import(int pos,
- Tree expr,
- Name[] selectors) {
- Tree t = new ExtImport(expr, selectors);
- t.pos = pos;
- return t;
- }
-
- public CaseDef CaseDef(int pos,
- Tree pat,
- Tree guard,
- Tree body) {
- CaseDef t = new CaseDef(pat, guard, body);
- t.pos = pos;
- return t;
- }
-
- public Template Template(int pos,
- Tree[] baseClasses,
- Tree[] body) {
- Template t = new ExtTemplate(baseClasses, body);
- t.pos = pos;
- return t;
- }
-
- public Tree LabelDef(int pos,
- Tree[] params,
- Tree body) {
- Tree t = new ExtLabelDef(params,body);
- t.pos = pos;
- return t;
- }
-
- public Tree Block(int pos,
- Tree[] stats) {
- Tree t = new Block(stats);
- t.pos = pos;
- return t;
- }
-
- public Tree Tuple(int pos,
- Tree[] trees) {
- Tree t = new Tuple(trees);
- t.pos = pos;
- return t;
- }
-
- public Tree Visitor(int pos,
- CaseDef[] cases) {
- Tree t = new Visitor(cases);
- t.pos = pos;
- return t;
- }
-
- public Tree Function(int pos,
- ValDef[] vparams,
- Tree body) {
- Tree t = new Function(vparams, body);
- t.pos = pos;
- return t;
- }
-
- public Tree Assign(int pos,
- Tree lhs,
- Tree rhs) {
- Tree t = new Assign(lhs, rhs);
- t.pos = pos;
- return t;
- }
-
- public Tree If(int pos,
- Tree cond,
- Tree thenp,
- Tree elsep) {
- Tree t = new If(cond, thenp, elsep);
- t.pos = pos;
- return t;
- }
-
- public Tree New(int pos,
- Template templ) {
- Tree t = new New(templ);
- t.pos = pos;
- return t;
- }
-
- public Tree Typed(int pos,
- Tree expr,
- Tree tpe) {
- Tree t = new Typed(expr, tpe);
- t.pos = pos;
- return t;
- }
-
- public Tree TypeApply(int pos,
- Tree fun,
- Tree[] tparams) {
- Tree t = new TypeApply(fun, tparams);
- t.pos = pos;
- return t;
- }
-
- public Tree Apply(int pos,
- Tree fun,
- Tree[] vparam) {
- Tree t = new Apply(fun, vparam);
- t.pos = pos;
- return t;
- }
-
- public Tree Super(int pos,
- Tree tpe) {
- Tree t = new Super(tpe);
- t.pos = pos;
- return t;
- }
-
- public Tree This(int pos,
- Tree qualifier) {
- Tree t = new This(qualifier);
- t.pos = pos;
- return t;
- }
-
- public Tree Select(int pos,
- Tree qualifier,
- Name selector) {
- Tree t = new ExtSelect(qualifier, selector);
- t.pos = pos;
- return t;
- }
-
- public Tree Ident(int pos,
- Name name) {
- Tree t = new ExtIdent(name);
- t.pos = pos;
- return t;
- }
-
- public Tree Literal(int pos,
- Object value) {
- Tree t = new Literal(value);
- t.pos = pos;
- return t;
- }
-
-
- public Tree TypeTerm(int pos) {
- Tree t = new TypeTerm();
- t.pos = pos;
- return t;
- }
-
- public Tree SingletonType(int pos, Tree ref) {
- Tree t = new SingletonType(ref);
- t.pos = pos;
- return t;
- }
-
- public Tree SelectFromType(int pos,
- Tree qualifier,
- Name selector) {
- Tree t = new ExtSelectFromType(qualifier, selector);
- t.pos = pos;
- return t;
- }
-
- public Tree FunType(int pos,
- Tree[] argtpes,
- Tree restpe) {
- Tree t = new FunType(argtpes, restpe);
- t.pos = pos;
- return t;
- }
-
- public Tree CompoundType(int pos,
- Tree[] mixins,
- Tree[] fields) {
- Tree t = new CompoundType(mixins, fields);
- t.pos = pos;
- return t;
- }
-
- public Tree AppliedType(int pos,
- Tree tpe,
- Tree[] args) {
- Tree t = new AppliedType(tpe, args);
- t.pos = pos;
- return t;
- }
-
- public Tree CovariantType(int pos,
- Tree tpe) {
- Tree t = new CovariantType(tpe);
- t.pos = pos;
- return t;
- }
-}
diff --git a/sources/scalac/ast/TreeFactory.java b/sources/scalac/ast/TreeFactory.java
deleted file mode 100644
index 23c40a3004..0000000000
--- a/sources/scalac/ast/TreeFactory.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/* ____ ____ ____ ____ ______ *\
-** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
-** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
-** /_____/\____/\___/\____/____/ **
-** **
-** $Id$
-\* */
-
-package scalac.ast;
-
-import scalac.util.Name;
-import Tree.*;
-
-public interface TreeFactory {
-
- public Tree Bad(int pos);
-
- public Tree ClassDef(int pos,
- int mods,
- Name name,
- TypeDef[] tparams,
- ValDef[][] vparams,
- Tree tpe,
- Template impl);
-
- public Tree PackageDef(int pos,
- Tree packaged,
- Template impl);
-
- public Tree ModuleDef(int pos,
- int mods,
- Name name,
- Tree tpe,
- Template impl);
-
- public Tree ValDef(int pos,
- int mods,
- Name name,
- Tree tpe,
- Tree rhs);
-
- public Tree PatDef(int pos,
- int mods,
- Tree pat,
- Tree rhs);
-
- public Tree DefDef(int pos,
- int mods,
- Name name,
- TypeDef[] tparams,
- ValDef[][] vparams,
- Tree tpe,
- Tree rhs);
-
- public Tree TypeDef(int pos,
- int mods,
- Name name,
- Tree rhs);
-
- public Tree Import(int pos,
- Tree expr,
- Name[] selectors);
-
- public CaseDef CaseDef(int pos,
- Tree pat,
- Tree guard,
- Tree body);
-
- public Template Template(int pos,
- Tree[] baseClasses,
- Tree[] body);
-
- public Tree LabelDef(int pos,
- Tree[] params,
- Tree rhs);
-
- public Tree Block(int pos,
- Tree[] stats);
-
- public Tree Tuple(int pos,
- Tree[] trees);
-
- public Tree Visitor(int pos,
- CaseDef[] cases);
-
- public Tree Function(int pos,
- ValDef[] vparams,
- Tree body);
-
- public Tree Assign(int pos,
- Tree lhs,
- Tree rhs);
-
- public Tree If(int pos,
- Tree cond,
- Tree thenp,
- Tree elsep);
-
- public Tree New(int pos,
- Template templ);
-
- public Tree Typed(int pos,
- Tree expr,
- Tree tpe);
-
- public Tree TypeApply(int pos,
- Tree fun,
- Tree[] tparams);
-
- public Tree Apply(int pos,
- Tree fun,
- Tree[] vparam);
-
- public Tree Super(int pos,
- Tree tpe);
-
- public Tree This(int pos,
- Tree qualifier);
-
- public Tree Select(int pos,
- Tree qualifier,
- Name selector);
-
- public Tree Ident(int pos,
- Name name);
-
- public Tree Literal(int pos,
- Object value);
-
- public Tree TypeTerm(int pos);
-
- public Tree SingletonType(int pos,
- Tree ref);
-
- public Tree SelectFromType(int pos,
- Tree qualifier,
- Name selector);
-
- public Tree FunType(int pos,
- Tree[] argtpes,
- Tree restpe);
-
- public Tree CompoundType(int pos,
- Tree[] baseTypes,
- Tree[] refinements);
-
- public Tree AppliedType(int pos,
- Tree tpe,
- Tree[] args);
-
- public Tree CovariantType(int pos,
- Tree tpe);
-}