Advertisement

Default parameters within namespace

Started by June 05, 2014 08:15 PM
1 comment, last by WitchLord 10 years ago

I have some binding code along these lines:


engine->SetDefaultNamespace("MyNamespace");

engine->RegisterObjectType("MyType", sizeof(MyType), asOBJ_VALUE | as OBJ_POD | ...);

engine->RegisterObjectMethod("SomeObject", "MyType AFunction(MyType param = MyType()) const", ...);

If in script you call AFunction() and don't provide the default parameter, that script will fail to compile with:


Identifier 'MyType' is not a data type
A cast operator has one argument
Identifier 'MyType' is not a data type
The type of the default argument expression doesn't match the function parameter type

Is it possible to make the compiler look at the current 'default namespace' when resolving this default parameter?

Thank you!

Yes, it should be possible to make the compiler use the namespace of function that the default arg is being evaluated for. I'll look into it.

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

Advertisement

This has been implemented in revision 2049. Thanks.

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