swp-uebersetzerbau-ss13 / common

Shared files between teams.
1 stars 0 forks source link

FUC AST implementation does not count correctly #47

Closed flofreud closed 11 years ago

flofreud commented 11 years ago

I opened the CalendarProg and counted the node by hand: 75 nodes.

Javabite AST returns for getNumberOfNodes() -> 75

FUC AST returns for getNumberOfNodes() -> 71

The ASTs created seems to be exactly the same and if I sum up all nodes found in the FUC AST tree I also count 75 but the method returns 71.

Please verify the 71 before looking for the error in cause of an error in my environment.

fub-frank commented 11 years ago

I can confirm this bug.

The problem is within ArrayIdentifierNode

@Override
public Integer getNumberOfNodes() {
    if (this.identifier == null) {
        return 1;
    }
    return 1 + this.identifier.getNumberOfNodes();
}

The array index is no longer static by commit 3a8a5793f821feef846e3d2954bfd277802b871c. Therefore calculation must be modified by adding this.indexNode.getNumberOfNodes() to the calculation

@Override
public Integer getNumberOfNodes() {
    int nodes = 1;
    if (this.indexNode != null) {
        nodes += this.indexNode.getNumberOfNodes();
    }
    if (this.identifier != null) {
        nodes += this.identifier.getNumberOfNodes();
    }
    return nodes;
}

Will be fixed as soon as possible.

leinge commented 11 years ago

I just pushed 5673b84 into fuc-master which should fix the issue. Unfortunately I cannot perform crosstesting atm, could someone confirm and close please?