summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-07-27 15:51:27 +0000
committerpaltherr <paltherr@epfl.ch>2003-07-27 15:51:27 +0000
commit115b836500f89a83fbfc9cec590aed836a04ef59 (patch)
treefb0c395538e107ff8271dc2a27c5c5e03e2a6552
parent40e05d7679d468d182f095b68f5f5d7fc87bda25 (diff)
downloadscala-115b836500f89a83fbfc9cec590aed836a04ef59.tar.gz
scala-115b836500f89a83fbfc9cec590aed836a04ef59.tar.bz2
scala-115b836500f89a83fbfc9cec590aed836a04ef59.zip
- Added method cloneArray
-rw-r--r--sources/scalac/ast/Tree.java.tmpl7
-rw-r--r--sources/scalac/symtab/Symbol.java7
-rw-r--r--sources/scalac/symtab/Type.java7
3 files changed, 21 insertions, 0 deletions
diff --git a/sources/scalac/ast/Tree.java.tmpl b/sources/scalac/ast/Tree.java.tmpl
index 69f5976626..30f6a4108c 100644
--- a/sources/scalac/ast/Tree.java.tmpl
+++ b/sources/scalac/ast/Tree.java.tmpl
@@ -131,6 +131,13 @@ public class Tree {
Global.instance, Global.instance.make,
new StrictTreeCopier(Global.instance.make));
+ /** Returns a shallow copy of the given array. */
+ public static Tree[] cloneArray(Tree[] array) {
+ Tree[] clone = new Tree[array.length];
+ for (int i = 0; i < clone.length; i++) clone[i] = array[i];
+ return clone;
+ }
+
public Tree duplicate() {
return duplicator.transform(this);
}
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index 6867bfb576..024b5241fd 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -82,6 +82,13 @@ public abstract class Symbol implements Modifiers, Kinds {
*/
public abstract Symbol cloneSymbol(Symbol owner);
+ /** Returns a shallow copy of the given array. */
+ public static Symbol[] cloneArray(Symbol[] array) {
+ Symbol[] clone = new Symbol[array.length];
+ for (int i = 0; i < clone.length; i++) clone[i] = array[i];
+ return clone;
+ }
+
/** copy all fields to `sym'
*/
public void copyTo(Symbol sym) {
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java
index 8d0d83c500..7dcf109456 100644
--- a/sources/scalac/symtab/Type.java
+++ b/sources/scalac/symtab/Type.java
@@ -1280,6 +1280,13 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
// Cloning ---------------------------------------------------------------
+ /** Returns a shallow copy of the given array. */
+ public static Type[] cloneArray(Type[] array) {
+ Type[] clone = new Type[array.length];
+ for (int i = 0; i < clone.length; i++) clone[i] = array[i];
+ return clone;
+ }
+
/**
* Clones a type i.e. returns a new type where all symbols in
* MethodTypes and PolyTypes have been cloned.