Skip to content

Fields start / end not set for AST_Accessor (in getter or setter) #1492

@OndrejSpanel

Description

@OndrejSpanel

I am parsing following source:

var obj = {
  get latest() {
    return undefined;
  }
}

I am processing the AST tree created by the parser. The AST tree is mostly fine, but there is one irregularity. The node AST_Accessor (containing the getter body) shows me token properties start and end as undefined.

The Uglify code responsible for this is:

                if (name == "get") {
                    a.push(new AST_ObjectGetter({
                        start : start,
                        key   : as_atom_node(),
                        value : function_(AST_Accessor),
                        end   : prev()
                    }));
                    continue;
                }

Another places using function_ are:

function_(AST_Function) - start and end handled.
function_(AST_Defun) - seems also to miss start and end handling, I amunsure how to fix it there, as I am unsure where to get end from.

When I have adapted the code to match what is handling function_(AST_Function), it seems to fix the issue. I will submit a PR.

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