-
Notifications
You must be signed in to change notification settings - Fork 45
Rpc service parsing #173
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
Rpc service parsing #173
Conversation
StartScope(); | ||
var indexAsOpcode = new OpcodeAttribute(serviceIndex, true); | ||
var returnStruct = new StructDefinition( | ||
$"_{serviceName.ToPascalCase()}{name.ToPascalCase()}Return", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should throw an extra delimiter between the service name and function name for good measure, so that _User_ListAdd
and _UserList_Add
or something won't clash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be cool to make some helper methods for this, like
private static string RpcNamePrefix(string serviceName, string name)
=> $"_{serviceName.ToPascalCase()}_{name.ToPascalCase()}";
private static string RpcReturnStructName(string serviceName, string name)
=> RpcNamePrefix(serviceName, name) + "Return";
just in case we change our minds about e.g. the Pascal-casing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things on this
- I assume that the different languages will convert to whatever name capitalization makes sense for them (e.g. Rust will use pascal for structs no matter what the name here is and snake case for functions) if they care
- You are right that another delimiter is technically needed, but a
_
might be problematic because of the previous point.
Since the structs are not really to be used by the end user we could just uglify them a bit and use something like "_Service{serviceName}Function{functionName}" even. All that matters is we know what it is when we go to generate code.
# Conflicts: # Compiler/Properties/launchSettings.json
Progress tracked by
https://github.com/RainwayApp/bebop/projects/2
Follows #177