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

implement func name(...) {....} as short for name=func(...) {...} #92

Merged
merged 6 commits into from
Aug 2, 2024

Conversation

ldemailly
Copy link
Member

@ldemailly ldemailly commented Aug 2, 2024

@ldemailly ldemailly changed the title follow up on #91 - typo/bad name handlElse -> printElse follow up on if/else PR - typo/bad name handlElse -> printElse Aug 2, 2024
@ldemailly ldemailly mentioned this pull request Aug 2, 2024
2 tasks
@ldemailly ldemailly changed the title follow up on if/else PR - typo/bad name handlElse -> printElse implement func name(...) {....} as short for name=func(...) {...} Aug 2, 2024
@ldemailly ldemailly requested a review from ccoVeille August 2, 2024 18:40
@ldemailly ldemailly merged commit f5798dc into main Aug 2, 2024
1 check passed
@ldemailly ldemailly deleted the func_name branch August 2, 2024 19:08
Copy link
Contributor

@ccoVeille ccoVeille left a comment

Choose a reason for hiding this comment

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

A few side remarks,otherwise 👍

Comment on lines +491 to +493
name := &ast.Identifier{}
name.Token = p.curToken
lit.Name = name
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit difficult to read

Maybe this

Suggested change
name := &ast.Identifier{}
name.Token = p.curToken
lit.Name = name
lit.Name = &ast.Identifier{Token: p.curToken}

Copy link
Contributor

Choose a reason for hiding this comment

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

But the rest of the code might be aligned with current code.

Copy link
Member Author

@ldemailly ldemailly Aug 3, 2024

Choose a reason for hiding this comment

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

it's like that because the Tokens are in Base... so you'd need to do the super annoying {Base: Base{Token: ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh indeed

}

// Common part of Inspect and SetCacheKey. Outputs the rest of the function.
func (f *Function) finishFuncOutput(out *strings.Builder) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit out of this PR, but maybe you could use godoc link

Suggested change
func (f *Function) finishFuncOutput(out *strings.Builder) string {
// Common part of [Inspect] and [SetCacheKey]. Prints the rest of the function.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm unsure about the godoc link in such case

Copy link
Member Author

Choose a reason for hiding this comment

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

godoc doesn't generate doc for private function does it? or maybe there is an option to do so I suppose

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point

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.

support func name(... as alternative to name = func(...
2 participants