fixed bug where void async return didn't work

This commit is contained in:
ParkerTenBroeck 2025-05-01 19:37:11 -04:00
parent 487723713a
commit 93a764c986
2 changed files with 6 additions and 8 deletions

View file

@ -2,7 +2,6 @@ import async_runtime.Delay;
import async_runtime.Jokio; import async_runtime.Jokio;
import generators.RT; import generators.RT;
import future.Future; import future.Future;
import future.Waker;
import gen.Gen; import gen.Gen;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -14,7 +13,7 @@ public class Main implements Runnable {
@Override @Override
public void run() { public void run() {
lambda(() -> { async_lambda(() -> {
System.out.println("START"); System.out.println("START");
Delay.delay(100).await(); Delay.delay(100).await();
System.out.println("END"); System.out.println("END");
@ -24,15 +23,15 @@ public class Main implements Runnable {
await(); await();
} }
void async_lambda(Supplier<Future<?, ?>> lambda){
new Jokio().blocking(lambda.get());
}
void await(){ void await(){
new Jokio().blocking(AsyncExamples.test()); new Jokio().blocking(AsyncExamples.test());
} }
void lambda(Supplier<Future<?, ?>> lambda){
new Jokio().blocking(lambda.get());
}
void lexer(){ void lexer(){
var gen = Lexer.parse("f7(x,y,z,w, u,v, othersIg) = v-(x*y+y+ln(z)^2*sin(z*pi/2))/(w*u)+sqrt(othersIg*120e-1)"); var gen = Lexer.parse("f7(x,y,z,w, u,v, othersIg) = v-(x*y+y+ln(z)^2*sin(z*pi/2))/(w*u)+sqrt(othersIg*120e-1)");

View file

@ -145,12 +145,11 @@ public class FutureSMBuilder extends StateMachineBuilder {
@Override @Override
public void build_prelude(StateMachineBuilder smb, CodeBuilder cob, Frame frame) { public void build_prelude(StateMachineBuilder smb, CodeBuilder cob, Frame frame) {
cob.aload(0).loadConstant(-1).putfield(smb.CD_this, STATE_NAME, TypeKind.INT.upperBound()).aconst_null().areturn();
} }
@Override @Override
public void build_inline(StateMachineBuilder smb, CodeBuilder cob, Frame frame) { public void build_inline(StateMachineBuilder smb, CodeBuilder cob, Frame frame) {
cob.aload(0).loadConstant(-1).putfield(smb.CD_this, STATE_NAME, TypeKind.INT.upperBound()).aconst_null().areturn();
} }
} }