Using result in an expression leads to a runtime error during interpretation. For example, the following code produces an error during the evaluation of the if's condition:
class A {
def boolean isX() {
if (result) {
}
result := false;
}
}
The error is "Couldn't find the 'result' variable".
Since result has not been initialized yet, the map returned by scopes.getCurrent().getVariableValues() won't contain it. The appropriate fix depends on the chosen solution.
Bug description
Using
result
in an expression leads to a runtime error during interpretation. For example, the following code produces an error during the evaluation of the if's condition:The error is "Couldn't find the 'result' variable".
Expected behavior
Not sure. One of the following:
result
is set a default value,How to reproduce
Steps to reproduce the behavior:
result
in an expression as shown aboveAdditional context
Issue caused by the following line:
https://github.com/gemoc/ale-lang/blob/a1a0bf83da3c2228b127d4dc73e3bf733f1b9b9e/plugins/org.eclipse.emf.ecoretools.ale.core/src/org/eclipse/emf/ecoretools/ale/core/interpreter/internal/MethodEvaluator.java#L688
Since
result
has not been initialized yet, the map returned byscopes.getCurrent().getVariableValues()
won't contain it. The appropriate fix depends on the chosen solution.