Created
August 5, 2023 07:05
-
-
Save kariyayo/cc3247b86bb887675f99568cfc5d5047 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlin.Metadata; | |
import kotlin.ResultKt; | |
import kotlin.Unit; | |
import kotlin.coroutines.Continuation; | |
import kotlin.coroutines.CoroutineContext; | |
import kotlin.coroutines.intrinsics.IntrinsicsKt; | |
import kotlin.coroutines.jvm.internal.ContinuationImpl; | |
import kotlin.jvm.functions.Function2; | |
import kotlin.jvm.internal.Intrinsics; | |
import kotlinx.coroutines.BuildersKt; | |
import kotlinx.coroutines.CoroutineScope; | |
import kotlinx.coroutines.CoroutineStart; | |
import kotlinx.coroutines.DelayKt; | |
import org.jetbrains.annotations.NotNull; | |
import org.jetbrains.annotations.Nullable; | |
@Metadata( | |
mv = {1, 9, 0}, | |
k = 2, | |
xi = 48, | |
d1 = {"\u0000\u0016\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0002\u001a\u0011\u0010\u0000\u001a\u00020\u0001H\u0086@ø\u0001\u0000¢\u0006\u0002\u0010\u0002\u001a\u0019\u0010\u0003\u001a\u00020\u00012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005¢\u0006\u0002\u0010\u0007\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\b"}, | |
d2 = {"hoge", "", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "main", "args", "", "", "([Ljava/lang/String;)V", "otameshi-kotlin"} | |
) | |
public final class MainKt { | |
@Nullable | |
public static final Object hoge(@NotNull Continuation var0) { | |
Object $continuation; | |
label20: { | |
if (var0 instanceof <undefinedtype>) { | |
$continuation = (<undefinedtype>)var0; | |
if ((((<undefinedtype>)$continuation).label & Integer.MIN_VALUE) != 0) { | |
((<undefinedtype>)$continuation).label -= Integer.MIN_VALUE; | |
break label20; | |
} | |
} | |
$continuation = new ContinuationImpl(var0) { | |
// $FF: synthetic field | |
Object result; | |
int label; | |
@Nullable | |
public final Object invokeSuspend(@NotNull Object $result) { | |
this.result = $result; | |
this.label |= Integer.MIN_VALUE; | |
return MainKt.hoge((Continuation)this); | |
} | |
}; | |
} | |
Object $result = ((<undefinedtype>)$continuation).result; | |
Object var3 = IntrinsicsKt.getCOROUTINE_SUSPENDED(); | |
switch (((<undefinedtype>)$continuation).label) { | |
case 0: | |
ResultKt.throwOnFailure($result); | |
((<undefinedtype>)$continuation).label = 1; | |
if (DelayKt.delay(1000L, (Continuation)$continuation) == var3) { | |
return var3; | |
} | |
break; | |
case 1: | |
ResultKt.throwOnFailure($result); | |
break; | |
default: | |
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); | |
} | |
System.out.println("foobar"); | |
return Unit.INSTANCE; | |
} | |
public static final void main(@NotNull String[] args) { | |
Intrinsics.checkNotNullParameter(args, "args"); | |
System.out.println("main BEGIN"); | |
BuildersKt.runBlocking$default((CoroutineContext)null, (Function2)(new Function2((Continuation)null) { | |
int label; | |
// $FF: synthetic field | |
private Object L$0; | |
@Nullable | |
public final Object invokeSuspend(@NotNull Object var1) { | |
IntrinsicsKt.getCOROUTINE_SUSPENDED(); | |
switch (this.label) { | |
case 0: | |
ResultKt.throwOnFailure(var1); | |
CoroutineScope $this$runBlocking = (CoroutineScope)this.L$0; | |
System.out.println("runBlocking BEGIN"); | |
BuildersKt.launch$default($this$runBlocking, (CoroutineContext)null, (CoroutineStart)null, (Function2)(new Function2((Continuation)null) { | |
int label; | |
@Nullable | |
public final Object invokeSuspend(@NotNull Object $result) { | |
label26: { | |
Continuation var10000; | |
Object var2; | |
label25: { | |
var2 = IntrinsicsKt.getCOROUTINE_SUSPENDED(); | |
switch (this.label) { | |
case 0: | |
ResultKt.throwOnFailure($result); | |
System.out.println("Hello"); | |
var10000 = (Continuation)this; | |
this.label = 1; | |
if (MainKt.hoge(var10000) == var2) { | |
return var2; | |
} | |
break; | |
case 1: | |
ResultKt.throwOnFailure($result); | |
break; | |
case 2: | |
ResultKt.throwOnFailure($result); | |
break label25; | |
case 3: | |
ResultKt.throwOnFailure($result); | |
break label26; | |
default: | |
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); | |
} | |
System.out.println("World"); | |
var10000 = (Continuation)this; | |
this.label = 2; | |
if (MainKt.hoge(var10000) == var2) { | |
return var2; | |
} | |
} | |
System.out.println("Again"); | |
var10000 = (Continuation)this; | |
this.label = 3; | |
if (MainKt.hoge(var10000) == var2) { | |
return var2; | |
} | |
} | |
System.out.println("Thanks"); | |
return Unit.INSTANCE; | |
} | |
@NotNull | |
public final Continuation create(@Nullable Object value, @NotNull Continuation $completion) { | |
return (Continuation)(new <anonymous constructor>($completion)); | |
} | |
@Nullable | |
public final Object invoke(@NotNull CoroutineScope p1, @Nullable Continuation p2) { | |
return ((<undefinedtype>)this.create(p1, p2)).invokeSuspend(Unit.INSTANCE); | |
} | |
// $FF: synthetic method | |
// $FF: bridge method | |
public Object invoke(Object p1, Object p2) { | |
return this.invoke((CoroutineScope)p1, (Continuation)p2); | |
} | |
}), 3, (Object)null); | |
System.out.println("runBlocking END"); | |
return Unit.INSTANCE; | |
default: | |
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); | |
} | |
} | |
@NotNull | |
public final Continuation create(@Nullable Object value, @NotNull Continuation $completion) { | |
Function2 var3 = new <anonymous constructor>($completion); | |
var3.L$0 = value; | |
return (Continuation)var3; | |
} | |
@Nullable | |
public final Object invoke(@NotNull CoroutineScope p1, @Nullable Continuation p2) { | |
return ((<undefinedtype>)this.create(p1, p2)).invokeSuspend(Unit.INSTANCE); | |
} | |
// $FF: synthetic method | |
// $FF: bridge method | |
public Object invoke(Object p1, Object p2) { | |
return this.invoke((CoroutineScope)p1, (Continuation)p2); | |
} | |
}), 1, (Object)null); | |
System.out.println("main END"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.runBlocking | |
suspend fun hoge() { | |
delay(1000) | |
println("foobar") | |
} | |
fun main(args: Array<String>) { | |
println("main BEGIN") | |
runBlocking { | |
println("runBlocking BEGIN") | |
launch { | |
println("Hello") | |
hoge() | |
println("World") | |
hoge() | |
println("Again") | |
hoge() | |
println("Thanks") | |
} | |
println("runBlocking END") | |
} | |
println("main END") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment