Skip to content

lengthToLen() is called when the selection pattern doesn't fully match #21

@rcludwick

Description

@rcludwick

So part of tracking down the length issue (since I'm seeing that currently), I noticed that the
call transforms.lengthToLen() got called repeatedly for transforms that weren't related to the selection definition for that
function.

Breaking in with the python debugger gave me the following:

In compiler/__init__.py(38):transformAST()
-> import pdb; pdb.set_trace()
(Pdb) print selector
Child(Type(DOT:15) > Type(IDENT=length:164))

There should be a METHOD_CALL in front of that according to what's in config/default.py:

(Type('METHOD_CALL') > Type('DOT') > Type('IDENT', 'length'), transform.lengthToLen)

Further tracing shows the problem to be in the Selector.gt() function in lang/selector.py:

def __gt__(self, other):
    """ E > F

    Like CSS: "E > F": an F element child of an E element
    """
    return Child(self, other)

In the case of Type(A) > Type(B) > Type(C), the interpreter is evaluating Type(A) > Type(B) as True first and then returns the
value of Type(B) > Type(C).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions