コード例 #1
0
ファイル: decl.cs プロジェクト: johnluetke/mono
		public virtual FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
		{
			return Parent.LookupNamespaceOrType (name, arity, mode, loc);
		}
コード例 #2
0
ファイル: namespace.cs プロジェクト: GirlD/mono
		FullNamedExpression Lookup (string name, int arity, LookupMode mode, Location loc)
		{
			//
			// Check whether it's in the namespace.
			//
			FullNamedExpression fne = ns.LookupTypeOrNamespace (this, name, arity, mode, loc);

			//
			// Check aliases. 
			//
			if (aliases != null && arity == 0) {
				UsingAliasNamespace uan;
				if (aliases.TryGetValue (name, out uan)) {
					if (fne != null && mode != LookupMode.Probing) {
						// TODO: Namespace has broken location
						//Report.SymbolRelatedToPreviousError (fne.Location, null);
						Compiler.Report.SymbolRelatedToPreviousError (uan.Location, null);
						Compiler.Report.Error (576, loc,
							"Namespace `{0}' contains a definition with same name as alias `{1}'",
							GetSignatureForError (), name);
					}

					return uan.ResolvedExpression;
				}
			}

			if (fne != null)
				return fne;

			//
			// Lookup can be called before the namespace is defined from different namespace using alias clause
			//
			if (namespace_using_table == null) {
				DoDefineNamespace ();
			}

			//
			// Check using entries.
			//
			FullNamedExpression match = null;
			foreach (Namespace using_ns in namespace_using_table) {
				//
				// A using directive imports only types contained in the namespace, it
				// does not import any nested namespaces
				//
				var t = using_ns.LookupType (this, name, arity, mode, loc);
				if (t == null)
					continue;

				fne = new TypeExpression (t, loc);
				if (match == null) {
					match = fne;
					continue;
				}

				// Prefer types over namespaces
				var texpr_fne = fne as TypeExpr;
				var texpr_match = match as TypeExpr;
				if (texpr_fne != null && texpr_match == null) {
					match = fne;
					continue;
				} else if (texpr_fne == null) {
					continue;
				}

				// It can be top level accessibility only
				var better = Namespace.IsImportedTypeOverride (Module, texpr_match.Type, texpr_fne.Type);
				if (better == null) {
					if (mode == LookupMode.Normal) {
						Compiler.Report.SymbolRelatedToPreviousError (texpr_match.Type);
						Compiler.Report.SymbolRelatedToPreviousError (texpr_fne.Type);
						Compiler.Report.Error (104, loc, "`{0}' is an ambiguous reference between `{1}' and `{2}'",
							name, texpr_match.GetSignatureForError (), texpr_fne.GetSignatureForError ());
					}

					return match;
				}

				if (better == texpr_fne.Type)
					match = texpr_fne;
			}

			return match;
		}
コード例 #3
0
ファイル: class.cs プロジェクト: fvalette/mono
		//
		// Public function used to locate types.
		//
		// Set 'ignore_cs0104' to true if you want to ignore cs0104 errors.
		//
		// Returns: Type or null if they type can not be found.
		//
		public override FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
		{
			FullNamedExpression e;
			if (arity == 0 && Cache.TryGetValue (name, out e) && mode != LookupMode.IgnoreAccessibility)
				return e;

			e = null;

			if (arity == 0) {
				var tp = CurrentTypeParameters;
				if (tp != null) {
					TypeParameter tparam = tp.Find (name);
					if (tparam != null)
						e = new TypeParameterExpr (tparam, Location.Null);
				}
			}

			if (e == null) {
				TypeSpec t = LookupNestedTypeInHierarchy (name, arity);

				if (t != null && (t.IsAccessible (this) || mode == LookupMode.IgnoreAccessibility))
					e = new TypeExpression (t, Location.Null);
				else {
					e = Parent.LookupNamespaceOrType (name, arity, mode, loc);
				}
			}

			// TODO MemberCache: How to cache arity stuff ?
			if (arity == 0 && mode == LookupMode.Normal)
				Cache[name] = e;

			return e;
		}
コード例 #4
0
ファイル: decl.cs プロジェクト: superowner/mcs-ICodeCompiler
 public virtual FullNamedExpression LookupNamespaceOrType(string name, int arity, LookupMode mode, Location loc)
 {
     return(Parent.LookupNamespaceOrType(name, arity, mode, loc));
 }
