Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2010-04-22 14:47:03 +0400
committerAtsushi Eno <atsushieno@gmail.com>2010-04-22 14:47:03 +0400
commitde0d9d0986519f06396402de89354b48850b3e70 (patch)
treea7ad61ff99c809629893da10c140b2e6fcc53753 /mcs/class
parent881488f0f43c81b7e164caff8c11925604b3ac34 (diff)
2010-04-22 Atsushi Enomoto <atsushi@ximian.com>
* XamlObjectReader.cs, TypeExtensionMethods.cs : handle System.Type as predefined type that returns Value instead of StartObject. Rename some member getter methods to explicitly limit the scope to object readers so far. svn path=/trunk/mcs/; revision=155942
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/System.Xaml/System.Xaml/ChangeLog7
-rw-r--r--mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs18
-rw-r--r--mcs/class/System.Xaml/System.Xaml/XamlObjectReader.cs4
3 files changed, 20 insertions, 9 deletions
diff --git a/mcs/class/System.Xaml/System.Xaml/ChangeLog b/mcs/class/System.Xaml/System.Xaml/ChangeLog
index ac419d39656..82d91b548cd 100644
--- a/mcs/class/System.Xaml/System.Xaml/ChangeLog
+++ b/mcs/class/System.Xaml/System.Xaml/ChangeLog
@@ -1,5 +1,12 @@
2010-04-22 Atsushi Enomoto <atsushi@ximian.com>
+ * XamlObjectReader.cs, TypeExtensionMethods.cs : handle System.Type
+ as predefined type that returns Value instead of StartObject.
+ Rename some member getter methods to explicitly limit the scope to
+ object readers so far.
+
+2010-04-22 Atsushi Enomoto <atsushi@ximian.com>
+
* XamlObjectReader.cs
XamlMember.cs
TypeExtensionMethods.cs
diff --git a/mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs b/mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs
index c1cb02d7839..f915c1153ce 100644
--- a/mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs
+++ b/mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs
@@ -101,11 +101,15 @@ namespace System.Xaml
return DoConvert (xt.TypeConverter, target, explicitTargetType ?? xt.UnderlyingType);
}
- public static object GetMemberValue (this XamlMember xm, XamlType xt, object target)
+ public static object GetMemberValueForObjectReader (this XamlMember xm, XamlType xt, object target)
{
- object native = GetPropertyOrFieldValue (xm, xt, target);
- var memberRType = xm.Type == null ? null : xm.Type.UnderlyingType;
- return DoConvert (xm.TypeConverter, native, memberRType);
+ object native = GetPropertyOrFieldValueForObjectReader (xm, xt, target);
+ var convertedType = xm.Type == null ? null : xm.Type.UnderlyingType;
+ // FIXME: not sure if it REALLY applies to everywhere.
+ if (convertedType == typeof (Type))
+ convertedType = typeof (string);
+
+ return DoConvert (xm.TypeConverter, native, convertedType);
}
static object DoConvert (XamlValueConverter<TypeConverter> converter, object value, Type targetType)
@@ -117,7 +121,7 @@ namespace System.Xaml
return value;
}
- static object GetPropertyOrFieldValue (this XamlMember xm, XamlType xt, object target)
+ static object GetPropertyOrFieldValueForObjectReader (this XamlMember xm, XamlType xt, object target)
{
// FIXME: should this be done here??
if (xm == XamlLanguage.Initialization)
@@ -127,7 +131,7 @@ namespace System.Xaml
string [] args = new string [argdefs.Length];
for (int i = 0; i < args.Length; i++) {
var am = argdefs [i];
- args [i] = GetStringValue (am.Type, GetMemberValue (am, xt, target));
+ args [i] = GetStringValue (am.Type, GetMemberValueForObjectReader (am, xt, target));
}
return String.Join (", ", args);
}
@@ -159,7 +163,7 @@ namespace System.Xaml
var t = type.UnderlyingType;
if (Type.GetTypeCode (t) != TypeCode.Object)
return true;
- else if (t == typeof (TimeSpan) || t == typeof (Uri)) // special predefined types
+ else if (t == typeof (Type) || t == typeof (TimeSpan) || t == typeof (Uri)) // special predefined types
return true;
return false;
}
diff --git a/mcs/class/System.Xaml/System.Xaml/XamlObjectReader.cs b/mcs/class/System.Xaml/System.Xaml/XamlObjectReader.cs
index 59f87d22a0e..1868c322822 100644
--- a/mcs/class/System.Xaml/System.Xaml/XamlObjectReader.cs
+++ b/mcs/class/System.Xaml/System.Xaml/XamlObjectReader.cs
@@ -315,9 +315,9 @@ namespace System.Xaml
var xm = members_stack.Peek ().Current;
var obj = objects.Peek ();
var xt = types.Peek ();
- if (xm == XamlLanguage.Initialization)
+ if (xt.IsContentValue ())
return xt.GetStringValue (obj);
- return xm != null ? xm.GetMemberValue (xt, obj) : instance;
+ return xm != null ? xm.GetMemberValueForObjectReader (xt, obj) : instance;
}
}
}