1mod container;
2mod function;
3
4use crate::{
5 naive::{container::Container, function::Function},
6 sign::Sign,
7 vm::{Any, Array, IVm, Property, StaticCode, Unpacked},
8};
9
10#[derive(Clone)]
13pub struct Naive(Unpacked<Naive>);
14
15impl<T: Into<Unpacked<Naive>>> From<T> for Naive {
16 fn from(value: T) -> Self {
17 Naive(value.into())
18 }
19}
20
21impl IVm for Naive {
22 type InternalString = Container<(), u16>;
23 type InternalBigInt = Container<Sign, u64>;
24 type InternalObject = Container<(), Property<Naive>>;
25 type InternalArray = Container<(), Any<Naive>>;
26 type InternalFunction = Function;
27
28 fn to_unpacked(self) -> Unpacked<Self> {
29 self.0
30 }
31
32 fn static_function(
34 code: StaticCode<Naive>,
35 length: u32,
36 frame: Array<Naive>,
37 text: Option<&'static str>,
38 ) -> crate::vm::Function<Naive> {
39 crate::vm::Function::new(Function::new(code, length, frame, text))
40 }
41
42 fn frame(self_: &Function) -> &Array<Naive> {
43 self_.frame()
44 }
45}