Page 1 of 1

check if local vraiables are declared

PostPosted: Wed Jul 11, 2012 9:09 am
by Hans Nieuwenhuis
Hi,

Is there a way to do a quick check on a method to see
which variables are locally declared and wich are global ?

Because if you forget to declare a variable localy, it becomes a global automaticaly.

Regards,

Re: check if local vraiables are declared

PostPosted: Wed Jul 11, 2012 9:11 am
by ROCLASI
Hi Hans,

This should show up in the Problems tab under the warnings.

Re: check if local vraiables are declared

PostPosted: Wed Jul 11, 2012 9:18 am
by Hans Nieuwenhuis
Thanks Robert,

But why should Servoy see it as a problem if I do not declare a variable localy

If I do :

var x = 1 // local

If I do

x=1 //global

the second one is not wrong or an error

Regards,

Re: check if local vraiables are declared

PostPosted: Wed Jul 11, 2012 12:20 pm
by ROCLASI
Hi Hans,

Correct, it's not an error and is also not flagged as such. It's flagged as a warning.
It's just a heads-up that you *may* have forgotten to declare the variable.

Re: check if local vraiables are declared

PostPosted: Wed Jul 11, 2012 12:25 pm
by Hans Nieuwenhuis
I do not see any warning.
Is there some preference or other setting needed ?

Re: check if local vraiables are declared

PostPosted: Wed Jul 11, 2012 1:16 pm
by Joas
You don't get those warnings in Servoy 5, they were introduced in 6.0.