Re: [Vala] How to get the local variables of a method?

2009-05-09 Thread Jürg Billeter
Hi,

On Sat, 2009-05-09 at 23:32 +0200, gege2061 wrote:
> I continu my learning of the vala parser.
> 
> I seek to get the local variables of a method. I tested
> Method.body.get_local_variables() but the list is empty.
> 
> What is the good way?

Local variables have block scope, which means that you might need to
call get_local_variables() on a child block of the method body. If you
want to list all local variables in a method, you need to iterate over
all block children and call get_local_variables() on each.

Jürg

___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How to get the local variables of a method?

2009-05-10 Thread gege2061
ok, but how to iterate over all children blocks?

2009/5/10 Jürg Billeter 

> Hi,
>
> On Sat, 2009-05-09 at 23:32 +0200, gege2061 wrote:
> > I continu my learning of the vala parser.
> >
> > I seek to get the local variables of a method. I tested
> > Method.body.get_local_variables() but the list is empty.
> >
> > What is the good way?
>
> Local variables have block scope, which means that you might need to
> call get_local_variables() on a child block of the method body. If you
> want to list all local variables in a method, you need to iterate over
> all block children and call get_local_variables() on each.
>
> Jürg
>
>


-- 
Nicolas Joseph

Responsable des rubriques C et GTK+ de developpez.com /
In charge of the C and GTK+ sections on developpez.com

http://nicolasj.developpez.com
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list