[cfe-commits] [PATCH] Implement Type.element_type

Tobias Grosser tobias at grosser.es
Sun Feb 5 04:49:02 PST 2012


On 02/05/2012 06:20 AM, Gregory Szorc wrote:
> ---
>   bindings/python/clang/cindex.py           |   18 ++++++++++++++++++
>   bindings/python/tests/cindex/test_type.py |   13 +++++++++++++
>   2 files changed, 31 insertions(+), 0 deletions(-)
>
>
> 0010-Implement-Type.element_type.patch
>
>
> diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
> index 364547b..d4b2712 100644
> --- a/bindings/python/clang/cindex.py
> +++ b/bindings/python/clang/cindex.py
> @@ -1147,16 +1147,29 @@ class Type(Structure):
>       @property
>       def argument_types(self):
>           """A generator of Type instances corresponding to the arguments for
>           this function type."""
>
>           for i in range(0, self.arguments_count):
>               yield self.get_arg_type(i)
>
> +    @property
> +    def element_type(self):
> +        """Retrieve the Type of elements within this type.
> +
> +        If accessed on a non-array, complex, or vector type, an exception will

This sentence is slightly confusing as the non seems only to apply to 
the array.

What about

If accessed on a type that is not an array, complex, or vector type, an 
exception will be raised.

Otherwise LGTM.

Tobi



More information about the cfe-commits mailing list