@@ -234,8 +234,7 @@
else if (rhs_type->interface_type() != NULL)
return Expression::convert_interface_to_type(context, lhs_type, rhs_type,
rhs_tree, location);
- else if (lhs_type->is_open_array_type()
- && rhs_type->is_nil_type())
+ else if (lhs_type->is_slice_type() && rhs_type->is_nil_type())
{
// Assigning nil to an open array.
go_assert(TREE_CODE(lhs_type_tree) == RECORD_TYPE);
@@ -3315,7 +3314,7 @@
mpfr_clear(imag);
}
- if (type->is_open_array_type() && type->named_type() == NULL)
+ if (type->is_slice_type() && type->named_type() == NULL)
{
Type* element_type = type->array_type()->element_type()->forwarded();
bool is_byte = element_type == Type::lookup_integer_type("uint8");
@@ -3663,7 +3662,7 @@
len);
}
}
- else if (type->is_open_array_type() && expr_type->is_string_type())
+ else if (type->is_slice_type() && expr_type->is_string_type())
{
Type* e = type->array_type()->element_type()->forwarded();
go_assert(e->integer_type() != NULL);
@@ -3831,9 +3830,9 @@
source_location loc = this->location();
bool use_view_convert = false;
- if (t->is_open_array_type())
- {
- go_assert(et->is_open_array_type());
+ if (t->is_slice_type())
+ {
+ go_assert(et->is_slice_type());
use_view_convert = true;
}
else if (t->map_type() != NULL)
@@ -7302,7 +7301,7 @@
if (args == NULL || args->empty())
return this;
Type* slice_type = args->front()->type();
- if (!slice_type->is_open_array_type())
+ if (!slice_type->is_slice_type())
{
error_at(args->front()->location(), "argument 1 must be a slice");
this->set_is_error();
@@ -7342,7 +7341,7 @@
bool is_slice = false;
bool is_map = false;
bool is_chan = false;
- if (type->is_open_array_type())
+ if (type->is_slice_type())
is_slice = true;
else if (type->map_type() != NULL)
is_map = true;
@@ -7554,7 +7553,7 @@
if (arg_type->points_to() != NULL
&& arg_type->points_to()->array_type() != NULL
- && !arg_type->points_to()->is_open_array_type())
+ && !arg_type->points_to()->is_slice_type())
arg_type = arg_type->points_to();
if (arg_type->array_type() != NULL
@@ -7633,7 +7632,7 @@
if (arg_type->points_to() != NULL
&& arg_type->points_to()->array_type() != NULL
- && !arg_type->points_to()->is_open_array_type())
+ && !arg_type->points_to()->is_slice_type())
arg_type = arg_type->points_to();
if (arg_type->array_type() != NULL
@@ -8080,7 +8079,7 @@
Type* arg_type = this->one_arg()->type();
if (arg_type->points_to() != NULL
&& arg_type->points_to()->array_type() != NULL
- && !arg_type->points_to()->is_open_array_type())
+ && !arg_type->points_to()->is_slice_type())
arg_type = arg_type->points_to();
if (this->code_ == BUILTIN_CAP)
{
@@ -8135,7 +8134,7 @@
|| type->channel_type() != NULL
|| type->map_type() != NULL
|| type->function_type() != NULL
- || type->is_open_array_type())
+ || type->is_slice_type())
;
else
this->report_error(_("unsupported argument type to "
@@ -8192,7 +8191,7 @@
break;
Type* e1;
- if (arg1_type->is_open_array_type())
+ if (arg1_type->is_slice_type())
e1 = arg1_type->array_type()->element_type();
else
{
@@ -8201,7 +8200,7 @@
}
Type* e2;
- if (arg2_type->is_open_array_type())
+ if (arg2_type->is_slice_type())
e2 = arg2_type->array_type()->element_type();
else if (arg2_type->is_string_type())
e2 = Type::lookup_integer_type("uint8");
@@ -8321,7 +8320,7 @@
{
arg_type = arg_type->points_to();
go_assert(arg_type->array_type() != NULL
- && !arg_type->is_open_array_type());
+ && !arg_type->is_slice_type());
go_assert(POINTER_TYPE_P(TREE_TYPE(arg_tree)));
arg_tree = build_fold_indirect_ref(arg_tree);
}
@@ -8515,7 +8514,7 @@
fnname = "__go_print_interface";
}
}
- else if (type->is_open_array_type())
+ else if (type->is_slice_type())
{
static tree print_slice_fndecl;
pfndecl = &print_slice_fndecl;
@@ -8694,7 +8693,7 @@
Type* arg2_type = arg2->type();
tree arg2_val;
tree arg2_len;
- if (arg2_type->is_open_array_type())
+ if (arg2_type->is_slice_type())
{
at = arg2_type->array_type();
arg2_tree = save_expr(arg2_tree);
@@ -9078,7 +9077,7 @@
source_location loc = this->location();
go_assert(param_count > 0);
- go_assert(varargs_type->is_open_array_type());
+ go_assert(varargs_type->is_slice_type());
size_t arg_count = this->args_ == NULL ? 0 : this->args_->size();
if (arg_count < param_count - 1)
@@ -9903,7 +9902,7 @@
return Expression::make_array_index(left, start, end, location);
else if (type->points_to() != NULL
&& type->points_to()->array_type() != NULL
- && !type->points_to()->is_open_array_type())
+ && !type->points_to()->is_slice_type())
{
Expression* deref = Expression::make_unary(OPERATOR_MULT, left,
location);
@@ -10060,7 +10059,7 @@
this->type_ = Type::make_error_type();
else if (this->end_ == NULL)
this->type_ = type->element_type();
- else if (type->is_open_array_type())
+ else if (type->is_slice_type())
{
// A slice of a slice has the same type as the original
// slice.
@@ -10150,7 +10149,7 @@
// A slice of an array requires an addressable array. A slice of a
// slice is always possible.
- if (this->end_ != NULL && !array_type->is_open_array_type())
+ if (this->end_ != NULL && !array_type->is_slice_type())
{
if (!this->array_->is_addressable())
this->report_error(_("array is not addressable"));
@@ -10169,7 +10168,7 @@
return false;
// An index into a slice is addressable.
- if (this->array_->type()->is_open_array_type())
+ if (this->array_->type()->is_slice_type())
return true;
// An index into an array is addressable if the array is
@@ -12234,7 +12233,7 @@
Expression::make_slice_composite_literal(Type* type, Expression_list* vals,
source_location location)
{
- go_assert(type->is_open_array_type());
+ go_assert(type->is_slice_type());
return new Open_array_construction_expression(type, vals, location);
}
@@ -3662,7 +3662,7 @@
if (t->array_type() != NULL
|| (t->points_to() != NULL
&& t->points_to()->array_type() != NULL
- && !t->points_to()->is_open_array_type()))
+ && !t->points_to()->is_slice_type()))
{
if (get_index_type)
return Type::lookup_integer_type("int");
@@ -4319,7 +4319,7 @@
case Type::TYPE_ARRAY:
is_small = false;
- can_take_address = !element_type->is_open_array_type();
+ can_take_address = !element_type->is_slice_type();
break;
default:
@@ -5181,7 +5181,7 @@
Type* range_type = this->range_->type();
if (range_type->points_to() != NULL
&& range_type->points_to()->array_type() != NULL
- && !range_type->points_to()->is_open_array_type())
+ && !range_type->points_to()->is_slice_type())
range_type = range_type->points_to();
Type* index_type;
@@ -240,7 +240,7 @@
// Return whether this is an open array type.
bool
-Type::is_open_array_type() const
+Type::is_slice_type() const
{
return this->array_type() != NULL && this->array_type()->length() == NULL;
}
@@ -457,7 +457,7 @@
if (lhs->is_nil_type()
&& (rhs->points_to() != NULL
|| rhs->interface_type() != NULL
- || rhs->is_open_array_type()
+ || rhs->is_slice_type()
|| rhs->map_type() != NULL
|| rhs->channel_type() != NULL
|| rhs->function_type() != NULL))
@@ -465,7 +465,7 @@
if (rhs->is_nil_type()
&& (lhs->points_to() != NULL
|| lhs->interface_type() != NULL
- || lhs->is_open_array_type()
+ || lhs->is_slice_type()
|| lhs->map_type() != NULL
|| lhs->channel_type() != NULL
|| lhs->function_type() != NULL))
@@ -556,7 +556,7 @@
if (rhs->is_nil_type()
&& (lhs->points_to() != NULL
|| lhs->function_type() != NULL
- || lhs->is_open_array_type()
+ || lhs->is_slice_type()
|| lhs->map_type() != NULL
|| lhs->channel_type() != NULL
|| lhs->interface_type() != NULL))
@@ -662,7 +662,7 @@
{
if (rhs->integer_type() != NULL)
return true;
- if (rhs->is_open_array_type() && rhs->named_type() == NULL)
+ if (rhs->is_slice_type() && rhs->named_type() == NULL)
{
const Type* e = rhs->array_type()->element_type()->forwarded();
if (e->integer_type() != NULL
@@ -674,7 +674,7 @@
// A string may be converted to []byte or []int.
if (rhs->is_string_type()
- && lhs->is_open_array_type()
+ && lhs->is_slice_type()
&& lhs->named_type() == NULL)
{
const Type* e = lhs->array_type()->element_type()->forwarded();
@@ -6480,7 +6480,7 @@
// essentially a pointer: a pointer, a slice, a function, a map, or
// a channel.
if (type->points_to() != NULL
- || type->is_open_array_type()
+ || type->is_slice_type()
|| type->function_type() != NULL
|| type->map_type() != NULL
|| type->channel_type() != NULL)
@@ -6699,7 +6699,7 @@
case TYPE_ARRAY:
// Slice types were completed in create_placeholder.
- if (!base->is_open_array_type())
+ if (!base->is_slice_type())
{
Btype* bet = base->array_type()->get_backend_element(gogo);
Bexpression* blen = base->array_type()->get_backend_length(gogo);
@@ -6789,7 +6789,7 @@
break;
case TYPE_ARRAY:
- if (base->is_open_array_type())
+ if (base->is_slice_type())
bt = gogo->backend()->placeholder_struct_type(this->name(),
this->location_);
else
@@ -6822,7 +6822,7 @@
this->named_btype_ = bt;
- if (base->is_open_array_type())
+ if (base->is_slice_type())
{
// We do not record slices as dependencies of other types,
// because we can fill them in completely here with the final
@@ -741,9 +741,9 @@
array_type() const
{ return this->convert<const Array_type, TYPE_ARRAY>(); }
- // Return whether if this is an open array type.
+ // Return whether if this is a slice type.
bool
- is_open_array_type() const;
+ is_slice_type() const;
// If this is a map type, return it. Otherwise, return NULL.
Map_type*