compiler: Indirection status of TTuple depends on elements

For instance, TTuple(TList(TInt32())) has indirections, while
TTuple(TInt32()) does not.

This fixes memory corruption with RPCs that return tuples of lists.

Signed-off-by: David Nadlinger <code@klickverbot.at>
pull/1104/merge
David Nadlinger 2018-06-30 19:29:34 +01:00 committed by Sébastien Bourdeauducq
parent d2c8e62cb7
commit 4359a43732
1 changed files with 3 additions and 1 deletions

View File

@ -311,9 +311,11 @@ def is_collection(typ):
types.is_mono(typ, "list")
def is_allocated(typ):
if types.is_tuple(typ):
return any(is_allocated(e.find()) for e in typ.elts)
return not (is_none(typ) or is_bool(typ) or is_int(typ) or
is_float(typ) or is_range(typ) or
types._is_pointer(typ) or types.is_function(typ) or
types.is_c_function(typ) or types.is_rpc(typ) or
types.is_method(typ) or types.is_tuple(typ) or
types.is_method(typ) or
types.is_value(typ))