Sign in to follow this  

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

Recommended Posts

zexee    118

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
WitchLord    4677

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this