jsduck icon indicating copy to clipboard operation
jsduck copied to clipboard

Add support for generator functions

Open sembrestels opened this issue 11 years ago • 2 comments

When I try to generate documentation for a file with generators, I get an error:

Invalid JavaScript syntax: Unexpected '*' on line ##

Try it with this:

function* foo(x) {
    yield x + 1;

    var y = yield null;
    return x + y;
}

I think it could be solved easily ignoring asterisks (*) when they are at the right of the function keyword.

sembrestels avatar Oct 22 '13 04:10 sembrestels

This really can't be solved with a simple patch like that.

It's a larger issue of RKelly parser not supporting ECMAScript 6, generators being just one of the several features added.

I've been working on RKelly lately, so adding ES6 support is not far-fetched. At least support for some of the ES6 features. Can't really make any promises though.

nene avatar Oct 22 '13 08:10 nene

Ok, I understand the complete fix is to add ES6 support to RKelly, I just wanted to share how I solved it easily. If somebody needs generator support in jsduck can use my patch.

sembrestels avatar Oct 22 '13 15:10 sembrestels