- changed status to resolved
Component declared NTA in both AST and JRAG discards equation result
Issue #198
resolved
This bug is active in at JastAdd 2.1.5 through 2.1.10.
In the below example, the B NTA is always evaluated as null
:
A ::= /B/;
B;
aspect Test {
syn nta B A.getB() = new B();
}
This bug is caused by the setB method not being called in the attribute evaluation method:
@ASTNodeAnnotation.Attribute
public B getB() {
if(getB_computed) {
return (B) getChild(getBChildPosition());
}
if (getB_visited) {
throw new RuntimeException("Circular definition of attr: getB in class: org.jastadd.ast.AST.SynDecl");
}
getB_visited = true;
boolean intermediate = state.INTERMEDIATE_VALUE;
state.INTERMEDIATE_VALUE = false;
getB_value = new B();
getB_value.setParent(this);
if (true) {
getB_computed = true;
} else {
}
state.INTERMEDIATE_VALUE |= intermediate;
getB_visited = false;
B node = (B) this.getChild(getBChildPosition());
return node;
}
This is caused by the code generation skipping the generation of setB
because B was declared NTA in the aspect file. If the nta
is removed from syn nta ...
then the error disappears.
Comments (2)
-
reporter -
reporter Even though I have only checked as far back as version 2.1.5, this issue was likely active much farther back than that.
- Log in to comment
Fixed storing of NTA value bug
fixes
#198(bitbucket)→ <<cset 1b4be8d9ade0>>