Use LLVM-18
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
parent
0813d084cc
commit
0f5db0972c
@ -1,4 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
odin run src -o:none -debug -out:speedcat '-extra-linker-flags:-L/opt/homebrew/opt/llvm/lib' -- test_type_checker.cat
|
||||
set -xe
|
||||
|
||||
LLVMC=llvm-config
|
||||
LLVM_LINKER="-lc++ $($LLVMC --libs core --cxxflags --ldflags --system-libs|tr '\n' ' ')"
|
||||
|
||||
odin run src -o:none -debug -out:speedcat -extra-linker-flags:"$LLVM_LINKER" -- test_type_checker.cat
|
||||
clang -I/opt/homebrew/include /opt/homebrew/lib/libraylib.a -lm -framework Cocoa -framework OpenGL -framework IOKit test_type_checker.ll test.c -o raylib
|
||||
|
1
llvm-project
Submodule
1
llvm-project
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a61252419779a6d4a5ebf71e7e2fc4adc75cfddd
|
@ -3,7 +3,7 @@ package main
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import llvmc "llvm/win64/LLVM-C.lib"
|
||||
} else when ODIN_OS == .Linux || ODIN_OS == .Darwin {
|
||||
foreign import llvmc "system:LLVM-C"
|
||||
foreign import llvmc "system:LLVMCore"
|
||||
}
|
||||
|
||||
LLVMBool :: distinct int
|
||||
|
@ -233,6 +233,21 @@ type_check :: proc(ast: ^Node, parent_ast: ^Node) {
|
||||
}
|
||||
scope_leave()
|
||||
case .FunctionCall:
|
||||
if ast.children[0].kind == .FieldAccess {
|
||||
type_check(ast.children[0], ast)
|
||||
if ast.children[0].return_type == nil {
|
||||
append(
|
||||
&g_message_list,
|
||||
message_create(.Error, fmt.aprintf("Field access return type is nil"), ast.children[0].range),
|
||||
)
|
||||
break
|
||||
}
|
||||
|
||||
lhs := ast.children[0].children[0]
|
||||
rhs := ast.children[0].children[1]
|
||||
|
||||
}
|
||||
|
||||
type := scope_variable_lookup(ast.children[0].value.([dynamic]u8))
|
||||
if type != nil {
|
||||
name := ast.children[0].value.([dynamic]u8)
|
||||
|
@ -44,26 +44,51 @@ struct Color {
|
||||
a b g r: u8,
|
||||
}
|
||||
|
||||
fn ClearBackground(c: u32)
|
||||
fn DrawRectangle(x y w h: i32, c: u32)
|
||||
fn DrawCircle(x y: i32, r: f32, c: u32)
|
||||
|
||||
fn InitWindow(w h: i32, title: i32)
|
||||
fn CloseWindow
|
||||
fn ClearBackgroundWrap(c: Color)
|
||||
fn BeginDrawing
|
||||
fn SetTargetFPS(fps: i32)
|
||||
fn EndDrawing
|
||||
fn DrawFPS(x y: i32)
|
||||
fn DrawRectangleWrap(x y w h: i32, c: Color)
|
||||
fn DrawCircleWrap(x y: i32, r: f32, c: Color)
|
||||
fn WindowShouldClose i32
|
||||
|
||||
1 << 3 | 2
|
||||
|
||||
fn ColorToRaylib(c: Color) u32 {
|
||||
ret c.a as u32 << 24 | c.b as u32 << 16 | c.g as u32 << 8 | c.r
|
||||
}
|
||||
|
||||
fn ClearBackgroundWrap(c: Color) {
|
||||
ClearBackground (ColorToRaylib c)
|
||||
}
|
||||
|
||||
fn DrawRectangleWrap(x y w h: i32, c: Color) {
|
||||
DrawRectangle x y w h (ColorToRaylib c)
|
||||
}
|
||||
|
||||
fn DrawCircleWrap(x y: i32, r: f32, c: Color) {
|
||||
DrawCircle x y r (ColorToRaylib c)
|
||||
}
|
||||
|
||||
let white :: .Color{255 69 69 69}
|
||||
let red :: .Color{255 0 0 255}
|
||||
let blue :: .Color{255 0 255 255}
|
||||
|
||||
let x := 0
|
||||
|
||||
InitWindow 640 480 0
|
||||
SetTargetFPS 30
|
||||
for WindowShouldClose == 0 {
|
||||
x = x + 1
|
||||
|
||||
BeginDrawing
|
||||
ClearBackgroundWrap white
|
||||
DrawFPS 20 20
|
||||
DrawRectangleWrap 80 80 100 200 red
|
||||
DrawRectangleWrap 80 x 100 200 red
|
||||
DrawCircleWrap 200 200 100.0 blue
|
||||
EndDrawing
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user