diff options
author | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
commit | 95408b1a41b31b645f3a8c3323ab7d3ca4bff26b (patch) | |
tree | f8f137cddcb9a40499d303be95722fd2c6081bce /main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ClassUtils.cs | |
parent | b70e4e04b4e41b8ec28d7e4b220b401ecf467e7a (diff) | |
parent | de043d330a8bf5855d4d983c804cd36727cb2406 (diff) |
Merge remote-tracking branch 'origin/roslyn' into new-project-model
Diffstat (limited to 'main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ClassUtils.cs')
-rw-r--r-- | main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ClassUtils.cs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ClassUtils.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ClassUtils.cs index 15ad4bc0ca..8c5d0a5462 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ClassUtils.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ClassUtils.cs @@ -30,32 +30,31 @@ using Gtk; using System; using System.Collections; using System.CodeDom; -using ICSharpCode.NRefactory.TypeSystem; -using ICSharpCode.NRefactory.Semantics; +using Microsoft.CodeAnalysis; namespace MonoDevelop.GtkCore.GuiBuilder { internal class ClassUtils { - public static IField FindWidgetField (ITypeDefinition cls, string name) + public static IFieldSymbol FindWidgetField (ITypeSymbol cls, string name) { - foreach (IField field in cls.Fields) { + foreach (var field in cls.GetMembers ().OfType<IFieldSymbol> ()) { if (name == GetWidgetFieldName (field)) return field; } return null; } - public static string GetWidgetFieldName (IField field) + public static string GetWidgetFieldName (IFieldSymbol field) { - foreach (IAttribute att in field.Attributes) { - var type = att.AttributeType; - if (type.ReflectionName == "Glade.Widget" || type.ReflectionName == "Widget" || type.ReflectionName == "Glade.WidgetAttribute" || type.ReflectionName == "WidgetAttribute") { - var pArgs = att.PositionalArguments; - if (pArgs != null && pArgs.Count > 0) { - var exp = pArgs[0] as ConstantResolveResult; + foreach (AttributeData att in field.GetAttributes ()) { + var type = att.AttributeClass; + if (type.Name == "Widget" || type.Name == "WidgetAttribute") { + var pArgs = att.ConstructorArguments; + if (pArgs != null && pArgs.Length > 0) { + var exp = pArgs[0].Value; if (exp != null) - return exp.ConstantValue.ToString (); + return exp.ToString (); } else { return field.Name; } |