Skip to content

...doesn't like inheritance with underscores #2

@donalffons

Description

@donalffons

Hi, thank you for this great project!

I tried to use this tool on this idl file (I am using Emscripten in this project). With that file, I get the following error.

$ yarn webidl2ts -i ./opencascade.idl -n opencascade -ed -o ./dist/opencascade.d.ts
yarn run v1.22.4
$ /home/sebastian/Projects/opencascade.js/node_modules/.bin/webidl2ts -i ./opencascade.idl -n opencascade -ed -o ./dist/opencascade.d.ts
(node:173512) UnhandledPromiseRejectionWarning: WebIDLParseError: Syntax error at line 107, since `interface BRepPrimAPI_MakeCylinder`:
BRepPrimAPI_MakeCylinder implements BRepPrimAPI_MakeOneAxis;
^ Unrecognised tokens
    at tokeniser_Tokeniser.error (/home/sebastian/Projects/opencascade.js/node_modules/webidl2/dist/webidl2.js:1:20350)
    at r (/home/sebastian/Projects/opencascade.js/node_modules/webidl2/dist/webidl2.js:1:33487)
    at L (/home/sebastian/Projects/opencascade.js/node_modules/webidl2/dist/webidl2.js:1:34464)
    at Module.q (/home/sebastian/Projects/opencascade.js/node_modules/webidl2/dist/webidl2.js:1:34604)
    at Object.<anonymous> (/home/sebastian/Projects/opencascade.js/node_modules/webidl2ts/dist/parse-idl.js:47:43)
    at step (/home/sebastian/Projects/opencascade.js/node_modules/webidl2ts/dist/parse-idl.js:33:23)
    at Object.next (/home/sebastian/Projects/opencascade.js/node_modules/webidl2ts/dist/parse-idl.js:14:53)
    at /home/sebastian/Projects/opencascade.js/node_modules/webidl2ts/dist/parse-idl.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/sebastian/Projects/opencascade.js/node_modules/webidl2ts/dist/parse-idl.js:4:12)
(node:173512) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:173512) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 0.87s.

I found a workaround: If I replace all underscores with some arbitrary text, it works. Seems to me like this could be a bug which is somehow related to inheritance and underscores.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions