fix: 补充部分不支持特性以提供详细报错信息
This commit is contained in:
@@ -302,6 +302,39 @@ impl CompileCtx {
|
|||||||
"parseFloat",
|
"parseFloat",
|
||||||
"isNaN",
|
"isNaN",
|
||||||
"isFinite",
|
"isFinite",
|
||||||
|
// Out-of-scope constructors: bound as TypeError-throwing stubs
|
||||||
|
"Proxy",
|
||||||
|
"WeakMap",
|
||||||
|
"WeakSet",
|
||||||
|
"WeakRef",
|
||||||
|
"FinalizationRegistry",
|
||||||
|
"Atomics",
|
||||||
|
"SharedArrayBuffer",
|
||||||
|
"ArrayBuffer",
|
||||||
|
"DataView",
|
||||||
|
"Iterator",
|
||||||
|
"BigInt",
|
||||||
|
// TypedArray family stubs
|
||||||
|
"Int8Array",
|
||||||
|
"Uint8Array",
|
||||||
|
"Uint8ClampedArray",
|
||||||
|
"Int16Array",
|
||||||
|
"Uint16Array",
|
||||||
|
"Int32Array",
|
||||||
|
"Uint32Array",
|
||||||
|
"Float32Array",
|
||||||
|
"Float64Array",
|
||||||
|
"BigInt64Array",
|
||||||
|
"BigUint64Array",
|
||||||
|
// Reflect namespace object
|
||||||
|
"Reflect",
|
||||||
|
// URI utility functions
|
||||||
|
"escape",
|
||||||
|
"unescape",
|
||||||
|
"encodeURI",
|
||||||
|
"decodeURI",
|
||||||
|
"encodeURIComponent",
|
||||||
|
"decodeURIComponent",
|
||||||
];
|
];
|
||||||
for name in &builtins {
|
for name in &builtins {
|
||||||
let reg = self.alloc_reg();
|
let reg = self.alloc_reg();
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ pub mod object;
|
|||||||
pub mod regexp;
|
pub mod regexp;
|
||||||
pub mod set;
|
pub mod set;
|
||||||
pub mod string;
|
pub mod string;
|
||||||
|
pub mod stubs;
|
||||||
pub mod symbol;
|
pub mod symbol;
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
use oxide_types::value::JsValue;
|
||||||
|
|
||||||
|
use crate::native::NativeResult;
|
||||||
|
use crate::vm::Vm;
|
||||||
|
|
||||||
|
fn stub_error(vm: &mut Vm, name: &str) -> NativeResult {
|
||||||
|
let msg = format!("TypeError: {} is not implemented", name);
|
||||||
|
let si = vm.kernel_core().string_forge().intern(&msg).0;
|
||||||
|
NativeResult::Err(JsValue::string(si, 0))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Architecturally deferred — see 13.5-CONTEXT.md for rationale
|
||||||
|
pub fn proxy_stub(vm: &mut Vm, _args: &[u8]) -> NativeResult { stub_error(vm, "Proxy") }
|
||||||
|
pub fn bigint_stub(vm: &mut Vm, _args: &[u8]) -> NativeResult { stub_error(vm, "BigInt") }
|
||||||
|
pub fn weakmap_stub(vm: &mut Vm, _args: &[u8]) -> NativeResult { stub_error(vm, "WeakMap") }
|
||||||
|
pub fn weakset_stub(vm: &mut Vm, _args: &[u8]) -> NativeResult { stub_error(vm, "WeakSet") }
|
||||||
|
pub fn weakref_stub(vm: &mut Vm, _args: &[u8]) -> NativeResult { stub_error(vm, "WeakRef") }
|
||||||
|
pub fn finalization_registry_stub(vm: &mut Vm, _args: &[u8]) -> NativeResult { stub_error(vm, "FinalizationRegistry") }
|
||||||
|
pub fn shared_array_buffer_stub(vm: &mut Vm, _args: &[u8]) -> NativeResult { stub_error(vm, "SharedArrayBuffer") }
|
||||||
|
pub fn atomics_stub(vm: &mut Vm, _args: &[u8]) -> NativeResult { stub_error(vm, "Atomics") }
|
||||||
Reference in New Issue
Block a user