Skip to content

Commit bf52ec4

Browse files
committed
a couple fixes
1 parent b39b741 commit bf52ec4

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

cache/cached_tree.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ typedef struct counted_string
1313
uint32_t size;
1414
} counted_string;
1515

16-
16+
#define LENGTH_SHIFT 16
1717
#if 0
1818
counted_string StripLastComponent(counted_string *path)
1919
{
@@ -35,7 +35,7 @@ meta_data_entry_t* LookupDirPathByKey(cache_t* cache, const char* dir_path,
3535
{
3636
uint32_t toc_size = cache->toc_size;
3737
meta_data_entry_t* result = 0;
38-
size_t path_length = (entry_key >> 16);
38+
size_t path_length = (entry_key >> LENGTH_SHIFT);
3939

4040
toc_entry_t* one_past_last = cache->toc_entries + toc_size;
4141
for(toc_entry_t* toc_entry = cache->toc_entries;
@@ -111,7 +111,7 @@ name_cache_ptr_t GetOrAddNameByKey(cache_t* cache, const char* name,
111111
uint32_t entry_key)
112112
{
113113
name_cache_ptr_t result = {0};
114-
size_t length = (entry_key >> 16);
114+
size_t length = (entry_key >> LENGTH_SHIFT);
115115
if (!length)
116116
return result;
117117

@@ -228,7 +228,7 @@ meta_data_entry_t* LookupInDirectoryByKey(cache_t* cache, cached_dir_t* lookupDi
228228
{
229229
meta_data_entry_t* result = 0;
230230

231-
const size_t name_length = (entry_key >> 16);
231+
const size_t name_length = (entry_key >> LENGTH_SHIFT);
232232

233233
meta_data_entry_t const * one_past_last_entry =
234234
lookupDir->entries + lookupDir->entries_size;

parser/metac_preproc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,10 @@ void MetaCPreProcessor_Init(metac_preprocessor_t *self, metac_lexer_t* lexer,
441441
metac_alloc_t* alloc,
442442
metac_file_storage_t* fs, const char* filepath)
443443
{
444+
{
445+
metac_preprocessor_t zero = {0};
446+
*self = zero;
447+
}
444448
self->FileStorage = fs;
445449
if (filepath)
446450
self->File = MetaCFileStorage_LoadFile(fs, filepath);

semantic/metac_expr_semantic.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,23 +466,29 @@ void ResolveIdentifierToExp(metac_sema_state_t* self,
466466
}
467467
else if (node->Kind == node_decl_type_struct)
468468
{
469+
metac_type_aggregate_t* t_agg = cast(metac_type_aggregate_t*)node;
469470
result->Kind = expr_type;
470471
result->TypeExp.v =
471-
TYPE_INDEX_V(type_index_struct, StructIndex(self, cast(metac_type_aggregate_t*)node));
472+
TYPE_INDEX_V(type_index_struct, StructIndex(self, t_agg));
472473
result->TypeIndex.v = TYPE_INDEX_V(type_index_basic, type_type);
474+
// hash = t_agg->Hash; ? where is hash
473475
}
474476
else if (node->Kind == node_decl_type_typedef)
475477
{
478+
metac_type_typedef_t* t_def = cast(metac_type_typedef_t*)node;
476479
result->Kind = expr_type;
477480
result->TypeExp.v =
478-
TYPE_INDEX_V(type_index_typedef, TypedefIndex(self, cast(metac_type_typedef_t*)node));
481+
TYPE_INDEX_V(type_index_typedef, TypedefIndex(self, t_def));
482+
result->TypeIndex.v = TYPE_INDEX_V(type_index_basic, type_type);
483+
// hash = t_def->Hash; // where is hash
479484
}
480485
else if (node->Kind == node_decl_function)
481486
{
482487
sema_decl_function_t* func = cast(sema_decl_function_t*) node;
483488
result->Kind = expr_function;
484489
result->Function = func;
485490
result->TypeIndex = func->TypeIndex;
491+
hash = func->Hash;
486492
}
487493
else if (node->Kind == node_expr_unknown_value)
488494
{
@@ -1250,7 +1256,7 @@ metac_sema_expr_t* MetaCSemantic_doExprSemantic_(metac_sema_state_t* self,
12501256
if (e1->TypeIndex.v == TYPE_INDEX_V(type_index_basic, type_type))
12511257
{
12521258
// if the expression is any other kind of expression and it is of type type
1253-
// it indicates we want this sizeof be resolved at a later time
1259+
// it indicates we want this typeof be resolved at a later time
12541260
// possibly when calling a function
12551261
}
12561262

semantic/metac_type_table.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define _METAC_TYPE_TABLE_H_
33

44
#include "../os/compat.h"
5-
#include "metac_type.h"
5+
#include "../semantic/metac_type.h"
66

77
uint32_t EntangleInts(uint32_t a, uint32_t b);
88
uint32_t UntangleInts(uint32_t tangled);
@@ -28,7 +28,7 @@ typedef struct metac_type_table_t
2828
(A == B ? true : Expr_IsEqual_(A, B))
2929

3030
bool Expr_IsEqual_(const struct metac_sema_expr_t* a,
31-
const struct metac_sema_expr_t* b);
31+
const struct metac_sema_expr_t* b);
3232

3333
static inline const bool EnumSlotsEqual(const metac_type_table_slot_t* a,
3434
const metac_type_table_slot_t* b)
@@ -185,8 +185,8 @@ static inline const bool TupleSlotsEqual(const metac_type_table_slot_t* a,
185185
return result;
186186
}
187187

188-
static inline const bool MetaCExpr_Equal(const metac_expr_t* a,
189-
const metac_expr_t* b)
188+
static inline const bool MetaCExpr_Equal(const struct metac_expr_t* a,
189+
const struct metac_expr_t* b)
190190
{
191191
// assert(0);
192192
return false;
@@ -215,7 +215,7 @@ static inline const bool TemplateSlotsEqual(const metac_type_table_slot_t* a,
215215
for(uint32_t i = 0; i < argumentCount; i++)
216216
{
217217
metac_expr_t argA = slotA->Arguments[i];
218-
metac_expr_t argB = slotA->Arguments[i];
218+
metac_expr_t argB = slotB->Arguments[i];
219219
if (argA.Hash != argB.Hash)
220220
{
221221
result = false;

0 commit comments

Comments
 (0)