mirror of https://github.com/icsharpcode/ILSpy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) |
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) |
|
|
|
using System; |
|
using ICSharpCode.NRefactory; |
|
using ICSharpCode.NRefactory.Ast; |
|
|
|
namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver |
|
{ |
|
public class NRefactoryInformationProvider : IEnvironmentInformationProvider |
|
{ |
|
IProjectContent _projectContent; |
|
|
|
public NRefactoryInformationProvider(IProjectContent projectContent) |
|
{ |
|
if (projectContent == null) |
|
throw new ArgumentNullException("projectContent"); |
|
_projectContent = projectContent; |
|
} |
|
|
|
public bool HasField(string reflectionTypeName, int typeParameterCount, string fieldName) |
|
{ |
|
IClass c; |
|
if (typeParameterCount > 0) { |
|
c = _projectContent.GetClass(reflectionTypeName, typeParameterCount); |
|
} else { |
|
c = _projectContent.GetClassByReflectionName(reflectionTypeName, true); |
|
} |
|
if (c == null) |
|
return false; |
|
foreach (IField field in c.DefaultReturnType.GetFields()) { |
|
if (field.Name == fieldName) |
|
return true; |
|
} |
|
return false; |
|
} |
|
} |
|
}
|
|
|