Make undefined variables be treated as strings
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
parent
4782252f7e
commit
8d666c0308
4
pong.cat
4
pong.cat
@ -52,7 +52,7 @@ let BLACK :: .Color{0 0 0 255}
|
||||
let RED :: .Color{255 0 0 255}
|
||||
let BLUE :: .Color{0 0 255 255}
|
||||
|
||||
InitWindow 800 450 "poop"
|
||||
InitWindow 800 450 Raylib
|
||||
SetTargetFPS 60
|
||||
|
||||
fn GetScreenWidth i32
|
||||
@ -147,7 +147,7 @@ for WindowShouldClose == 0 {
|
||||
|
||||
DrawRectangleWrap GetScreenWidth/2-112 GetScreenHeight/2-112 224 224 colorw
|
||||
|
||||
DrawTextWrap (TextSubtext "raylib" 0 lc) GetScreenWidth/2-44 GetScreenHeight/2+48 50 colorb
|
||||
DrawTextWrap (TextSubtext raylib 0 lc) GetScreenWidth/2-44 GetScreenHeight/2+48 50 colorb
|
||||
} else {
|
||||
DrawTextWrap "[R] REPLAY" 340 200 20 BLACK
|
||||
}
|
||||
|
@ -391,10 +391,10 @@ type_check :: proc(ast: ^Node, parent_ast: ^Node) {
|
||||
if type == nil {
|
||||
fn := type_check_function_call(ast, parent_ast, false)
|
||||
if fn == nil {
|
||||
append(
|
||||
&g_message_list,
|
||||
message_create(.Error, fmt.aprintf("Undefined variable: %s", ast.value.([dynamic]u8)), ast.range),
|
||||
)
|
||||
append(&g_message_list, message_create(.Warning, "Variable name treated as string", ast.range))
|
||||
ast.kind = .String
|
||||
append(&ast.value.([dynamic]u8), 0)
|
||||
type_check(ast, parent_ast)
|
||||
} else {
|
||||
ast.kind = .FunctionCall
|
||||
append(&ast.children, node_create_value(.Identifier, ast.range, ast.value))
|
||||
|
Loading…
x
Reference in New Issue
Block a user