Пример #1
0
 public virtual void Visit(NamespaceContainer ns)
 {
     if (!AutoVisit)
     {
         VisitTypeContainer(ns);
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
 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;
 }
Пример #4
0
 public override void Define(NamespaceContainer ctx)
 {
     resolved = ctx.Module.GetRootNamespace(Alias.Value);
     if (resolved == null)
     {
         ctx.Module.Compiler.Report.Error(430, Location,
                                          "The extern alias `{0}' was not specified in -reference option",
                                          Alias.Value);
     }
 }
Пример #5
0
        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);
        }
Пример #6
0
 		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);
		}
Пример #7
0
        public Delegate(NamespaceContainer ns, DeclSpace 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);
        }
Пример #8
0
 public override void Define(NamespaceContainer ctx)
 {
     //
     // The namespace-or-type-name of a using-alias-directive is resolved as if
     // the immediately containing compilation unit or namespace body had no
     // using-directives. A using-alias-directive may however be affected
     // by extern-alias-directives in the immediately containing compilation
     // unit or namespace body
     //
     // We achieve that by introducing alias-context which redirect any local
     // namespace or type resolve calls to parent namespace
     //
     resolved = NamespaceExpression.ResolveAsTypeOrNamespace(new AliasContext(ctx));
 }
Пример #9
0
        public FullNamedExpression LookupNamespaceOrType(string name, int arity, LookupMode mode, Location loc)
        {
            // Precondition: Only simple names (no dots) will be looked up with this function.
            FullNamedExpression resolved = null;

            for (NamespaceContainer curr_ns = this; curr_ns != null; curr_ns = curr_ns.ImplicitParent)
            {
                if ((resolved = curr_ns.Lookup(name, arity, mode, loc)) != null)
                {
                    break;
                }
            }

            return(resolved);
        }
Пример #10
0
        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());
                }
            }
        }
Пример #11
0
        //
        // Creates alias global namespace
        //
        public RootNamespace CreateRootNamespace(string alias)
        {
            if (alias == global_ns.Alias)
            {
                NamespaceContainer.Error_GlobalNamespaceRedefined(Location.Null, Report);
                return(global_ns);
            }

            RootNamespace rn;

            if (!alias_ns.TryGetValue(alias, out rn))
            {
                rn = new RootNamespace(alias);
                alias_ns.Add(alias, rn);
            }

            return(rn);
        }
Пример #12
0
        //
        // Looks-up a alias named @name in this and surrounding namespace declarations
        //
        public FullNamedExpression LookupNamespaceAlias(string name)
        {
            for (NamespaceContainer n = this; n != null; n = n.ImplicitParent)
            {
                if (n.aliases == null)
                {
                    continue;
                }

                UsingAliasNamespace uan;
                if (n.aliases.TryGetValue(name, out uan))
                {
                    return(uan.ResolvedExpression);
                }
            }

            return(null);
        }
Пример #13
0
        // Looks-up a alias named @name in this and surrounding namespace declarations
        public FullNamedExpression LookupNamespaceAlias(string name)
        {
            for (NamespaceContainer n = this; n != null; n = n.ImplicitParent)
            {
                if (n.using_aliases == null)
                {
                    continue;
                }

                foreach (NamespaceUsingAlias ue in n.using_aliases)
                {
                    if (ue.Alias == name)
                    {
                        return(ue.Resolve(Doppelganger ?? this, Doppelganger == null));
                    }
                }
            }

            return(null);
        }
Пример #14
0
        public NamespaceContainer(MemberName name, ModuleContainer module, NamespaceContainer parent, CompilationSourceFile sourceFile)
        {
            this.module = module;
            this.parent = parent;
            this.file   = sourceFile;
            this.loc    = name == null ? Location.Null : name.Location;

            if (parent != null)
            {
                ns = parent.NS.GetNamespace(name.GetName(), true);
            }
            else if (name != null)
            {
                ns = module.GlobalRootNamespace.GetNamespace(name.GetName(), true);
            }
            else
            {
                ns = module.GlobalRootNamespace;
            }

            SlaveDeclSpace = new RootDeclSpace(module, this);
        }
Пример #15
0
        public IList <string> CompletionGetTypesStartingWith(string prefix)
        {
            IEnumerable <string> all = Enumerable.Empty <string> ();

            for (NamespaceContainer curr_ns = this; curr_ns != null; curr_ns = curr_ns.ImplicitParent)
            {
                foreach (Namespace using_ns in GetUsingTable())
                {
                    if (prefix.StartsWith(using_ns.Name))
                    {
                        int ld = prefix.LastIndexOf('.');
                        if (ld != -1)
                        {
                            string rest = prefix.Substring(ld + 1);

                            all = all.Concat(using_ns.CompletionGetTypesStartingWith(rest));
                        }
                    }
                    all = all.Concat(using_ns.CompletionGetTypesStartingWith(prefix));
                }
            }

            return(all.Distinct().ToList());
        }
