Fix assert; exporting rules

This commit is contained in:
Ginger Bill
2016-09-22 23:18:29 +01:00
parent 2e506b7e6e
commit ee0aa7b9de
5 changed files with 45 additions and 49 deletions
+5 -5
View File
@@ -4,7 +4,7 @@
set exe_name=odin.exe set exe_name=odin.exe
:: Debug = 0, Release = 1 :: Debug = 0, Release = 1
set release_mode=1 set release_mode=0
set compiler_flags= -nologo -Oi -TP -W4 -fp:fast -fp:except- -Gm- -MP -FC -GS- -EHsc- -GR- set compiler_flags= -nologo -Oi -TP -W4 -fp:fast -fp:except- -Gm- -MP -FC -GS- -EHsc- -GR-
@@ -46,10 +46,10 @@ rem pushd %build_dir%
del *.pdb > NUL 2> NUL del *.pdb > NUL 2> NUL
del *.ilk > NUL 2> NUL del *.ilk > NUL 2> NUL
rem cl %compiler_settings% "src\main.cpp" ^ cl %compiler_settings% "src\main.cpp" ^
rem /link %linker_settings% -OUT:%exe_name% ^ /link %linker_settings% -OUT:%exe_name% ^
rem && odin run code/demo.odin && odin run code/demo.odin
odin run code/demo.odin rem odin run code/demo.odin
:do_not_compile_exe :do_not_compile_exe
+14 -13
View File
@@ -5,14 +5,13 @@
// #import "punity.odin" as pn // #import "punity.odin" as pn
main :: proc() { main :: proc() {
// struct_padding() // struct_padding()
// bounds_checking() // bounds_checking()
// type_introspection() // type_introspection()
// any_type() // any_type()
// crazy_introspection() // crazy_introspection()
// namespaces_and_files() namespaces_and_files()
// miscellany() // miscellany()
// ht.run() // ht.run()
@@ -125,11 +124,11 @@ bounds_checking :: proc() {
// x[-1] = 0; // Compile Time // x[-1] = 0; // Compile Time
// x[4] = 0; // Compile Time // x[4] = 0; // Compile Time
/*{ {
a, b := -1, 4; a, b := -1, 4;
x[a] = 0; // Runtime Time // x[a] = 0; // Runtime Time
x[b] = 0; // Runtime Time // x[b] = 0; // Runtime Time
}*/ }
// Works for arrays, strings, slices, and related procedures & operations // Works for arrays, strings, slices, and related procedures & operations
@@ -190,11 +189,9 @@ type_introspection :: proc() {
fmt.println() fmt.println()
fmt.print("Type of v1 is:\n\t", t1) fmt.print("Type of v1 is:\n\t", t1)
// fmt.fprint_type(os.stdout, t1)
fmt.println() fmt.println()
fmt.print("Type of v2 is:\n\t") fmt.print("Type of v2 is:\n\t", t2)
fmt.fprint_type(os.stdout, t2)
fmt.println("\n") fmt.println("\n")
fmt.println("t1 == t2:", t1 == t2) fmt.println("t1 == t2:", t1 == t2)
@@ -205,9 +202,9 @@ type_introspection :: proc() {
any_type :: proc() { any_type :: proc() {
a: any a: any
x := 123 x: int = 123
y := 6.28 y: f64 = 6.28
z := "Yo-Yo Ma" z: string = "Yo-Yo Ma"
// All types can be implicit cast to `any` // All types can be implicit cast to `any`
a = x a = x
a = y a = y
@@ -267,7 +264,7 @@ crazy_introspection :: proc() {
name := (fruit_ti as ^Type_Info.Named).name // Unsafe casts name := (fruit_ti as ^Type_Info.Named).name // Unsafe casts
info := type_info_base(fruit_ti) as ^Type_Info.Enum // Unsafe casts info := type_info_base(fruit_ti) as ^Type_Info.Enum // Unsafe casts
fmt.printf("% :: enum % {", name, info.base); fmt.printf("% :: enum % {\n", name, info.base);
for i := 0; i < info.values.count; i++ { for i := 0; i < info.values.count; i++ {
fmt.printf("\t%\t= %,\n", info.names[i], info.values[i]) fmt.printf("\t%\t= %,\n", info.names[i], info.values[i])
} }
@@ -293,6 +290,10 @@ crazy_introspection :: proc() {
// #import "test.odin" // #import "test.odin"
namespaces_and_files :: proc() { namespaces_and_files :: proc() {
// test.thing()
// test.format.println()
// test.println()
/* /*
// Non-exporting import // Non-exporting import
#import "file.odin" #import "file.odin"
-1
View File
@@ -1,4 +1,3 @@
#import "fmt.odin" as fmt #import "fmt.odin" as fmt
#foreign_system_library "Ws2_32" #foreign_system_library "Ws2_32"
+23 -25
View File
@@ -1,38 +1,36 @@
#import "fmt.odin" /*#import "fmt.odin"
thing :: proc() { thing :: proc() {
fmt.println("Hello!") fmt.println("Hello1!")
}*/
#import "fmt.odin" as format
thing :: proc() {
format.println("Hello2!")
} }
/*
#import "fmt.odin" as fmt /*#import "fmt.odin" as .
thing :: proc() { thing :: proc() {
fmt.println("Hello!") println("Hello3!")
}
*/
/*#import "fmt.odin" as _
thing :: proc() {
// println("Hello4!")
} }
*/ */
/*
#import "fmt.odin" as .
thing :: proc() {
println("Hello!")
}
*/
/*
#import "fmt.odin" as _
thing :: proc() {
// println("Hello!")
}
*/
/* /*
#load "fmt.odin" #load "fmt.odin"
thing :: proc() { thing :: proc() {
println("Hello!") println("Hello5!")
} }*/
*/
+3 -5
View File
@@ -2077,11 +2077,11 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node) {
check_entity_decl(c, entity, NULL, NULL); check_entity_decl(c, entity, NULL, NULL);
} }
GB_ASSERT(entity->type != NULL); GB_ASSERT(entity->type != NULL);
b32 is_not_exported = !((e->ImportName.scope == entity->scope) && !is_entity_exported(entity)); b32 is_not_exported = !is_entity_exported(entity);
if (is_not_exported) { if (is_not_exported) {
auto found = map_get(&e->ImportName.scope->implicit, hash_string(sel_name)); auto found = map_get(&e->ImportName.scope->implicit, hash_string(sel_name));
if (!found) { if (!found && e->ImportName.scope != entity->scope) {
is_not_exported = false; is_not_exported = false;
} }
} }
@@ -2437,9 +2437,7 @@ b32 check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id)
return false; return false;
} }
if (operand->mode != Addressing_Constant) { operand->mode = Addressing_NoValue;
operand->mode = Addressing_NoValue;
}
break; break;
case BuiltinProc_panic: case BuiltinProc_panic: