1use crate::common::default::default;
2use crate::js::{any::Any, js_string::JsStringRef};
3use crate::mem::manager::Dealloc;
4
5pub type Property<D> = (JsStringRef<D>, Expression<D>);
6
7#[derive(Default)]
8pub enum Expression<D: Dealloc> {
9 #[default]
10 Void,
11 LocalRef(u32),
12 ArgRef(u32),
13 Value(Any<D>),
14 Object(Vec<Property<D>>),
15 Array(Vec<Expression<D>>),
16}
17
18pub struct Body<D: Dealloc> {
19 local: Vec<Expression<D>>,
20 result: Expression<D>,
21}
22
23impl<D: Dealloc> Default for Body<D> {
24 fn default() -> Self {
25 Self {
26 local: default(),
27 result: default(),
28 }
29 }
30}
31
32pub struct Module<D: Dealloc> {
33 import: Vec<JsStringRef<D>>,
34 body: Body<D>,
35}
36
37impl<D: Dealloc> Default for Module<D> {
38 fn default() -> Self {
39 Self {
40 import: Vec::new(),
41 body: default(),
42 }
43 }
44}