Skip to content

Commit

Permalink
feat: implement while
Browse files Browse the repository at this point in the history
  • Loading branch information
edg-l committed Feb 14, 2024
1 parent 6c83d1e commit ce05166
Show file tree
Hide file tree
Showing 3 changed files with 268 additions and 171 deletions.
7 changes: 5 additions & 2 deletions lib/edlang_ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,13 @@ impl Local {
}
}

pub const fn temp(ty: TypeInfo) -> Self {
pub const fn temp(ty: TypeKind) -> Self {
Self {
span: None,
ty,
ty: TypeInfo {
span: None,
kind: ty,
},
kind: LocalKind::Temp,
debug_name: None,
mutable: false,
Expand Down
7 changes: 2 additions & 5 deletions lib/edlang_lowering/src/common.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::HashMap;

use edlang_ir::{Body, DefId, Local, ModuleBody, ProgramBody, Statement, TypeInfo, TypeKind};
use edlang_ir::{Body, DefId, Local, ModuleBody, ProgramBody, Statement, TypeKind};

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)]
pub struct IdGenerator {
Expand Down Expand Up @@ -72,10 +72,7 @@ impl BodyBuilder {

pub fn add_temp_local(&mut self, ty_kind: TypeKind) -> usize {
let id = self.body.locals.len();
self.body.locals.push(Local::temp(TypeInfo {
span: None,
kind: ty_kind,
}));
self.body.locals.push(Local::temp(ty_kind));
id
}

Expand Down
Loading

0 comments on commit ce05166

Please sign in to comment.