Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
let ir to decide exception depth
  • Loading branch information
ShaharNaveh committed Mar 27, 2026
commit 07d019a891d030c9b87c04a3a0fe46e967033558
27 changes: 9 additions & 18 deletions crates/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1277,9 +1277,7 @@ impl Compiler {
context: OpArgMarker::marker(),
}
.into(),
arg: OpArg::new(
oparg::ResumeContext::new(oparg::ResumeLocation::AtFuncStart, false).into(),
),
arg: OpArg::new(oparg::ResumeLocation::AtFuncStart.into()),
target: BlockIdx::NULL,
location,
end_location,
Expand Down Expand Up @@ -7201,14 +7199,11 @@ impl Compiler {
emit!(
self,
Instruction::Resume {
context: oparg::ResumeContext::new(
if is_await {
oparg::ResumeLocation::AfterAwait
} else {
oparg::ResumeLocation::AfterYieldFrom
},
false
)
context: if is_await {
oparg::ResumeContext::from(oparg::ResumeLocation::AfterAwait)
} else {
oparg::ResumeContext::from(oparg::ResumeLocation::AfterYieldFrom)
}
}
);

Expand Down Expand Up @@ -7379,10 +7374,7 @@ impl Compiler {
emit!(
self,
Instruction::Resume {
context: oparg::ResumeContext::new(
oparg::ResumeLocation::AfterYield,
true, // TODO: Is this always true?
)
context: oparg::ResumeContext::from(oparg::ResumeLocation::AfterYield)
}
);
}
Expand Down Expand Up @@ -7604,9 +7596,8 @@ impl Compiler {
emit!(
compiler,
Instruction::Resume {
context: oparg::ResumeContext::new(
oparg::ResumeLocation::AfterYield,
true, // TODO: Is this always true?
context: oparg::ResumeContext::from(
oparg::ResumeLocation::AfterYield
)
}
);
Expand Down
6 changes: 6 additions & 0 deletions crates/compiler-core/src/bytecode/oparg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,12 @@ pub enum ResumeLocation {
AfterAwait,
}

impl From<ResumeLocation> for ResumeContext {
fn from(location: ResumeLocation) -> Self {
Self::new(location, false)
}
}

impl TryFrom<u32> for ResumeLocation {
type Error = MarshalError;

Expand Down
Loading