mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 18:32:11 +00:00
Merge pull request #1230 from flaviut/fix1226
Fix 1226 and document associated methods
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
|
||||
proc mangleField(name: string): string =
|
||||
result = mangle(name)
|
||||
if name[0] in 'a'..'z':
|
||||
result[0] = name[0].toUpper
|
||||
result[0] = result[0].toUpper # Mangling makes everything lowercase,
|
||||
# but some identifiers are C keywords
|
||||
|
||||
proc isKeyword(w: PIdent): bool =
|
||||
# nimrod and C++ share some keywords
|
||||
|
||||
@@ -162,6 +162,9 @@ proc makeSingleLineCString*(s: string): string =
|
||||
result.add('\"')
|
||||
|
||||
proc mangle*(name: string): string =
|
||||
## Lowercases the given name and manges any non-alphanumeric characters
|
||||
## so they are represented as `HEX____`. If the name starts with a number,
|
||||
## `N` is prepended
|
||||
result = ""
|
||||
case name[0]
|
||||
of Letters:
|
||||
|
||||
Reference in New Issue
Block a user