parser: small c2v fixes
parent
67c6f24c84
commit
0a03856c83
|
@ -1878,7 +1878,7 @@ pub fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type {
|
|||
// builtin C.m*, C.s* only - temp
|
||||
c.warn('function `$f.name` must be called from an `unsafe` block', call_expr.pos)
|
||||
}
|
||||
if f.mod != 'builtin' && f.language == .v && f.no_body {
|
||||
if f.mod != 'builtin' && f.language == .v && f.no_body && !c.pref.translated {
|
||||
c.error('cannot call a function that does not have a body', call_expr.pos)
|
||||
}
|
||||
for generic_type in call_expr.generic_types {
|
||||
|
|
|
@ -80,7 +80,7 @@ fn (mut p Parser) array_init() ast.ArrayInit {
|
|||
first_pos.extend(last_pos))
|
||||
}
|
||||
} else {
|
||||
if p.tok.kind == .not && p.tok.line_nr == p.prev_tok.line_nr {
|
||||
if p.tok.kind == .not { // && p.tok.line_nr == p.prev_tok.line_nr {
|
||||
last_pos = p.tok.position()
|
||||
is_fixed = true
|
||||
has_val = true
|
||||
|
|
|
@ -1015,7 +1015,8 @@ fn (mut p Parser) parse_multi_expr(is_top_level bool) ast.Stmt {
|
|||
}
|
||||
if p.tok.kind in [.assign, .decl_assign] || p.tok.kind.is_assign() {
|
||||
return p.partial_assign_stmt(left, left_comments)
|
||||
} else if tok.kind !in [.key_if, .key_match, .key_lock, .key_rlock, .key_select]
|
||||
} else if !p.pref.translated // TODO remove translated
|
||||
&& tok.kind !in [.key_if, .key_match, .key_lock, .key_rlock, .key_select]
|
||||
&& left0 !is ast.CallExpr && (is_top_level || p.tok.kind != .rcbr)
|
||||
&& left0 !is ast.PostfixExpr && !(left0 is ast.InfixExpr
|
||||
&& (left0 as ast.InfixExpr).op in [.left_shift, .arrow]) && left0 !is ast.ComptimeCall
|
||||
|
|
|
@ -178,7 +178,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
|
|||
}
|
||||
field_start_pos := p.tok.position()
|
||||
is_embed := ((p.tok.lit.len > 1 && p.tok.lit[0].is_capital())
|
||||
|| p.peek_tok.kind == .dot) && language == .v
|
||||
|| p.peek_tok.kind == .dot) && language == .v && p.peek_tok.kind != .key_fn
|
||||
is_on_top := ast_fields.len == 0 && !(is_field_mut || is_field_mut || is_field_global)
|
||||
mut field_name := ''
|
||||
mut typ := table.Type(0)
|
||||
|
|
Loading…
Reference in New Issue