estools / esvalid

confirm that a SpiderMonkey format AST represents an ECMAScript program
26 stars 7 forks source link

Use esutils.ast.isProblematicIfStatement #20

Closed Constellation closed 10 years ago

Constellation commented 10 years ago

I've extracted esmangle's isProblematicIfStatement routine to esutils. It covers edge cases. For example,

{
    type: "IfStatement",
    test: EXPR,
    consequent: {
        type: "LabeledStatement",
        body: {type: "IfStatement", test: EXPR, consequent: STMT}
    },
    alternate: STMT
}

is also an invalid node.

Constellation commented 10 years ago

Updated :)

michaelficarra commented 10 years ago

You're the best, Yusuke! I'm going to add assertions for number of errors so we can try to minimise all these tests.

Constellation commented 10 years ago

Thank you for merging!!