1
0
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:
Alexander Medvednikov
2020-04-25 08:36:53 +02:00
parent f1f9e423c3
commit 2d187fb951
4 changed files with 45 additions and 8 deletions

View File

@@ -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
}