t-artistik / qtscriptgenerator

Automatically exported from code.google.com/p/qtscriptgenerator
0 stars 0 forks source link

qtscriptgenerator strips reference from type #68

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a class with a function returning a reference
2. Convert that reference to a pointer with:
   <modify-function signature="getFoo( )">
        <modify-argument index="return">
            <replace-type modified-type="Foo*" />
            <conversion-rule class="native">
                Foo* %out% = &amp;%in%;
            </conversion-rule>
        </modify-argument>
    </modify-function> 

What is the expected output? What do you see instead?

This should result in a conversion in qtscript_Foo_prototype_call
that looks like

Foo& _q_result = _q_self->getFoo();        
Foo* _q_convertedResult = &_q_result ;
return qScriptValueFromValue(context->engine(), _q_convertedResult);

but instead i get

Foo _q_result = _q_self->getFoo();  //reference type is missing       
Foo* _q_convertedResult = &_q_result ; //creates a pointer to a local var
return qScriptValueFromValue(context->engine(), _q_convertedResult);

The pointer will get invalid when the function returns.

Original issue reported on code.google.com by zbnj...@gmail.com on 16 Feb 2010 at 3:25