コード例 #5
0
        public FullNamedExpression LookupTypeOrNamespace(IMemberContext ctx, string name, int arity, LookupMode mode, Location loc)
        {
            var texpr = LookupType (ctx, name, arity, mode, loc);

            Namespace ns;
            if (arity == 0 && namespaces.TryGetValue (name, out ns)) {
                if (texpr == null)
                    return new NamespaceExpression (ns, loc);

                if (mode != LookupMode.Probing) {
                    //ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (texpr.Type);
                    // ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (ns.loc, "");
                    ctx.Module.Compiler.Report.Warning (437, 2, loc,
                        "The type `{0}' conflicts with the imported namespace `{1}'. Using the definition found in the source file",
                        texpr.GetSignatureForError (), ns.GetSignatureForError ());
                }

                if (texpr.MemberDefinition.IsImported)
                    return new NamespaceExpression (ns, loc);
            }

            if (texpr == null)
                return null;

            return new TypeExpression (texpr, loc);
        }
コード例 #6
0
ファイル: context.cs プロジェクト: KAW0/Alter-Native
		public FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
		{
			return MemberContext.LookupNamespaceOrType (name, arity, mode, loc);
		}
コード例 #7
0
ファイル: decl.cs プロジェクト: johnv315/playscript-mono
		public virtual FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, bool absolute_ns, Location loc)
		{
			if (Parent != null) {
				return Parent.LookupNamespaceOrType (name, arity, mode, absolute_ns, loc);
			} else {
				return null;
			}
		}
コード例 #8
0
            public FullNamedExpression LookupNamespaceOrType(string name, int arity, LookupMode mode, Location loc)
            {
                var fne = ns.NS.LookupTypeOrNamespace (ns, name, arity, mode, loc);
                if (fne != null)
                    return fne;

                //
                // Only extern aliases are allowed in this context
                //
                fne = ns.LookupExternAlias (name);
                if (fne != null || ns.MemberName == null)
                    return fne;

                var container_ns = ns.NS.Parent;
                var mn = ns.MemberName.Left;
                while (mn != null) {
                    fne = container_ns.LookupTypeOrNamespace (this, name, arity, mode, loc);
                    if (fne != null)
                        return fne;

                    mn = mn.Left;
                    container_ns = container_ns.Parent;
                }

                if (ns.Parent != null)
                    return ns.Parent.LookupNamespaceOrType (name, arity, mode, loc);

                return null;
            }
コード例 #9
0
ファイル: namespace.cs プロジェクト: johnv315/playscript-mono
		FullNamedExpression Lookup (string name, int arity, LookupMode mode, bool absolute_ns, Location loc)
		{
			//
			// Check whether it's in the namespace.
			//

			FullNamedExpression fne;

			// For PlayScript/ActionScript we only search for namespaces for simple names when we're at the top level namespace.  ActionScript does not
			// use relative package name resolution.
			if (absolute_ns && this.MemberName != null && this.MemberName.Left != null)
				fne = ns.LookupType (this, name, arity, mode, loc);
			else
				fne = ns.LookupTypeOrNamespace (this, name, arity, mode, loc);

			//
			// Check aliases. 
			//
			if (aliases != null && arity == 0) {
				UsingAliasNamespace uan;
				if (aliases.TryGetValue (name, out uan)) {
					if (fne != null) {
						// TODO: Namespace has broken location
						//Report.SymbolRelatedToPreviousError (fne.Location, null);
						Compiler.Report.SymbolRelatedToPreviousError (uan.Location, null);
						Compiler.Report.Error (576, loc,
							"Namespace `{0}' contains a definition with same name as alias `{1}'",
							GetSignatureForError (), name);
					}

					return uan.ResolvedExpression;
				}
			}

			if (fne != null)
				return fne;

			//
			// Lookup can be called before the namespace is defined from different namespace using alias clause
			//
			if (namespace_using_table == null) {
				DoDefineNamespace ();
			}
			
			FullNamedExpression match = null;

			//
			// Check using types.
			//
			foreach (Tuple<TypeExpr,TypeSpec> using_type in type_using_table) {
				var texpr = using_type.Item1;
				var tspec = using_type.Item2;
				if (tspec.Name == name && tspec.Arity == arity) {
					match = texpr;
				}
			}
			
			//
			// Check using entries.
			//
			foreach (Namespace using_ns in namespace_using_table) {
				//
				// A using directive imports only types contained in the namespace, it
				// does not import any nested namespaces
				//
				fne = using_ns.LookupType (this, name, arity, mode, loc);
				if (fne == null)
					continue;

				if (match == null) {
					match = fne;
					continue;
				}

				// Prefer types over namespaces
				var texpr_fne = fne as TypeExpr;
				var texpr_match = match as TypeExpr;
				if (texpr_fne != null && texpr_match == null) {
					match = fne;
					continue;
				} else if (texpr_fne == null) {
					continue;
				}

				// It can be top level accessibility only
				var better = Namespace.IsImportedTypeOverride (Module, texpr_match.Type, texpr_fne.Type);
				if (better == null) {
					if (mode == LookupMode.Normal) {
						Compiler.Report.SymbolRelatedToPreviousError (texpr_match.Type);
						Compiler.Report.SymbolRelatedToPreviousError (texpr_fne.Type);
						Compiler.Report.Error (104, loc, "`{0}' is an ambiguous reference between `{1}' and `{2}'",
							name, texpr_match.GetSignatureForError (), texpr_fne.GetSignatureForError ());
					}

					return match;
				}

				if (better == texpr_fne.Type)
					match = texpr_fne;
			}

			return match;
		}
