Constructor entries break the parser
evanplaice opened this issue · comments
Attempting conversion on a source file that contains a class constructor or function marked w/ @constructor
breaks the parser.
Cause
The issue starts here
Line 100 in 297e61f
Further down it attempts to dynamically assign the key organized.constructor
Line 130 in 297e61f
This results in a tocGroup
receiving a TypeError as a value which throws when tocGroup.push
is called here
Line 147 in 297e61f
Resolution
The issue is due to trying to use an object that inherits from Object
as a key/value store. The name of organized (ie an array) tries and fails to overwrite the existing constructor function.
To fix this, organized
can be initialized with an object literal that doesn't inherit any properties/methods from Object
with.
organized = Object.create(null),
It's possible this may also resolve #45