Browse Source

Add protected virtual Clone() method to CSharpProjectContent.

newNRvisualizers
Daniel Grunwald 15 years ago
parent
commit
bf12c0083e
  1. 19
      ICSharpCode.NRefactory.CSharp/CSharpProjectContent.cs

19
ICSharpCode.NRefactory.CSharp/CSharpProjectContent.cs

@ -87,7 +87,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -87,7 +87,7 @@ namespace ICSharpCode.NRefactory.CSharp
return null;
}
public ICompilation CreateCompilation()
public virtual ICompilation CreateCompilation()
{
var solutionSnapshot = new DefaultSolutionSnapshot();
ICompilation compilation = new SimpleCompilation(solutionSnapshot, this, assemblyReferences);
@ -95,28 +95,33 @@ namespace ICSharpCode.NRefactory.CSharp @@ -95,28 +95,33 @@ namespace ICSharpCode.NRefactory.CSharp
return compilation;
}
public ICompilation CreateCompilation(ISolutionSnapshot solutionSnapshot)
public virtual ICompilation CreateCompilation(ISolutionSnapshot solutionSnapshot)
{
return new SimpleCompilation(solutionSnapshot, this, assemblyReferences);
}
protected virtual CSharpProjectContent Clone()
{
return new CSharpProjectContent(this);
}
public IProjectContent SetAssemblyName(string newAssemblyName)
{
CSharpProjectContent pc = new CSharpProjectContent(this);
CSharpProjectContent pc = Clone();
pc.assemblyName = newAssemblyName;
return pc;
}
public IProjectContent AddAssemblyReferences(IEnumerable<IAssemblyReference> references)
{
CSharpProjectContent pc = new CSharpProjectContent(this);
CSharpProjectContent pc = Clone();
pc.assemblyReferences.AddRange(references);
return pc;
}
public IProjectContent RemoveAssemblyReferences(IEnumerable<IAssemblyReference> references)
{
CSharpProjectContent pc = new CSharpProjectContent(this);
CSharpProjectContent pc = Clone();
pc.assemblyReferences.RemoveAll(r => references.Contains(r));
return pc;
}
@ -129,7 +134,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -129,7 +134,7 @@ namespace ICSharpCode.NRefactory.CSharp
if (!Platform.FileNameComparer.Equals(oldFile.FileName, newFile.FileName))
throw new ArgumentException("When both oldFile and newFile are specified, they must use the same file name.");
}
CSharpProjectContent pc = new CSharpProjectContent(this);
CSharpProjectContent pc = Clone();
if (newFile == null)
pc.parsedFiles.Remove(oldFile.FileName);
else
@ -139,7 +144,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -139,7 +144,7 @@ namespace ICSharpCode.NRefactory.CSharp
public IProjectContent UpdateProjectContent(IEnumerable<IParsedFile> oldFiles, IEnumerable<IParsedFile> newFiles)
{
CSharpProjectContent pc = new CSharpProjectContent(this);
CSharpProjectContent pc = Clone();
if (oldFiles != null) {
foreach (var oldFile in oldFiles) {
pc.parsedFiles.Remove(oldFile.FileName);

Loading…
Cancel
Save