neo3-boa icon indicating copy to clipboard operation
neo3-boa copied to clipboard

fix script_container attribute access

Open ixje opened this issue 6 months ago • 1 comments

Related issue fix #1273

Summary or solution description script_container is the only module attribute of the interop package that returns a class with more properties. The module analyser is changed to allow to capture the class properties.

In the case of importing the runtime module and trying to do

x = runtime.script_container.hash

The code generator failed to generate code for getting the script_container and only generated code for picking the hash property. It now recursively generates for all attributes instead of just the first as the AST looks as follows

                Assign(
                    targets=[
                        Name(id='x', ctx=Store())],
                    value=Attribute(
                        value=Attribute(
                            value=Name(id='runtime', ctx=Load()),
                            attr='script_container',
                            ctx=Load()),
                        attr='hash',
                        ctx=Load())),

ixje avatar Aug 24 '24 10:08 ixje