本文整理汇总了C#中Mono.CSharp.NamespaceContainer类的典型用法代码示例。如果您正苦于以下问题:C# NamespaceContainer类的具体用法?C# NamespaceContainer怎么用?C# NamespaceContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NamespaceContainer类属于Mono.CSharp命名空间,在下文中一共展示了NamespaceContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Enum
public Enum(NamespaceContainer ns, DeclSpace parent, TypeExpression type,
Modifiers mod_flags, MemberName name, Attributes attrs)
: base(ns, parent, name, attrs, MemberKind.Enum)
{
underlying_type_expr = type;
var accmods = IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE;
ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod_flags, accmods, Location, Report);
spec = new EnumSpec (null, this, null, null, ModFlags);
}
示例2: Delegate
public Delegate (NamespaceContainer ns, TypeContainer parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, ParametersCompiled param_list,
Attributes attrs)
: base (ns, parent, name, attrs, MemberKind.Delegate)
{
this.ReturnType = type;
ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod_flags,
IsTopLevel ? Modifiers.INTERNAL :
Modifiers.PRIVATE, name.Location, Report);
parameters = param_list;
spec = new TypeSpec (Kind, null, this, null, ModFlags | Modifiers.SEALED);
}
示例3: TypeContainer
public TypeContainer (NamespaceContainer ns, DeclSpace parent, MemberName name,
Attributes attrs, MemberKind kind)
: base (ns, parent, name, attrs)
{
if (parent != null && parent.NamespaceEntry != ns)
throw new InternalErrorException ("A nested type should be in the same NamespaceEntry as its enclosing class");
this.Kind = kind;
this.PartialContainer = this;
}
示例4: Visit
public override void Visit(NamespaceContainer ns)
{
NamespaceDeclaration nDecl = null;
var loc = LocationsBag.GetLocations(ns);
// <invalid> is caused by the parser - see Bug 12383 - [AST] Non existing namespaces generated
if (ns.NS != null && !string.IsNullOrEmpty(ns.NS.Name) && !ns.NS.Name.EndsWith("<invalid>", StringComparison.Ordinal)) {
nDecl = new NamespaceDeclaration();
if (loc != null) {
nDecl.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.NamespaceKeyword), Roles.NamespaceKeyword);
}
nDecl.AddChild(ConvertNamespaceName(ns.RealMemberName), NamespaceDeclaration.NamespaceNameRole);
if (loc != null && loc.Count > 1) {
nDecl.AddChild(new CSharpTokenNode(Convert(loc [1]), Roles.LBrace), Roles.LBrace);
}
AddToNamespace(nDecl);
namespaceStack.Push(nDecl);
}
if (ns.Usings != null) {
foreach (var us in ns.Usings) {
us.Accept(this);
}
}
if (ns.Containers != null) {
foreach (var container in ns.Containers) {
container.Accept(this);
}
}
if (nDecl != null) {
AddAttributeSection(nDecl, ns.UnattachedAttributes, EntityDeclaration.UnattachedAttributeRole);
if (loc != null && loc.Count > 2)
nDecl.AddChild(new CSharpTokenNode(Convert(loc [2]), Roles.RBrace), Roles.RBrace);
if (loc != null && loc.Count > 3)
nDecl.AddChild(new CSharpTokenNode(Convert(loc [3]), Roles.Semicolon), Roles.Semicolon);
namespaceStack.Pop();
}
}
示例5: Define
public override void Define(NamespaceContainer ctx)
{
base.Define (ctx);
if (resolved == null)
return;
var ns = resolved as NamespaceExpression;
if (ns != null) {
var compiler = ctx.Module.Compiler;
compiler.Report.Error (7007, Location,
"A 'using static' directive can only be applied to types but `{0}' denotes a namespace. Consider using a `using' directive instead",
ns.GetSignatureForError ());
return;
}
// TODO: Need to move it to post_process_using_aliases
//ObsoleteAttribute obsolete_attr = resolved.Type.GetAttributeObsolete ();
//if (obsolete_attr != null) {
// AttributeTester.Report_ObsoleteMessage (obsolete_attr, resolved.GetSignatureForError (), Location, ctx.Compiler.Report);
//}
}
示例6: AliasContext
public AliasContext(NamespaceContainer ns)
{
this.ns = ns;
}
示例7: Define
public virtual void Define (NamespaceContainer ctx)
{
resolved = expr.ResolveAsTypeOrNamespace (ctx);
var ns = resolved as Namespace;
if (ns == null) {
if (resolved != null) {
ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (resolved.Type);
ctx.Module.Compiler.Report.Error (138, Location,
"`{0}' is a type not a namespace. A using namespace directive can only be applied to namespaces",
GetSignatureForError ());
}
}
}
示例8: case_21
void case_21()
#line 501 "cs-parser.jay"
{
Attributes attrs = (Attributes) yyVals[-2+yyTop];
var name = (MemberName) yyVals[0+yyTop];
if (attrs != null) {
bool valid_global_attrs = true;
if ((current_namespace.DeclarationFound || current_namespace != file)) {
valid_global_attrs = false;
} else {
foreach (var a in attrs.Attrs) {
if (a.ExplicitTarget == "assembly" || a.ExplicitTarget == "module")
continue;
valid_global_attrs = false;
break;
}
}
if (!valid_global_attrs)
report.Error (1671, name.Location, "A namespace declaration cannot have modifiers or attributes");
}
module.AddAttributes (attrs, current_namespace);
var ns = new NamespaceContainer (name, current_namespace);
current_namespace.AddTypeContainer (ns);
current_container = current_namespace = ns;
}
示例9: Visit
public virtual void Visit (NamespaceContainer ns)
{
}
示例10: LookupExtensionMethod
//
// Does extension methods look up to find a method which matches name and extensionType.
// Search starts from this namespace and continues hierarchically up to top level.
//
public IList<MethodSpec> LookupExtensionMethod (TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
{
List<MethodSpec> candidates = null;
foreach (Namespace n in GetUsingTable ()) {
var a = n.LookupExtensionMethod (this, extensionType, name, arity);
if (a == null)
continue;
if (candidates == null)
candidates = a;
else
candidates.AddRange (a);
}
scope = parent;
if (candidates != null)
return candidates;
if (parent == null)
return null;
//
// Inspect parent namespaces in namespace expression
//
Namespace parent_ns = ns.Parent;
do {
candidates = parent_ns.LookupExtensionMethod (this, extensionType, name, arity);
if (candidates != null)
return candidates;
parent_ns = parent_ns.Parent;
} while (parent_ns != null);
//
// Continue in parent scope
//
return parent.LookupExtensionMethod (extensionType, name, arity, ref scope);
}
示例11: NamespaceContainer
private NamespaceContainer (ModuleContainer module, NamespaceContainer parent, CompilationSourceFile file, Namespace ns, bool slave)
{
this.module = module;
this.parent = parent;
this.file = file;
this.IsImplicit = true;
this.ns = ns;
this.SlaveDeclSpace = slave ? new RootDeclSpace (module, this) : null;
}
示例12: Visit
public virtual void Visit (NamespaceContainer ns)
{
if (!AutoVisit)
VisitTypeContainer (ns);
}
示例13: LookupExtensionMethod
public IList<MethodSpec> LookupExtensionMethod (TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
{
return null;
}
示例14: case_24
void case_24()
#line 543 "cs-parser.jay"
{
report.Error (1514, lexer.Location, "Unexpected symbol `{0}', expecting `.' or `{{'", GetSymbolName (yyToken));
var name = (MemberName) yyVals[0+yyTop];
var ns = new NamespaceContainer (name, current_namespace);
lbag.AddLocation (ns, GetLocation (yyVals[-1+yyTop]));
current_namespace.AddTypeContainer (ns);
}
示例15: DeclSpace
public DeclSpace (NamespaceContainer ns, DeclSpace parent, MemberName name,
Attributes attrs)
: base (parent, name, attrs)
{
NamespaceEntry = ns;
Basename = name.Basename;
defined_names = new Dictionary<string, MemberCore> ();
PartialContainer = null;
if (name.TypeArguments != null) {
is_generic = true;
count_type_params = name.TypeArguments.Count;
}
if (parent != null)
count_type_params += parent.count_type_params;
}