Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Tree.java to Tree.ts #5

Merged
merged 3 commits into from
Oct 3, 2016
Merged

Convert Tree.java to Tree.ts #5

merged 3 commits into from
Oct 3, 2016

Conversation

BurtHarris
Copy link
Collaborator

This is the small example you requested.

I'd like to see how things work if you make a small change in the Java version...

Copy link
Member

@sharwell sharwell left a comment

Choose a reason for hiding this comment

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

This looks good. Feel free to merge after answering the question I left.

* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// ConvertTo-TS run at 2016-10-02T21:58:18.5966470-07:00
Copy link
Member

Choose a reason for hiding this comment

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

💭 We could replace this line with our sign-off comments when we go back and review the file for all the details (completeness, correctness). Then when the initial version of the target is complete we just remove the sign-off comments too.

* It is the most abstract interface for all the trees used by ANTLR.
*/
export interface Tree {
/** The parent of this node. If the return value is null, then this
Copy link
Member

Choose a reason for hiding this comment

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

❓ Would this be a case where we want null or undefined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

?? You comment doesn't seem to match up with a place that makes sense!

Copy link
Member

Choose a reason for hiding this comment

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

The comment says the return value can be null.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, the comment. Perhaps, but we're really defining the contract here, rather than testing a value. I see no reason we should define the contract to allow a return value of undefined.

In TypeScript 2 there is a new "strict null checking" option, which requires you to explicitly allow both null and/or undefined in type declarations, or it will flag code which violates this. We should consider if we want to use strict null checking on this project. Opened issue #14 to track.

* invocation. For abstract syntax trees (ASTs), this is a {@link Token}
* object.
*/
getPayload(): any;
Copy link
Member

Choose a reason for hiding this comment

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

💭 In the end, we may not need this method for TypeScript target, but I see no harm in keeping with the "port as close as possible" for now. Maybe we create issues related to potential style changes that could be applied in the future, between when things are first working and when we're ready to :shipit:?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I like the idea of tracking possible style changes with issues.

/** The parent of this node. If the return value is null, then this
* node is the root of the tree.
*/
getParent(): Tree;
Copy link
Member

Choose a reason for hiding this comment

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

📝 I filed #8 so we can come back after the initial port and discuss the best pattern to use for this type of read-only property.

@BurtHarris
Copy link
Collaborator Author

So what's the protocol, you approve and I merge?

@sharwell
Copy link
Member

sharwell commented Oct 3, 2016

So what's the protocol, you approve and I merge?

If I have questions then I'll wait until you answer to merge (in case it triggers some thinking where you want to make a change). Otherwise I'll just merge.

If you have a WIP item, add a do not merge label and I won't merge it.

@sharwell sharwell modified the milestone: 0.0.1 Oct 3, 2016
@BurtHarris BurtHarris merged commit cf33fa7 into tunnelvisionlabs:master Oct 3, 2016
@BurtHarris BurtHarris deleted the tree branch October 3, 2016 23:20
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.

None yet

2 participants