Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reserved keywords #232

Merged

Conversation

bilal-alsharifi
Copy link
Collaborator

@bilal-alsharifi bilal-alsharifi commented Mar 23, 2020

Fixes #231

This PR adds a list of keywords that RPC Generators in all platforms (iOS, Java Suite, JavaScript Suite) should avoid using by following these rules:

  • If the generator needs to create a variable or method and the name was one of the names in the reserved keyword, the generator should append the suffix Param to it. For example getFunctionID > getFunctionIDParam
  • Any empty line in the reserved keywords file should be ignored
  • Any line in the reserved keywords file that starts with one or more # symbols then space should be considered a comment and ignored (like #<space> or ##<space> or ###<space> …). Note that some reserved keywords have a # without a <space> so it can't just check for #.
  • Reserved keywords matching should be case insensitive
  • Although the reserved keywords list has a section for each platform, The generator for each platform should avoid using any of the keywords whether it belongs to that platform or another one.

@crokita
Copy link

crokita commented Mar 24, 2020

There is a weird case for CancelInteraction where both getFunctionID and setFunctionID are used, but only the getFunctionID is a reserved keyword. If we want consistency with the method name changes, setFunctionID may need to be added to this list so that both will have the same suffix once generated. Thoughts?

@bilal-alsharifi
Copy link
Collaborator Author

Good point @crokita I am okay with adding setFunctionID to prevent that weird case from happening. What do you think @joeljfischer ?

@joeljfischer
Copy link
Contributor

the generator should append the suffix param to it.

For clarity, I think that should be Param.

Any line in the reserved keywords file that starts with one or more # symbols then space should be considered a comment and ignored

I would add that some reserved keywords have a # without a <space> so it can't just check for #

RpcParser/RESERVED_KEYWORDS Outdated Show resolved Hide resolved
RpcParser/RESERVED_KEYWORDS Outdated Show resolved Hide resolved
RpcParser/RESERVED_KEYWORDS Outdated Show resolved Hide resolved
RpcParser/RESERVED_KEYWORDS Outdated Show resolved Hide resolved
@joeljfischer
Copy link
Contributor

I think this should also be case insensitive

Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
@bilal-alsharifi
Copy link
Collaborator Author

@joeljfischer I applied your requested changes.

@crokita
Copy link

crokita commented Mar 24, 2020

Please resolve my previous question about adding setFunctionID to the list before continuing

@bilal-alsharifi
Copy link
Collaborator Author

@crokita done.

@crokita crokita self-requested a review March 25, 2020 13:24
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.

None yet

4 participants