mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix tests
This commit is contained in:
parent
e8803390d2
commit
b4c3bc47f0
|
@ -438,7 +438,7 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
|
|||
sourceWriter.append("var ").append(entry.getKey()).ws().append("=").ws();
|
||||
boolean wrapAsync = !asyncMethods.contains(entry.getValue().reference) && entry.getValue().isAsync();
|
||||
if (wrapAsync) {
|
||||
sourceWriter.append("$rt_asyncAdapter(");
|
||||
sourceWriter.append("$rt_staticAsyncAdapter(");
|
||||
}
|
||||
sourceWriter.appendMethodBody(entry.getValue().reference);
|
||||
if (wrapAsync) {
|
||||
|
|
|
@ -459,6 +459,19 @@ function $rt_asyncError(e) {
|
|||
throw e;
|
||||
}
|
||||
}
|
||||
function $rt_staticAsyncAdapter(f) {
|
||||
return function() {
|
||||
var result;
|
||||
var args = Array.prototype.slice.apply(arguments);
|
||||
var $return = args.pop();
|
||||
try {
|
||||
result = f.apply(this, args);
|
||||
} catch (e) {
|
||||
return $return($rt_asyncError(e));
|
||||
}
|
||||
return $return($rt_asyncResult(result));
|
||||
}
|
||||
}
|
||||
function $rt_asyncAdapter(f) {
|
||||
return function() {
|
||||
var result;
|
||||
|
|
Loading…
Reference in New Issue
Block a user