PropertyFormat properties).
Fix a bug where the ReflectionNodeFinder wouldn't display the value of static
properties (it was using an invalid instance reference).
svn path=/trunk/mcs/; revision=10372
protected override string LineComment {get {return "//";}}
+ protected override string PropertyFormat {get {return "{0} {1} {{{2}{3}}}";}}
+ protected override string PropertyGetFormat {get {return "get{0};";}}
+ protected override string PropertySet {get {return "set;";}}
+
protected override string KeywordClass {get {return "class";}}
protected override string KeywordEnum {get {return "enum";}}
protected override string KeywordValueType {get {return "struct";}}
// [0] is open, [1] is close
protected abstract string[] AttributeDelimeters {get;}
+ // Format for Property descriptions generated by GetPropertyDescription
+ // {0}: Property Type
+ // {1}: Property Name
+ // {2}: The Get Accessor. This will be generated from PropertyGetFormat,
+ // if appropriate.
+ // {3}: The Set Accessor. This will be generated from PropertySet, if
+ // appropriate
+ protected abstract string PropertyFormat {get;}
+
+ // Format for the `get' property accessor
+ // {0}: The return value of the property, if present
+ protected abstract string PropertyGetFormat {get;}
+
+ protected abstract string PropertySet {get;}
+
protected abstract string KeywordClass {get;}
protected abstract string KeywordEnum {get;}
protected abstract string KeywordValueType {get;}
AddAttributes (sb, property);
AddMethodQualifiers (sb, property.GetAccessors(true)[0]);
- sb.AppendFormat ("{0} {1} {{", property.PropertyType, property.Name);
+ string getter = null;
if (property.CanRead) {
- sb.Append ("get");
+ string v = null;
try {
- sb.AppendFormat (" /* = {0} */", GetValue (property.GetValue (instance, null)));
+ v = string.Format (" /* = {0} */", GetValue (property.GetValue (instance, null)));
}
catch {
}
- sb.Append (";");
+ getter = string.Format (PropertyGetFormat, v);
}
+
+ string setter = null;
if (property.CanWrite)
- sb.Append ("set;");
- sb.Append ("}}");
+ setter = PropertySet;
+
+ sb.AppendFormat (PropertyFormat, property.PropertyType, property.Name, getter, setter);
return sb.ToString();
}
protected override void AddTypeChildren (NodeInfoCollection c, NodeInfo parent, Type type)
{
+ object instance = parent.ReflectionInstance;
+
foreach (MemberInfo mi in GetMembers (type)) {
- AddNode (c, parent, mi, mi);
+ AddNode (c, parent, mi, instance);
}
}
protected override string LineComment {get {return "'";}}
+ protected override string PropertyFormat {get {return "Property {1} As {0}\n{2}{3}End Property";}}
+ protected override string PropertyGetFormat {get {return "\tGet\n\t\t' Return {0}\n\tEnd Get\n";}}
+ protected override string PropertySet {get {return "\tSet\n\tEnd Set\n";}}
+
protected override string KeywordClass {get {return "Class";}}
protected override string KeywordEnum {get {return "Enum";}}
protected override string KeywordValueType {get {return "Struct";}}
protected override void AddTypeChildren (NodeInfoCollection c, NodeInfo parent, Type type)
{
+ object instance = parent.ReflectionInstance;
+
foreach (MemberInfo mi in GetMembers (type)) {
- AddNode (c, parent, mi, mi);
+ AddNode (c, parent, mi, instance);
}
}
protected override string LineComment {get {return "//";}}
+ protected override string PropertyFormat {get {return "{0} {1} {{{2}{3}}}";}}
+ protected override string PropertyGetFormat {get {return "get{0};";}}
+ protected override string PropertySet {get {return "set;";}}
+
protected override string KeywordClass {get {return "class";}}
protected override string KeywordEnum {get {return "enum";}}
protected override string KeywordValueType {get {return "struct";}}
// [0] is open, [1] is close
protected abstract string[] AttributeDelimeters {get;}
+ // Format for Property descriptions generated by GetPropertyDescription
+ // {0}: Property Type
+ // {1}: Property Name
+ // {2}: The Get Accessor. This will be generated from PropertyGetFormat,
+ // if appropriate.
+ // {3}: The Set Accessor. This will be generated from PropertySet, if
+ // appropriate
+ protected abstract string PropertyFormat {get;}
+
+ // Format for the `get' property accessor
+ // {0}: The return value of the property, if present
+ protected abstract string PropertyGetFormat {get;}
+
+ protected abstract string PropertySet {get;}
+
protected abstract string KeywordClass {get;}
protected abstract string KeywordEnum {get;}
protected abstract string KeywordValueType {get;}
AddAttributes (sb, property);
AddMethodQualifiers (sb, property.GetAccessors(true)[0]);
- sb.AppendFormat ("{0} {1} {{", property.PropertyType, property.Name);
+ string getter = null;
if (property.CanRead) {
- sb.Append ("get");
+ string v = null;
try {
- sb.AppendFormat (" /* = {0} */", GetValue (property.GetValue (instance, null)));
+ v = string.Format (" /* = {0} */", GetValue (property.GetValue (instance, null)));
}
catch {
}
- sb.Append (";");
+ getter = string.Format (PropertyGetFormat, v);
}
+
+ string setter = null;
if (property.CanWrite)
- sb.Append ("set;");
- sb.Append ("}}");
+ setter = PropertySet;
+
+ sb.AppendFormat (PropertyFormat, property.PropertyType, property.Name, getter, setter);
return sb.ToString();
}
protected override string LineComment {get {return "'";}}
+ protected override string PropertyFormat {get {return "Property {1} As {0}\n{2}{3}End Property";}}
+ protected override string PropertyGetFormat {get {return "\tGet\n\t\t' Return {0}\n\tEnd Get\n";}}
+ protected override string PropertySet {get {return "\tSet\n\tEnd Set\n";}}
+
protected override string KeywordClass {get {return "Class";}}
protected override string KeywordEnum {get {return "Enum";}}
protected override string KeywordValueType {get {return "Struct";}}