mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 18:51:13 +08:00
feat: TA Set 面接统一数值键门与 receiver 四分类裁决
This commit is contained in:
@@ -144,6 +144,29 @@ impl Vm {
|
||||
Err(err.to_string())
|
||||
}
|
||||
|
||||
/// 恢复已捕获的原始异常值(强转失败载荷)并走异常展开,保原值 kind:
|
||||
/// 深度 0 置原值入异常通道就地展开到外围 catch;深度 >0 返回 kind 前缀
|
||||
/// 文本 `Err`,由原生调用边界恢复为异常对象。
|
||||
///
|
||||
/// # 步骤
|
||||
/// 1. 深度 0:原值与 kind 写入异常通道,就地 `unwind`。
|
||||
/// 2. 深度 >0:以 `Kind: message` 文本 `Err` 返回,不就地展开。
|
||||
///
|
||||
/// # 边界与前提
|
||||
/// - `exc` 为调用方已提取的原始异常值;本入口不重取 uncaught 槽。
|
||||
///
|
||||
/// # 副作用
|
||||
/// - 深度 0 写 `exception_value`/`pending_error_kind`,pc 经展开改写。
|
||||
pub(crate) fn raise_captured(&mut self, exc: JsValue) -> Result<(), String> {
|
||||
if self.native_call_depth == 0 {
|
||||
let kind = self.thrown_error_kind(exc);
|
||||
self.exception_value = Some(exc);
|
||||
self.pending_error_kind = Some(kind);
|
||||
return self.unwind();
|
||||
}
|
||||
Err(oxide_builtins::typed_array::element_error_text(self, exc))
|
||||
}
|
||||
|
||||
/// ToNumber 有界版:先按 number hint 做 ToPrimitive,再转 `f64`。
|
||||
///
|
||||
/// # 边界与前提
|
||||
|
||||
@@ -49,6 +49,9 @@ impl oxide_runtime_api::VmHost for Vm {
|
||||
fn epoch(&self) -> &Epoch {
|
||||
self.epoch()
|
||||
}
|
||||
fn pc(&self) -> usize {
|
||||
self.pc
|
||||
}
|
||||
fn take_uncaught_value(&mut self) -> Option<JsValue> {
|
||||
self.last_uncaught_value.take()
|
||||
}
|
||||
@@ -145,6 +148,9 @@ impl oxide_runtime_api::VmHost for Vm {
|
||||
fn raise_type_error(&mut self, msg: &str) -> Result<(), String> {
|
||||
self.raise_type_error(msg)
|
||||
}
|
||||
fn raise_captured(&mut self, exc: JsValue) -> Result<(), String> {
|
||||
self.raise_captured(exc)
|
||||
}
|
||||
fn error_message_text(&self, kind: &str, msg: &str) -> String {
|
||||
self.error_message_text(kind, msg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user