It is currently Fri Dec 06, 2019 11:45 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Wrong error when calling an undefined module procedure
PostPosted: Fri Nov 15, 2019 11:22 pm 
Offline
Addict
Addict

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3362
When attempting to call a procedure which is undefined in a module but is also a PureBasic library function, the compiler will incorrectly state the "module variable" (the function parameter) is undefined:

Code:
DeclareModule SomeModule
EndDeclareModule

Module SomeModule
EndModule

Define i_am_defined

SomeModule::OpenWindow(i_am_defined)


Error:

Code:
---------------------------
PureBasic
---------------------------
Line 9: Module variable 'i_am_defined' not found.
---------------------------
OK   
---------------------------


This is the expected behavior (with example):

Code:
DeclareModule SomeModule
EndDeclareModule

Module SomeModule
EndModule

SomeModule::SomethingElse()


Expected error:

Code:
---------------------------
PureBasic
---------------------------
Line 7: Module item 'SomethingElse()' not found.
---------------------------
OK   
---------------------------


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong error when calling an undefined module procedure
PostPosted: Sat Nov 23, 2019 12:45 pm 
Offline
User
User
User avatar

Joined: Mon Feb 26, 2018 10:41 pm
Posts: 70
Location: Netherlands
I am not a real best programmer. But i played lot with Purebasic.

Your first Error is for me a legit error.
Cause OpenWindow is already declared. Hit F1 and search on OpenWindow.
Quote:
Result = OpenWindow(#Window, x, y, InnerWidth, InnerHeight, Title$ [, Flags [, ParentWindowID]])


So PureBasic compiler is a pass trough compiler the error is detecte directly
Quote:
-SomeModule - exist
-OpenWindow - exist


But 'i_a_defined' is a local variable and not a part of the module declaration and therefore its outside the module.

The error specified Module Variable 'i_am_defined" is then in this case correct. Its not a Module variable

_________________
From my first self made computer till now I stil like computers.


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong error when calling an undefined module procedure
PostPosted: Tue Nov 26, 2019 1:20 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13640
Location: France
IMHO, it's a bug to be able to find OpenWindow() if the module is explicitely specified. I will take a closer look.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye