summaryrefslogtreecommitdiff
path: root/sources/scalac/ast/AbstractTreeCopyFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scalac/ast/AbstractTreeCopyFactory.java')
-rw-r--r--sources/scalac/ast/AbstractTreeCopyFactory.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/sources/scalac/ast/AbstractTreeCopyFactory.java b/sources/scalac/ast/AbstractTreeCopyFactory.java
new file mode 100644
index 0000000000..358d468cd4
--- /dev/null
+++ b/sources/scalac/ast/AbstractTreeCopyFactory.java
@@ -0,0 +1,30 @@
+/* ____ ____ ____ ____ ______ *\
+** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
+** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
+** /_____/\____/\___/\____/____/ **
+** **
+\* */
+
+// $Id$
+
+package scalac.ast;
+
+import scalac.ast.*;
+
+/**
+ * Abstract superclass for all TreeCopyFactories, which provides only
+ * the code to copy the attribution from the "old" to the "new" tree.
+ *
+ * @author Michel Schinz
+ * @version 1.0
+ */
+
+public abstract class AbstractTreeCopyFactory implements TreeCopyFactory {
+ public void attribute(Tree newTree, Tree oldTree) {
+ if (newTree != oldTree) {
+ newTree.type = oldTree.type;
+ if (newTree.hasSymbol())
+ newTree.setSymbol(oldTree.symbol());
+ }
+ }
+}