parser: allow types that start with &&; cgen: allow ++/-- exprs for now

pull/4175/head
Alexander Medvednikov 2020-04-01 13:18:52 +02:00
parent 56a9196be8
commit 48832200bb
3 changed files with 4 additions and 2 deletions

View File

@ -186,7 +186,7 @@ fn (p mut Parser) fn_args() ([]table.Arg,bool) {
mut args := []table.Arg
mut is_variadic := false
// `int, int, string` (no names, just types)
types_only := p.tok.kind in [.amp] || (p.peek_tok.kind == .comma && p.table.known_type(p.tok.lit)) || p.peek_tok.kind == .rpar
types_only := p.tok.kind in [.amp, .and] || (p.peek_tok.kind == .comma && p.table.known_type(p.tok.lit)) || p.peek_tok.kind == .rpar
if types_only {
// p.warn('types only')
mut arg_no := 1

View File

@ -896,7 +896,7 @@ pub fn (p mut Parser) expr(precedence int) ast.Expr {
pos: p.tok.position()
}
p.next()
return node
// return node // TODO bring back, only allow ++/-- in exprs in translated code
}
else {
return node

View File

@ -1,3 +1,5 @@
fn C.strlen() int
fn test_cstring() {
w := c'world'
hlen := C.strlen(c'hello')