Skip to content

[core] Allow abstract node types to be valid rulechain visits  #1785

@oowekyala

Description

@oowekyala

Rulechain visits are for now entirely handled as strings:

private List<String> ruleChainVisits = new ArrayList<>();

The implementation also throws an exception (!) if the node class doesn't have a hardcoded "AST" prefix:

public void addRuleChainVisit(Class<? extends Node> nodeClass) {
if (!nodeClass.getSimpleName().startsWith("AST")) {
throw new IllegalArgumentException("Node class does not start with 'AST' prefix: " + nodeClass);
}
addRuleChainVisit(nodeClass.getSimpleName().substring("AST".length()));
}

Introducing some abstractions into the AST (like done in #1759, argumented on the wiki) has a number of advantages, but the current rulechain implementation doesn't scale. Adding a rulechain visit to an abstract node type currently does nothing, instead of visiting all nodes having the specified supertype.

Refs #1772

There's the exact same problem with XPath queries, which I'll explain in another issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions