mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 02:04:56 +08:00
parse.y (patch_method_invocation): Pick the correct enclosing context when creating inner class instances.
2000-12-04 Alexandre Petit-Bianco <apbianco@cygnus.com> * parse.y (patch_method_invocation): Pick the correct enclosing context when creating inner class instances. Fixes gcj/332. (http://gcc.gnu.org/ml/gcc-patches/2000-12/msg00217.html) From-SVN: r38026
This commit is contained in:
parent
fad3e66e8e
commit
f8b93ea75d
@ -1,3 +1,9 @@
|
||||
2000-12-04 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
||||
|
||||
* parse.y (patch_method_invocation): Pick the correct enclosing
|
||||
context when creating inner class instances.
|
||||
Fixes gcj/332.
|
||||
|
||||
2000-11-26 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* gjavah.c (version), jcf-dump.c (version), jv-scan.c (version):
|
||||
|
@ -9997,7 +9997,33 @@ patch_method_invocation (patch, primary, where, is_static, ret_decl)
|
||||
|
||||
/* Secretly pass the current_this/primary as a second argument */
|
||||
if (primary || current_this)
|
||||
args = tree_cons (NULL_TREE, (primary ? primary : current_this), args);
|
||||
{
|
||||
tree extra_arg;
|
||||
tree this_type = (current_this ?
|
||||
TREE_TYPE (TREE_TYPE (current_this)) : NULL_TREE);
|
||||
/* Method's (list) enclosing context */
|
||||
tree mec = DECL_CONTEXT (TYPE_NAME (DECL_CONTEXT (list)));
|
||||
/* If we have a primary, use it. */
|
||||
if (primary)
|
||||
extra_arg = primary;
|
||||
/* The current `this' is an inner class but isn't a direct
|
||||
enclosing context for the inner class we're trying to
|
||||
create. Build an access to the proper enclosing context
|
||||
and use it. */
|
||||
else if (current_this && PURE_INNER_CLASS_TYPE_P (this_type)
|
||||
&& this_type != TREE_TYPE (mec))
|
||||
{
|
||||
|
||||
extra_arg = build_access_to_thisn (current_class,
|
||||
TREE_TYPE (mec), 0);
|
||||
extra_arg = java_complete_tree (extra_arg);
|
||||
}
|
||||
/* Otherwise, just use the current `this' as an enclosing
|
||||
context. */
|
||||
else
|
||||
extra_arg = current_this;
|
||||
args = tree_cons (NULL_TREE, extra_arg, args);
|
||||
}
|
||||
else
|
||||
args = tree_cons (NULL_TREE, integer_zero_node, args);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user