BRANCHING (TURING COMPLETE????)
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
use crate::ir::NamespaceGuard;
|
||||
use crate::ir::IRUProgram;
|
||||
|
||||
use super::{PModule, CompilerOutput};
|
||||
|
||||
impl PModule {
|
||||
pub fn lower(&self, map: &mut NamespaceGuard, output: &mut CompilerOutput) {
|
||||
pub fn lower(&self, p: &mut IRUProgram, output: &mut CompilerOutput) {
|
||||
for s in &self.structs {
|
||||
s.lower(map, output);
|
||||
s.lower(p, output);
|
||||
}
|
||||
let mut fns = Vec::new();
|
||||
for f in &self.functions {
|
||||
if let Some(id) = f.lower_header(map, output) {
|
||||
if let Some(id) = f.lower_header(p, output) {
|
||||
fns.push(Some(id));
|
||||
} else {
|
||||
fns.push(None)
|
||||
@@ -17,8 +17,8 @@ impl PModule {
|
||||
}
|
||||
for (f, id) in self.functions.iter().zip(fns) {
|
||||
if let Some(id) = id {
|
||||
if let Some(res) = f.lower_body(id, map, output) {
|
||||
map.write_fn(id, res);
|
||||
if let Some(res) = f.lower_body(id, p, output) {
|
||||
p.write_fn(id, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user