-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.rs
More file actions
28 lines (26 loc) · 782 Bytes
/
Copy pathmodule.rs
File metadata and controls
28 lines (26 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crate::function::BytecodeFunction;
use serde::{Deserialize, Serialize};
use techscript_ir::types::IRType;
/// A top-level compiled program module carrying functions and global definitions.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BytecodeModule {
pub name: String,
pub functions: Vec<BytecodeFunction>,
pub globals: Vec<(String, IRType)>,
pub imports: Vec<String>,
pub exports: Vec<String>,
pub entry_idx: u32,
}
impl BytecodeModule {
/// Creates a new BytecodeModule.
pub fn new(name: String) -> Self {
Self {
name,
functions: Vec::new(),
globals: Vec::new(),
imports: Vec::new(),
exports: Vec::new(),
entry_idx: 0,
}
}
}