Skip to content

Commit 6570752

Browse files
committed
More bug fixing
1 parent ef3114b commit 6570752

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/compiler.pr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,9 +3442,9 @@ def walk_Identifier(node: &parser::Node, state: &State) -> Value {
34423442
var val = node.svalue
34433443
if not val { return NO_VALUE }
34443444

3445-
if val.tpe and val.tpe.kind == typechecking::TypeKind::TYPE and val.value {
3445+
if val.kind == scope::ValueKind::TYPE {
34463446
let loc = make_location(node, state)
3447-
return change_value_to_type(val.value.value_tpe, loc, state)
3447+
return change_value_to_type(val.get_type(), loc, state)
34483448
}
34493449
if not val { return NO_VALUE }
34503450

@@ -9078,7 +9078,7 @@ def change_value_to_type(tpe: &typechecking::Type, loc: &Value, state: &State) -
90789078
let fun = declare_reflection_type_id_fun(state)
90799079
if not fun { return NO_VALUE }
90809080
let tmp = state.alloca(builtins::type_t(), loc)
9081-
let res = state.call(fun.fdef.name, builtins::TypeT_, [[ tpe = builtins::uint64_, kind = ValueKind::INT, i = tpe.id ] !Value], loc)
9081+
let res = state.call(fun.fdef.name, builtins::type_t(), [[ tpe = builtins::uint64_, kind = ValueKind::INT, i = tpe.id ] !Value], loc)
90829082
state.store(tmp, res, loc)
90839083
create_temporary(tmp, res, loc, state)
90849084
return res

src/debug.pr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,8 +866,9 @@ export def type_to_str(tpe: &typechecking::Type, full_name: bool = false) -> Str
866866
typechecking::TypeKind::STRUCT, typechecking::TypeKind::UNION,
867867
typechecking::TypeKind::INTERFACE,
868868
typechecking::TypeKind::TYPE_CONSTRUCTOR
869-
if tpe.is_anon { return "<anonymous>" }
870-
return tpe.type_name if full_name else tpe.name
869+
let name = tpe.type_name if full_name else tpe.name
870+
if not name { return "<anonymous " + tpe.id + ">" }
871+
return name
871872
case typechecking::TypeKind::TYPE
872873
return type_t_to_string(tpe, full_name)
873874
case typechecking::TypeKind::FUNCTION, typechecking::TypeKind::CLOSURE

src/eval.pr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ export def get_address(loc: compiler::Value, state: &State) -> * {
220220
errors::errorv("Global by the name of `", loc.name, "` not found")
221221
return null
222222
} else {
223-
ptr = state.cstate.mem.allocate(loc_tpe.tpe.resolve().size)
223+
let ltpe = loc_tpe.tpe.resolve()
224+
ptr = state.cstate.mem.allocate(ltpe.size)
224225
if global.value {
225226
set(ptr, loc_tpe.tpe, @global.value)
226227
}

src/scope.pr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ export def has_function(scope: &Scope, fdef: typechecking::FunctionDef) -> &Valu
917917
var value = get(scope, parser::make_identifier(fdef.unmangled), false, false, true)
918918
if value and value.kind == ValueKind::FUNCTION {
919919
while value {
920-
if value.fdef.name == fdef.name {
920+
if value.fdef == fdef {
921921
return value
922922
}
923923
value = value.next

0 commit comments

Comments
 (0)