Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

GetDeclarationsStr


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Jason Goepel   Members   -  Reputation: 402

Like
0Likes
Like

Posted 17 September 2013 - 03:11 PM

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.



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3291

Like
0Likes
Like

Posted 17 September 2013 - 04:11 PM

Not really a bug, but certainly something I'll look into changing.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS