Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Returning a structure from a class method

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
codeferret



Joined: 03 Jan 2012
Posts: 7

Posted: 11 January 2012, 1:50 AM    Post subject: Returning a structure from a class method Reply with quote

I am having a problem returning structures from functions within classes; the compiler says:

Quote:
Internal error: statement.cpp(1472), Rev 1805: no means to generate assignment code


Here is the simplest code that will generate the problem. Can anyone explain this behavior?

Code:
option objects


public structure thingy
   public number as Integer
end structure


public class classy
   public function method() as thingy
      method.number = 2
   end function
   
   public function methodical() as integer
      methodical = 3
   end function
end class


public function func() as thingy
   func.number = 1
end function


public sub main()
   dim thing1 as thingy
   dim thing2 as thingy
   dim testObject as classy
   
   thing1 = thing2 ' This line compiles.
   thing1 = func() ' This line compiles.
   thing1.number = testObject.methodical() ' This line compiles.
   thing1 = testObject.method() ' This line does not compile.  Why?
end sub
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2514
Location: Portland, OR

Posted: 11 January 2012, 2:44 AM    Post subject: Re: Returning a structure from a class method Reply with quote

codeferret wrote:
I am having a problem returning structures from functions within classes;
This is the same problem that was reported a few days ago. The new compiler version should handle it correctly.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group