Nodes not initialized "final" when not subtype of a root node

Issue #165 invalid
Jesper Öqvist created an issue

If a node is not a subtype of a root node, then it will not be initialized "final" - i.e. is$Final(true). Test case (see tests/syn/lazy04):

###Test.ast:

A ::= B*;
B ::= C*;
C;

###Test.jrag:

aspect Test {
        syn lazy Object B.attr() = new Object();

        // invoke attr twice to find out if it is cached
        syn boolean B.isAttrCached() = attr() == attr();
}

###Test.java:

public class Test {
        public static void main(String[] args) {
                B b = new B();

                test("B.attr should be cached", b.isAttrCached());
        }
}

Comments (1)

  1. Jesper Öqvist reporter

    Marking this as invalid because the current behaviour is correct

    A non-root node is set to final when it is accessed through it's parent using getChild. However, this means that subtypes of root nodes should probably not be set to final, but this is a separate issue.

    I assumed that the lack of final-initialization was a bug, but it is intended to work this way since nodes may be constructed during rewrite.

  2. Log in to comment