コード例 #10
0
ファイル: namespace.cs プロジェクト: yayanyang/monodevelop
		FullNamedExpression Lookup (string name, int arity, LookupMode mode, Location loc)
		{
			//
			// Check whether it's in the namespace.
			//
			FullNamedExpression fne = ns.LookupTypeOrNamespace (this, name, arity, mode, loc);

			//
			// Check aliases. 
			//
			if (using_aliases != null && arity == 0) {
				foreach (NamespaceUsingAlias ue in using_aliases) {
					if (ue.Alias == name) {
						if (fne != null) {
							if (Doppelganger != null) {
								if (mode == LookupMode.Normal) {
									// TODO: Namespace has broken location
									//Report.SymbolRelatedToPreviousError (fne.Location, null);
									Compiler.Report.SymbolRelatedToPreviousError (ue.Location, null);
									Compiler.Report.Error (576, loc,
										"Namespace `{0}' contains a definition with same name as alias `{1}'",
										GetSignatureForError (), name);
								}
							} else {
								return fne;
							}
						}

						return ue.Resolve (Doppelganger ?? this, Doppelganger == null);
					}
				}
			}

			if (fne != null)
				return fne;

			if (IsImplicit)
				return null;

			//
			// Check using entries.
			//
			FullNamedExpression match = null;
			foreach (Namespace using_ns in GetUsingTable ()) {
				// A using directive imports only types contained in the namespace, it
				// does not import any nested namespaces
				fne = using_ns.LookupType (this, name, arity, mode, loc);
				if (fne == null)
					continue;

				if (match == null) {
					match = fne;
					continue;
				}

				// Prefer types over namespaces
				var texpr_fne = fne as TypeExpr;
				var texpr_match = match as TypeExpr;
				if (texpr_fne != null && texpr_match == null) {
					match = fne;
					continue;
				} else if (texpr_fne == null) {
					continue;
				}

				// It can be top level accessibility only
				var better = Namespace.IsImportedTypeOverride (module, texpr_match.Type, texpr_fne.Type);
				if (better == null) {
					if (mode == LookupMode.Normal) {
						Compiler.Report.SymbolRelatedToPreviousError (texpr_match.Type);
						Compiler.Report.SymbolRelatedToPreviousError (texpr_fne.Type);
						Compiler.Report.Error (104, loc, "`{0}' is an ambiguous reference between `{1}' and `{2}'",
							name, texpr_match.GetSignatureForError (), texpr_fne.GetSignatureForError ());
					}

					return match;
				}

				if (better == texpr_fne.Type)
					match = texpr_fne;
			}

			return match;
		}