Пример #16
0
        public override void Define(NamespaceContainer ctx)
        {
            var ns = ctx.Module.GetRootNamespace (Alias.Value);
            if (ns == null) {
                ctx.Module.Compiler.Report.Error (430, Location,
                    "The extern alias `{0}' was not specified in -reference option",
                    Alias.Value);
                return;
            }

            resolved = new NamespaceExpression (ns, Location);
        }
Пример #17
0
 public AliasContext(NamespaceContainer ns)
 {
     this.ns = ns;
 }
Пример #18
0
		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 ());
				}
			}
		}
Пример #19
0
		public override IList<MethodSpec> LookupExtensionMethod (TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
		{
			DeclSpace top_level = Parent;
			if (top_level != null) {
				var candidates = NamespaceEntry.NS.LookupExtensionMethod (this, extensionType, name, arity);
				if (candidates != null) {
					scope = NamespaceEntry;
					return candidates;
				}
			}

			return NamespaceEntry.LookupExtensionMethod (extensionType, name, arity, ref scope);
		}
Пример #20
0
            public override void Visit(NamespaceContainer nspace)
            {
                NamespaceDeclaration nDecl = null;
                var loc = LocationsBag.GetLocations(nspace);

                if (nspace.NS != null && !string.IsNullOrEmpty(nspace.NS.Name)) {
                    nDecl = new NamespaceDeclaration ();
                    if (loc != null) {
                        nDecl.AddChild(new CSharpTokenNode (Convert(loc [0]), Roles.NamespaceKeyword), Roles.NamespaceKeyword);
                    }
                    ConvertNamespaceName(nspace.RealMemberName, nDecl);
                    if (loc != null && loc.Count > 1) {
                        nDecl.AddChild(new CSharpTokenNode (Convert(loc [1]), Roles.LBrace), Roles.LBrace);
                    }
                    AddToNamespace(nDecl);
                    namespaceStack.Push(nDecl);
                }

                if (nspace.Usings != null) {
                    foreach (var us in nspace.Usings) {
                        us.Accept(this);
                    }
                }

                if (nspace.Containers != null) {
                    foreach (var container in nspace.Containers) {
                        container.Accept(this);
                    }
                }

                if (nDecl != null) {
                    AddAttributeSection(nDecl, nspace.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 ();
                }
            }
Пример #21
0
		public TypeContainer (NamespaceContainer ns, TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind)
			: base (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;
			this.Basename = name.Basename;
			this.NamespaceEntry = ns;

			defined_names = new Dictionary<string, MemberCore> ();
		}
Пример #22
0
		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;
		}
Пример #23
0
		public virtual void Visit (NamespaceContainer ns)
		{
		}
Пример #24
0
 public IList <MethodSpec> LookupExtensionMethod(TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
 {
     throw new NotImplementedException();
 }
Пример #25
0
 public RootDeclSpace(ModuleContainer module, NamespaceContainer ns)
     : base(ns, null, MemberName.Null, null, 0)
 {
     PartialContainer = module;
 }
Пример #26
0
		//
		// 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);
		}
Пример #27
0
		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;
		}
Пример #28
0
        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);
            //}
        }
Пример #29
0
		public virtual void Visit (NamespaceContainer ns)
		{
			if (!AutoVisit)
				VisitTypeContainer (ns);
		}
Пример #30
0
		public NamespaceContainer (MemberName name, ModuleContainer module, NamespaceContainer parent, CompilationSourceFile sourceFile)
		{
			this.module = module;
			this.parent = parent;
			this.file = sourceFile;
			this.loc = name == null ? Location.Null : name.Location;

			if (parent != null)
				ns = parent.NS.GetNamespace (name.GetName (), true);
			else if (name != null)
				ns = module.GlobalRootNamespace.GetNamespace (name.GetName (), true);
			else
				ns = module.GlobalRootNamespace;

			SlaveDeclSpace = new RootDeclSpace (module, this);
		}
Пример #31
0
			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();
				}
			}
Пример #32
0
		public virtual IList<MethodSpec> LookupExtensionMethod (TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
		{
			return Parent.LookupExtensionMethod (extensionType, name, arity, ref scope);
		}
Пример #33
0
		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;
		}
Пример #34
0
		public Struct (NamespaceContainer ns, TypeContainer parent, MemberName name, Modifiers mod, Attributes attrs)
			: base (ns, parent, name, attrs, MemberKind.Struct)
		{
			var accmods = parent.Parent == null ? Modifiers.INTERNAL : Modifiers.PRIVATE;			
			this.ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod, accmods, Location, Report) | Modifiers.SEALED ;
			spec = new TypeSpec (Kind, null, this, null, ModFlags);
		}
