static std::string swiftify()

in Sources/makeOptions/makeOptions.cpp [73:95]


static std::string swiftify(const std::string &name) {
  std::string result;
  bool shouldUppercase = false;
  for (char c : name) {
    if (c == '_') {
      shouldUppercase = true;
      continue;
    }

    if (shouldUppercase && islower(c)) {
      result.push_back(toupper(c));
    } else {
      result.push_back(c);
    }

    shouldUppercase = false;
  }

  if (swiftKeywords.count(result) > 0)
    return "`" + result + "`";

  return result;
}