groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Milles (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (GROOVY-8726) Parameter lacks a reference to the MethodNode it belongs to
Date Fri, 03 Aug 2018 16:37:00 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-8726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16568448#comment-16568448
] 

Eric Milles edited comment on GROOVY-8726 at 8/3/18 4:36 PM:
-------------------------------------------------------------

And this from Groovy Core:
{code:java}
public class ConstructorNode extends MethodNode {
    public ConstructorNode(int modifiers, Parameter[] parameters, ClassNode[] exceptions,
Statement code) {
        super("<init>",modifiers,ClassHelper.VOID_TYPE,parameters,exceptions,code);
        // This variable scope is thrown out and replaced with a different one during semantic
analysis.
        VariableScope scope = new VariableScope();
        for (int i = 0; i < parameters.length; i++) {
            scope.putDeclaredVariable(parameters[i]); // this is the original parameter reference,
not the cloned one
        }
        this.setVariableScope(scope);
    }
{code}

The code here to create a variable scope seems redundant with the current implementation of
{{MethodNode.setParameters}}.


was (Author: emilles):
And this from Groovy Core:
{code:java}
public class ConstructorNode extends MethodNode {
    public ConstructorNode(int modifiers, Parameter[] parameters, ClassNode[] exceptions,
Statement code) {
        super("<init>",modifiers,ClassHelper.VOID_TYPE,parameters,exceptions,code);
        // This variable scope is thrown out and replaced with a different one during semantic
analysis.
        VariableScope scope = new VariableScope();
        for (int i = 0; i < parameters.length; i++) {
            scope.putDeclaredVariable(parameters[i]); // this is the original parameter reference,
not the cloned one
        }
        this.setVariableScope(scope);
    }
{code}

> Parameter lacks a reference to the MethodNode it belongs to
> -----------------------------------------------------------
>
>                 Key: GROOVY-8726
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8726
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Compiler
>    Affects Versions: 2.5.1
>            Reporter: James Kleeh
>            Priority: Major
>
> The Parameter class lacks a reference to it's method node. This is important to find
arguments that have been "overridden".



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message