- Timestamp:
- 01/26/15 16:33:53 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionDataFactory.cs
r11722 r11825 25 25 using ICSharpCode.AvalonEdit.CodeCompletion; 26 26 using ICSharpCode.NRefactory.Completion; 27 using ICSharpCode.NRefactory.CSharp; 27 28 using ICSharpCode.NRefactory.CSharp.Completion; 29 using ICSharpCode.NRefactory.CSharp.Resolver; 28 30 using ICSharpCode.NRefactory.TypeSystem; 29 31 using ICompletionData = ICSharpCode.NRefactory.Completion.ICompletionData; … … 121 123 122 124 #region IParameterCompletionDataFactory Members 123 public IParameterDataProvider CreateConstructorProvider(int startOffset, IType type, ICSharpCode.NRefactory.CSharp.AstNode thisInitializer) {124 return Create MethodDataProvider(startOffset, type.GetConstructors());125 public IParameterDataProvider CreateConstructorProvider(int startOffset, IType type, AstNode thisInitializer) { 126 return CreateConstructorProvider(startOffset, type); 125 127 } 126 128 127 129 public IParameterDataProvider CreateConstructorProvider(int startOffset, IType type) { 128 return CreateMethodDataProvider(startOffset, type.GetConstructors()); 130 var constructors = FilterMethodsForAccessibility(type, type.GetConstructors()); 131 return CreateMethodDataProvider(startOffset, constructors); 129 132 } 130 133 131 134 public IParameterDataProvider CreateDelegateDataProvider(int startOffset, IType type) { 132 return CreateMethodDataProvider(startOffset, new[] { type.GetDelegateInvokeMethod() }); 135 var delegates = FilterMethodsForAccessibility(type, new[] { type.GetDelegateInvokeMethod() }); 136 return CreateMethodDataProvider(startOffset, delegates); 133 137 } 134 138 … … 138 142 139 143 public IParameterDataProvider CreateMethodDataProvider(int startOffset, IEnumerable<IMethod> methods) { 140 return new CSharpOverloadProvider(context, startOffset, from m in methods where m != null select new CSharpInsightItem(m));144 return new CSharpOverloadProvider(context, startOffset, methods.Where(x => x != null).Select(x => new CSharpInsightItem(x))); 141 145 } 142 146 … … 149 153 } 150 154 #endregion 155 156 private IEnumerable<IMethod> FilterMethodsForAccessibility(IType type, IEnumerable<IMethod> methods) { 157 var typeResolveContext = context.TypeResolveContextAtCaret; 158 var lookup = new MemberLookup(typeResolveContext.CurrentTypeDefinition, typeResolveContext.Compilation.MainAssembly); 159 bool protectedAccessAllowed = lookup.IsProtectedAccessAllowed(type); 160 return protectedAccessAllowed ? methods : methods.Where(x => !x.IsProtected); 161 } 151 162 } 152 163 }
Note: See TracChangeset
for help on using the changeset viewer.