mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
runtime as
type check: part 1
This commit is contained in:
@@ -170,3 +170,10 @@ pub fn is_atty(fd int) int {
|
||||
return C.isatty(fd)
|
||||
}
|
||||
}
|
||||
|
||||
fn __as_cast(obj voidptr, obj_type, expected_type int) voidptr {
|
||||
if obj_type != expected_type {
|
||||
panic('as cast: cannot cast $obj_type to $expected_type')
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
Reference in New Issue
Block a user