Skip to content

Commit

Permalink
2002-04-10 Miguel de Icaza <miguel@ximian.com>
Browse files Browse the repository at this point in the history
	* class.cs (FindMembers): Allow the Builders of the various
	members to be null.  If they are skip them.  This only happens
	during the PInvoke declaration.

svn path=/trunk/mcs/; revision=3757
  • Loading branch information
migueldeicaza committed Apr 11, 2002
1 parent 7f0c3d7 commit e59897a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 22 deletions.
6 changes: 6 additions & 0 deletions mcs/mcs/ChangeLog
@@ -1,3 +1,9 @@
2002-04-10 Miguel de Icaza <miguel@ximian.com>

* class.cs (FindMembers): Allow the Builders of the various
members to be null. If they are skip them. This only happens
during the PInvoke declaration.

2002-04-09 Miguel de Icaza <miguel@ximian.com>

* parameter.cs (Parameters.ComputeParameterTypes): Flag the
Expand Down
43 changes: 24 additions & 19 deletions mcs/mcs/class.cs
Expand Up @@ -1165,6 +1165,16 @@ static TypeContainer ()
// FIXME: return an empty static array instead of null, that cleans up
// some code and is consistent with some coding conventions I just found
// out existed ;-)
//
//
// Notice that in various cases we check if our field is non-null,
// something that would normally mean that there was a bug elsewhere.
//
// The problem happens while we are defining p-invoke methods, as those
// will trigger a FindMembers, but this happens before things are defined
//
// Since the whole process is a no-op, it is fine to check for null here.
//
public MemberInfo [] FindMembers (MemberTypes mt, BindingFlags bf,
MemberFilter filter, object criteria)
{
Expand All @@ -1181,9 +1191,9 @@ static TypeContainer ()
if ((f.ModFlags & Modifiers.PRIVATE) != 0)
if (!priv)
continue;

FieldBuilder fb = f.FieldBuilder;
if (filter (fb, criteria) == true)
if (fb != null && filter (fb, criteria) == true)
members.Add (fb);
}
}
Expand All @@ -1195,7 +1205,7 @@ static TypeContainer ()
continue;

FieldBuilder fb = con.FieldBuilder;
if (filter (fb, criteria) == true)
if (fb != null && filter (fb, criteria) == true)
members.Add (fb);
}
}
Expand All @@ -1210,14 +1220,7 @@ static TypeContainer ()

MethodBuilder mb = m.MethodBuilder;

// If we are in transit, ignore
// This case arises when we are still defining a PInvoke method
// and we hit FindMembers because of the need to resolve named
// arguments inside of Attribute.DefinePInvokeMethod
if (mb == null)
continue;

if (filter (mb, criteria) == true)
if (mb != null && filter (mb, criteria) == true)
members.Add (mb);
}
}
Expand All @@ -1229,8 +1232,7 @@ static TypeContainer ()
continue;

MethodBuilder ob = o.OperatorMethodBuilder;

if (filter (ob, criteria) == true)
if (ob != null && filter (ob, criteria) == true)
members.Add (ob);
}
}
Expand Down Expand Up @@ -1260,8 +1262,9 @@ static TypeContainer ()
if ((e.ModFlags & Modifiers.PRIVATE) != 0)
if (!priv)
continue;

if (filter (e.EventBuilder, criteria) == true)

MemberInfo eb = e.EventBuilder;
if (eb != null && filter (eb, criteria) == true)
members.Add (e.EventBuilder);
}
}
Expand All @@ -1272,8 +1275,9 @@ static TypeContainer ()
if ((p.ModFlags & Modifiers.PRIVATE) != 0)
if (!priv)
continue;

if (filter (p.PropertyBuilder, criteria) == true) {

MemberInfo pb = p.PropertyBuilder;
if (pb != null && filter (pb, criteria) == true) {
members.Add (p.PropertyBuilder);
}
}
Expand All @@ -1283,8 +1287,9 @@ static TypeContainer ()
if ((ix.ModFlags & Modifiers.PRIVATE) != 0)
if (!priv)
continue;

if (filter (ix.PropertyBuilder, criteria) == true) {

MemberInfo ib = ix.PropertyBuilder;
if (ib != null && filter (ib, criteria) == true) {
members.Add (ix.PropertyBuilder);
}
}
Expand Down
6 changes: 3 additions & 3 deletions mcs/tests/makefile
Expand Up @@ -11,15 +11,15 @@ TEST_SOURCES = \
test-41 test-42 test-43 test-44 test-45 test-46 test-47 test-48 test-49 test-50 \
test-51 test-52 test-53 test-54 test-55 test-56 test-57 test-59 \
test-61 test-62 test-63 test-64 test-65 test-66 test-67 test-68 test-69 test-70 \
test-71 test-72 test-73 test-74 test-75 test-77 test-78 test-79 test-80 \
test-71 test-72 test-73 test-74 test-75 test-76 test-77 test-78 test-79 test-80 \
test-81 test-82 test-83 test-84 test-86 test-87 test-88 test-89 test-90 \
test-91 test-92 test-93 test-94 test-95 test-96 test-97 test-98 test-99
test-91 test-92 test-93 test-94 test-95 test-96 test-97 test-98 test-99 test-100

UNSAFE_SOURCES = \
unsafe-1 unsafe-2

TEST_NOPASS = \
test-29 test-38 test-76
test-29 test-38

all: test-compiler test-unsafe

Expand Down

0 comments on commit e59897a

Please sign in to comment.