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

Add InvokeMethod2 to front-end ASTs #7749

Closed
magnus-madsen opened this issue May 21, 2024 · 7 comments · Fixed by #7750
Closed

Add InvokeMethod2 to front-end ASTs #7749

magnus-madsen opened this issue May 21, 2024 · 7 comments · Fixed by #7750

Comments

@magnus-madsen
Copy link
Member

magnus-madsen commented May 21, 2024

Add a new node:

case class InvokeMethod2(ident: Name.Ident, exp: Expr, exps: List[Expr], loc: SourceLocation) extends Expr

Just below the existing InvokeMethod.

To begin with, we should just support the syntax:

.name1.name2(exps..) // Note the prefix dot

Here name2 is a Name.Ident. We should also parse name1 as a Name.Ident, but wrap it in an Expr.Var.

That way, we can later extend the parser without making changes to the rest.

@magnus-madsen
Copy link
Member Author

@JonathanStarup
Copy link
Contributor

InvokeImplicitMethod?

@magnus-madsen
Copy link
Member Author

InvokeImplicitMethod?

I think InvokeMethod2 is fine. It will replace InvokeMethod at some point.

@JonathanStarup
Copy link
Contributor

Your example code doesnt really match the structure of the asts, i guess we add it to parsedAst as a JvmOp and then later an atomic op also

@magnus-madsen
Copy link
Member Author

Your example code doesnt really match the structure of the asts, i guess we add it to parsedAst as a JvmOp and then later an atomic op also

Why not? Compare it to WeededAst.Expr.InvokeMethod.

@magnus-madsen
Copy link
Member Author

Your example code doesnt really match the structure of the asts, i guess we add it to parsedAst as a JvmOp and then later an atomic op also

Looking at JvmOp I would not add it there. The structure is very different. InvokeMethod is now much closer to Apply than it is to an import.

@JonathanStarup
Copy link
Contributor

Yes, we also concluded that after some tinkering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants