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

v2: add UnsafeStmt to checker & byte/byteptr to check

This commit is contained in:
Joe Conigliaro 2020-03-05 00:20:37 +11:00
parent 7daf8f8fd0
commit 8458ea40f0
2 changed files with 9 additions and 2 deletions

View File

@ -457,6 +457,11 @@ fn (c mut Checker) stmt(node ast.Stmt) {
c.return_stmt(it)
}
// ast.StructDecl {}
ast.UnsafeStmt {
for stmt in it.stmts {
c.stmt(stmt)
}
}
ast.VarDecl {
typ := c.expr(it.expr)
it.typ = typ

View File

@ -398,8 +398,10 @@ pub fn (t &Table) check(got, expected Type) bool {
if got_type_sym.is_number() && exp_type_sym.is_number() {
return true
}
// check hack in checker IndexExpr line #691
if type_is_ptr(got) && got_type_sym.kind == .byte && exp_type_sym.kind == .byteptr {
// TODO: actually check for & handle pointers with name_expr
// see hack in checker IndexExpr line #691
if (got_type_sym.kind == .byte && exp_type_sym.kind == .byteptr) ||
(exp_type_sym.kind == .byte && got_type_sym.kind == .byteptr) {
return true
}
// TODO