mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: support most kinds of ast.PrefixExpr in gen_assert_metainfo
This commit is contained in:
parent
f7698ea160
commit
66787b05d6
@ -1370,9 +1370,21 @@ fn (mut g Gen) gen_assert_metainfo(a ast.AssertStmt) string {
|
|||||||
fn (mut g Gen) gen_assert_single_expr(e ast.Expr, t table.Type) {
|
fn (mut g Gen) gen_assert_single_expr(e ast.Expr, t table.Type) {
|
||||||
unknown_value := '*unknown value*'
|
unknown_value := '*unknown value*'
|
||||||
match e {
|
match e {
|
||||||
ast.CastExpr, ast.IndexExpr, ast.PrefixExpr, ast.MatchExpr {
|
ast.CastExpr, ast.IndexExpr, ast.MatchExpr {
|
||||||
g.write(ctoslit(unknown_value))
|
g.write(ctoslit(unknown_value))
|
||||||
}
|
}
|
||||||
|
ast.PrefixExpr {
|
||||||
|
if e.right is ast.CastExpr {
|
||||||
|
// TODO: remove this check;
|
||||||
|
// vlib/builtin/map_test.v (a map of &int, set to &int(0)) fails
|
||||||
|
// without special casing ast.CastExpr here
|
||||||
|
g.write(ctoslit(unknown_value))
|
||||||
|
} else {
|
||||||
|
g.gen_expr_to_string(e, t) or {
|
||||||
|
g.write(ctoslit('[$err]'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
ast.Type {
|
ast.Type {
|
||||||
sym := g.table.get_type_symbol(t)
|
sym := g.table.get_type_symbol(t)
|
||||||
g.write(ctoslit('$sym.name'))
|
g.write(ctoslit('$sym.name'))
|
||||||
|
Loading…
Reference in New Issue
Block a user