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 {
|
for stmt in &self.top_level_statements {
|
||||||
match stmt {
|
match stmt {
|
||||||
Import(import) => {
|
Import(import) => {
|
||||||
for name in &import.0 {
|
imports.push(mir::Import(import.0.clone(), import.1.into()));
|
||||||
imports.push(mir::Import(name.clone(), import.1.into()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
FunctionDefinition(ast::FunctionDefinition(signature, is_pub, block, range)) => {
|
FunctionDefinition(ast::FunctionDefinition(signature, is_pub, block, range)) => {
|
||||||
let def = mir::FunctionDefinition {
|
let def = mir::FunctionDefinition {
|
||||||
|
@ -32,7 +32,7 @@ impl Display for Module {
|
|||||||
|
|
||||||
impl Display for Import {
|
impl Display for Import {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
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);
|
pub struct NamedVariableRef(pub TypeKind, pub String, pub Metadata);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Import(pub String, pub Metadata);
|
pub struct Import(pub Vec<String>, pub Metadata);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ExprKind {
|
pub enum ExprKind {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
extern fn puts(message: string) -> i32;
|
import std::print;
|
||||||
|
|
||||||
fn main() -> u16 {
|
fn main() -> u16 {
|
||||||
let hello = "hello world";
|
let hello = "hello world";
|
||||||
|
|
||||||
puts(hello);
|
print(hello);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user