webmcp
annotate framework/env/execute/_initializers.lua @ 561:e13a3fa97aad
Removed unused pointer for database connection to avoid compiler warning
| author | jbe |
|---|---|
| date | Fri Feb 05 15:37:48 2021 +0100 (2021-02-05) |
| parents | c37d4bf50a4b |
| children |
| rev | line source |
|---|---|
| jbe@214 | 1 function execute._initializers(initializer_path_element) |
| jbe@425 | 2 local yieldvalue_inner = {} |
| jbe@425 | 3 local coro = coroutine.create(function() |
| jbe@214 | 4 execute.multi_wrapped( |
| jbe@214 | 5 execute._create_sorted_execution_list( |
| jbe@214 | 6 function(add_by_path) |
| jbe@214 | 7 add_by_path(initializer_path_element) |
| jbe@316 | 8 add_by_path(WEBMCP_APP_NAME, initializer_path_element) |
| jbe@214 | 9 end, |
| jbe@214 | 10 function(full_path, relative_path) |
| jbe@214 | 11 execute.file_path{ file_path = full_path } |
| jbe@214 | 12 end |
| jbe@214 | 13 ), |
| jbe@214 | 14 function() |
| jbe@425 | 15 coroutine.yield(yieldvalue_inner) |
| jbe@214 | 16 end |
| jbe@214 | 17 ) |
| jbe@214 | 18 end) |
| jbe@449 | 19 local success, value = coroutine.resume(coro) |
| jbe@425 | 20 if not success then |
| jbe@449 | 21 error(debug.traceback(coro, "Error in initializer: " .. tostring(value))) |
| jbe@425 | 22 end |
| jbe@425 | 23 if coroutine.status(coro) == "dead" then |
| jbe@277 | 24 error("Initializers failed to call execute.inner()") |
| jbe@449 | 25 elseif value ~= yieldvalue_inner then |
| jbe@425 | 26 error("Unexpected yield in initializer") |
| jbe@214 | 27 end |
| jbe@277 | 28 execute._finalizers[#execute._finalizers+1] = function() |
| jbe@449 | 29 local success, value = coroutine.resume(coro) |
| jbe@449 | 30 if not success then |
| jbe@449 | 31 error(debug.traceback(coro, "Error in finalizer: " .. tostring(value))) |
| jbe@425 | 32 end |
| jbe@425 | 33 if coroutine.status(coro) ~= "dead" then |
| jbe@425 | 34 error("Unexpected yield in finalizer") |
| jbe@425 | 35 end |
| jbe@277 | 36 end |
| jbe@214 | 37 end |