[Mono-list] [patch] mcs and nested types
Matt Kimball
matt@kimball.net
Mon, 07 Jan 2002 19:21:24 -0800 (PST)
This is a multi-part message in MIME format...
------------=_1010460084-21945-0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: binary
mcs has compile errors with the following code:
using System;
public class outer {
public class inner {
public void meth(Object o) {
inner inst = (inner)o;
}
}
}
This seems to be because RootContext.LookupType will only look for the "inner"
type declared in the innermost class containing the compiled method. Included
is a patch against current CVS code, which fixes this problem: LookupType will
now cascade up the tree of containing types looking for the type name specified.
In order to implement this, I reorganized things so that DeclSpace objects
always know their parents. (Before, only TypeContainer objects knew their
parents, not DeclSpace objects in general).
With this fix, mcs can now compile the "WordCount" demo appliction which comes
with the .NET SDK. Before, mcs would error out.
--
Matt Kimball
matt@kimball.net
------------=_1010460084-21945-0
Content-Type: application/octet-stream; name="mcs-nest-types.patch"
Content-Disposition: attachment; filename="mcs-nest-types.patch"
Content-Transfer-Encoding: base64
SW5kZXg6IGNsYXNzLmNzCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZp
bGU6IC9tb25vL21jcy9tY3MvY2xhc3MuY3MsdgpyZXRyaWV2aW5nIHJldmlz
aW9uIDEuMTQ4CmRpZmYgLXUgLXIxLjE0OCBjbGFzcy5jcwotLS0gY2xhc3Mu
Y3MJNyBKYW4gMjAwMiAyMjo0NzowMyAtMDAwMAkxLjE0OAorKysgY2xhc3Mu
Y3MJOCBKYW4gMjAwMiAwMzoxMzo1NCAtMDAwMApAQCAtNzksNyArNzksNiBA
QAogCQkvLwogCQlzdHJpbmcgICAgIGJhc2VfY2xhc3NfbmFtZTsKIAotCQlU
eXBlQ29udGFpbmVyIHBhcmVudDsKIAkJQXJyYXlMaXN0IHR5cGVfYmFzZXM7
CiAKIAkJLy8gQXR0cmlidXRlcyBmb3IgdGhpcyB0eXBlCkBAIC05MywxMSAr
O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