ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.66k stars 751 forks source link

Can we have two versions(deprecated old one and new) of the same node? #35545

Open lochana-chathura opened 2 years ago

lochana-chathura commented 2 years ago

Description: $subject.

We can have the two nodes with an is-a relationship. e.g. Renaming BracedExpressionNode to ParenthesisedExpressionNode

  1. Extend the old node with the new one. BracedExpressionNode extends ParenthesisedExpressionNode
  2. Override the BracedExpressionNode methods to consume ParenthesisedExpressionNode methods underneath. If the method names also have changed.

Need to evaluate if this causes a lot of complications with treeModifiers, transformers, etc.

Also, we need to find a way to allow it via treegen.

hasithaa commented 2 years ago

I think Option 1 is the safest and easy to migrate.

First, we extend the BracedExpressionNode with ParenthesisedExpressionNode and deprecate it. Also, we can update the usage of BracedExpressionNode to ParenthesisedExpressionNode. After one or two updates we can remove the BracedExpressionNode.