Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

finish XamlType.BaseType implementation.

  • Loading branch information...
commit bdef99df3450df5192c8266b42623b6d4bb208d2 1 parent 4a5f7c7
Atsushi Eno authored
View
6 mcs/class/System.Xaml/System.Xaml/XamlType.cs
@@ -508,15 +508,13 @@ protected virtual XamlMember LookupAttachableMember (string name)
return GetAllAttachableMembers ().FirstOrDefault (m => m.Name == name);
}
- [MonoTODO]
protected virtual XamlType LookupBaseType ()
{
if (base_type == null) {
if (UnderlyingType == null)
- // FIXME: probably something advanced is needed here.
- base_type = new XamlType (typeof (object), SchemaContext, Invoker);
+ base_type = SchemaContext.GetXamlType (typeof (object));
else
- base_type = type.BaseType == null || type.BaseType == typeof (object) ? null : new XamlType (type.BaseType, SchemaContext, Invoker);
+ base_type = type.BaseType == null || type.BaseType == typeof (object) ? null : SchemaContext.GetXamlType (type.BaseType);
}
return base_type;
}
View
1  mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs
@@ -565,6 +565,7 @@ public void Object ()
{
var t = XamlLanguage.Object;
TestXamlTypePrimitive (t, "Object", typeof (object), true, false);
+ Assert.IsNull (t.BaseType, "#x1");
/* Those properties are pointless regarding practical use. Those "members" does not participate in serialization.
var l = t.GetAllAttachableMembers ().ToArray ();
View
10 mcs/class/System.Xaml/Test/System.Xaml/XamlTypeTest.cs
@@ -783,6 +783,16 @@ public void ReadOnlyPropertyContainer ()
Assert.IsNotNull (xm, "#1");
Assert.IsFalse (xm.IsWritePublic, "#2");
}
+
+ [Test]
+ public void UnknownType ()
+ {
+ var xt = new XamlType ("urn:foo", "MyUnknown", null, sctx);
+ Assert.IsTrue (xt.IsUnknown, "#1");
+ Assert.IsNotNull (xt.BaseType, "#2");
+ Assert.IsFalse (xt.BaseType.IsUnknown, "#3");
+ Assert.AreEqual (typeof (object), xt.BaseType.UnderlyingType, "#4");
+ }
}
class MyXamlType : XamlType
Please sign in to comment.
Something went wrong with that request. Please try again.