Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1130)

Unified Diff: mojo/public/tools/bindings/pylib/mojom/generate/generator.py

Issue 2891193002: Mojo JS bindings: switch all mojo/ layout tests to use the new mode. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/pylib/mojom/generate/generator.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/generator.py b/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
index c7bbbe3c119b4d82fe32e143423453ec81502260..2778dcb25825f850c03fe94976725eee8e85e0ff 100644
--- a/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
@@ -25,9 +25,9 @@ def ToCamel(identifier, lower_initial=False, dilimiter='_'):
if |lower_initial| is set to True), and joins the words. Please note that for
each word, all the characters except the first one are untouched.
"""
- result = ''.join(
- word[0].upper() + word[1:] for word in identifier.split(dilimiter))
- if lower_initial:
+ result = ''.join(word[0].upper() + word[1:]
+ for word in identifier.split(dilimiter) if word)
+ if lower_initial and result:
result = result[0].lower() + result[1:]
return result

Powered by Google App Engine
This is Rietveld 408576698