diff options
-rw-r--r-- | config/list/library-msil.lst | 44 | ||||
-rw-r--r-- | sources/scalac/backend/msil/GenMSIL.java | 21 | ||||
-rw-r--r-- | sources/scalac/symtab/classfile/CLRClassParser.java | 3 |
3 files changed, 39 insertions, 29 deletions
diff --git a/config/list/library-msil.lst b/config/list/library-msil.lst index 2785d1b633..cba31c0d8b 100644 --- a/config/list/library-msil.lst +++ b/config/list/library-msil.lst @@ -12,7 +12,7 @@ Byte.java CaseClass.scala Cell.scala Char.java -../msil/scala/Console.scala +Console.scala Double.java Application.scala Enumeration.scala @@ -71,50 +71,50 @@ collection/MapProxy.scala collection/Set.scala collection/SetProxy.scala -../msil/scala/collection/mutable/ArrayBuffer.scala +collection/mutable/ArrayBuffer.scala collection/mutable/BitSet.scala -../msil/scala/collection/mutable/Buffer.scala -../msil/scala/collection/mutable/BufferProxy.scala +collection/mutable/Buffer.scala +collection/mutable/BufferProxy.scala collection/mutable/DefaultMapModel.scala collection/mutable/DoubleLinkedList.scala -../msil/scala/collection/mutable/HashMap.scala -../msil/scala/collection/mutable/HashSet.scala +collection/mutable/HashMap.scala +collection/mutable/HashSet.scala collection/mutable/HashTable.scala collection/mutable/History.scala collection/mutable/ImmutableMapAdaptor.scala collection/mutable/ImmutableSetAdaptor.scala -../msil/scala/collection/mutable/JavaMapAdaptor.scala -../msil/scala/collection/mutable/JavaSetAdaptor.scala +collection/mutable/JavaMapAdaptor.scala +collection/mutable/JavaSetAdaptor.scala collection/mutable/LinkedList.scala -../msil/scala/collection/mutable/ListBuffer.scala +collection/mutable/ListBuffer.scala collection/mutable/Location.scala -../msil/scala/collection/mutable/Map.scala -../msil/scala/collection/mutable/MapProxy.scala +collection/mutable/Map.scala +collection/mutable/MapProxy.scala collection/mutable/Message.scala collection/mutable/MultiMap.scala collection/mutable/MutableList.scala collection/mutable/ObservableBuffer.scala collection/mutable/ObservableMap.scala collection/mutable/ObservableSet.scala -../msil/scala/collection/mutable/PriorityQueue.scala -../msil/scala/collection/mutable/PriorityQueueProxy.scala +collection/mutable/PriorityQueue.scala +collection/mutable/PriorityQueueProxy.scala collection/mutable/Publisher.scala -../msil/scala/collection/mutable/Queue.scala -../msil/scala/collection/mutable/QueueProxy.scala +collection/mutable/Queue.scala +collection/mutable/QueueProxy.scala collection/mutable/ResizableArray.scala collection/mutable/RevertableHistory.scala collection/mutable/Scriptable.scala -../msil/scala/collection/mutable/Set.scala -../msil/scala/collection/mutable/SetProxy.scala +collection/mutable/Set.scala +collection/mutable/SetProxy.scala collection/mutable/SingleLinkedList.scala -../msil/scala/collection/mutable/Stack.scala -../msil/scala/collection/mutable/StackProxy.scala +collection/mutable/Stack.scala +collection/mutable/StackProxy.scala collection/mutable/Subscriber.scala -../msil/scala/collection/mutable/SynchronizedBuffer.scala -../msil/scala/collection/mutable/SynchronizedMap.scala +collection/mutable/SynchronizedBuffer.scala +collection/mutable/SynchronizedMap.scala collection/mutable/SynchronizedPriorityQueue.scala collection/mutable/SynchronizedQueue.scala -../msil/scala/collection/mutable/SynchronizedSet.scala +collection/mutable/SynchronizedSet.scala collection/mutable/SynchronizedStack.scala collection/mutable/Undoable.scala diff --git a/sources/scalac/backend/msil/GenMSIL.java b/sources/scalac/backend/msil/GenMSIL.java index ec490359d9..8aab417000 100644 --- a/sources/scalac/backend/msil/GenMSIL.java +++ b/sources/scalac/backend/msil/GenMSIL.java @@ -42,7 +42,6 @@ import java.util.List; import java.util.Map; import java.util.HashMap; import java.util.Iterator; -import java.io.IOException; /** * Generates MS IL code via Reflection.Emit-like API @@ -209,9 +208,6 @@ public final class GenMSIL { * Generate the code for a class definition */ private void genClass(Symbol clazz, Tree[] body) { -// AttrInfo attrs = global.getAttributes(clazz); -// if (attrs != null) -// System.out.println("" + attrs + Debug.show(clazz)); Symbol outerClass = currentClass; currentClass = clazz; if (clazz.isModuleClass()) { @@ -253,6 +249,20 @@ public final class GenMSIL { + Debug.show(body[i]); } } + if (tc.isCloneable(clazz)) { + Symbol cloneSym = clazz.lookup(Names.clone); + if (cloneSym.isNone()) { + short mods = MethodAttributes.Public + | MethodAttributes.Virtual + | MethodAttributes.HideBySig; + ILGenerator code = + type.DefineMethod("Clone", mods, tc.OBJECT, Type.EmptyTypes) + .GetILGenerator(); + code.Emit(OpCodes.Ldarg_0); + code.Emit(OpCodes.Call, tc.MEMBERWISE_CLONE); + code.Emit(OpCodes.Ret); + } + } currentClass = outerClass; } //genClass() @@ -278,9 +288,6 @@ public final class GenMSIL { * Generate code for constructors and methods. */ private void genDef(Symbol sym, ValDef[] parameters, Tree rhs, MSILType toType) { -// AttrInfo attrs = global.getAttributes(sym); -// if (attrs != null) -// System.out.println("" + attrs + Debug.show(sym)); MethodBase method = tc.getMethod(sym); params.clear(); diff --git a/sources/scalac/symtab/classfile/CLRClassParser.java b/sources/scalac/symtab/classfile/CLRClassParser.java index 1c19932c92..92b9409492 100644 --- a/sources/scalac/symtab/classfile/CLRClassParser.java +++ b/sources/scalac/symtab/classfile/CLRClassParser.java @@ -300,6 +300,9 @@ public class CLRClassParser extends SymbolLoader { if (name.equals("Equals") && params.length == 1 && params[0].ParameterType == clrTypes.OBJECT) return Names.equals; + // TODO: check if the type implements ICloneable? + if (name.equals("Clone") && params.length == 0) + return Names.clone; return Name.fromString(name); } |