Fix imports in MIR
This commit is contained in:
parent
3d5ddc60dc
commit
464156b2dc
@ -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 {
|
||||
|
@ -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("::"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<String>, pub Metadata);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ExprKind {
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user