コード例 #11
0
ファイル: namespace.cs プロジェクト: johnv315/playscript-mono
		public override FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, bool absolute_ns, Location loc)
		{
			//
			// Only simple names (no dots) will be looked up with this function
			//
			FullNamedExpression resolved;
			for (NamespaceContainer container = this; container != null; container = container.Parent) {
				resolved = container.Lookup (name, arity, mode, absolute_ns, loc);
				if (resolved != null || container.MemberName == null)
					return resolved;

				var container_ns = container.ns.Parent;
				var mn = container.MemberName.Left;
				while (mn != null) {
					// If PlayScript/ActionScript we need to avoid lookup up the first identifier in a namespace relatively.  This means we only
					// do namespace lookup for the first identifier from the global namespace.
					if (absolute_ns) 
						resolved = container_ns.LookupType (this, name, arity, mode, loc);
					else
						resolved = container_ns.LookupTypeOrNamespace (this, name, arity, mode, loc);
					if (resolved != null)
						return resolved;

					mn = mn.Left;
					container_ns = container_ns.Parent;
				}
			}

			return null;
		}
コード例 #12
0
 public FullNamedExpression LookupNamespaceOrType(string name, int arity, LookupMode mode, Location loc)
 {
     return(MemberContext.LookupNamespaceOrType(name, arity, mode, loc));
 }
コード例 #13
0
 public FullNamedExpression LookupNamespaceOrType(string name, int arity, LookupMode mode, Location loc)
 {
     throw new NotImplementedException();
 }
コード例 #14
0
        public override FullNamedExpression LookupNamespaceOrType(string name, int arity, LookupMode mode, Location loc)
        {
            //
            // Only simple names (no dots) will be looked up with this function
            //
            FullNamedExpression resolved;
            for (NamespaceContainer container = this; container != null; container = container.Parent) {
                resolved = container.Lookup (name, arity, mode, loc);
                if (resolved != null || container.MemberName == null)
                    return resolved;

                var container_ns = container.ns.Parent;
                var mn = container.MemberName.Left;
                while (mn != null) {
                    resolved = container_ns.LookupTypeOrNamespace (this, name, arity, mode, loc);
                    if (resolved != null)
                        return resolved;

                    mn = mn.Left;
                    container_ns = container_ns.Parent;
                }
            }

            return null;
        }
コード例 #15
0
ファイル: method.cs プロジェクト: rlfqudxo/playscript-mono
		public override FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, bool absolute_ns, Location loc)
		{
			if (arity == 0) {
				var tp = CurrentTypeParameters;
				if (tp != null) {
					TypeParameter t = tp.Find (name);
					if (t != null)
						return new TypeParameterExpr (t, loc);
				}
			}

			return base.LookupNamespaceOrType (name, arity, mode, absolute_ns, loc);
		}
