Improving compiler error message for script function without return type

Started by
2 comments, last by WitchLord 9 years, 5 months ago

class Foo
{
    Foo()  {}
    ~Foo() {}

    doSomething() {}
}

If the return type is accidentally left off a function, the compile error says, "The name of constructors and destructors must be the same as the class"

In the above example the mistake is trivial to see.. but if it is in some large class (i.e. a copy/paste mistake) and the error sends you looking at the ctor(s)/dtor(s), which are fine.. it can potentially take some time to track down what went wrong.

Would it be possible to print the name of the offending function?

If a script function does not have a return parameter, is it most commonly a typo'd ctor/dtor?

Thank you!

Advertisement

Why aren't you printing the line number for the error message too? It should make it quite easy to find which function is incorrect :)

I'll look into improving the error message.

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


Why aren't you printing the line number for the error message too?

I am and that was the first thing I asked my user :)

I guess they saw the error message and went on a tangent (looking at the ctors/dtors).

I've improved the error message in revision 2055.

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

This topic is closed to new replies.

Advertisement