[mcs] Initial by ref returns and variables support
[mono.git] / mcs / mcs / typespec.cs
index e6ee60c585a8780e1af95af20b7941356d0a160b..0585dfd667a08d6d7f56cf247831eb915fbb7d49 100644 (file)
@@ -1991,10 +1991,11 @@ namespace Mono.CSharp
                }
        }
 
+       [System.Diagnostics.DebuggerDisplay("{DisplayDebugInfo()}")]
        class ReferenceContainer : ElementTypeSpec
        {
                ReferenceContainer (TypeSpec element)
-                       : base (MemberKind.Class, element, null)        // TODO: Kind.Class is most likely wrong
+                       : base (MemberKind.ByRef, element, null)
                {
                }
 
@@ -2004,6 +2005,11 @@ namespace Mono.CSharp
                        }
                }
 
+               string DisplayDebugInfo()
+               {
+                       return "ref " + GetSignatureForError();
+               }
+
                public override MetaType GetMetaInfo ()
                {
                        if (info == null) {
@@ -2013,8 +2019,16 @@ namespace Mono.CSharp
                        return info;
                }
 
+               public override string GetSignatureForError ()
+               {
+                       return Element.GetSignatureForError ();
+               }
+
                public static ReferenceContainer MakeType (ModuleContainer module, TypeSpec element)
                {
+                       if (element.Kind == MemberKind.ByRef)
+                               throw new ArgumentException ();
+
                        ReferenceContainer pc;
                        if (!module.ReferenceTypesCache.TryGetValue (element, out pc)) {
                                pc = new ReferenceContainer (element);