Skip to content

Fixed: prevent codegen'ing a function with an invalid name.#870

Closed
eventualbuddha wants to merge 1 commit intoprotobufjs:masterfrom
eventualbuddha:prevent-codegen-from-using-keyword-function-names
Closed

Fixed: prevent codegen'ing a function with an invalid name.#870
eventualbuddha wants to merge 1 commit intoprotobufjs:masterfrom
eventualbuddha:prevent-codegen-from-using-keyword-function-names

Conversation

@eventualbuddha
Copy link
Copy Markdown
Contributor

This can happen when, for example, an RPC method name is the uppercase of a keyword like "Delete". I tried to retain the performance of the original, but since the test just uses the same names over and over again and they're memoized it's not a super representative set of test data to really understand how the performance changed.

This can happen when, for example, an RPC method name is the uppercase of a keyword like "Delete".
@eventualbuddha
Copy link
Copy Markdown
Contributor Author

Ping.

@eventualbuddha
Copy link
Copy Markdown
Contributor Author

Is this project unmaintained? Do I need to do something before this can be considered?

@dcodeIO
Copy link
Copy Markdown
Member

dcodeIO commented Nov 24, 2017

Thanks, but this doesn't fix the underlying issue since these function might still be called by other parts of the library, using their original name. Instead, we should make sure that invalid names are handled on the reflection level.

@dcodeIO
Copy link
Copy Markdown
Member

dcodeIO commented Nov 27, 2017

The commit above should prevent the parse error in runtime code while still naming the method delete, hence to be accessed through myService["delete"](...). Should also be consistent with statically generated code doing the same.

@eventualbuddha
Copy link
Copy Markdown
Contributor Author

Cool, that seems like a good approach. Thanks for looking at this!

@eventualbuddha
Copy link
Copy Markdown
Contributor Author

@dcodeIO so is your solution finished? Anything I can do to help?

@dcodeIO
Copy link
Copy Markdown
Member

dcodeIO commented Nov 30, 2017

The changes are live, latest on npm is 6.8.3. Have you tested with this one?

@eventualbuddha
Copy link
Copy Markdown
Contributor Author

Oh cool, I’ll try it out tomorrow. I had assumed that since the issue was still open that the problem remained.

@dcodeIO
Copy link
Copy Markdown
Member

dcodeIO commented Feb 6, 2018

Closing for now, feel free to report any remaining issues.

@dcodeIO dcodeIO closed this Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants