aboutsummaryrefslogtreecommitdiff
path: root/src/types.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-10-20 17:08:55 +0100
committergingerBill <bill@gingerbill.org>2020-10-20 17:08:55 +0100
commitfeeb342c009022b3de6f903ef1e3cc40b54951ca (patch)
treedc345900689842753ae079f616d00b240551cfe4 /src/types.cpp
parentc4dbc88a1239c719170931a62fe53c942f13a155 (diff)
Improve multiple return value copy-elision
Diffstat (limited to 'src/types.cpp')
-rw-r--r--src/types.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp
index 5e696eaa7..03e071045 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -3338,6 +3338,17 @@ Type *get_struct_field_type(Type *t, isize index) {
}
+Type *reduce_tuple_to_single_type(Type *original_type) {
+ if (original_type != nullptr) {
+ Type *t = core_type(original_type);
+ if (t->kind == Type_Tuple && t->Tuple.variables.count == 1) {
+ return t->Tuple.variables[0]->type;
+ }
+ }
+ return original_type;
+}
+
+
gbString write_type_to_string(gbString str, Type *type) {
if (type == nullptr) {
return gb_string_appendc(str, "<no type>");