diff options
author | Jonathan Pryor <jpryor@novell.com> | 2010-06-22 00:25:42 +0400 |
---|---|---|
committer | Jonathan Pryor <jpryor@novell.com> | 2010-06-22 00:25:42 +0400 |
commit | 796ceff79462661ba913489f212ce2526cec9722 (patch) | |
tree | 2ae1f45d03836aff108174d742250e9287f20f87 /mcs/tools | |
parent | a850c3df61a8d158555b90305abd68c55d261cdc (diff) |
Backport r155640 from trunk:
* Mono.Documentation/monodocer.cs: Use Int64 instead of UInt64 for
enum values, so that we can properly capture negative values.
svn path=/branches/mono-2-6/mcs/; revision=159290
Diffstat (limited to 'mcs/tools')
-rw-r--r-- | mcs/tools/mdoc/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/tools/mdoc/Mono.Documentation/monodocer.cs | 15 |
2 files changed, 16 insertions, 4 deletions
diff --git a/mcs/tools/mdoc/ChangeLog b/mcs/tools/mdoc/ChangeLog index 35277ad2679..90de07ad5a9 100644 --- a/mcs/tools/mdoc/ChangeLog +++ b/mcs/tools/mdoc/ChangeLog @@ -5,6 +5,11 @@ new <summary/> values to be inserted into the index.{opts.ext} files, instead of the index files being "stale". Fixes #573121. +2010-04-16 Jonathan Pryor <jpryor@novell.com> + + * Mono.Documentation/monodocer.cs: Use Int64 instead of UInt64 for + enum values, so that we can properly capture negative values. + 2010-02-28 Jonathan Pryor <jpryor@novell.com> * Mono.Documentation/webdoc.cs: Allow .source files to be provided to diff --git a/mcs/tools/mdoc/Mono.Documentation/monodocer.cs b/mcs/tools/mdoc/Mono.Documentation/monodocer.cs index 3bbbadae036..2e5e8a9f4bd 100644 --- a/mcs/tools/mdoc/Mono.Documentation/monodocer.cs +++ b/mcs/tools/mdoc/Mono.Documentation/monodocer.cs @@ -2282,7 +2282,7 @@ class MDocUpdater : MDocCommand return v.ToString (); string typename = GetDocTypeFullName (valueType); var values = GetEnumerationValues (valueDef); - ulong c = Convert.ToUInt64 (v); + long c = ToInt64 (v); if (values.ContainsKey (c)) return typename + "." + values [c]; if (valueDef.CustomAttributes.Cast<CustomAttribute> () @@ -2296,17 +2296,24 @@ class MDocUpdater : MDocCommand return "(" + GetDocTypeFullName (valueType) + ") " + v.ToString (); } - private static Dictionary<ulong, string> GetEnumerationValues (TypeDefinition type) + private static Dictionary<long, string> GetEnumerationValues (TypeDefinition type) { - var values = new Dictionary<ulong, string> (); + var values = new Dictionary<long, string> (); foreach (var f in (from f in type.Fields.Cast<FieldDefinition> () where !(f.IsRuntimeSpecialName || f.IsSpecialName) select f)) { - values [Convert.ToUInt64 (f.Constant)] = f.Name; + values [ToInt64 (f.Constant)] = f.Name; } return values; } + + static long ToInt64 (object value) + { + if (value is ulong) + return (long) (ulong) value; + return Convert.ToInt64 (value); + } private void MakeParameters (XmlElement root, ParameterDefinitionCollection parameters) { |