Advertisement

function call operators?

Started by January 16, 2014 04:57 PM
12 comments, last by gjl 10 years, 10 months ago

To be more precise, what happens is the following:


class Functor
{
    void opCall()
    {
    }
};

class Test
{
    Functor f;
}

Test h;

void globalVariableCall()
{
    // This Runs fine
    h.f();
}

void localVariableCall()
{
    Test local;
    // This crashes when calling the opCall
    local.f();
}

A quick update:

I think I have now been able to fix the problem: in the case of a member access, the CompileVariableAccess method does not work (which is not surprising I guess. It seems this one is defigned for variable access inside of a function right, not accessed as a member, except maybe if written this.myMember, right?). So I have gathered the code managing member access (the one managing 'ttDot' in CompileExpressionPostOp) into a method that I call instead of CompileVariableAccess, and it seems to work.

Still needs some more testing, but if it runs fine I'll share the new code. Given my limited understanding of the compiler, there is probably a better way to do it though, but I might need some help to clean it up!

Advertisement

I'm sorry I couldn't help more, but I was on vacation and wasn't always able to keep up with the forum posts. But, it seems you managed to sort it out anyway :)

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

No problem, I think it was a good way to get started with angelscript's implementation. smile.png And thanks for the support!

This topic is closed to new replies.

Advertisement