mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 15:26:00 +02:00
allow zero arguments
This commit is contained in:
parent
09131c1df0
commit
67e4b845fd
1 changed files with 14 additions and 1 deletions
|
@ -109,13 +109,26 @@ class WebAssembly
|
|||
return new $"result = emscripten_asm_const_{JSGetResultName(typeof(TResult))}(AddStringToSection({TCall.Quote(.. scope .())}, \"em_asm\"), \"{argSigs}\", {argString});";
|
||||
}
|
||||
|
||||
private static String JSGetCallString<TResult, TCall>() where TCall : const String
|
||||
{
|
||||
if (TCall == null)
|
||||
return "";
|
||||
return new $"result = emscripten_asm_const_{JSGetResultName(typeof(TResult))}(AddStringToSection({TCall.Quote(.. scope .())}, \"em_asm\"), \"i\");";
|
||||
}
|
||||
|
||||
public static TResult JSCall<TResult, TCall, T0>(TCall callString, T0 p0) where TCall : const String
|
||||
{
|
||||
TResult result = default;
|
||||
Compiler.Mixin(JSGetCallString<TResult, const TCall, T0>());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static TResult JSCall<TResult, TCall>(TCall callString) where TCall : const String
|
||||
{
|
||||
TResult result = default;
|
||||
Compiler.Mixin(JSGetCallString<TResult, const TCall>());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue