stringtemplate4 icon indicating copy to clipboard operation
stringtemplate4 copied to clipboard

Interpreter.getAttribute scans attributes of parent scopes but ignores dictionaries

Open almondtools opened this issue 2 years ago • 1 comments

I found an unexpected behavior on resolving dictionaries and tracked it down to attribute resolution.

I found this code:

        // got to root scope and no definition, try dictionaries in group and up
        final ST self = scope.st;
        STGroup g = self.impl.nativeGroup;
        Object o = getDictionary(g, name);
        if ( o!=null ) return o;

        // not found, report unknown attr
        throw new STNoSuchAttributeException(name, scope);

According to the comment ("try dictionaries in group and up") dictionaries of parent scopes should have been resolved, but the code does not.

Now what is wrong? The comment or the code?

Actually I cannot reduce my code to a reproducing example, but I can try to provide a new example if the code is considered wrong.

almondtools avatar Aug 26 '21 15:08 almondtools

Hmm...That does seem strange but unfortunately I'm not sure what the correct behavior is because it's been so long and I don't have time to investigate at the moment sorry!

parrt avatar Aug 27 '21 00:08 parrt