コード例 #16
0
        FullNamedExpression Lookup(string name, int arity, LookupMode mode, Location loc)
        {
            //
            // Check whether it's in the namespace.
            //
            FullNamedExpression fne = ns.LookupTypeOrNamespace (this, name, arity, mode, loc);

            //
            // Check aliases.
            //
            if (aliases != null && arity == 0) {
                UsingAliasNamespace uan;
                if (aliases.TryGetValue (name, out uan)) {
                    if (fne != null && mode != LookupMode.Probing) {
                        // TODO: Namespace has broken location
                        //Report.SymbolRelatedToPreviousError (fne.Location, null);
                        Compiler.Report.SymbolRelatedToPreviousError (uan.Location, null);
                        Compiler.Report.Error (576, loc,
                            "Namespace `{0}' contains a definition with same name as alias `{1}'",
                            GetSignatureForError (), name);
                    }

                    if (uan.ResolvedExpression == null)
                        uan.Define (this);

                    return uan.ResolvedExpression;
                }
            }

            if (fne != null)
                return fne;

            //
            // Lookup can be called before the namespace is defined from different namespace using alias clause
            //
            if (namespace_using_table == null) {
                DoDefineNamespace ();
            }

            //
            // Check using entries.
            //
            FullNamedExpression match = null;
            foreach (Namespace using_ns in namespace_using_table) {
                //
                // A using directive imports only types contained in the namespace, it
                // does not import any nested namespaces
                //
                var t = using_ns.LookupType (this, name, arity, mode, loc);
                if (t == null)
                    continue;

                fne = new TypeExpression (t, loc);
                if (match == null) {
                    match = fne;
                    continue;
                }

                // Prefer types over namespaces
                var texpr_fne = fne as TypeExpr;
                var texpr_match = match as TypeExpr;
                if (texpr_fne != null && texpr_match == null) {
                    match = fne;
                    continue;
                } else if (texpr_fne == null) {
                    continue;
                }

                // It can be top level accessibility only
                var better = Namespace.IsImportedTypeOverride (Module, texpr_match.Type, texpr_fne.Type);
                if (better == null) {
                    if (mode == LookupMode.Normal) {
                        Error_AmbiguousReference (name, texpr_match, texpr_fne, loc);
                    }

                    return match;
                }

                if (better == texpr_fne.Type)
                    match = texpr_fne;
            }

            if (types_using_table != null) {
                foreach (var using_type in types_using_table) {
                    var members = MemberCache.FindMembers (using_type, name, true);
                    if (members == null)
                        continue;

                    foreach (var member in members) {
                        if (arity > 0 && member.Arity != arity)
                            continue;

                        if ((member.Kind & MemberKind.NestedMask) != 0) {
                            // non-static nested type is included with using static
                        } else {
                            if ((member.Modifiers & Modifiers.STATIC) == 0)
                                continue;

                            if ((member.Modifiers & Modifiers.METHOD_EXTENSION) != 0)
                                continue;

                            if (mode == LookupMode.Normal)
                                throw new NotImplementedException ();

                            return null;
                        }

                        fne = new TypeExpression ((TypeSpec) member, loc);
                        if (match == null) {
                            match = fne;
                            continue;
                        }

                        if (mode == LookupMode.Normal) {
                            Error_AmbiguousReference (name, match, fne, loc);
                        }
                    }
                }
            }

            return match;
        }
コード例 #17
0
ファイル: doc.cs プロジェクト: KAW0/Alter-Native
		public FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
		{
			if (arity == 0) {
				var tp = CurrentTypeParameters;
				if (tp != null) {
					for (int i = 0; i < tp.Count; ++i) {
						var t = tp[i];
						if (t.Name == name) {
							t.Type.DeclaredPosition = i;
							return new TypeParameterExpr (t, loc);
						}
					}
				}
			}

			return host.Parent.LookupNamespaceOrType (name, arity, mode, loc);
		}
コード例 #18
0
        public TypeSpec LookupType(IMemberContext ctx, string name, int arity, LookupMode mode, Location loc)
        {
            if (types == null)
                return null;

            TypeSpec best = null;
            if (arity == 0 && cached_types.TryGetValue (name, out best)) {
                if (best != null || mode != LookupMode.IgnoreAccessibility)
                    return best;
            }

            IList<TypeSpec> found;
            if (!types.TryGetValue (name, out found))
                return null;

            foreach (var ts in found) {
                if (ts.Arity == arity) {
                    if (best == null) {
                        if ((ts.Modifiers & Modifiers.INTERNAL) != 0 && !ts.MemberDefinition.IsInternalAsPublic (ctx.Module.DeclaringAssembly) && mode != LookupMode.IgnoreAccessibility)
                            continue;

                        best = ts;
                        continue;
                    }

                    if (best.MemberDefinition.IsImported && ts.MemberDefinition.IsImported) {
                        if (ts.Kind == MemberKind.MissingType)
                            continue;

                        if (best.Kind == MemberKind.MissingType) {
                            best = ts;
                            continue;
                        }

                        if (mode == LookupMode.Normal) {
                            ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (best);
                            ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (ts);
                            ctx.Module.Compiler.Report.Error (433, loc, "The imported type `{0}' is defined multiple times", ts.GetSignatureForError ());
                        }

                        break;
                    }

                    if (ts.Kind == MemberKind.MissingType)
                        continue;

                    if (best.MemberDefinition.IsImported)
                        best = ts;

                    if ((best.Modifiers & Modifiers.INTERNAL) != 0 && !best.MemberDefinition.IsInternalAsPublic (ctx.Module.DeclaringAssembly))
                        continue;

                    if (mode != LookupMode.Normal)
                        continue;

                    if (ts.MemberDefinition.IsImported) {
                        ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (best);
                        ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (ts);
                    }

                    ctx.Module.Compiler.Report.Warning (436, 2, loc,
                        "The type `{0}' conflicts with the imported type of same name'. Ignoring the imported type definition",
                        best.GetSignatureForError ());
                }

                //
                // Lookup for the best candidate with the closest arity match
                //
                if (arity < 0) {
                    if (best == null) {
                        best = ts;
                    } else if (System.Math.Abs (ts.Arity + arity) < System.Math.Abs (best.Arity + arity)) {
                        best = ts;
                    }
                }
            }

            // TODO MemberCache: Cache more
            if (arity == 0 && mode == LookupMode.Normal)
                cached_types.Add (name, best);

            if (best != null) {
                var dep = best.GetMissingDependencies ();
                if (dep != null)
                    ImportedTypeDefinition.Error_MissingDependency (ctx, dep, loc);
            }

            return best;
        }