Пример #35
0
 public IList <MethodSpec> LookupExtensionMethod(TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
 {
     return(MemberContext.LookupExtensionMethod(extensionType, name, arity, ref scope));
 }
Пример #36
0
			public IList<MethodSpec> LookupExtensionMethod (TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
			{
				return null;
			}
Пример #37
0
public CSharpParser (SeekableStreamReader reader, CompilationSourceFile file, Report report, ParserSession session)
{
	this.file = file;
	current_container = current_namespace = file;
	
	this.module = file.Module;
	this.compiler = file.Compiler;
	this.settings = compiler.Settings;
	this.report = report;
	
	lang_version = settings.Version;
	yacc_verbose_flag = settings.VerboseParserFlag;
	doc_support = settings.DocumentationFile != null;
	lexer = new Tokenizer (reader, file, session);
	oob_stack = new Stack<object> ();
	lbag = session.LocationsBag;
	use_global_stacks = session.UseJayGlobalArrays;
	parameters_bucket = session.ParametersStack;
}
Пример #38
0
 public AliasContext(NamespaceContainer ns)
 {
     this.ns = ns;
 }
Пример #39
0
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;
	  }
Пример #40
0
 public override void Define(NamespaceContainer ctx)
 {
     //
     // The namespace-or-type-name of a using-alias-directive is resolved as if
     // the immediately containing compilation unit or namespace body had no
     // using-directives. A using-alias-directive may however be affected
     // by extern-alias-directives in the immediately containing compilation
     // unit or namespace body
     //
     // We achieve that by introducing alias-context which redirect any local
     // namespace or type resolve calls to parent namespace
     //
     resolved = NamespaceExpression.ResolveAsTypeOrNamespace (new AliasContext (ctx), false) ??
         new TypeExpression (InternalType.ErrorType, NamespaceExpression.Location);
 }
Пример #41
0
void case_23()
#line 534 "cs-parser.jay"
{
		if (yyVals[0+yyTop] != null)
			lbag.AddLocation (current_container, GetLocation (yyVals[-9+yyTop]), GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop]));
		else
			lbag.AddLocation (current_container, GetLocation (yyVals[-9+yyTop]), GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-1+yyTop]));
	  
		current_container = current_namespace = current_namespace.Parent;
	  }
Пример #42
0
 public virtual void Define(NamespaceContainer ctx)
 {
     resolved = expr.ResolveAsTypeOrNamespace (ctx, false);
 }
Пример #43
0
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);
	  }
Пример #44
0
        public override void Define(NamespaceContainer ctx)
        {
            base.Define (ctx);

            var ns = resolved as NamespaceExpression;
            if (ns != null)
                return;

            if (resolved != null) {
                var compiler = ctx.Module.Compiler;
                var type = resolved.Type;

                compiler.Report.SymbolRelatedToPreviousError (type);
                compiler.Report.Error (138, Location,
                    "A `using' directive can only be applied to namespaces but `{0}' denotes a type. Consider using a `using static' instead",
                    type.GetSignatureForError ());
            }
        }
Пример #45
0
 public virtual void Visit(NamespaceContainer ns)
 {
 }
Пример #46
0
        public NamespaceContainer(MemberName name, NamespaceContainer parent)
            : base(parent, name, null, MemberKind.Namespace)
        {
            this.Parent = parent;
            this.ns = parent.NS.AddNamespace (name);

            containers = new List<TypeContainer> ();
        }
Пример #47
0
 public override IList <MethodSpec> LookupExtensionMethod(TypeSpec extensionType, string name, int arity, ref NamespaceContainer scope)
 {
     return(null);
 }
Пример #48
0
		public ClassOrStruct (NamespaceContainer ns, DeclSpace parent,
				      MemberName name, Attributes attrs, MemberKind kind)
			: base (ns, parent, name, attrs, kind)
		{
		}
Пример #49
0
        //
        // 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));
        }
Пример #50
0
		public Interface (NamespaceContainer ns, DeclSpace parent, MemberName name, Modifiers mod,
				  Attributes attrs)
			: base (ns, parent, name, attrs, MemberKind.Interface)
		{
			var accmods = parent.Parent == null ? Modifiers.INTERNAL : Modifiers.PRIVATE;

			this.ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod, accmods, name.Location, Report);
			spec = new TypeSpec (Kind, null, this, null, ModFlags);
		}
Пример #51
0
 public IList <Compiler.MethodSpec> LookupExtensionMethod(Compiler.TypeSpec extensionType, string name, int arity, ref Compiler.NamespaceContainer scope)
 {
     // No extension method lookup in this context
     return(null);
 }