Skip to content

Side-effects in StlDiscreteTimeOfflineAstVisitor #197

@ManCla

Description

@ManCla

In the STL discrete-time offline AstVisitor some of the visit functions manipulate the variable returned by the recursive call to self.visit(node.children[0], *args, **kwargs) (most times called sample). However, this is the very same variable that was stored in the result field of the ast at line 14. Therefore, the changes performed in the visit functions will cause side-effects in the ast.result dictionary.

In visitVariable even the input traces are directly returned and might be changed by other functions.

Solution is either to change the visit function at line14 to store a copy of the variables in ast.results or to avoid all changes to the sample variable in the various visit functions. Probably best to do both?

I have not checked if other interpreters have the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions