Sign in to follow this  

BUG: asCContext::GetLineNumber(asUINT stackLevel, int *column, const char **sectionName)

This topic is 2493 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 think I've found a bug. The method:

[code]int asCContext::GetLineNumber(asUINT stackLevel, int *column, const char **sectionName)[/code]
returns wrong line number when it comes to the object constructor. Take a look at the screenshot of my AS IDE which I'm currently developing:

[center][img]https://lh4.googleusercontent.com/_pctHwDHtR7Q/TV6QLso_Q9I/AAAAAAAAAi0/7LVSyCEnJ8U/BugReport_WrongLineNumber.png[/img][/center]
As you can see on my callstack, it says that the constructor of the class named "MyClass" is in line 0, but it should tell that it's in the line 43.

The method:
[code]int asCScriptFunction::GetLineNumber(int programPosition)[/code]
which is called from asCContext::GetLineNumber is returning 0, because lineNumbers.GetLength() equals 0 when it comes to the constructor.

I'm using AngelScript 2.20:

[code]#define ANGELSCRIPT_VERSION 22000
#define ANGELSCRIPT_VERSION_STRING "2.20.0 WIP"[/code]

Share this post


Link to post
Share on other sites
[quote name='virious' timestamp='1298043526' post='4775912']
As you can see on my callstack, it says that the constructor of the class named "MyClass" is in line 0, but it should tell that it's in the line 43.
[/quote]



My guess would be it refers to a constructor version created on the fly by the compiler.

Share this post


Link to post
Share on other sites
Actually, the function MyClass @MyClass(int), is a factory stub. It is responsible for allocating the memory for the script class, and then call the class' constructor MyClass::Myclass(int) to initialize it. It is an automatically generated piece of code, so it doesn't have a line number (which is why you're getting the line 0).

Share this post


Link to post
Share on other sites
Thanks for the answer :). So I will just modify my callstack and I will try to filter out entries with line number = 0 on the object constructors (I must think of method how to know when the callstack entry with the line number equal 0 occured on constructor).

Share this post


Link to post
Share on other sites

This topic is 2493 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.

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