Skip to content

GROOVY-8778: Cast short-hand breaks for empty map#792

Closed
paulk-asert wants to merge 1 commit into
apache:masterfrom
paulk-asert:groovy8778
Closed

GROOVY-8778: Cast short-hand breaks for empty map#792
paulk-asert wants to merge 1 commit into
apache:masterfrom
paulk-asert:groovy8778

Conversation

@paulk-asert
Copy link
Copy Markdown
Contributor

No description provided.

}
if (mapEntryExpressionList.size() == 0) {
// expecting list of MapEntryExpressions later so use SpreadMap to smuggle empty MapExpression to later stages
right = new SpreadMapExpression(configureAST(new MapExpression(), ctx.namedPropertyArgs()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to configureAST the instance of SpreadMapExpression too, or its node position will be missing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had that originally but we throw that expression away in resolve visitor.

Copy link
Copy Markdown
Contributor

@daniellansun daniellansun Sep 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation of parser should decouple with back end(i.e. not rely on the implementation of back end).
If the implementation of resolve visitor changes in the future, the expression is not thrown away, the node position is missing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right - if we ever do support getAt(Map) more generally, we would need to process that differently, so best it is correct to start with.

@asfgit asfgit closed this in 522fd49 Sep 8, 2018
@paulk-asert paulk-asert deleted the groovy8778 branch September 8, 2018 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants