diff --git a/parser/parse_ast.go b/parser/parse_ast.go index e935c66..ee2d797 100644 --- a/parser/parse_ast.go +++ b/parser/parse_ast.go @@ -321,6 +321,18 @@ func (p *Parser) parseUnaryExpr() ast.Node { }, } + case token.Asterisk: + asterisk := p.consume() + + return &ast.PrefixOp{ + X: p.parseUnaryExpr(), + Opr: &ast.Operator{ + Start: asterisk.Start, + End: asterisk.End, + Kind: ast.OperatorDeref, + }, + } + case token.Amp: loc := p.consume().Start @@ -800,18 +812,6 @@ func (p *Parser) parseType() ast.Node { }, } - case token.Asterisk: - asterisk := p.consume() - - return &ast.PrefixOp{ - X: p.parseType(), - Opr: &ast.Operator{ - Start: asterisk.Start, - End: asterisk.End, - Kind: ast.OperatorDeref, - }, - } - case token.LBracket: brackets := p.parseBracketList(p.parseExpr)