1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: ptr++,*(ptr+1)

This commit is contained in:
BigBlack
2019-11-12 04:39:16 +08:00
committed by Alexander Medvednikov
parent bd34524a1c
commit 99169ae4ff
3 changed files with 18 additions and 2 deletions

View File

@ -1623,7 +1623,7 @@ fn (p mut Parser) var_expr(v Var) string {
if !v.is_changed {
p.mark_var_changed(v)
}
if typ != 'int' {
if typ != 'int' && !typ.contains('*') {
if !p.pref.translated && !is_number_type(typ) {
p.error('cannot ++/-- value of type `$typ`')
}
@ -1635,7 +1635,7 @@ fn (p mut Parser) var_expr(v Var) string {
//return p.index_expr(typ, fn_ph)
}
else {
return 'void'
return typ
}
}
typ = p.index_expr(typ, fn_ph)