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:
class A {
def boolean isX() {
if (result) {
}
result := false;
}
}
The error is "Couldn't find the 'result' variable".
Expected behavior
Not sure. One of the following:
result is set a default value,
- it is explicitely forbidden to use result without initializing it first and this is enforced by an error marker in the editor.
How to reproduce
Steps to reproduce the behavior:
- Create an ALE project
- Write a semantics that uses
result in an expression as shown above
- Run the interpreter
Additional context
Issue caused by the following line:
|
result = aqlEngine.eval(dummyAstResult, scopes.getCurrent().getVariableValues()); |
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
resultin 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:
resultis set a default value,How to reproduce
Steps to reproduce the behavior:
resultin an expression as shown aboveAdditional context
Issue caused by the following line:
ale-lang/plugins/org.eclipse.emf.ecoretools.ale.core/src/org/eclipse/emf/ecoretools/ale/core/interpreter/internal/MethodEvaluator.java
Line 688 in a1a0bf8
Since
resulthas not been initialized yet, the map returned byscopes.getCurrent().getVariableValues()won't contain it. The appropriate fix depends on the chosen solution.