| Index: tools/dom/scripts/generator.py
|
| diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
|
| index 1a9ee7fff5c15cd580107557de828dec1c202b00..f1a5fa058acc27d390e7e75d47a3b2c3a9e4b599 100644
|
| --- a/tools/dom/scripts/generator.py
|
| +++ b/tools/dom/scripts/generator.py
|
| @@ -1211,7 +1211,10 @@ class PrimitiveIDLTypeInfo(IDLTypeInfo):
|
| type = 'RefPtr<%s>' % type
|
| if type == 'String':
|
| type = 'DartStringAdapter'
|
| - return '%s', type, 'DartUtilities', 'dartTo%s' % self._capitalized_native_type()
|
| + target_type = self._capitalized_native_type()
|
| + if self.idl_type() == 'Date':
|
| + target_type = 'Date'
|
| + return '%s', type, 'DartUtilities', 'dartTo%s' % target_type
|
|
|
| def parameter_type(self):
|
| if self.native_type() == 'String':
|
| @@ -1222,8 +1225,14 @@ class PrimitiveIDLTypeInfo(IDLTypeInfo):
|
| return []
|
|
|
| def to_dart_conversion(self, value, interface_name=None, attributes=None):
|
| - function_name = self._capitalized_native_type()
|
| - function_name = function_name[0].lower() + function_name[1:]
|
| + # TODO(antonm): if there are more instances of the case
|
| + # when conversion depends on both Dart type and C++ type,
|
| + # consider introducing a corresponding argument/class.
|
| + if self.idl_type() == 'Date':
|
| + function_name = 'date'
|
| + else:
|
| + function_name = self._capitalized_native_type()
|
| + function_name = function_name[0].lower() + function_name[1:]
|
| function_name = 'DartUtilities::%sToDart' % function_name
|
| if attributes and 'TreatReturnedNullStringAs' in attributes:
|
| function_name += 'WithNullCheck'
|
| @@ -1332,7 +1341,7 @@ _idl_type_registry = monitored.Dict('generator._idl_type_registry', {
|
| 'any': TypeData(clazz='Primitive', dart_type='Object', native_type='ScriptValue'),
|
| 'Array': TypeData(clazz='Primitive', dart_type='List'),
|
| 'custom': TypeData(clazz='Primitive', dart_type='dynamic'),
|
| - 'Date': TypeData(clazz='Primitive', dart_type='Date', native_type='double'),
|
| + 'Date': TypeData(clazz='Primitive', dart_type='DateTime', native_type='double'),
|
| 'DOMObject': TypeData(clazz='Primitive', dart_type='Object', native_type='ScriptValue'),
|
| 'DOMString': TypeData(clazz='Primitive', dart_type='String', native_type='String'),
|
| # TODO(vsm): This won't actually work until we convert the Map to
|
|
|