コード例 #19
0
			public FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
			{
				var fne = ns.NS.LookupTypeOrNamespace (ns, name, arity, mode, loc);
				if (fne != null)
					return fne;

				//
				// Only extern aliases are allowed in this context
				//
				fne = ns.LookupExternAlias (name);
				if (fne != null)
					return fne;

				if (ns.ImplicitParent != null)
					return ns.ImplicitParent.LookupNamespaceOrType (name, arity, mode, loc);

				return null;
			}
コード例 #20
0
ファイル: pending.cs プロジェクト: jordanbtucker/mono
		public FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
		{
			throw new NotImplementedException ();
		}
コード例 #21
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;
		}
コード例 #22
0
ファイル: class.cs プロジェクト: 0xd4d/NRefactory
		//
		// Public function used to locate types.
		//
		// Returns: Type or null if they type can not be found.
		//
		public override FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
		{
			FullNamedExpression e;
			if (arity == 0 && Cache.TryGetValue (name, out e) && mode != LookupMode.IgnoreAccessibility)
				return e;

			e = null;

			if (arity == 0) {
				var tp = CurrentTypeParameters;
				if (tp != null) {
					TypeParameter tparam = tp.Find (name);
					if (tparam != null)
						e = new TypeParameterExpr (tparam, Location.Null);
				}
			}

			if (e == null) {
				TypeSpec t = LookupNestedTypeInHierarchy (name, arity);

				if (t != null && (t.IsAccessible (this) || mode == LookupMode.IgnoreAccessibility))
					e = new TypeExpression (t, Location.Null);
				else {
					var errors = Compiler.Report.Errors;
					e = Parent.LookupNamespaceOrType (name, arity, mode, loc);

					// TODO: LookupNamespaceOrType does more than just lookup. The result
					// cannot be cached or the error reporting won't happen
					if (errors != Compiler.Report.Errors)
						return e;
				}
			}

			// TODO MemberCache: How to cache arity stuff ?
			if (arity == 0 && mode == LookupMode.Normal)
				Cache[name] = e;

			return e;
		}
コード例 #23
0
ファイル: method.cs プロジェクト: crazyjncsu/mono
		public override FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
		{
			if (arity == 0) {
				TypeParameter[] tp = CurrentTypeParameters;
				if (tp != null) {
					TypeParameter t = TypeParameter.FindTypeParameter (tp, name);
					if (t != null)
						return new TypeParameterExpr (t, loc);
				}
			}

			return base.LookupNamespaceOrType (name, arity, mode, loc);
		}
コード例 #24
0
ファイル: class.cs プロジェクト: fvalette/mono
			public FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
			{
				if (arity == 0) {
					var tp = CurrentTypeParameters;
					if (tp != null) {
						TypeParameter t = tp.Find (name);
						if (t != null)
							return new TypeParameterExpr (t, loc);
					}
				}

				return tc.Parent.LookupNamespaceOrType (name, arity, mode, loc);
			}
コード例 #25
0
ファイル: decl.cs プロジェクト: slagusev/playscript-mono
 public virtual FullNamedExpression LookupNamespaceOrType(string name, int arity, LookupMode mode, Location loc)
 {
     if (Parent != null) {
         return Parent.LookupNamespaceOrType (name, arity, mode, loc);
     } else {
         return null;
     }
 }