check if local vraiables are declared

Questions, tips and tricks and techniques for scripting in Servoy

check if local vraiables are declared

Postby Hans Nieuwenhuis » Wed Jul 11, 2012 9:09 am

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,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: check if local vraiables are declared

Postby ROCLASI » Wed Jul 11, 2012 9:11 am

Hi Hans,

This should show up in the Problems tab under the warnings.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: check if local vraiables are declared

Postby Hans Nieuwenhuis » Wed Jul 11, 2012 9:18 am

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,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: check if local vraiables are declared

Postby ROCLASI » Wed Jul 11, 2012 12:20 pm

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.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: check if local vraiables are declared

Postby Hans Nieuwenhuis » Wed Jul 11, 2012 12:25 pm

I do not see any warning.
Is there some preference or other setting needed ?
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: check if local vraiables are declared

Postby Joas » Wed Jul 11, 2012 1:16 pm

You don't get those warnings in Servoy 5, they were introduced in 6.0.
Joas de Haan
Yield Software Development
Need help on your project? yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 842
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL


Return to Methods

Who is online

Users browsing this forum: No registered users and 12 guests