Sign in to follow this  
saejox

Mixin in different section compile error

Recommended Posts

Hi,

If a mixin and a class are in different script sections it causes a compile error.
compile error is non-nonsensical. probably a parsing error.

here is the minimal setup for the error
Test1.as
[CODE]
class Base : MChild
{

};
[/CODE]

Test2.as
[CODE]
mixin class MChild
{
// error occurs only if one or more functions exists in mixin.
void SomeFunc()
{

}
};
[/CODE]

c++ , simple load from file
[CODE]
engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
engine->SetMessageCallback(asFUNCTION(MessageCallback), 0, asCALL_CDECL);
mod = engine->GetModule("TEST", asEGMFlags::asGM_ALWAYS_CREATE);
string f;
LoadScriptFile("Test1.as", f);
mod->AddScriptSection("Test1.as", f.c_str());
f = "";
LoadScriptFile("Test2.as", f);
mod->AddScriptSection("Test2.as", f.c_str());
mod->Build();
[/CODE]

error does not occur if both are in same section.
error is : Test1.as (5, 12) ERR: Expected '{'

Thanks.

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