Skip to content

Commit

Permalink
fix slice type/ array type as return type
Browse files Browse the repository at this point in the history
  • Loading branch information
douyixuan committed Aug 22, 2024
1 parent be82334 commit c4f802f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/parser/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ func (p *parser) parseFuncDefinition() *DefineFuncNode {

// Next can be type, that means that the previous was the name of the var
isType := p.lookAhead(0)
if isType.Type == lexer.IDENTIFIER {
if isType.Type == lexer.IDENTIFIER ||
isType.Type == lexer.OPERATOR && isType.Val == "[" {
retType, err := p.parseOneType()
if err != nil {
panic(err)
Expand Down

0 comments on commit c4f802f

Please sign in to comment.