escodegen icon indicating copy to clipboard operation
escodegen copied to clipboard

Unknown node type "ExperimentalSpreadProperty"

Open m-a-r-c-e-l-i-n-o opened this issue 8 years ago • 0 comments

Hello, thank you for the awesome project. I received an "Unknown node type ExperimentalSpreadProperty" error as I was traversing the ast tree with estraverse. So I decided to add ExperimentalSpreadProperty: ['argument'] around here. But life is never this easy, escodegen immediately proceeded to throw a TypeError: this[type] is not a function error here -- complaining (rightfully so) that this type "ExperimentalSpreadProperty" does not exist.

Are there plans to support the ExperimentalSpreadProperty soon? If not, what is the minimal I need to know to do this right? Perhaps starting with a brief explanation of what the precedence and flags arguments dictate, if they are relevant in this case. Without spending too much time, the code below is currently getting me from point A to point B:

CodeGenerator.prototype.ExperimentalSpreadProperty = function (expr, precedence, flags) {
    return [
        '...',
        this.generateExpression(expr.argument, precedence, flags)
    ].join('')
}

m-a-r-c-e-l-i-n-o avatar Sep 15 '16 23:09 m-a-r-c-e-l-i-n-o