Skip to content

Commit

Permalink
version and fix no return
Browse files Browse the repository at this point in the history
  • Loading branch information
edg-l committed Feb 17, 2024
1 parent 819a70d commit ff0b6fb
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 38 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bin/edlang/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "A experimental language using LLVM."
edition = "2021"
Expand All @@ -14,4 +14,4 @@ repository = "https://github.com/edg-l/edlang"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
edlang_driver = { version = "0.0.1-alpha.6", path = "../../lib/edlang_driver" }
edlang_driver = { version = "0.0.1-alpha.7", path = "../../lib/edlang_driver" }
4 changes: 2 additions & 2 deletions lib/edlang_ast/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang_ast"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "edlang AST"
edition = "2021"
Expand All @@ -13,4 +13,4 @@ repository = "https://github.com/edg-l/edlang"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
edlang_span = { version = "0.0.1-alpha.6", path = "../edlang_span" }
edlang_span = { version = "0.0.1-alpha.7", path = "../edlang_span" }
4 changes: 2 additions & 2 deletions lib/edlang_check/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang_check"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "edlang check"
edition = "2021"
Expand All @@ -14,5 +14,5 @@ repository = "https://github.com/edg-l/edlang"

[dependencies]
ariadne = { version = "0.4.0", features = ["auto-color"] }
edlang_ast = { version = "0.0.1-alpha.6", path = "../edlang_ast" }
edlang_ast = { version = "0.0.1-alpha.7", path = "../edlang_ast" }
tracing = { workspace = true }
10 changes: 5 additions & 5 deletions lib/edlang_codegen_llvm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang_codegen_llvm"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "edlang LLVM codegen"
edition = "2021"
Expand All @@ -13,10 +13,10 @@ repository = "https://github.com/edg-l/edlang"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
edlang_ir = { version = "0.0.1-alpha.6", path = "../edlang_ir" }
edlang_parser = { version = "0.0.1-alpha.6", path = "../edlang_parser" }
edlang_session = { version = "0.0.1-alpha.6", path = "../edlang_session" }
edlang_ir = { version = "0.0.1-alpha.7", path = "../edlang_ir" }
edlang_parser = { version = "0.0.1-alpha.7", path = "../edlang_parser" }
edlang_session = { version = "0.0.1-alpha.7", path = "../edlang_session" }
llvm-sys = "170.0.1"
inkwell = { git = "https://github.com/TheDan64/inkwell", rev = "c044e3cd8d92972ca75b374fb6c5a2794f5b53ca", features = ["llvm17-0"] }
tracing = { workspace = true }
edlang_span = { version = "0.0.1-alpha.6", path = "../edlang_span" }
edlang_span = { version = "0.0.1-alpha.7", path = "../edlang_span" }
16 changes: 8 additions & 8 deletions lib/edlang_driver/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang_driver"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "edlang compiler driver library"
edition = "2021"
Expand All @@ -16,13 +16,13 @@ repository = "https://github.com/edg-l/edlang"
ariadne = { version = "0.4.0", features = ["auto-color"] }
clap = { version = "4.4.16", features = ["derive"] }
color-eyre = "0.6.2"
edlang_ast = { version = "0.0.1-alpha.6", path = "../edlang_ast" }
edlang_check = { version = "0.0.1-alpha.6", path = "../edlang_check" }
edlang_codegen_llvm = { version = "0.0.1-alpha.6", path = "../edlang_codegen_llvm" }
edlang_ir = { version = "0.0.1-alpha.6", path = "../edlang_ir" }
edlang_lowering = { version = "0.0.1-alpha.6", path = "../edlang_lowering" }
edlang_parser = { version = "0.0.1-alpha.6", path = "../edlang_parser" }
edlang_session = { version = "0.0.1-alpha.6", path = "../edlang_session" }
edlang_ast = { version = "0.0.1-alpha.7", path = "../edlang_ast" }
edlang_check = { version = "0.0.1-alpha.7", path = "../edlang_check" }
edlang_codegen_llvm = { version = "0.0.1-alpha.7", path = "../edlang_codegen_llvm" }
edlang_ir = { version = "0.0.1-alpha.7", path = "../edlang_ir" }
edlang_lowering = { version = "0.0.1-alpha.7", path = "../edlang_lowering" }
edlang_parser = { version = "0.0.1-alpha.7", path = "../edlang_parser" }
edlang_session = { version = "0.0.1-alpha.7", path = "../edlang_session" }
tracing = { workspace = true }
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

