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

v2: match cgen; use as for casting

This commit is contained in:
Alexander Medvednikov
2020-02-07 14:49:14 +01:00
parent 27719ded9b
commit 9034b1fd08
14 changed files with 154 additions and 73 deletions

View File

@@ -77,6 +77,12 @@ fn (p mut Parser) bool_expression() string {
// `as` cast
// TODO remove copypasta
if p.tok == .key_as {
return p.key_as(typ, start_ph)
}
return typ
}
fn (p mut Parser) key_as(typ string, start_ph int) string {
p.fspace()
p.next()
p.fspace()
@@ -132,9 +138,7 @@ exit(1);
p.gen(')')
}
return cast_typ
}
return typ
}
}
fn (p mut Parser) bterm() string {
ph := p.cgen.add_placeholder()