Improve minimum dependency for complex numbers and quaternion numbers.

This commit is contained in:
gingerBill
2020-01-04 18:04:12 +00:00
parent 5ae924f988
commit 5c7d6fcfd0
3 changed files with 19 additions and 9 deletions

View File

@@ -437,12 +437,14 @@ default_logger :: proc() -> Logger {
}
@private
__init_context_from_ptr :: proc "contextless" (c: ^Context, other: ^Context) {
if c == nil do return;
c^ = other^;
__init_context(c);
}
@private
__init_context :: proc "contextless" (c: ^Context) {
if c == nil do return;

View File

@@ -2668,6 +2668,22 @@ void check_binary_expr(CheckerContext *c, Operand *x, Ast *node, Type *type_hint
return;
}
if (op.kind == Token_Quo || op.kind == Token_QuoEq) {
Type *bt = base_type(x->type);
if (bt->kind == Type_Basic) switch (bt->Basic.kind) {
case Basic_complex64: add_package_dependency(c, "runtime", "quo_complex64"); break;
case Basic_complex128: add_package_dependency(c, "runtime", "quo_complex128"); break;
case Basic_quaternion128: add_package_dependency(c, "runtime", "quo_quaternion128"); break;
case Basic_quaternion256: add_package_dependency(c, "runtime", "quo_quaternion256"); break;
}
} else if (op.kind == Token_Mul || op.kind == Token_MulEq) {
Type *bt = base_type(x->type);
if (bt->kind == Type_Basic) switch (bt->Basic.kind) {
case Basic_quaternion128: add_package_dependency(c, "runtime", "mul_quaternion128"); break;
case Basic_quaternion256: add_package_dependency(c, "runtime", "mul_quaternion256"); break;
}
}
x->mode = Addressing_Value;
}

View File

@@ -1665,12 +1665,10 @@ void generate_minimum_dependency_set(Checker *c, Entity *start) {
str_lit("mem_zero"),
str_lit("__init_context"),
str_lit("default_assertion_failure_proc"),
str_lit("args__"),
str_lit("type_table"),
str_lit("__type_info_of"),
str_lit("global_default_temp_allocator_data"),
str_lit("default_temp_allocator"),
str_lit("default_temp_allocator_init"),
str_lit("default_temp_allocator_destroy"),
@@ -1680,13 +1678,7 @@ void generate_minimum_dependency_set(Checker *c, Entity *start) {
str_lit("Source_Code_Location"),
str_lit("Context"),
str_lit("quo_complex64"),
str_lit("quo_complex128"),
str_lit("mul_quaternion128"),
str_lit("mul_quaternion256"),
str_lit("quo_quaternion128"),
str_lit("quo_quaternion256"),
str_lit("cstring_to_string"),
str_lit("cstring_to_string"), // Is tihs needed?
str_lit("umodti3"),
str_lit("udivti3"),