v2: add UnsafeStmt to checker & byte/byteptr to check
parent
7daf8f8fd0
commit
8458ea40f0
|
@ -457,6 +457,11 @@ fn (c mut Checker) stmt(node ast.Stmt) {
|
||||||
c.return_stmt(it)
|
c.return_stmt(it)
|
||||||
}
|
}
|
||||||
// ast.StructDecl {}
|
// ast.StructDecl {}
|
||||||
|
ast.UnsafeStmt {
|
||||||
|
for stmt in it.stmts {
|
||||||
|
c.stmt(stmt)
|
||||||
|
}
|
||||||
|
}
|
||||||
ast.VarDecl {
|
ast.VarDecl {
|
||||||
typ := c.expr(it.expr)
|
typ := c.expr(it.expr)
|
||||||
it.typ = typ
|
it.typ = typ
|
||||||
|
|
|
@ -398,8 +398,10 @@ pub fn (t &Table) check(got, expected Type) bool {
|
||||||
if got_type_sym.is_number() && exp_type_sym.is_number() {
|
if got_type_sym.is_number() && exp_type_sym.is_number() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// check hack in checker IndexExpr line #691
|
// TODO: actually check for & handle pointers with name_expr
|
||||||
if type_is_ptr(got) && got_type_sym.kind == .byte && exp_type_sym.kind == .byteptr {
|
// 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
|
return true
|
||||||
}
|
}
|
||||||
// TODO
|
// TODO
|
||||||
|
|
Loading…
Reference in New Issue