Jump to content
  • Advertisement
Sign in to follow this  
zexee

How to get the full declaration of a local variable in context

This topic is 1735 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

Hi, I want to get the full declaration (something like: const namespace::array<object> a;) of a local variable in context.

 

I tried function->GetVarDecl(), but it does not full (no namespace, no <object>). I know namespace can be found in engine->GetObjectTypeById()->GetNamespace(), and const can be found in function->GetVarDecl() but how to get the template subtype?

 

Since the template subtype can also be a template and have const and reference/handle, it seems to be a iterative process to get the full declaration. Is there a simple way to do that?

 

Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement

I'll need to change asIScriptFunction::GetVarDecl to add an optional argument to include the namespace in the typenames.

 

For now you can use the asIScriptEngine::GetTypeDeclaration method and pass it the typeId of the variable (obtained with asIScriptFunction::GetVar).

 

 

The GetVarDecl and GetTypeDeclaration should give a proper declaration for template types, you shouldn't have to do this by yourself. If that is not happening it must be a bug in the library.

Share this post


Link to post
Share on other sites

That's great! Then I found a bug that GetVarDecl and GetTypeDeclaration does not work on template specializations. 

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!