-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds support for literal number suffixes
- Loading branch information
1 parent
5ea272f
commit d188cfd
Showing
14 changed files
with
929 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
crates/mun_codegen/src/snapshots/test__literal_types_file_ir.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
source: crates/mun_codegen/src/test.rs | ||
expression: "fn main(){\n let a = 123;\n let a = 123u8;\n let a = 123u16;\n let a = 123u32;\n let a = 123u64;\n let a = 123uint;\n let a = 1_000_000_u32;\n let a = 123i8;\n let a = 123i16;\n let a = 123i32;\n let a = 123i64;\n let a = 123int;\n let a = 1_000_000_i32;\n let a = 1_000_123.0e-2;\n let a = 1_000_123.0e-2f32;\n let a = 1_000_123.0e-2f64;\n let a = 1_000_123.0e-2float;\n}\n\nfn add(a:u32): u32 {\n a + 12u32\n}" | ||
--- | ||
; ModuleID = 'main.mun' | ||
source_filename = "main.mun" | ||
|
||
define void @main() { | ||
body: | ||
%a16 = alloca double | ||
%a15 = alloca double | ||
%a14 = alloca float | ||
%a13 = alloca double | ||
%a12 = alloca i32 | ||
%a11 = alloca i64 | ||
%a10 = alloca i64 | ||
%a9 = alloca i32 | ||
%a8 = alloca i16 | ||
%a7 = alloca i8 | ||
%a6 = alloca i32 | ||
%a5 = alloca i64 | ||
%a4 = alloca i64 | ||
%a3 = alloca i32 | ||
%a2 = alloca i16 | ||
%a1 = alloca i8 | ||
%a = alloca i64 | ||
store i64 123, i64* %a | ||
store i8 123, i8* %a1 | ||
store i16 123, i16* %a2 | ||
store i32 123, i32* %a3 | ||
store i64 123, i64* %a4 | ||
store i64 123, i64* %a5 | ||
store i32 1000000, i32* %a6 | ||
store i8 123, i8* %a7 | ||
store i16 123, i16* %a8 | ||
store i32 123, i32* %a9 | ||
store i64 123, i64* %a10 | ||
store i64 123, i64* %a11 | ||
store i32 1000000, i32* %a12 | ||
store double 0x40C3889D70A3D70A, double* %a13 | ||
store float 0x40C3889D80000000, float* %a14 | ||
store double 0x40C3889D70A3D70A, double* %a15 | ||
store double 0x40C3889D70A3D70A, double* %a16 | ||
ret void | ||
} | ||
|
||
define i32 @add(i32) { | ||
body: | ||
%a = alloca i32 | ||
store i32 %0, i32* %a | ||
%a1 = load i32, i32* %a | ||
%add = add i32 %a1, 12 | ||
ret i32 %add | ||
} | ||
|
7 changes: 7 additions & 0 deletions
7
crates/mun_codegen/src/snapshots/test__literal_types_group_ir.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: crates/mun_codegen/src/test.rs | ||
expression: "fn main(){\n 123;\n 123u8;\n 123u16;\n 123u32;\n 123u64;\n 123uint;\n 1_000_000_u32;\n 123i8;\n 123i16;\n 123i32;\n 123i64;\n 123int;\n 1_000_000_i32;\n 1_000_123.0e-2;\n 1_000_123.0e-2f32;\n 1_000_123.0e-2f64;\n 1_000_123.0e-2float;\n}\n\nfn add(a:u32): u32 {\n a + 12u32\n}" | ||
--- | ||
; ModuleID = 'group_name' | ||
source_filename = "group_name" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.