Skip to content

Lose "()" after parse and cause Syntax error in js #114

@forthlsss

Description

@forthlsss

here is a content:

function _fAddItem(_aoContainer, _aoItem, _anIndex)
{
({}).toString.call([]) != "[object Array]" && (_aoItem = [_aoItem]);
return _aoContainer.slice(0, _anIndex).concat(_aoItem).concat(_aoContainer.slice(_anIndex, _aoContainer.length));
};

and this is my code

from slimit.parser import Parser
parser = Parser()
tree = parser.parse(content)
print tree.to_ecma()

and then i got this

function _fAddItem(_aoContainer, _aoItem, _anIndex) {
{
}.toString.call([]) != "[object Array]" && (_aoItem = [_aoItem]);
return _aoContainer.slice(0, _anIndex).concat(_aoItem).concat(_aoContainer.slice(_anIndex, _aoContainer.length));
}
;
I found that the "()" in the "({}}"" in line 3 of the content is gone and casued Syntax error in js
i wonder which part of code what reason caused this.
I have not learned lexer, parser or something,i want to know whether i have the ability to learn and fix it by myself or not ,and if it will takes me too much time.
I will be appreciate if someone can help

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