Commit b3cfdc54 authored by dbarbera's avatar dbarbera
Browse files

Extended length operator generation to variable size SequenceOf types

parent 2820b497
......@@ -798,6 +798,10 @@ def generate_length(params):
''' Generate the code for the built-in length operation'''
seq_ptr = reference(params[0])
arr_ty = seq_ptr.type.pointee.elements[0]
if arr_ty.kind != core.TYPE_ARRAY:
# If is not an array this is a pointer to a variable size SeqOf
# The array is in the second field of the struct
arr_ty = seq_ptr.type.pointee.elements[1]
return core.Constant.int(ctx.i32, arr_ty.count)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment