Skip to content

Infinite recursion of use() #291

Description

@Victorystick

Attempting to Rollup (0.20.5) some code today yielded:

gobble: 04-rollup transformation failed

input:  /Users/oskar/widespace/repo/.gobble/03-include/1
output: /Users/oskar/widespace/repo/.gobble/04-rollup/1
>>>
Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at Array.forEach (native)
    at Declaration.use (/Users/oskar/widespace/repo/node_modules/rollup/Volumes/Storage/www/ROLLUP/rollup/src/ast/Scope.js:67:16)
    at /Users/oskar/widespace/repo/node_modules/rollup/Volumes/Storage/www/ROLLUP/rollup/src/ast/Scope.js:67:40
    at Array.forEach (native)
    at Declaration.use (/Users/oskar/widespace/repo/node_modules/rollup/Volumes/Storage/www/ROLLUP/rollup/src/ast/Scope.js:67:16)
    ...
<<<

We currently set isUsed, but never prevent the recursion.

    use () {
+       if ( this.isUsed ) return;
+
        this.isUsed = true;
        this.statement.mark();

        if ( this.original ) this.original.use();

        this.aliases.forEach( alias => alias.use() );
    }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions