Private
Public Access
Remove export handling from the C++ unit_call implementation.
This commit is contained in:
1 parent
ef0f9e87e1
commit
b7649932e2
1 file changed
+2
-25
+2
-25
@@ -172,7 +172,6 @@ bool unit_compile(String path)
|
||||
return(response["ok"].to_bool());
|
||||
}
|
||||
|
||||
static DValue wasm_unit_call_result;
|
||||
static String wasm_component_capture_result;
|
||||
static String wasm_file_read_result;
|
||||
static String wasm_file_temp_result;
|
||||
@@ -910,6 +909,8 @@ static String wasm_unit_call_handler(const String& function_name)
|
||||
return("");
|
||||
}
|
||||
|
||||
// Calls a handler (RENDER, COMPONENT, ...) of another unit with the given
|
||||
// props node. Exported (dval) dval functions go through bearer_dv_module_call.
|
||||
DValue* unit_call(String file_name, String function_name, DValue* call_param)
|
||||
{
|
||||
String handler = wasm_unit_call_handler(function_name);
|
||||
@@ -941,30 +942,6 @@ DValue* unit_call(String file_name, String function_name, DValue* call_param)
|
||||
bearer_handler_restore(*context);
|
||||
return(0);
|
||||
}
|
||||
|
||||
String resolved;
|
||||
String resolve_error;
|
||||
s32 slot = wasm_resolve_target(file_name, "export:" + function_name, &resolved, &resolve_error);
|
||||
if(!slot)
|
||||
{
|
||||
if(resolve_error != "")
|
||||
print("Error: ", resolve_error);
|
||||
else
|
||||
print("Error: unit_call() function '", function_name, "' not found");
|
||||
return(0);
|
||||
}
|
||||
|
||||
String previous_unit = context->resources.current_unit_file;
|
||||
if(resolved != "")
|
||||
context->resources.current_unit_file = resolved;
|
||||
WasmDValueCallHandler handler_fn = (WasmDValueCallHandler)(uintptr_t)slot;
|
||||
DValue* result = handler_fn(call_param);
|
||||
context->resources.current_unit_file = previous_unit;
|
||||
if(result)
|
||||
{
|
||||
wasm_unit_call_result = *result;
|
||||
return(&wasm_unit_call_result);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user