2.24.0 Cannot instantiate a class outside of it's namespace

Started by
4 comments, last by WitchLord 11 years, 9 months ago
Hello, I've been testing the 2.24.0 release with namespaces and I think i found a bug.

Say we have the following script code:


namespace TestNamespace
{
class MyHappyClass
{
MyHappyClass ()
{
}

void DoSomething ()
{
//Actually should be called: DoNothing ()
}
}
}

void main ()
{
TestNamespace::MyHappyClass ClassInstance;

ClassInstance.DoSomething ();
}



We get the following error:

test.as (17, 1) : INFO : Compiling void main()
test.as (19, 17) : ERR : Identifier 'MyHappyClass' is not a data type
test.as (0, 0) : ERR : Script failed to build



Even if I remove the "TestNamespace::" from the ClassInstance declaration, the compiling error persists sad.png
format c: /q
Advertisement
I'll look into it.

Thanks for the clear report.

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

I've fixed this bug in revision 1355.

Thanks,
Andreas

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

Hey Andreas, I've tried with version 2.24.0a (Which by the way is not linked in the main page wink.png ), and I can tell you that, at least under a simple example, the bug is fixed.

BUT!
I'm affraid I found another similar bug sad.png

If you try to inherit from a class that's inside a namespace from OUTSIDE of that namespace, you get a compiler error.
Example code:


namespace Test
{
class FSM
{
}

}

class AdvancedFSM: Test::FSM
{
}

void main ()
{
AdvancedFSM Adv;
}


We get the following output:


main.fss (9, 24) : ERR : Expected '{'
main.fss (0, 0) : ERR : Script failed to build
format c: /q
Ah, the parser is not expecting the scope in the inheritance list. I'll have this corrected.

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

Fixed in revision 1362.

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