rename typed_ir::Block to Body

This commit is contained in:
NotAFile 2022-04-05 16:42:30 +02:00
parent 5dca566cca
commit b71f9f09ae
5 changed files with 8 additions and 8 deletions

View File

@ -43,7 +43,7 @@ impl CompileError {
#[derive(Debug)] #[derive(Debug)]
pub struct Module { pub struct Module {
pub blocks: Vec<typed_ir::Block>, pub blocks: Vec<typed_ir::Body>,
} }
pub struct Context { pub struct Context {
@ -276,7 +276,7 @@ impl Context {
fn type_comb( fn type_comb(
&mut self, &mut self,
comb: &parser::comb::CombBlock, comb: &parser::comb::CombBlock,
) -> Result<typed_ir::Block, CompileError> { ) -> Result<typed_ir::Body, CompileError> {
let mut signals = Vec::new(); let mut signals = Vec::new();
let callable_id = self.callable_from_block(comb)?; let callable_id = self.callable_from_block(comb)?;
@ -296,7 +296,7 @@ impl Context {
let root_expr = self.type_expression(&comb.expr)?; let root_expr = self.type_expression(&comb.expr)?;
Ok(typed_ir::Block { Ok(typed_ir::Body {
signature: callable_id, signature: callable_id,
signals, signals,
expr: root_expr, expr: root_expr,

View File

@ -109,7 +109,7 @@ fn lower_expression(
fn lower_comb( fn lower_comb(
ctx: &mut Context, ctx: &mut Context,
module: &mut rtlil::Module, module: &mut rtlil::Module,
block: &typed_ir::Block, block: &typed_ir::Body,
) -> Result<(), CompileError> { ) -> Result<(), CompileError> {
for (num, sig) in block.signals.iter().enumerate() { for (num, sig) in block.signals.iter().enumerate() {
let sig_id = format!("\\$sig_{}", sig.id.0); let sig_id = format!("\\$sig_{}", sig.id.0);
@ -134,7 +134,7 @@ fn lower_comb(
Ok(()) Ok(())
} }
pub fn lower_block(context: &mut Context, block: &typed_ir::Block) -> Result<String, CompileError> { pub fn lower_block(context: &mut Context, block: &typed_ir::Body) -> Result<String, CompileError> {
let mut writer = rtlil::ILWriter::new(); let mut writer = rtlil::ILWriter::new();
let mut ir_module = rtlil::Module::new(make_pubid("test")); let mut ir_module = rtlil::Module::new(make_pubid("test"));

View File

@ -5,7 +5,7 @@ impl Context {
pub fn pretty_typed_block( pub fn pretty_typed_block(
&self, &self,
w: &mut dyn std::fmt::Write, w: &mut dyn std::fmt::Write,
block: &typed_ir::Block, block: &typed_ir::Body,
) -> std::fmt::Result { ) -> std::fmt::Result {
let callsig = self.callables.get(block.signature); let callsig = self.callables.get(block.signature);
{ {

View File

@ -3,7 +3,7 @@ use super::types;
use super::Context; use super::Context;
impl Context { impl Context {
pub fn infer_types(&mut self, mut block: typed_ir::Block) -> typed_ir::Block { pub fn infer_types(&mut self, mut block: typed_ir::Body) -> typed_ir::Body {
let new_root = self.infer_expr_types(&block.expr); let new_root = self.infer_expr_types(&block.expr);
block.expr = new_root; block.expr = new_root;
block block

View File

@ -57,7 +57,7 @@ pub struct Signal {
/// A block of HDL code, e.g. comb block /// A block of HDL code, e.g. comb block
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Block { pub struct Body {
pub signature: CallableId, pub signature: CallableId,
pub signals: Vec<Signal>, pub signals: Vec<Signal>,
pub expr: Expr, pub expr: Expr,