Expand Down
1 change: 1 addition & 0 deletions lib/edlang_driver/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod common;
#[test_case(include_str!("programs/basic_ifs.ed"), "basic_ifs", false, 9, &[] ; "basic_ifs")]
#[test_case(include_str!("programs/while.ed"), "while", false, 10, &[] ; "r#while")]
#[test_case(include_str!("programs/factorial.ed"), "factorial", false, 24, &[] ; "factorial")]
#[test_case(include_str!("programs/refs.ed"), "refs", false, 2, &[] ; "refs")]
#[test_case(TEST_ADD, "TEST_ADD", false, 2, &[] ; "TEST_ADD")]
#[test_case(TEST_SUB, "TEST_SUB", false, 1, &[] ; "TEST_SUB")]
#[test_case(TEST_MUL, "TEST_MUL", false, 4, &[] ; "TEST_MUL")]
Expand Down
13 changes: 13 additions & 0 deletions lib/edlang_driver/tests/programs/refs.ed
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mod Main {
pub fn main() -> i64 {
let mut a: i64 = 0;

hello(&mut a);

return a;
}

pub fn hello(a: &mut i32) {
*a = 2;
}
}
4 changes: 2 additions & 2 deletions lib/edlang_ir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang_ir"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "edlang IR"
edition = "2021"
Expand All @@ -13,5 +13,5 @@ repository = "https://github.com/edg-l/edlang"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
edlang_span = { version = "0.0.1-alpha.6", path = "../edlang_span" }
edlang_span = { version = "0.0.1-alpha.7", path = "../edlang_span" }
smallvec = "1.13.1"
6 changes: 3 additions & 3 deletions lib/edlang_lowering/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang_lowering"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "edlang lowering"
edition = "2021"
Expand All @@ -13,6 +13,6 @@ repository = "https://github.com/edg-l/edlang"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
edlang_ast = { version = "0.0.1-alpha.6", path = "../edlang_ast" }
edlang_ir = { version = "0.0.1-alpha.6", path = "../edlang_ir" }
edlang_ast = { version = "0.0.1-alpha.7", path = "../edlang_ast" }
edlang_ir = { version = "0.0.1-alpha.7", path = "../edlang_ir" }
tracing.workspace = true
9 changes: 9 additions & 0 deletions lib/edlang_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ fn lower_function(ctx: BuildCtx, func: &ast::Function, module_id: DefId) -> Buil
lower_statement(&mut builder, stmt, &ret_ty.kind);
}

if !builder.statements.is_empty() {
let statements = std::mem::take(&mut builder.statements);
builder.body.blocks.push(BasicBlock {
statements: statements.into(),
terminator: Terminator::Return,
terminator_span: None,
});
}

let (mut ctx, body) = (builder.ctx, builder.body);
ctx.unresolved_function_signatures.remove(&body.def_id);
ctx.body.functions.insert(body.def_id, body);
Expand Down
4 changes: 2 additions & 2 deletions lib/edlang_parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang_parser"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "edlang parser"
edition = "2021"
Expand All @@ -14,7 +14,7 @@ repository = "https://github.com/edg-l/edlang"

[dependencies]
ariadne = { version = "0.4.0", features = ["auto-color"] }
edlang_ast = { version = "0.0.1-alpha.6", path = "../edlang_ast" }
edlang_ast = { version = "0.0.1-alpha.7", path = "../edlang_ast" }
itertools = "0.12.0"
lalrpop-util = { version = "0.20.0", features = ["lexer"] }
logos = "0.14.0"
Expand Down
2 changes: 1 addition & 1 deletion lib/edlang_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang_session"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "edlang session"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion lib/edlang_span/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "edlang_span"
version = "0.0.1-alpha.6"
version = "0.0.1-alpha.7"
authors = ["Edgar Luque <edgar@edgarluque.com>"]
description = "edlang span"
edition = "2021"
Expand Down
13 changes: 13 additions & 0 deletions programs/refs.ed
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mod Main {
pub fn main() -> i64 {
let mut a: i64 = 0;

hello(&mut a);

return a;
}

pub fn hello(a: &mut i32) {
*a = 2;
}
}

0 comments on commit ff0b6fb

Please sign in to comment.