projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2002-11-16 Martin Baulig <martin@ximian.com>
[mono.git]
/
mcs
/
mcs
/
decl.cs
diff --git
a/mcs/mcs/decl.cs
b/mcs/mcs/decl.cs
index 83de6262d0330aacdbec3a8e379bfd5e362d6cc4..413b1e7ccfa3bd810521f74555fc1828b1042cc1 100755
(executable)
--- a/
mcs/mcs/decl.cs
+++ b/
mcs/mcs/decl.cs
@@
-260,6
+260,9
@@
namespace Mono.CSharp {
return AdditionResult.Success;
}
return AdditionResult.Success;
}
+ public static int length;
+ public static int small;
+
/// <summary>
/// Introduce @name into this declaration space and
/// associates it with the object @o. Note that for
/// <summary>
/// Introduce @name into this declaration space and
/// associates it with the object @o. Note that for
@@
-268,6
+271,13
@@
namespace Mono.CSharp {
protected void DefineName (string name, object o)
{
defined_names.Add (name, o);
protected void DefineName (string name, object o)
{
defined_names.Add (name, o);
+
+#if DEBUGME
+ int p = name.LastIndexOf (".");
+ int l = name.Length;
+ length += l;
+ small += l -p;
+#endif
}
/// <summary>
}
/// <summary>
@@
-399,6
+409,7
@@
namespace Mono.CSharp {
int errors = Report.Errors;
Expression d = e.Resolve (type_resolve_ec, ResolveFlags.Type);
int errors = Report.Errors;
Expression d = e.Resolve (type_resolve_ec, ResolveFlags.Type);
+
if (d == null || d.eclass != ExprClass.Type){
if (!silent && errors == Report.Errors){
Report.Error (246, loc, "Cannot find type `"+ e.ToString () +"'");
if (d == null || d.eclass != ExprClass.Type){
if (!silent && errors == Report.Errors){
Report.Error (246, loc, "Cannot find type `"+ e.ToString () +"'");
@@
-419,6
+430,7
@@
namespace Mono.CSharp {
type_resolve_ec = GetTypeResolveEmitContext (parent, loc);
Expression d = e.Resolve (type_resolve_ec, ResolveFlags.Type);
type_resolve_ec = GetTypeResolveEmitContext (parent, loc);
Expression d = e.Resolve (type_resolve_ec, ResolveFlags.Type);
+
if (d == null || d.eclass != ExprClass.Type){
if (!silent){
Report.Error (246, loc, "Cannot find type `"+ e +"'");
if (d == null || d.eclass != ExprClass.Type){
if (!silent){
Report.Error (246, loc, "Cannot find type `"+ e +"'");
@@
-453,7
+465,14
@@
namespace Mono.CSharp {
}
return t;
}
}
return t;
}
-
+
+ public static void Error_AmbiguousTypeReference (Location loc, string name, Type t1, Type t2)
+ {
+ Report.Error (104, loc,
+ String.Format ("`{0}' is an ambiguous reference ({1} or {2}) ", name,
+ t1.FullName, t2.FullName));
+ }
+
/// <summary>
/// GetType is used to resolve type names at the DeclSpace level.
/// Use this to lookup class/struct bases, interface bases or
/// <summary>
/// GetType is used to resolve type names at the DeclSpace level.
/// Use this to lookup class/struct bases, interface bases or
@@
-466,7
+485,7
@@
namespace Mono.CSharp {
/// during the tree resolution process and potentially define
/// recursively the type
/// </remarks>
/// during the tree resolution process and potentially define
/// recursively the type
/// </remarks>
- public Type FindType (string name)
+ public Type FindType (
Location loc,
string name)
{
Type t;
bool error;
{
Type t;
bool error;
@@
-482,7
+501,7
@@
namespace Mono.CSharp {
while (current_type != null) {
string pre = current_type.FullName;
while (current_type != null) {
string pre = current_type.FullName;
-
+
t = LookupInterfaceOrClass (pre, name, out error);
if (error)
return null;
t = LookupInterfaceOrClass (pre, name, out error);
if (error)
return null;
@@
-548,7
+567,7
@@
namespace Mono.CSharp {
if (match != null){
if (t != null){
if (match != null){
if (t != null){
-
Report.Error (104, Location, "`" + name + "' is an ambiguous reference"
);
+
Error_AmbiguousTypeReference (loc, name, t, match
);
return null;
}
return null;
}
@@
-970,8
+989,10
@@
namespace Mono.CSharp {
/// </summary>
void AddMethods (Type type)
{
/// </summary>
void AddMethods (Type type)
{
- AddMethods (BindingFlags.Static | BindingFlags.Public, type);
- AddMethods (BindingFlags.Static | BindingFlags.NonPublic, type);
+ AddMethods (BindingFlags.Static | BindingFlags.Public |
+ BindingFlags.FlattenHierarchy, type);
+ AddMethods (BindingFlags.Static | BindingFlags.NonPublic |
+ BindingFlags.FlattenHierarchy, type);
AddMethods (BindingFlags.Instance | BindingFlags.Public, type);
AddMethods (BindingFlags.Instance | BindingFlags.NonPublic, type);
}
AddMethods (BindingFlags.Instance | BindingFlags.Public, type);
AddMethods (BindingFlags.Instance | BindingFlags.NonPublic, type);
}