mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 18:51:13 +08:00
feat: 实现 SequenceExpression + 带标签 break/continue + EmptyStatement
This commit is contained in:
@@ -82,6 +82,19 @@ impl Compiler {
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::emitter) fn emit_sequence_expression(
|
||||
&self, seq: &oxide_parser::SequenceExpression, ctx: &mut CompileCtx,
|
||||
) -> Result<u8, String> {
|
||||
// Comma operator: evaluate each expression in order, value is the last.
|
||||
// Emits exactly one expression per element (no extra instruction), so the
|
||||
// projected-PC count in count_sequence_expression stays aligned.
|
||||
let mut last = 0u8;
|
||||
for e in &seq.expressions {
|
||||
last = self.emit_expression(e, ctx)?;
|
||||
}
|
||||
Ok(last)
|
||||
}
|
||||
|
||||
pub(in crate::emitter) fn emit_unsupported_expression(
|
||||
&self, expr: &Expression, ctx: &mut CompileCtx,
|
||||
) -> Result<u8, String> {
|
||||
|
||||
Reference in New Issue
Block a user