Skip to content

Commit c4f802f

Browse files
committed
fix slice type/ array type as return type
1 parent be82334 commit c4f802f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/parser/func.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ func (p *parser) parseFuncDefinition() *DefineFuncNode {
185185

186186
// Next can be type, that means that the previous was the name of the var
187187
isType := p.lookAhead(0)
188-
if isType.Type == lexer.IDENTIFIER {
188+
if isType.Type == lexer.IDENTIFIER ||
189+
isType.Type == lexer.OPERATOR && isType.Val == "[" {
189190
retType, err := p.parseOneType()
190191
if err != nil {
191192
panic(err)

0 commit comments

Comments
 (0)