Jump to content
  • Advertisement
Sign in to follow this  
Jason Goepel


This topic is 2127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not sure if this is a bug or not, but when I call asIScriptFunction::GetDeclaration on a constructor I am getting a return type, contrary to some comments in the code as_scriptfunction.cpp, line 480.

// Don't add the return type for constructors and destructors
if( !(returnType.GetTokenType() == ttVoid && 
      objectType && 
      (name == objectType->name || (name.GetLength() > 0 && name[0] == '~'))) ) 
    str = returnType.Format();
    str += " ";

The problem seems to be that "name" is always "_beh_0_", which is certainly not going to equal objectType->name.  This name is set here when registering a behaviour, as_scriptengine.cpp, line 1811:

asCBuilder bld(this, 0);
int r = bld.ParseFunctionDeclaration(objectType, decl, &func, true, &internal.paramAutoHandles, &internal.returnAutoHandle);
if( r < 0 )
    return ConfigError(asINVALID_DECLARATION, "RegisterObjectBehaviour", objectType->name.AddressOf(), decl);
func.name.Format("_beh_%d_", behaviour);

These two sections of code seem inconsistent.  If I had to pick, I would prefer constructors to have their names equal the names of the objects which they construct.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!