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

Unified Diff: lib/dom/scripts/generator.py

Issue 10217004: Get rid of overloaded toDartValue. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/scripts/generator.py
diff --git a/lib/dom/scripts/generator.py b/lib/dom/scripts/generator.py
index d7a2fe126b966bdf3aab202087d1a6bd270b1d64..198c0cfaf63e68511e1b25d1731781a44fafa3ba 100644
--- a/lib/dom/scripts/generator.py
+++ b/lib/dom/scripts/generator.py
@@ -7,7 +7,6 @@
Dart APIs from the IDL database."""
import re
-import string
_pure_interfaces = set([
'DOMStringMap',
@@ -543,13 +542,9 @@ class PrimitiveIDLTypeInfo(IDLTypeInfo):
conversion_arguments = [value]
if attributes and 'TreatReturnedNullStringAs' in attributes:
conversion_arguments.append('DartUtilities::ConvertNullToDefaultValue')
- function_name = 'toDartValue'
- # FIXME: implement DartUtilities::toDart for other primitive types and
- # remove this list.
- if self.native_type() in ['String', 'bool', 'int', 'unsigned', 'long long', 'unsigned long long', 'double']:
- function_name = string.capwords(self.native_type()).replace(' ', '')
- function_name = function_name[0].lower() + function_name[1:]
- function_name = 'DartUtilities::%sToDart' % function_name
+ function_name = re.sub(r' [a-z]', lambda x: x.group(0)[1:].upper(), self.native_type())
Anton Muhin 2012/04/25 10:05:18 nit. I am probably biased here, but is it more re
podivilov 2012/04/25 11:12:58 I've changed this logic for ScriptValue -> scriptV
Anton Muhin 2012/04/25 13:09:55 I see, thanks for explanations. Still maybe: def
+ function_name = function_name[0].lower() + function_name[1:]
+ function_name = 'DartUtilities::%sToDart' % function_name
return '%s(%s)' % (function_name, ', '.join(conversion_arguments))
def webcore_getter_name(self):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698