File tree Expand file tree Collapse file tree 2 files changed +13
-15
lines changed
compiler-core/src/bytecode Expand file tree Collapse file tree 2 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -1277,9 +1277,7 @@ impl Compiler {
12771277 context : OpArgMarker :: marker ( ) ,
12781278 }
12791279 . into ( ) ,
1280- arg : OpArg :: new (
1281- oparg:: ResumeContext :: new ( oparg:: ResumeLocation :: AtFuncStart , false ) . into ( ) ,
1282- ) ,
1280+ arg : OpArg :: new ( oparg:: ResumeLocation :: AtFuncStart . into ( ) ) ,
12831281 target : BlockIdx :: NULL ,
12841282 location,
12851283 end_location,
@@ -7201,14 +7199,11 @@ impl Compiler {
72017199 emit ! (
72027200 self ,
72037201 Instruction :: Resume {
7204- context: oparg:: ResumeContext :: new(
7205- if is_await {
7206- oparg:: ResumeLocation :: AfterAwait
7207- } else {
7208- oparg:: ResumeLocation :: AfterYieldFrom
7209- } ,
7210- false
7211- )
7202+ context: if is_await {
7203+ oparg:: ResumeContext :: from( oparg:: ResumeLocation :: AfterAwait )
7204+ } else {
7205+ oparg:: ResumeContext :: from( oparg:: ResumeLocation :: AfterYieldFrom )
7206+ }
72127207 }
72137208 ) ;
72147209
@@ -7379,10 +7374,7 @@ impl Compiler {
73797374 emit ! (
73807375 self ,
73817376 Instruction :: Resume {
7382- context: oparg:: ResumeContext :: new(
7383- oparg:: ResumeLocation :: AfterYield ,
7384- true , // TODO: Is this always true?
7385- )
7377+ context: oparg:: ResumeContext :: from( oparg:: ResumeLocation :: AfterYield )
73867378 }
73877379 ) ;
73887380 }
Original file line number Diff line number Diff line change @@ -850,6 +850,12 @@ pub enum ResumeLocation {
850850 AfterAwait ,
851851}
852852
853+ impl From < ResumeLocation > for ResumeContext {
854+ fn from ( location : ResumeLocation ) -> Self {
855+ Self :: new ( location, false )
856+ }
857+ }
858+
853859impl TryFrom < u32 > for ResumeLocation {
854860 type Error = MarshalError ;
855861
You can’t perform that action at this time.
0 commit comments