randomPoison / cs-bindgen

Experiment in using Rust to build a library that can be loaded by Unity across multiple platforms
4 stars 0 forks source link

Function argument names can conflict with C# keywods #67

Open randomPoison opened 4 years ago

randomPoison commented 4 years ago

If an exported item in Rust has a name that's valid in Rust but is a reserved keyword in C# the generated code won't compile. This is mainly an issue for single word function arguments, since type names and field names are converted to CamelCase and so shouldn't conflict with any keywords. If an argument in an exported function is not a valid C# argument name, we should prefix it with an underscore in the generated C# code.

Reference the list of C# keywords to determine which names we need to handle.