restore checker.v

pull/13637/head
yuyi98 2022-03-03 12:12:53 +08:00
parent 573a564aba
commit f8c7213ee3
1 changed files with 6 additions and 3 deletions

View File

@ -3544,9 +3544,12 @@ pub fn (mut c Checker) prefix_expr(mut node ast.PrefixExpr) ast.Type {
for mut expr is ast.ParExpr {
expr = expr.expr
}
if expr in [ast.BoolLiteral, ast.CallExpr, ast.CharLiteral, ast.FloatLiteral,
ast.IntegerLiteral, ast.InfixExpr, ast.StringLiteral, ast.StringInterLiteral] {
c.error('cannot take the address of $expr', node.pos)
match expr {
ast.BoolLiteral, ast.CallExpr, ast.CharLiteral, ast.FloatLiteral, ast.IntegerLiteral,
ast.InfixExpr, ast.StringLiteral, ast.StringInterLiteral {
c.error('cannot take the address of $expr', node.pos)
}
else {}
}
if mut node.right is ast.IndexExpr {
typ_sym := c.table.sym(node.right.left_type)