diff --git a/reid/src/ast/process.rs b/reid/src/ast/process.rs index af1942e..3fd79a3 100644 --- a/reid/src/ast/process.rs +++ b/reid/src/ast/process.rs @@ -20,9 +20,7 @@ impl ast::Module { for stmt in &self.top_level_statements { match stmt { Import(import) => { - for name in &import.0 { - imports.push(mir::Import(name.clone(), import.1.into())); - } + imports.push(mir::Import(import.0.clone(), import.1.into())); } FunctionDefinition(ast::FunctionDefinition(signature, is_pub, block, range)) => { let def = mir::FunctionDefinition { diff --git a/reid/src/mir/display.rs b/reid/src/mir/display.rs index a24d6ba..5ae166e 100644 --- a/reid/src/mir/display.rs +++ b/reid/src/mir/display.rs @@ -32,7 +32,7 @@ impl Display for Module { impl Display for Import { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "import {}", self.0) + write!(f, "import {}", self.0.join("::")) } } diff --git a/reid/src/mir/mod.rs b/reid/src/mir/mod.rs index 2578145..7984b01 100644 --- a/reid/src/mir/mod.rs +++ b/reid/src/mir/mod.rs @@ -209,7 +209,7 @@ pub enum ReturnKind { pub struct NamedVariableRef(pub TypeKind, pub String, pub Metadata); #[derive(Debug)] -pub struct Import(pub String, pub Metadata); +pub struct Import(pub Vec, pub Metadata); #[derive(Debug)] pub enum ExprKind { diff --git a/reid_src/hello_world.reid b/reid_src/hello_world.reid index c4ee78a..0c5bf41 100644 --- a/reid_src/hello_world.reid +++ b/reid_src/hello_world.reid @@ -1,10 +1,10 @@ -extern fn puts(message: string) -> i32; +import std::print; fn main() -> u16 { let hello = "hello world"; - puts(hello); + print(hello); return 0; }