diff options
author | Alexandre Petit-Bianco <apbianco@cygnus.com> | 2000-12-05 07:08:56 +0000 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 2000-12-04 23:08:56 -0800 |
commit | f8b93ea75d7fa70c34eca646c56ec34be2e13c00 (patch) | |
tree | c02efcee3b9c0b87bf2c35fd36bd0e799a0bf834 /gcc | |
parent | fad3e66e8e783dfb8a1985ab150e24996b0f8bf7 (diff) | |
download | gcc-f8b93ea75d7fa70c34eca646c56ec34be2e13c00.zip gcc-f8b93ea75d7fa70c34eca646c56ec34be2e13c00.tar.gz gcc-f8b93ea75d7fa70c34eca646c56ec34be2e13c00.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/java/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/java/parse.y | 28 |
2 files changed, 33 insertions, 1 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 69e257b..69044f8 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -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): diff --git a/gcc/java/parse.y b/gcc/java/parse.y index c411054..d89ace4 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -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); } |