Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/src/addins/AspNet/Commands/AddViewDialog.cs1
-rw-r--r--main/src/addins/AspNet/Commands/GoToControllerCommandHandler.cs1
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.csproj5
-rw-r--r--main/src/addins/AspNet/WebForms/WebFormsEditorExtension.cs1
-rw-r--r--main/src/addins/AspNet/WebForms/WebFormsTypeContext.cs1
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.csproj1
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/OverrideMembersGenerator.cs1
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs7
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionCategory.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs9
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs25
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj5
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs1
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs8
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs1
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj5
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs5
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj5
-rw-r--r--main/src/addins/NUnit/MonoDevelop.NUnit.csproj7
-rw-r--r--main/src/addins/NUnit/Services/BinaryResultsStore.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/MonoDevelop.VersionControl.Git.Tests.csproj20
-rw-r--r--main/src/core/MonoDevelop.Ide/AssemblyInfo.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/NR5CompatibiltyExtensions.cs742
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj1
25 files changed, 785 insertions, 80 deletions
diff --git a/main/src/addins/AspNet/Commands/AddViewDialog.cs b/main/src/addins/AspNet/Commands/AddViewDialog.cs
index a533c2b25b..108c8e062a 100644
--- a/main/src/addins/AspNet/Commands/AddViewDialog.cs
+++ b/main/src/addins/AspNet/Commands/AddViewDialog.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
using PP = System.IO.Path;
using Gtk;
-using ICSharpCode.NRefactory6.CSharp;
using Microsoft.CodeAnalysis;
using MonoDevelop.Core;
using MonoDevelop.Ide;
diff --git a/main/src/addins/AspNet/Commands/GoToControllerCommandHandler.cs b/main/src/addins/AspNet/Commands/GoToControllerCommandHandler.cs
index fb944f910e..252a97bb27 100644
--- a/main/src/addins/AspNet/Commands/GoToControllerCommandHandler.cs
+++ b/main/src/addins/AspNet/Commands/GoToControllerCommandHandler.cs
@@ -26,7 +26,6 @@
using System;
using System.Linq;
-using ICSharpCode.NRefactory6.CSharp;
using Microsoft.CodeAnalysis;
using MonoDevelop.AspNet.Projects;
using MonoDevelop.Components.Commands;
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.csproj b/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
index 90b0c0c245..16eb240d8e 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
@@ -127,11 +127,6 @@
<Reference Include="System.Web.Mvc">
<HintPath>..\..\..\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
- <ProjectReference Include="..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory6.CSharp.csproj">
- <Project>{7E891659-45F3-42B5-B940-A728780CCAE9}</Project>
- <Name>ICSharpCode.NRefactory6.CSharp</Name>
- <Private>False</Private>
- </ProjectReference>
<Reference Include="System.Web.Mvc" Condition="!Exists('$(SolutionDir)\..\.git')" />
<ProjectReference Include="..\..\..\external\nrefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
diff --git a/main/src/addins/AspNet/WebForms/WebFormsEditorExtension.cs b/main/src/addins/AspNet/WebForms/WebFormsEditorExtension.cs
index 2a7512ac64..12eb150e63 100644
--- a/main/src/addins/AspNet/WebForms/WebFormsEditorExtension.cs
+++ b/main/src/addins/AspNet/WebForms/WebFormsEditorExtension.cs
@@ -39,7 +39,6 @@ using MonoDevelop.DesignerSupport;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.TypeSystem;
-using ICSharpCode.NRefactory6.CSharp;
using MonoDevelop.Ide.Editor;
using MonoDevelop.AspNet.Html;
using MonoDevelop.AspNet.Html.Parser;
diff --git a/main/src/addins/AspNet/WebForms/WebFormsTypeContext.cs b/main/src/addins/AspNet/WebForms/WebFormsTypeContext.cs
index ad86c54b2d..ff23aeab04 100644
--- a/main/src/addins/AspNet/WebForms/WebFormsTypeContext.cs
+++ b/main/src/addins/AspNet/WebForms/WebFormsTypeContext.cs
@@ -44,7 +44,6 @@ using MonoDevelop.AspNet.WebForms.Dom;
using System.Reflection;
using MonoDevelop.Ide.Editor;
using Microsoft.CodeAnalysis;
-using ICSharpCode.NRefactory6.CSharp;
using Microsoft.CodeAnalysis.CSharp;
using System.Threading;
using System.Threading.Tasks;
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.csproj b/main/src/addins/CSharpBinding/CSharpBinding.csproj
index e5eab435ae..61d4704532 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.csproj
+++ b/main/src/addins/CSharpBinding/CSharpBinding.csproj
@@ -124,7 +124,6 @@
<ProjectReference Include="..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory6.CSharp.csproj">
<Project>{7E891659-45F3-42B5-B940-A728780CCAE9}</Project>
<Name>ICSharpCode.NRefactory6.CSharp</Name>
- <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\external\NRefactory6\NR6Pack\NR6Pack.csproj">
<Project>{C465A5DC-AD28-49A2-89C0-F81838814A7E}</Project>
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs
index 01fb9b6052..732e19c263 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeFixes/FullyQualify/CSharpFullyQualifyCodeFixProvider.cs
@@ -40,7 +40,6 @@ using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis.CodeActions;
using System;
using ICSharpCode.NRefactory6.CSharp.Refactoring;
-using MonoDevelop.Ide.TypeSystem;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using MonoDevelop.Core;
@@ -299,7 +298,7 @@ namespace MonoDevelop.CSharp.CodeFixes.FullyQualify
private static IList<string> GetNameParts(INamespaceOrTypeSymbol symbol)
{
- return symbol.ToDisplayString(Ambience.NameFormat).Split('.');
+ return symbol.ToDisplayString(MonoDevelop.Ide.TypeSystem.Ambience.NameFormat).Split('.');
}
private int Compare(INamespaceOrTypeSymbol n1, INamespaceOrTypeSymbol n2)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/OverrideMembersGenerator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/OverrideMembersGenerator.cs
index 771cd7e524..73c5b9beb6 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/OverrideMembersGenerator.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/OverrideMembersGenerator.cs
@@ -28,7 +28,6 @@ using Gtk;
using System.Collections.Generic;
using MonoDevelop.Core;
using MonoDevelop.Refactoring;
-using MonoDevelop.Ide.TypeSystem;
using ICSharpCode.NRefactory6.CSharp;
using System.Linq;
using System.Threading;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
index aecb7a7070..c2c040b331 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
@@ -39,7 +39,6 @@ using MonoDevelop.Components.Commands;
using MonoDevelop.CSharp.Formatting;
using ICSharpCode.NRefactory6.CSharp.Completion;
-using MonoDevelop.Ide.TypeSystem;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
@@ -89,7 +88,7 @@ namespace MonoDevelop.CSharp.Completion
}
}
- public ParsedDocument ParsedDocument {
+ public MonoDevelop.Ide.TypeSystem.ParsedDocument ParsedDocument {
get {
return DocumentContext.ParsedDocument;
}
@@ -399,7 +398,7 @@ namespace MonoDevelop.CSharp.Completion
var roslynCodeCompletionFactory = new RoslynCodeCompletionFactory (this, semanticModel);
foreach (var extHandler in additionalContextHandlers.OfType<IExtensionContextHandler> ())
extHandler.Init (roslynCodeCompletionFactory);
- var engine = new CompletionEngine(TypeSystemService.Workspace, roslynCodeCompletionFactory);
+ var engine = new CompletionEngine(MonoDevelop.Ide.TypeSystem.TypeSystemService.Workspace, roslynCodeCompletionFactory);
var ctx = new ICSharpCode.NRefactory6.CSharp.CompletionContext (partialDoc, offset, semanticModel);
ctx.AdditionalContextHandlers = additionalContextHandlers;
var triggerInfo = new CompletionTriggerInfo (ctrlSpace ? CompletionTriggerReason.CompletionCommand : CompletionTriggerReason.CharTyped, completionChar);
@@ -629,7 +628,7 @@ namespace MonoDevelop.CSharp.Completion
return null;
var partialDoc = await WithFrozenPartialSemanticsAsync (analysisDocument, token);
var semanticModel = await partialDoc.GetSemanticModelAsync ();
- var engine = new ParameterHintingEngine (TypeSystemService.Workspace, new RoslynParameterHintingFactory ());
+ var engine = new ParameterHintingEngine (MonoDevelop.Ide.TypeSystem.TypeSystemService.Workspace, new RoslynParameterHintingFactory ());
var result = await engine.GetParameterDataProviderAsync (analysisDocument, semanticModel, offset, token);
return new MonoDevelop.Ide.CodeCompletion.ParameterHintingResult (result.OfType<MonoDevelop.Ide.CodeCompletion.ParameterHintingData>().ToList (), result.StartOffset);
} catch (Exception e) {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionCategory.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionCategory.cs
index c903029f97..769440ea66 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionCategory.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/RoslynCompletionCategory.cs
@@ -26,7 +26,6 @@
using System;
using MonoDevelop.Ide.CodeCompletion;
using Microsoft.CodeAnalysis;
-using MonoDevelop.Ide.TypeSystem;
using ICSharpCode.NRefactory6.CSharp;
using System.Linq;
@@ -39,8 +38,8 @@ namespace MonoDevelop.CSharp.Completion
public RoslynCompletionCategory (ISymbol symbol)
{
this.symbol = symbol;
- this.DisplayText = symbol.ToDisplayString (Ambience.NameFormat);
- this.Icon = symbol.GetStockIcon ();
+ this.DisplayText = symbol.ToDisplayString (MonoDevelop.Ide.TypeSystem.Ambience.NameFormat);
+ this.Icon = MonoDevelop.Ide.TypeSystem.Stock.GetStockIcon (symbol);
}
public override int CompareTo (CompletionCategory other)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs
index 7861437ee3..038b4ec9c4 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CodeGenerationService.cs
@@ -32,7 +32,6 @@ using MonoDevelop.Core;
using System.CodeDom;
using MonoDevelop.Projects;
using System.CodeDom.Compiler;
-using MonoDevelop.Ide.TypeSystem;
using MonoDevelop.Ide;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
@@ -104,7 +103,7 @@ namespace MonoDevelop.Refactoring
throw new ArgumentException ("The given type needs to be defined in source code.", nameof (type));
- var ws = TypeSystemService.GetWorkspace (project.ParentSolution);
+ var ws = MonoDevelop.Ide.TypeSystem.TypeSystemService.GetWorkspace (project.ParentSolution);
var projectId = ws.GetProjectId (project);
var docId = ws.GetDocumentId (projectId, part.SourceTree.FilePath);
@@ -142,7 +141,7 @@ namespace MonoDevelop.Refactoring
throw new ArgumentNullException (nameof (type));
if (newMember == null)
throw new ArgumentNullException (nameof (newMember));
- var ws = TypeSystemService.GetWorkspace (project.ParentSolution);
+ var ws = MonoDevelop.Ide.TypeSystem.TypeSystemService.GetWorkspace (project.ParentSolution);
var projectId = ws.GetProjectId (project);
var docId = ws.GetDocumentId (projectId, part.SourceTree.FilePath);
@@ -290,8 +289,8 @@ namespace MonoDevelop.Refactoring
sw.WriteLine (ns.ToString ());
}
FileService.NotifyFileChanged (fileName);
- var roslynProject = TypeSystemService.GetCodeAnalysisProject (project);
- var id = TypeSystemService.GetDocumentId (roslynProject.Id, fileName);
+ var roslynProject = MonoDevelop.Ide.TypeSystem.TypeSystemService.GetCodeAnalysisProject (project);
+ var id = MonoDevelop.Ide.TypeSystem.TypeSystemService.GetDocumentId (roslynProject.Id, fileName);
if (id == null)
return null;
var model = roslynProject.GetDocument (id).GetSemanticModelAsync ().Result;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs
index aec54afefb..c3f0c62101 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs
@@ -24,7 +24,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using MonoDevelop.Ide.TypeSystem;
using System.Text;
using System.IO;
using System.Collections.Generic;
@@ -84,7 +83,7 @@ namespace MonoDevelop.CSharp
}
this.options = ctx.GetOptionSet ();
} else {
- this.options = TypeSystemService.Workspace.Options;
+ this.options = MonoDevelop.Ide.TypeSystem.TypeSystemService.Workspace.Options;
}
}
@@ -114,11 +113,11 @@ namespace MonoDevelop.CSharp
//ToMinimalDisplayString can use little outdated model this is fine
//but in case of Sketches where user usually is at end of document when typing text this can throw exception
//because offset can be >= Length
- displayString = model != null ? type.ToMinimalDisplayString (model, Math.Min (model.SyntaxTree.Length - 1, offset), Ambience.LabelFormat) : type.Name;
+ displayString = model != null ? type.ToMinimalDisplayString (model, Math.Min (model.SyntaxTree.Length - 1, offset), MonoDevelop.Ide.TypeSystem.Ambience.LabelFormat) : type.Name;
} else {
- displayString = type.ToDisplayString (Ambience.LabelFormat);
+ displayString = type.ToDisplayString (MonoDevelop.Ide.TypeSystem.Ambience.LabelFormat);
}
- var text = Ambience.EscapeText (displayString);
+ var text = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (displayString);
return highlight ? HighlightSemantically (text, colorStyle.UserTypes) : text;
}
@@ -576,7 +575,7 @@ namespace MonoDevelop.CSharp
static string FilterEntityName (string name)
{
- return Ambience.EscapeText (CSharpAmbience.FilterName (name));
+ return MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (CSharpAmbience.FilterName (name));
}
public string GetDelegateInfo (ITypeSymbol type)
@@ -1505,7 +1504,7 @@ namespace MonoDevelop.CSharp
{
var result = new TooltipInformation ();
if (resolveResult == null) {
- result.SignatureMarkup = Ambience.EscapeText (typeOfExpression.Type.ToString ());
+ result.SignatureMarkup = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (typeOfExpression.Type.ToString ());
} else {
result.SignatureMarkup = GetTypeMarkup (resolveResult, true);
}
@@ -1650,7 +1649,7 @@ namespace MonoDevelop.CSharp
void AppendConstant (StringBuilder sb, ITypeSymbol constantType, object constantValue, bool useNumericalEnumValue = false)
{
if (constantValue is string) {
- sb.Append (Highlight ("\"" + Ambience.EscapeText ((string)constantValue) + "\"", colorStyle.String));
+ sb.Append (Highlight ("\"" + MonoDevelop.Ide.TypeSystem.Ambience.EscapeText ((string)constantValue) + "\"", colorStyle.String));
return;
}
if (constantValue is char) {
@@ -1714,7 +1713,7 @@ namespace MonoDevelop.CSharp
sb.Append ("(" + GetTypeReferenceString (constantType) + ")" + Highlight (constantValue.ToString (), colorStyle.Number));
return;
}
- sb.Append (Highlight (Ambience.EscapeText (constantValue.ToString ()), colorStyle.Number));
+ sb.Append (Highlight (MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (constantValue.ToString ()), colorStyle.Number));
}
void AppendVariance (StringBuilder sb, VarianceKind variance)
@@ -1817,8 +1816,8 @@ namespace MonoDevelop.CSharp
// "<small>" + GettextCatalog.GetString ("File:\t\t{0} (line {1})", AmbienceService.EscapeText (relPath), line) + "</small>";
// }
}
- return (type.ContainingNamespace.IsGlobalNamespace ? "" : "<small>" + GettextCatalog.GetString ("Namespace:\t{0}", Ambience.EscapeText (type.ContainingNamespace.Name)) + "</small>" + Environment.NewLine) +
- "<small>" + GettextCatalog.GetString ("Assembly:\t{0}", Ambience.EscapeText (type.ContainingAssembly.Name)) + "</small>";
+ return (type.ContainingNamespace.IsGlobalNamespace ? "" : "<small>" + GettextCatalog.GetString ("Namespace:\t{0}", MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (type.ContainingNamespace.Name)) + "</small>" + Environment.NewLine) +
+ "<small>" + GettextCatalog.GetString ("Assembly:\t{0}", MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (type.ContainingAssembly.Name)) + "</small>";
}
if (entity.ContainingType != null) {
@@ -1834,8 +1833,8 @@ namespace MonoDevelop.CSharp
// "<small>" + GettextCatalog.GetString ("File:\t\t{0} (line {1})", AmbienceService.EscapeText (relPath), line) + "</small>";
// }
}
- return "<small>" + GettextCatalog.GetString ("From type:\t{0}", Ambience.EscapeText (entity.ContainingType.Name)) + "</small>" + Environment.NewLine +
- "<small>" + GettextCatalog.GetString ("Assembly:\t{0}", Ambience.EscapeText (entity.ContainingAssembly.Name)) + "</small>";
+ return "<small>" + GettextCatalog.GetString ("From type:\t{0}", MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (entity.ContainingType.Name)) + "</small>" + Environment.NewLine +
+ "<small>" + GettextCatalog.GetString ("Assembly:\t{0}", MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (entity.ContainingAssembly.Name)) + "</small>";
}
return null;
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
index 37d155aa0f..c31712a276 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
@@ -175,11 +175,6 @@
<Name>Mono.Debugging</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory6.CSharp.csproj">
- <Project>{7E891659-45F3-42B5-B940-A728780CCAE9}</Project>
- <Name>ICSharpCode.NRefactory6.CSharp</Name>
- <Private>False</Private>
- </ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs
index 9ccdb54b71..11b8ebfe09 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs
@@ -36,7 +36,6 @@ using Xwt;
using Xwt.Drawing;
using System.Linq;
using System.IO;
-using ICSharpCode.NRefactory6.CSharp;
namespace MonoDevelop.Debugger
{
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
index ac4ee6ef12..b3d178c847 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
@@ -46,7 +46,7 @@ using MonoDevelop.Debugger.Viewers;
using MonoDevelop.Ide.TextEditing;
using System.Linq;
using System.Threading.Tasks;
-using ICSharpCode.NRefactory6.CSharp;
+using MonoDevelop.Ide.TypeSystem;
namespace MonoDevelop.Debugger
{
@@ -1070,9 +1070,9 @@ namespace MonoDevelop.Debugger
var rr = textEditorResolver.GetLanguageItem (doc.Editor.LocationToOffset (location.Line, 1), identifier);
var ns = rr as Microsoft.CodeAnalysis.INamespaceSymbol;
if (ns != null)
- return ns.GetFullName ();
+ return ns.ToDisplayString (Microsoft.CodeAnalysis.SymbolDisplayFormat.CSharpErrorMessageFormat);
var result = rr as Microsoft.CodeAnalysis.INamedTypeSymbol;
- if (result != null && !(result.TypeKind == Microsoft.CodeAnalysis.TypeKind.Dynamic && result.GetFullName () == "dynamic")) {
+ if (result != null && !(result.TypeKind == Microsoft.CodeAnalysis.TypeKind.Dynamic && result.ToDisplayString (Microsoft.CodeAnalysis.SymbolDisplayFormat.CSharpErrorMessageFormat) == "dynamic")) {
return result.ToDisplayString (new Microsoft.CodeAnalysis.SymbolDisplayFormat (
typeQualificationStyle: Microsoft.CodeAnalysis.SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
miscellaneousOptions:
@@ -1146,7 +1146,7 @@ namespace MonoDevelop.Debugger
public void SetMessage (DebuggerStartInfo dsi, string message, bool listening, int attemptNumber)
{
Gtk.Application.Invoke (delegate {
- IdeApp.Workbench.StatusBar.ShowMessage (Stock.StatusConnecting, message);
+ IdeApp.Workbench.StatusBar.ShowMessage (Ide.Gui.Stock.StatusConnecting, message);
});
}
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs
index d3f30ee9e0..4a60c3f121 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs
@@ -41,6 +41,7 @@ using Microsoft.CodeAnalysis;
using ICSharpCode.NRefactory6.CSharp;
using ICSharpCode.NRefactory6.CSharp.Completion;
using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide.TypeSystem;
namespace MonoDevelop.GtkCore.GuiBuilder
{
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj
index ca274dae25..c95b2ac6e4 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj
@@ -150,11 +150,6 @@
<Name>Mono.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory6.CSharp.csproj">
- <Project>{7E891659-45F3-42B5-B940-A728780CCAE9}</Project>
- <Name>ICSharpCode.NRefactory6.CSharp</Name>
- <Private>False</Private>
- </ProjectReference>
<ProjectReference Include="..\CSharpBinding\CSharpBinding.csproj">
<Project>{07CC7654-27D6-421D-A64C-0FFA40456FA2}</Project>
<Name>CSharpBinding</Name>
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs
index ff5887bc0a..8dc308f030 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs
@@ -27,7 +27,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using MonoDevelop.Ide.TypeSystem;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using MonoDevelop.Ide.Editor;
@@ -40,7 +39,7 @@ namespace MonoDevelop.Refactoring
{
public static class InsertionPointService
{
- public static List<InsertionPoint> GetInsertionPoints (IReadonlyTextDocument data, ParsedDocument parsedDocument, ITypeSymbol type, int part)
+ public static List<InsertionPoint> GetInsertionPoints (IReadonlyTextDocument data, MonoDevelop.Ide.TypeSystem.ParsedDocument parsedDocument, ITypeSymbol type, int part)
{
if (data == null)
throw new ArgumentNullException (nameof (data));
@@ -127,7 +126,7 @@ namespace MonoDevelop.Refactoring
return result;
}
- public static List<InsertionPoint> GetInsertionPoints (IReadonlyTextDocument data, ParsedDocument parsedDocument, ITypeSymbol type, Location location)
+ public static List<InsertionPoint> GetInsertionPoints (IReadonlyTextDocument data, MonoDevelop.Ide.TypeSystem.ParsedDocument parsedDocument, ITypeSymbol type, Location location)
{
return GetInsertionPoints (data, parsedDocument, type, location.SourceSpan.Start);
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
index ce2cba47ed..9efd1f0ffb 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
@@ -98,11 +98,6 @@
<Name>Mono.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory6.CSharp.csproj">
- <Project>{7E891659-45F3-42B5-B940-A728780CCAE9}</Project>
- <Name>ICSharpCode.NRefactory6.CSharp</Name>
- <Private>False</Private>
- </ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/main/src/addins/NUnit/MonoDevelop.NUnit.csproj b/main/src/addins/NUnit/MonoDevelop.NUnit.csproj
index 078198a4c0..0416f22fdd 100644
--- a/main/src/addins/NUnit/MonoDevelop.NUnit.csproj
+++ b/main/src/addins/NUnit/MonoDevelop.NUnit.csproj
@@ -118,10 +118,9 @@
<Name>Xwt</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory6.CSharp.csproj">
- <Project>{7E891659-45F3-42B5-B940-A728780CCAE9}</Project>
- <Name>ICSharpCode.NRefactory6.CSharp</Name>
- <Private>False</Private>
+ <ProjectReference Include="..\..\..\external\nrefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
+ <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
+ <Name>ICSharpCode.NRefactory</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
diff --git a/main/src/addins/NUnit/Services/BinaryResultsStore.cs b/main/src/addins/NUnit/Services/BinaryResultsStore.cs
index dc0581e209..a50efcdc81 100644
--- a/main/src/addins/NUnit/Services/BinaryResultsStore.cs
+++ b/main/src/addins/NUnit/Services/BinaryResultsStore.cs
@@ -26,7 +26,7 @@
using System;
using System.Xml.Serialization;
using System.IO;
-using ICSharpCode.NRefactory6.Utils;
+using ICSharpCode.NRefactory.Utils;
namespace MonoDevelop.NUnit
{
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/MonoDevelop.VersionControl.Git.Tests.csproj b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/MonoDevelop.VersionControl.Git.Tests.csproj
index 13adc1d047..cdfa502f70 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/MonoDevelop.VersionControl.Git.Tests.csproj
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/MonoDevelop.VersionControl.Git.Tests.csproj
@@ -19,20 +19,17 @@
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\build\tests</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<NoWarn>1591;1573</NoWarn>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\build\tests</OutputPath>
- <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
- <DebugSymbols>true</DebugSymbols>
<NoWarn>1591;1573</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMac|AnyCPU' ">
@@ -41,7 +38,6 @@
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\build\tests</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<NoWarn>1591;1573</NoWarn>
@@ -52,7 +48,6 @@
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\build\tests</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<NoWarn>1591;1573</NoWarn>
@@ -63,34 +58,33 @@
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\build\tests</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<NoWarn>1591;1573</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWin32|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\build\tests</OutputPath>
<WarningLevel>4</WarningLevel>
- <DebugSymbols>true</DebugSymbols>
<NoWarn>1591;1573</NoWarn>
- <DebugType>pdbonly</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMac|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\build\tests</OutputPath>
<WarningLevel>4</WarningLevel>
- <DebugSymbols>true</DebugSymbols>
<NoWarn>1591;1573</NoWarn>
- <DebugType>pdbonly</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseGnome|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\build\tests</OutputPath>
<WarningLevel>4</WarningLevel>
- <DebugSymbols>true</DebugSymbols>
<NoWarn>1591;1573</NoWarn>
- <DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/main/src/core/MonoDevelop.Ide/AssemblyInfo.cs b/main/src/core/MonoDevelop.Ide/AssemblyInfo.cs
index ce2f49f15a..84242fe658 100644
--- a/main/src/core/MonoDevelop.Ide/AssemblyInfo.cs
+++ b/main/src/core/MonoDevelop.Ide/AssemblyInfo.cs
@@ -28,4 +28,5 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("MonoDevelop.AssemblyBrowser")]
[assembly: InternalsVisibleTo("MonoDevelop.AspNet")]
[assembly: InternalsVisibleTo("Xamarin.Sketches")]
-[assembly: InternalsVisibleTo("MonoDevelop.CSharpBinding.AspNet")] \ No newline at end of file
+[assembly: InternalsVisibleTo("MonoDevelop.CSharpBinding.AspNet")]
+[assembly: InternalsVisibleTo("MonoDevelop.GtkCore")]
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/NR5CompatibiltyExtensions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/NR5CompatibiltyExtensions.cs
new file mode 100644
index 0000000000..3ccffb855a
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/NR5CompatibiltyExtensions.cs
@@ -0,0 +1,742 @@
+//
+// NR5CompatibiltyExtensions.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using Microsoft.CodeAnalysis;
+
+namespace MonoDevelop.Ide.TypeSystem
+{
+ static class NR5CompatibiltyExtensions
+ {
+ /// <summary>
+ /// Gets the full name of the metadata.
+ /// In case symbol is not INamedTypeSymbol it returns raw MetadataName
+ /// Example: Generic type returns T1, T2...
+ /// </summary>
+ /// <returns>The full metadata name.</returns>
+ /// <param name="symbol">Symbol.</param>
+ public static string GetFullMetadataName (this ITypeSymbol symbol)
+ {
+ //This is for comaptibility with NR5 reflection name in case of generic types like T1, T2...
+ var namedTypeSymbol = symbol as INamedTypeSymbol;
+ return namedTypeSymbol != null ? GetFullMetadataName (namedTypeSymbol) : symbol.MetadataName;
+ }
+
+ /// <summary>
+ /// Gets the full MetadataName(ReflectionName in NR5).
+ /// Example: Namespace1.Namespace2.Classs1+NestedClassWithTwoGenericTypes`2+NestedClassWithoutGenerics
+ /// </summary>
+ /// <returns>The full metadata name.</returns>
+ /// <param name="symbol">Symbol.</param>
+ public static string GetFullMetadataName (this INamedTypeSymbol symbol)
+ {
+ var fullName = new StringBuilder (symbol.MetadataName);
+ var parentType = symbol.ContainingType;
+ while (parentType != null) {
+ fullName.Insert (0, '+');
+ fullName.Insert (0, parentType.MetadataName);
+ parentType = parentType.ContainingType;
+ }
+ var ns = symbol.ContainingNamespace;
+ while (ns != null && !ns.IsGlobalNamespace) {
+ fullName.Insert (0, '.');
+ fullName.Insert (0, ns.MetadataName);
+ ns = ns.ContainingNamespace;
+ }
+ return fullName.ToString ();
+ }
+
+ public static IEnumerable<INamedTypeSymbol> GetAllTypes (this INamespaceSymbol namespaceSymbol, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (namespaceSymbol == null)
+ throw new ArgumentNullException (nameof (namespaceSymbol));
+ var stack = new Stack<INamespaceOrTypeSymbol> ();
+ stack.Push (namespaceSymbol);
+
+ while (stack.Count > 0) {
+ if (cancellationToken.IsCancellationRequested)
+ yield break;
+ var current = stack.Pop ();
+ var currentNs = current as INamespaceSymbol;
+ if (currentNs != null) {
+ foreach (var member in currentNs.GetMembers ())
+ stack.Push (member);
+ } else {
+ var namedType = (INamedTypeSymbol)current;
+ foreach (var nestedType in namedType.GetTypeMembers ())
+ stack.Push (nestedType);
+ yield return namedType;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Determines if derived from baseType. Includes itself and all base classes, but does not include interfaces.
+ /// </summary>
+ /// <returns><c>true</c> if is derived from class the specified type baseType; otherwise, <c>false</c>.</returns>
+ /// <param name="type">Type.</param>
+ /// <param name="baseType">Base type.</param>
+ public static bool IsDerivedFromClass(this INamedTypeSymbol type, INamedTypeSymbol baseType)
+ {
+ //NR5 is returning true also for same type
+ for (; type != null; type = type.BaseType) {
+ if (type == baseType) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static IEnumerable<INamedTypeSymbol> GetBaseTypes(this ITypeSymbol type)
+ {
+ var current = type.BaseType;
+ while (current != null)
+ {
+ yield return current;
+ current = current.BaseType;
+ }
+ }
+
+ public static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(this ITypeSymbol type)
+ {
+ var current = type;
+ while (current != null)
+ {
+ yield return current;
+ current = current.BaseType;
+ }
+ }
+
+ public static ITypeSymbol GetReturnType(this ISymbol symbol)
+ {
+ if (symbol == null)
+ throw new ArgumentNullException("symbol");
+ switch (symbol.Kind) {
+ case SymbolKind.Field:
+ var field = (IFieldSymbol)symbol;
+ return field.Type;
+ case SymbolKind.Method:
+ var method = (IMethodSymbol)symbol;
+ if (method.MethodKind == MethodKind.Constructor)
+ return method.ContainingType;
+ return method.ReturnType;
+ case SymbolKind.Property:
+ var property = (IPropertySymbol)symbol;
+ return property.Type;
+ case SymbolKind.Event:
+ var evt = (IEventSymbol)symbol;
+ return evt.Type;
+ case SymbolKind.Parameter:
+ var param = (IParameterSymbol)symbol;
+ return param.Type;
+ case SymbolKind.Local:
+ var local = (ILocalSymbol)symbol;
+ return local.Type;
+ }
+ return null;
+ }
+
+
+ /// <summary>
+ /// Gets the full name of the namespace.
+ /// </summary>
+ public static string GetFullName (this INamespaceSymbol ns)
+ {
+ return ns.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat);
+ }
+
+ /// <summary>
+ /// Gets the full name. The full name is no 1:1 representation of a type it's missing generics and it has a poor
+ /// representation for inner types (just dot separated).
+ /// DO NOT use this method unless you're know what you do. It's only implemented for legacy code.
+ /// </summary>
+ public static string GetFullName (this ITypeSymbol type)
+ {
+ return type.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat);
+ }
+
+ public static IEnumerable<INamedTypeSymbol> GetAllTypesInMainAssembly(this Compilation compilation, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (compilation == null)
+ throw new ArgumentNullException("compilation");
+ return compilation.Assembly.GlobalNamespace.GetAllTypes(cancellationToken);
+ }
+
+ public static IEnumerable<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol containingType, ISymbol within) where T : class, ISymbol
+ {
+ if (containingType == null)
+ return Enumerable.Empty<T>();
+
+ var types = containingType.GetBaseTypesAndThis();
+ return types.SelectMany(x => x.GetMembers().OfType<T>().Where(m => m.IsAccessibleWithin(within)));
+ }
+
+ /// <summary>
+ /// Gets all base classes.
+ /// </summary>
+ /// <returns>The all base classes.</returns>
+ /// <param name="type">Type.</param>
+ public static IEnumerable<INamedTypeSymbol> GetAllBaseClasses(this INamedTypeSymbol type, bool includeSuperType = false)
+ {
+ if (!includeSuperType)
+ type = type.BaseType;
+ while (type != null) {
+ yield return type;
+ type = type.BaseType;
+ }
+ }
+
+ /// <summary>
+ /// Checks if 'symbol' is accessible from within 'within'.
+ /// </summary>
+ public static bool IsAccessibleWithin(
+ this ISymbol symbol,
+ ISymbol within,
+ ITypeSymbol throughTypeOpt = null)
+ {
+ if (within is IAssemblySymbol)
+ {
+ return symbol.IsAccessibleWithin((IAssemblySymbol)within, throughTypeOpt);
+ }
+ else if (within is INamedTypeSymbol)
+ {
+ return symbol.IsAccessibleWithin((INamedTypeSymbol)within, throughTypeOpt);
+ }
+ else
+ {
+ throw new ArgumentException();
+ }
+ }
+
+ /// <summary>
+ /// Checks if 'symbol' is accessible from within assembly 'within'.
+ /// </summary>
+ public static bool IsAccessibleWithin(
+ this ISymbol symbol,
+ IAssemblySymbol within,
+ ITypeSymbol throughTypeOpt = null)
+ {
+ bool failedThroughTypeCheck;
+ return IsSymbolAccessibleCore(symbol, within, throughTypeOpt, out failedThroughTypeCheck);
+ }
+
+ /// <summary>
+ /// Checks if 'symbol' is accessible from within name type 'within', with an optional
+ /// qualifier of type "throughTypeOpt".
+ /// </summary>
+ public static bool IsAccessibleWithin(
+ this ISymbol symbol,
+ INamedTypeSymbol within,
+ ITypeSymbol throughTypeOpt = null)
+ {
+ bool failedThroughTypeCheck;
+ return IsSymbolAccessible(symbol, within, throughTypeOpt, out failedThroughTypeCheck);
+ }
+
+ /// <summary>
+ /// Checks if 'symbol' is accessible from within assembly 'within', with an qualifier of
+ /// type "throughTypeOpt". Sets "failedThroughTypeCheck" to true if it failed the "through
+ /// type" check.
+ /// </summary>
+ private static bool IsSymbolAccessible(
+ ISymbol symbol,
+ INamedTypeSymbol within,
+ ITypeSymbol throughTypeOpt,
+ out bool failedThroughTypeCheck)
+ {
+ return IsSymbolAccessibleCore(symbol, within, throughTypeOpt, out failedThroughTypeCheck);
+ }
+
+ /// <summary>
+ /// Checks if 'symbol' is accessible from within 'within', which must be a INamedTypeSymbol
+ /// or an IAssemblySymbol. If 'symbol' is accessed off of an expression then
+ /// 'throughTypeOpt' is the type of that expression. This is needed to properly do protected
+ /// access checks. Sets "failedThroughTypeCheck" to true if this protected check failed.
+ /// </summary>
+ //// NOTE(cyrusn): I expect this function to be called a lot. As such, I do not do any memory
+ //// allocations in the function itself (including not making any iterators). This does mean
+ //// that certain helper functions that we'd like to call are inlined in this method to
+ //// prevent the overhead of returning collections or enumerators.
+ private static bool IsSymbolAccessibleCore(
+ ISymbol symbol,
+ ISymbol within, // must be assembly or named type symbol
+ ITypeSymbol throughTypeOpt,
+ out bool failedThroughTypeCheck)
+ {
+ // Contract.ThrowIfNull(symbol);
+ // Contract.ThrowIfNull(within);
+ // Contract.Requires(within is INamedTypeSymbol || within is IAssemblySymbol);
+
+ failedThroughTypeCheck = false;
+ // var withinAssembly = (within as IAssemblySymbol) ?? ((INamedTypeSymbol)within).ContainingAssembly;
+
+ switch (symbol.Kind)
+ {
+ case SymbolKind.Alias:
+ return IsSymbolAccessibleCore(((IAliasSymbol)symbol).Target, within, throughTypeOpt, out failedThroughTypeCheck);
+
+ case SymbolKind.ArrayType:
+ return IsSymbolAccessibleCore(((IArrayTypeSymbol)symbol).ElementType, within, null, out failedThroughTypeCheck);
+
+ case SymbolKind.PointerType:
+ return IsSymbolAccessibleCore(((IPointerTypeSymbol)symbol).PointedAtType, within, null, out failedThroughTypeCheck);
+
+ case SymbolKind.NamedType:
+ return IsNamedTypeAccessible((INamedTypeSymbol)symbol, within);
+
+ case SymbolKind.ErrorType:
+ return true;
+
+ case SymbolKind.TypeParameter:
+ case SymbolKind.Parameter:
+ case SymbolKind.Local:
+ case SymbolKind.Label:
+ case SymbolKind.Namespace:
+ case SymbolKind.DynamicType:
+ case SymbolKind.Assembly:
+ case SymbolKind.NetModule:
+ case SymbolKind.RangeVariable:
+ // These types of symbols are always accessible (if visible).
+ return true;
+
+ case SymbolKind.Method:
+ case SymbolKind.Property:
+ case SymbolKind.Field:
+ case SymbolKind.Event:
+ if (symbol.IsStatic)
+ {
+ // static members aren't accessed "through" an "instance" of any type. So we
+ // null out the "through" instance here. This ensures that we'll understand
+ // accessing protected statics properly.
+ throughTypeOpt = null;
+ }
+
+ // If this is a synthesized operator of dynamic, it's always accessible.
+ if (symbol?.Kind == SymbolKind.Method &&
+ ((IMethodSymbol)symbol).MethodKind == MethodKind.BuiltinOperator &&
+ symbol.ContainingSymbol?.Kind == SymbolKind.DynamicType)
+ {
+ return true;
+ }
+
+ // If it's a synthesized operator on a pointer, use the pointer's PointedAtType.
+ if (symbol?.Kind == SymbolKind.Method &&
+ ((IMethodSymbol)symbol).MethodKind == MethodKind.BuiltinOperator &&
+ symbol.ContainingSymbol?.Kind == SymbolKind.PointerType)
+ {
+ return IsSymbolAccessibleCore(((IPointerTypeSymbol)symbol.ContainingSymbol).PointedAtType, within, null, out failedThroughTypeCheck);
+ }
+
+ return IsMemberAccessible(symbol.ContainingType, symbol.DeclaredAccessibility, within, throughTypeOpt, out failedThroughTypeCheck);
+
+ default:
+ throw new Exception ("unreachable");
+ }
+ }
+
+ // Is the named type "type" accessible from within "within", which must be a named type or
+ // an assembly.
+ private static bool IsNamedTypeAccessible(INamedTypeSymbol type, ISymbol within)
+ {
+ // Contract.Requires(within is INamedTypeSymbol || within is IAssemblySymbol);
+ // Contract.ThrowIfNull(type);
+
+ if (type?.TypeKind == TypeKind.Error)
+ {
+ // Always assume that error types are accessible.
+ return true;
+ }
+
+ bool unused;
+ if (!type.IsDefinition)
+ {
+ // All type argument must be accessible.
+ foreach (var typeArg in type.TypeArguments)
+ {
+ // type parameters are always accessible, so don't check those (so common it's
+ // worth optimizing this).
+ if (typeArg.Kind != SymbolKind.TypeParameter &&
+ typeArg.TypeKind != TypeKind.Error &&
+ !IsSymbolAccessibleCore(typeArg, within, null, out unused))
+ {
+ return false;
+ }
+ }
+ }
+
+ var containingType = type.ContainingType;
+ return containingType == null
+ ? IsNonNestedTypeAccessible(type.ContainingAssembly, type.DeclaredAccessibility, within)
+ : IsMemberAccessible(type.ContainingType, type.DeclaredAccessibility, within, null, out unused);
+ }
+
+ // Is a top-level type with accessibility "declaredAccessibility" inside assembly "assembly"
+ // accessible from "within", which must be a named type of an assembly.
+ private static bool IsNonNestedTypeAccessible(
+ IAssemblySymbol assembly,
+ Accessibility declaredAccessibility,
+ ISymbol within)
+ {
+ // Contract.Requires(within is INamedTypeSymbol || within is IAssemblySymbol);
+ // Contract.ThrowIfNull(assembly);
+ var withinAssembly = (within as IAssemblySymbol) ?? ((INamedTypeSymbol)within).ContainingAssembly;
+
+ switch (declaredAccessibility)
+ {
+ case Accessibility.NotApplicable:
+ case Accessibility.Public:
+ // Public symbols are always accessible from any context
+ return true;
+
+ case Accessibility.Private:
+ case Accessibility.Protected:
+ case Accessibility.ProtectedAndInternal:
+ // Shouldn't happen except in error cases.
+ return false;
+
+ case Accessibility.Internal:
+ case Accessibility.ProtectedOrInternal:
+ // An internal type is accessible if we're in the same assembly or we have
+ // friend access to the assembly it was defined in.
+ return withinAssembly.IsSameAssemblyOrHasFriendAccessTo(assembly);
+
+ default:
+ throw new Exception ("unreachable");
+ }
+ }
+
+ // Is a member with declared accessibility "declaredAccessiblity" accessible from within
+ // "within", which must be a named type or an assembly.
+ private static bool IsMemberAccessible(
+ INamedTypeSymbol containingType,
+ Accessibility declaredAccessibility,
+ ISymbol within,
+ ITypeSymbol throughTypeOpt,
+ out bool failedThroughTypeCheck)
+ {
+ // Contract.Requires(within is INamedTypeSymbol || within is IAssemblySymbol);
+ // Contract.ThrowIfNull(containingType);
+
+ failedThroughTypeCheck = false;
+
+ var originalContainingType = containingType.OriginalDefinition;
+ var withinNamedType = within as INamedTypeSymbol;
+ var withinAssembly = (within as IAssemblySymbol) ?? ((INamedTypeSymbol)within).ContainingAssembly;
+
+ // A nested symbol is only accessible to us if its container is accessible as well.
+ if (!IsNamedTypeAccessible(containingType, within))
+ {
+ return false;
+ }
+
+ switch (declaredAccessibility)
+ {
+ case Accessibility.NotApplicable:
+ // TODO(cyrusn): Is this the right thing to do here? Should the caller ever be
+ // asking about the accessibility of a symbol that has "NotApplicable" as its
+ // value? For now, I'm preserving the behavior of the existing code. But perhaps
+ // we should fail here and require the caller to not do this?
+ return true;
+
+ case Accessibility.Public:
+ // Public symbols are always accessible from any context
+ return true;
+
+ case Accessibility.Private:
+ // All expressions in the current submission (top-level or nested in a method or
+ // type) can access previous submission's private top-level members. Previous
+ // submissions are treated like outer classes for the current submission - the
+ // inner class can access private members of the outer class.
+ if (withinAssembly.IsInteractive && containingType.IsScriptClass)
+ {
+ return true;
+ }
+
+ // private members never accessible from outside a type.
+ return withinNamedType != null && IsPrivateSymbolAccessible(withinNamedType, originalContainingType);
+
+ case Accessibility.Internal:
+ // An internal type is accessible if we're in the same assembly or we have
+ // friend access to the assembly it was defined in.
+ return withinAssembly.IsSameAssemblyOrHasFriendAccessTo(containingType.ContainingAssembly);
+
+ case Accessibility.ProtectedAndInternal:
+ if (!withinAssembly.IsSameAssemblyOrHasFriendAccessTo(containingType.ContainingAssembly))
+ {
+ // We require internal access. If we don't have it, then this symbol is
+ // definitely not accessible to us.
+ return false;
+ }
+
+ // We had internal access. Also have to make sure we have protected access.
+ return IsProtectedSymbolAccessible(withinNamedType, withinAssembly, throughTypeOpt, originalContainingType, out failedThroughTypeCheck);
+
+ case Accessibility.ProtectedOrInternal:
+ if (withinAssembly.IsSameAssemblyOrHasFriendAccessTo(containingType.ContainingAssembly))
+ {
+ // If we have internal access to this symbol, then that's sufficient. no
+ // need to do the complicated protected case.
+ return true;
+ }
+
+ // We don't have internal access. But if we have protected access then that's
+ // sufficient.
+ return IsProtectedSymbolAccessible(withinNamedType, withinAssembly, throughTypeOpt, originalContainingType, out failedThroughTypeCheck);
+
+ case Accessibility.Protected:
+ return IsProtectedSymbolAccessible(withinNamedType, withinAssembly, throughTypeOpt, originalContainingType, out failedThroughTypeCheck);
+
+ default:
+ throw new Exception ("unreachable");
+ }
+ }
+
+ // Is a protected symbol inside "originalContainingType" accessible from within "within",
+ // which much be a named type or an assembly.
+ private static bool IsProtectedSymbolAccessible(
+ INamedTypeSymbol withinType,
+ IAssemblySymbol withinAssembly,
+ ITypeSymbol throughTypeOpt,
+ INamedTypeSymbol originalContainingType,
+ out bool failedThroughTypeCheck)
+ {
+ failedThroughTypeCheck = false;
+
+ // It is not an error to define protected member in a sealed Script class,
+ // it's just a warning. The member behaves like a private one - it is visible
+ // in all subsequent submissions.
+ if (withinAssembly.IsInteractive && originalContainingType.IsScriptClass)
+ {
+ return true;
+ }
+
+ if (withinType == null)
+ {
+ // If we're not within a type, we can't access a protected symbol
+ return false;
+ }
+
+ // A protected symbol is accessible if we're (optionally nested) inside the type that it
+ // was defined in.
+
+ // NOTE(ericli): It is helpful to consider 'protected' as *increasing* the
+ // accessibility domain of a private member, rather than *decreasing* that of a public
+ // member. Members are naturally private; the protected, internal and public access
+ // modifiers all increase the accessibility domain. Since private members are accessible
+ // to nested types, so are protected members.
+
+ // NOTE(cyrusn): We do this check up front as it is very fast and easy to do.
+ if (IsNestedWithinOriginalContainingType(withinType, originalContainingType))
+ {
+ return true;
+ }
+
+ // Protected is really confusing. Check out 3.5.3 of the language spec "protected access
+ // for instance members" to see how it works. I actually got the code for this from
+ // LangCompiler::CheckAccessCore
+ {
+ var current = withinType.OriginalDefinition;
+ var originalThroughTypeOpt = throughTypeOpt == null ? null : throughTypeOpt.OriginalDefinition;
+ while (current != null)
+ {
+ // Contract.Requires(current.IsDefinition);
+
+ if (current.Equals(originalContainingType))
+ {
+ // NOTE(cyrusn): We're continually walking up the 'throughType's inheritance
+ // chain. We could compute it up front and cache it in a set. However, i
+ // don't want to allocate memory in this function. Also, in practice
+ // inheritance chains should be very short. As such, it might actually be
+ // slower to create and check inside the set versus just walking the
+ // inheritance chain.
+ if (originalThroughTypeOpt == null ||
+ originalThroughTypeOpt.Equals(current))
+ {
+ return true;
+ }
+ else
+ {
+ failedThroughTypeCheck = true;
+ }
+ }
+
+ // NOTE(cyrusn): The container of an original type is always original.
+ current = current.ContainingType;
+ }
+ }
+
+ return false;
+ }
+
+ // Is a private symbol access
+ private static bool IsPrivateSymbolAccessible(
+ ISymbol within,
+ INamedTypeSymbol originalContainingType)
+ {
+ //Contract.Requires(within is INamedTypeSymbol || within is IAssemblySymbol);
+
+ var withinType = within as INamedTypeSymbol;
+ if (withinType == null)
+ {
+ // If we're not within a type, we can't access a private symbol
+ return false;
+ }
+
+ // A private symbol is accessible if we're (optionally nested) inside the type that it
+ // was defined in.
+ return IsNestedWithinOriginalContainingType(withinType, originalContainingType);
+ }
+
+ // Is the type "withinType" nested within the original type "originalContainingType".
+ private static bool IsNestedWithinOriginalContainingType(
+ INamedTypeSymbol withinType,
+ INamedTypeSymbol originalContainingType)
+ {
+ // Contract.ThrowIfNull(withinType);
+ // Contract.ThrowIfNull(originalContainingType);
+
+ // Walk up my parent chain and see if I eventually hit the owner. If so then I'm a
+ // nested type of that owner and I'm allowed access to everything inside of it.
+ var current = withinType.OriginalDefinition;
+ while (current != null)
+ {
+ //Contract.Requires(current.IsDefinition);
+ if (current.Equals(originalContainingType))
+ {
+ return true;
+ }
+
+ // NOTE(cyrusn): The container of an 'original' type is always original.
+ current = current.ContainingType;
+ }
+
+ return false;
+ }
+
+ public static bool IsDefinedInMetadata(this ISymbol symbol)
+ {
+ return symbol.Locations.Any (loc => loc.IsInMetadata);
+ }
+
+ public static bool IsDefinedInSource(this ISymbol symbol)
+ {
+ return symbol.Locations.All (loc => loc.IsInSource);
+ }
+
+ //public static DeclarationModifiers GetSymbolModifiers(this ISymbol symbol)
+ //{
+ // // ported from roslyn source - why they didn't use DeclarationModifiers.From (symbol) ?
+ // return DeclarationModifiers.None
+ // .WithIsStatic (symbol.IsStatic)
+ // .WithIsAbstract (symbol.IsAbstract)
+ // .WithIsUnsafe (symbol.IsUnsafe ())
+ // .WithIsVirtual (symbol.IsVirtual)
+ // .WithIsOverride (symbol.IsOverride)
+ // .WithIsSealed (symbol.IsSealed);
+ //}
+
+ public static IEnumerable<SyntaxReference> GetDeclarations(this ISymbol symbol)
+ {
+ return symbol != null
+ ? symbol.DeclaringSyntaxReferences.AsEnumerable()
+ : Enumerable.Empty<SyntaxReference>();
+ }
+
+ public static bool IsSameAssemblyOrHasFriendAccessTo(this IAssemblySymbol assembly, IAssemblySymbol toAssembly)
+ {
+ return
+ Equals(assembly, toAssembly) ||
+ (assembly.IsInteractive && toAssembly.IsInteractive) ||
+ toAssembly.GivesAccessTo(assembly);
+ }
+
+ /// <summary>
+ /// Returns the component category.
+ /// [System.ComponentModel.CategoryAttribute (CATEGORY)]
+ /// </summary>
+ /// <param name="symbol">Symbol.</param>
+ public static string GetComponentCategory(this ISymbol symbol)
+ {
+ if (symbol == null)
+ throw new ArgumentNullException("symbol");
+ var browsableState = symbol.GetAttributes().FirstOrDefault(attr => attr.AttributeClass.Name == "CategoryAttribute" && attr.AttributeClass.ContainingNamespace.MetadataName == "System.ComponentModel");
+ if (browsableState != null && browsableState.ConstructorArguments.Length == 1) {
+ try {
+ return (string)browsableState.ConstructorArguments [0].Value;
+ } catch {
+ }
+ }
+ return null;
+ }
+
+
+ /// <summary>
+ /// Returns true if the type is public and was tagged with
+ /// [System.ComponentModel.ToolboxItem (true)]
+ /// </summary>
+ /// <returns><c>true</c> if is designer browsable the specified symbol; otherwise, <c>false</c>.</returns>
+ /// <param name="symbol">Symbol.</param>
+ public static bool IsToolboxItem(this ITypeSymbol symbol)
+ {
+ if (symbol == null)
+ throw new ArgumentNullException ("symbol");
+ if (symbol.DeclaredAccessibility != Accessibility.Public)
+ return false;
+ var toolboxItemAttr = symbol.GetAttributes().FirstOrDefault(attr => attr.AttributeClass.Name == "ToolboxItemAttribute" && attr.AttributeClass.ContainingNamespace.MetadataName == "System.ComponentModel");
+ if (toolboxItemAttr != null && toolboxItemAttr.ConstructorArguments.Length == 1) {
+ try {
+ return (bool)toolboxItemAttr.ConstructorArguments [0].Value;
+ } catch {
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Returns true if the symbol wasn't tagged with
+ /// [System.ComponentModel.BrowsableAttribute (false)]
+ /// </summary>
+ /// <returns><c>true</c> if is designer browsable the specified symbol; otherwise, <c>false</c>.</returns>
+ /// <param name="symbol">Symbol.</param>
+ public static bool IsDesignerBrowsable(this ISymbol symbol)
+ {
+ if (symbol == null)
+ throw new ArgumentNullException("symbol");
+ var browsableState = symbol.GetAttributes().FirstOrDefault(attr => attr.AttributeClass.Name == "BrowsableAttribute" && attr.AttributeClass.ContainingNamespace.MetadataName == "System.ComponentModel");
+ if (browsableState != null && browsableState.ConstructorArguments.Length == 1) {
+ try {
+ return (bool)browsableState.ConstructorArguments [0].Value;
+ } catch {
+ }
+ }
+ return true;
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index 44ef1d9065..b3b1fb8dfb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -3489,6 +3489,7 @@
<Compile Include="MonoDevelop.Ide\TaskUtil.cs" />
<Compile Include="MonoDevelop.Ide.CodeCompletion\ICompletionKeyHandler.cs" />
<Compile Include="MonoDevelop.Components.MainToolbar\FirstCategory.cs" />
+ <Compile Include="MonoDevelop.Ide.TypeSystem\NR5CompatibiltyExtensions.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />