Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3675 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
26 changed files with 295 additions and 78 deletions
@ -0,0 +1,70 @@
@@ -0,0 +1,70 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Dom |
||||
{ |
||||
public class DefaultUsingScope : AbstractFreezable, IUsingScope |
||||
{ |
||||
DomRegion region; |
||||
IUsingScope parent; |
||||
IList<IUsing> usings; |
||||
IList<IUsingScope> childScopes; |
||||
string namespaceName = ""; |
||||
|
||||
protected override void FreezeInternal() |
||||
{ |
||||
base.FreezeInternal(); |
||||
usings = FreezeList(usings); |
||||
childScopes = FreezeList(childScopes); |
||||
} |
||||
|
||||
public DomRegion Region { |
||||
get { return region; } |
||||
set { |
||||
CheckBeforeMutation(); |
||||
region = value; |
||||
} |
||||
} |
||||
|
||||
public IUsingScope Parent { |
||||
get { return parent; } |
||||
set { |
||||
CheckBeforeMutation(); |
||||
parent = value; |
||||
} |
||||
} |
||||
|
||||
public virtual IList<IUsing> Usings { |
||||
get { |
||||
if (usings == null) |
||||
usings = new List<IUsing>(); |
||||
return usings; |
||||
} |
||||
} |
||||
|
||||
public virtual IList<IUsingScope> ChildScopes { |
||||
get { |
||||
if (childScopes == null) |
||||
childScopes = new List<IUsingScope>(); |
||||
return childScopes; |
||||
} |
||||
} |
||||
|
||||
public string NamespaceName { |
||||
get { return namespaceName; } |
||||
set { |
||||
if (value == null) |
||||
throw new ArgumentNullException("NamespaceName"); |
||||
CheckBeforeMutation(); |
||||
namespaceName = value; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Dom |
||||
{ |
||||
/// <summary>
|
||||
/// A scope that can contain using declarations.
|
||||
/// In C#, every file is a using scope, and every "namespace" declaration inside
|
||||
/// the file is a nested using scope.
|
||||
/// </summary>
|
||||
public interface IUsingScope : IFreezable |
||||
{ |
||||
/// <summary>
|
||||
/// Gets the region of the using scope.
|
||||
/// </summary>
|
||||
DomRegion Region { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the parent scope.
|
||||
/// Returns null if this is a root scope.
|
||||
/// </summary>
|
||||
IUsingScope Parent { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the usings in this using scope.
|
||||
/// </summary>
|
||||
IList<IUsing> Usings { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the list of child scopes. Child scopes usually represent "namespace" declarations.
|
||||
/// </summary>
|
||||
IList<IUsingScope> ChildScopes { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the namespace represented by the using scope.
|
||||
/// </summary>
|
||||
string NamespaceName { get; } |
||||
} |
||||
} |
||||
Loading…
Reference in new issue