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

checker: optimize the position of the propagation error, where a fn needs to return an optional or result(fix #15780) (#15813)

This commit is contained in:
shove
2022-09-19 19:49:23 +08:00
committed by GitHub
parent 0ff53d18c1
commit 84bc170720
5 changed files with 73 additions and 13 deletions

View File

@ -85,13 +85,19 @@ pub fn (mut app App) controller_get_all_task() ?vweb.Result {
for orm_stmt_kind in orm_stmt_kinds {
match orm_stmt_kind {
'insert' {
framework_platform[orm_stmt_kind] = insert_framework_benchmark_times().to_map()
framework_platform[orm_stmt_kind] = insert_framework_benchmark_times() or {
return error('')
}.to_map()
}
'select' {
framework_platform[orm_stmt_kind] = select_framework_benchmark_times().to_map()
framework_platform[orm_stmt_kind] = select_framework_benchmark_times() or {
return error('')
}.to_map()
}
'update' {
framework_platform[orm_stmt_kind] = update_framework_benchmark_times().to_map()
framework_platform[orm_stmt_kind] = update_framework_benchmark_times() or {
return error('')
}.to_map()
}
else {}
}
@ -109,7 +115,7 @@ pub fn (mut app App) controller_get_all_task() ?vweb.Result {
return $vweb.html()
}
fn insert_framework_benchmark_times() FrameworkPlatform {
fn insert_framework_benchmark_times() !FrameworkPlatform {
numbers := FrameworkPlatform{
v_sqlite_memory: v_sqlite_memory()!.insert
// v_sqlite_file: v_sqlite_file()!.insert
@ -119,7 +125,7 @@ fn insert_framework_benchmark_times() FrameworkPlatform {
return numbers
}
fn select_framework_benchmark_times() FrameworkPlatform {
fn select_framework_benchmark_times() !FrameworkPlatform {
numbers := FrameworkPlatform{
v_sqlite_memory: v_sqlite_memory()!.@select
// v_sqlite_file: v_sqlite_file()!.@select
@ -129,7 +135,7 @@ fn select_framework_benchmark_times() FrameworkPlatform {
return numbers
}
fn update_framework_benchmark_times() FrameworkPlatform {
fn update_framework_benchmark_times() !FrameworkPlatform {
numbers := FrameworkPlatform{
v_sqlite_memory: v_sqlite_memory()!.update
// v_sqlite_file: v_sqlite_file()!.@select