mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 07:54:11 -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();
|
sourceWriter.append("var ").append(entry.getKey()).ws().append("=").ws();
|
||||||
boolean wrapAsync = !asyncMethods.contains(entry.getValue().reference) && entry.getValue().isAsync();
|
boolean wrapAsync = !asyncMethods.contains(entry.getValue().reference) && entry.getValue().isAsync();
|
||||||
if (wrapAsync) {
|
if (wrapAsync) {
|
||||||
sourceWriter.append("$rt_asyncAdapter(");
|
sourceWriter.append("$rt_staticAsyncAdapter(");
|
||||||
}
|
}
|
||||||
sourceWriter.appendMethodBody(entry.getValue().reference);
|
sourceWriter.appendMethodBody(entry.getValue().reference);
|
||||||
if (wrapAsync) {
|
if (wrapAsync) {
|
||||||
|
|
|
@ -459,6 +459,19 @@ function $rt_asyncError(e) {
|
||||||
throw 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) {
|
function $rt_asyncAdapter(f) {
|
||||||
return function() {
|
return function() {
|
||||||
var result;
|
var result;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user