-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changes from all commits
fe44380
94b1c41
7b7f821
8ca911d
5b1c2d2
7402e21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -485,7 +485,13 @@ func (p *Parser) parseBlockStatement() *ast.Statements { | |||||||||
func (p *Parser) parseFunctionLiteral() ast.Node { | ||||||||||
lit := &ast.FunctionLiteral{} | ||||||||||
lit.Token = p.curToken | ||||||||||
|
||||||||||
// Optional name/identifier | ||||||||||
if p.peekTokenIs(token.IDENT) { | ||||||||||
p.nextToken() | ||||||||||
name := &ast.Identifier{} | ||||||||||
name.Token = p.curToken | ||||||||||
lit.Name = name | ||||||||||
Comment on lines
+491
to
+493
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit difficult to read Maybe this
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But the rest of the code might be aligned with current code. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh indeed |
||||||||||
} | ||||||||||
if !p.expectPeek(token.LPAREN) { | ||||||||||
return nil | ||||||||||
} | ||||||||||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point