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

builtin,cgen: rename Option to _option (#14317)

This commit is contained in:
Daniel Däschle
2022-05-06 18:25:54 +02:00
committed by GitHub
parent 45fe87c9e3
commit 76cdf75299
12 changed files with 83 additions and 47 deletions

View File

@@ -121,6 +121,23 @@ fn opt_ok(data voidptr, mut option Option, size int) {
}
}
// option is the base of V's internal optional return system.
struct _option {
state u8
err IError = none__
// Data is trailing after err
// and is not included in here but in the
// derived _option_xxx types
}
fn opt_ok2(data voidptr, mut option _option, size int) {
unsafe {
*option = _option{}
// use err to get the end of OptionBase and then memcpy into it
vmemcpy(&u8(&option.err) + sizeof(IError), data, size)
}
}
struct _result {
is_error bool
err IError = none__