Now using adt_lower, which also makes the backing deconstruct a reference, which makes sense

This commit is contained in:
Nathan Braswell
2016-06-20 01:52:28 -07:00
parent 4a33a94b15
commit 26e7ee249a
10 changed files with 292 additions and 210 deletions

View File

@@ -10,7 +10,6 @@ import io:*
adt base_type {
none,
object,
adt,
no_type_adt_option,
function,
template,
@@ -95,10 +94,7 @@ obj type (Object) {
return this
}
fun construct(type_def_in: *ast_node, traits_in: set<string>): *type {
if (is_type_def(type_def_in))
base.copy_construct(&base_type::object())
else
base.copy_construct(&base_type::adt())
base.copy_construct(&base_type::object())
parameter_types.construct()
indirection = 0
return_type = null<type>()
@@ -160,7 +156,7 @@ obj type (Object) {
traits.for_each(fun(t: string) trait_string += t;)
trait_string += "] "
}
var indr_string = string("")
if (is_ref)
indr_string += " ref "
@@ -169,8 +165,7 @@ obj type (Object) {
for (var i = 0; i < indirection; i++;) indr_string += "*"
match (base) {
base_type::none() return indr_string + string("none") + trait_string
base_type::object() return indr_string + type_def->type_def.name + trait_string
base_type::adt() return indr_string + type_def->adt_def.name + trait_string
base_type::object() return indr_string + get_ast_name(type_def) + trait_string
base_type::no_type_adt_option() return indr_string + "no_type_adt_option" + trait_string
base_type::template() return indr_string + string("template") + trait_string
base_type::template_type() return indr_string + string("template_type") + trait_string
@@ -225,20 +220,12 @@ obj type (Object) {
to_ret->is_ref = is_ref_in
return to_ret
}
fun is_object_like(): bool
return is_object() || is_adt()
fun is_object(): bool {
match (base) {
base_type::object() return true
}
return false
}
fun is_adt(): bool {
match (base) {
base_type::adt() return true
}
return false
}
fun is_function(): bool {
match (base) {
base_type::function() return true