Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove redundant Return node after processing an ASR through subroutine_from_function pass #2420

Closed
@anutosh491

Description

@anutosh491

From #2419

When we go from

def func() -> S:
    return pi

To something like

def func(r: Out[S]) -> None:
    r = pi

Or any cases like this where the subroutine_from_function pass is involved, we don't get rid of the redundant Return node in the function body.

                                    (=
                                        (Var 3 _lpython_return_variable)
                                        (IntrinsicScalarFunction
                                            SymbolicPi
                                            []
                                            0
                                            (SymbolicExpression)
                                            ()
                                        )
                                        ()
                                    )
                                    (Return)

Whereas x->m_return_var points to nullptr so we don't need this node.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions