mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-26 03:31:12 +08:00
feat: 添加严格比较运算符与一元加法
This commit is contained in:
@@ -399,6 +399,8 @@ impl Compiler {
|
||||
BinaryOperator::LessEqualThan => OpCode::LTE,
|
||||
BinaryOperator::GreaterEqualThan => OpCode::GTE,
|
||||
BinaryOperator::In => OpCode::IN,
|
||||
BinaryOperator::StrictEquality => OpCode::STRICT_EQ,
|
||||
BinaryOperator::StrictInequality => OpCode::STRICT_NEQ,
|
||||
_ => return Err(format!("unsupported binary operator: {:?}", bin.operator)),
|
||||
};
|
||||
let r = ctx.alloc_reg();
|
||||
@@ -428,6 +430,11 @@ impl Compiler {
|
||||
ctx.emit(opcode::encode(OpCode::NOT, r, arg, 0));
|
||||
Ok(r)
|
||||
}
|
||||
UnaryOperator::UnaryPlus => {
|
||||
let r = ctx.alloc_reg();
|
||||
ctx.emit(opcode::encode(OpCode::UNARY_PLUS, r, arg, 0));
|
||||
Ok(r)
|
||||
}
|
||||
_ => Err(format!("unsupported unary operator: {:?}", un.operator)),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user