[jira] [Updated] (GROOVY-8834) Making "public" - BinaryExpression.leftExpression and similar fields

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (GROOVY-8834) Making "public" - BinaryExpression.leftExpression and similar fields

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/GROOVY-8834?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anton Pryamostanov updated GROOVY-8834:
---------------------------------------
    Description:
This is a general request related to AST API.

 

Currently BinaryExpression.leftExpression and similar fields are having Private access.

So to change the value, we need to replace the whole BinaryExpression with new one.

This is not useful as it requires coding outside of Visitor methods, and I do not see reason why it should be private. It will greatly simplify visitor methods and transformations, if all Expression fields will have Public access.

Alternatively please add setter methods with Public access.

List of fields to be changed from Private to Public:
{code:java}
ArrayExpression->expressions
ArrayExpression->sizeExpression
BitwiseNegationExpression->expression
BooleanExpression->expression
CastExpression->expression
ConstructorCallExpression->arguments
GStringExpression->strings
GStringExpression->values
ListExpression->expressions
MapExpression->mapEntryExpressions
MethodPointerExpression->expression
MethodPointerExpression->methodName
PropertyExpression->property
RangeExpression->from
RangeExpression->to
SpreadExpression->expression
SpreadMapExpression->expression
StaticMethodCallExpression->arguments
TernaryExpression->booleanExpression
TernaryExpression->trueExpression
TernaryExpression->falseExpression
TupleExpression->expressions
UnaryMinusExpression->expression
UnaryPlusExpression->expression{code}

Note: those fields with "final" modifier should also be made re-assignable.

  was:
This is a general request related to AST API.

 

Currently BinaryExpression.leftExpression and similar fields are having Private access.

So to change the value, we need to replace the whole BinaryExpression with new one.

This is not useful as it requires coding outside of Visitor methods, and I do not see reason why it should be private. It will greatly simplify visitor methods and transformations, if all Expression fields will have Public access.

Alternatively please add setter methods with Public access.

List of fields to be changed from Private to Public:
{code:java}
ArrayExpression->expressions
ArrayExpression->sizeExpression
BitwiseNegationExpression->expression
BooleanExpression->expression
CastExpression->expression
ConstructorCallExpression->arguments
GStringExpression->strings
GStringExpression->values
ListExpression->expressions
MapExpression->mapEntryExpressions
MethodPointerExpression->expression
MethodPointerExpression->methodName
PropertyExpression->property
RangeExpression->from
RangeExpression->to
SpreadExpression->expression
SpreadMapExpression->expression
StaticMethodCallExpression->arguments
TernaryExpression->booleanExpression
TernaryExpression->trueExpression
TernaryExpression->falseExpression
TupleExpression->expressions
UnaryMinusExpression->expression
UnaryPlusExpression->expression{code}


> Making "public" - BinaryExpression.leftExpression and similar fields
> --------------------------------------------------------------------
>
>                 Key: GROOVY-8834
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8834
>             Project: Groovy
>          Issue Type: Wish
>            Reporter: Anton Pryamostanov
>            Priority: Major
>              Labels: ast
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> This is a general request related to AST API.
>  
> Currently BinaryExpression.leftExpression and similar fields are having Private access.
> So to change the value, we need to replace the whole BinaryExpression with new one.
> This is not useful as it requires coding outside of Visitor methods, and I do not see reason why it should be private. It will greatly simplify visitor methods and transformations, if all Expression fields will have Public access.
> Alternatively please add setter methods with Public access.
> List of fields to be changed from Private to Public:
> {code:java}
> ArrayExpression->expressions
> ArrayExpression->sizeExpression
> BitwiseNegationExpression->expression
> BooleanExpression->expression
> CastExpression->expression
> ConstructorCallExpression->arguments
> GStringExpression->strings
> GStringExpression->values
> ListExpression->expressions
> MapExpression->mapEntryExpressions
> MethodPointerExpression->expression
> MethodPointerExpression->methodName
> PropertyExpression->property
> RangeExpression->from
> RangeExpression->to
> SpreadExpression->expression
> SpreadMapExpression->expression
> StaticMethodCallExpression->arguments
> TernaryExpression->booleanExpression
> TernaryExpression->trueExpression
> TernaryExpression->falseExpression
> TupleExpression->expressions
> UnaryMinusExpression->expression
> UnaryPlusExpression->expression{code}
> Note: those fields with "final" modifier should also be made re-assignable.



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