| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """This module provides shared functionality for systems to generate | 6 """This module provides shared functionality for systems to generate |
| 7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
| 8 | 8 |
| 9 import copy | 9 import copy |
| 10 import json | 10 import json |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 # All getters (setters) of type. | 414 # All getters (setters) of type. |
| 415 # | 415 # |
| 416 # where DIRECTION is 'get' for getters and operation return values, 'set' for | 416 # where DIRECTION is 'get' for getters and operation return values, 'set' for |
| 417 # setters and operation arguments. INTERFACE and MEMBER are the idl names. | 417 # setters and operation arguments. INTERFACE and MEMBER are the idl names. |
| 418 # | 418 # |
| 419 | 419 |
| 420 _serialize_SSV = Conversion('convertDartToNative_SerializedScriptValue', | 420 _serialize_SSV = Conversion('convertDartToNative_SerializedScriptValue', |
| 421 'dynamic', 'dynamic') | 421 'dynamic', 'dynamic') |
| 422 | 422 |
| 423 dart2js_conversions = monitored.Dict('generator.dart2js_conversions', { | 423 dart2js_conversions = monitored.Dict('generator.dart2js_conversions', { |
| 424 'Date get': |
| 425 Conversion('_convertNativeToDart_DateTime', 'dynamic', 'DateTime'), |
| 426 'Date set': |
| 427 Conversion('_convertDartToNative_DateTime', 'DateTime', 'dynamic'), |
| 424 # Wrap non-local Windows. We need to check EventTarget (the base type) | 428 # Wrap non-local Windows. We need to check EventTarget (the base type) |
| 425 # as well. Note, there are no functions that take a non-local Window | 429 # as well. Note, there are no functions that take a non-local Window |
| 426 # as a parameter / setter. | 430 # as a parameter / setter. |
| 427 'DOMWindow get': | 431 'DOMWindow get': |
| 428 Conversion('_convertNativeToDart_Window', 'dynamic', 'WindowBase'), | 432 Conversion('_convertNativeToDart_Window', 'dynamic', 'WindowBase'), |
| 429 'EventTarget get': | 433 'EventTarget get': |
| 430 Conversion('_convertNativeToDart_EventTarget', 'dynamic', | 434 Conversion('_convertNativeToDart_EventTarget', 'dynamic', |
| 431 'EventTarget'), | 435 'EventTarget'), |
| 432 'EventTarget set': | 436 'EventTarget set': |
| 433 Conversion('_convertDartToNative_EventTarget', 'EventTarget', | 437 Conversion('_convertDartToNative_EventTarget', 'EventTarget', |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 webcore_getter_name='getUnsignedIntegralAttribute'
, | 1329 webcore_getter_name='getUnsignedIntegralAttribute'
, |
| 1326 webcore_setter_name='setUnsignedIntegralAttribute'
), | 1330 webcore_setter_name='setUnsignedIntegralAttribute'
), |
| 1327 'long long': TypeData(clazz='Primitive', dart_type='int'), | 1331 'long long': TypeData(clazz='Primitive', dart_type='int'), |
| 1328 'unsigned long long': TypeData(clazz='Primitive', dart_type='int'), | 1332 'unsigned long long': TypeData(clazz='Primitive', dart_type='int'), |
| 1329 'float': TypeData(clazz='Primitive', dart_type='num', native_type='double'), | 1333 'float': TypeData(clazz='Primitive', dart_type='num', native_type='double'), |
| 1330 'double': TypeData(clazz='Primitive', dart_type='num'), | 1334 'double': TypeData(clazz='Primitive', dart_type='num'), |
| 1331 | 1335 |
| 1332 'any': TypeData(clazz='Primitive', dart_type='Object', native_type='ScriptVa
lue'), | 1336 'any': TypeData(clazz='Primitive', dart_type='Object', native_type='ScriptVa
lue'), |
| 1333 'Array': TypeData(clazz='Primitive', dart_type='List'), | 1337 'Array': TypeData(clazz='Primitive', dart_type='List'), |
| 1334 'custom': TypeData(clazz='Primitive', dart_type='dynamic'), | 1338 'custom': TypeData(clazz='Primitive', dart_type='dynamic'), |
| 1335 'Date': TypeData(clazz='Primitive', dart_type='Date', native_type='double'), | 1339 'Date': TypeData(clazz='Primitive', dart_type='DateTime', native_type='doubl
e'), |
| 1336 'DOMObject': TypeData(clazz='Primitive', dart_type='Object', native_type='Sc
riptValue'), | 1340 'DOMObject': TypeData(clazz='Primitive', dart_type='Object', native_type='Sc
riptValue'), |
| 1337 'DOMString': TypeData(clazz='Primitive', dart_type='String', native_type='St
ring'), | 1341 'DOMString': TypeData(clazz='Primitive', dart_type='String', native_type='St
ring'), |
| 1338 # TODO(vsm): This won't actually work until we convert the Map to | 1342 # TODO(vsm): This won't actually work until we convert the Map to |
| 1339 # a native JS Map for JS DOM. | 1343 # a native JS Map for JS DOM. |
| 1340 'Dictionary': TypeData(clazz='Primitive', dart_type='Map'), | 1344 'Dictionary': TypeData(clazz='Primitive', dart_type='Map'), |
| 1341 'DOMTimeStamp': TypeData(clazz='Primitive', dart_type='int', native_type='un
signed long long'), | 1345 'DOMTimeStamp': TypeData(clazz='Primitive', dart_type='int', native_type='un
signed long long'), |
| 1342 'object': TypeData(clazz='Primitive', dart_type='Object', native_type='Scrip
tValue'), | 1346 'object': TypeData(clazz='Primitive', dart_type='Object', native_type='Scrip
tValue'), |
| 1343 'ObjectArray': TypeData(clazz='Primitive', dart_type='List'), | 1347 'ObjectArray': TypeData(clazz='Primitive', dart_type='List'), |
| 1344 'PositionOptions': TypeData(clazz='Primitive', dart_type='Object'), | 1348 'PositionOptions': TypeData(clazz='Primitive', dart_type='Object'), |
| 1345 # TODO(sra): Come up with some meaningful name so that where this appears in | 1349 # TODO(sra): Come up with some meaningful name so that where this appears in |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 self) | 1492 self) |
| 1489 | 1493 |
| 1490 if type_data.clazz == 'SVGTearOff': | 1494 if type_data.clazz == 'SVGTearOff': |
| 1491 dart_interface_name = self._renamer.RenameInterface( | 1495 dart_interface_name = self._renamer.RenameInterface( |
| 1492 self._database.GetInterface(type_name)) | 1496 self._database.GetInterface(type_name)) |
| 1493 return SVGTearOffIDLTypeInfo( | 1497 return SVGTearOffIDLTypeInfo( |
| 1494 type_name, type_data, dart_interface_name, self) | 1498 type_name, type_data, dart_interface_name, self) |
| 1495 | 1499 |
| 1496 class_name = '%sIDLTypeInfo' % type_data.clazz | 1500 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1497 return globals()[class_name](type_name, type_data) | 1501 return globals()[class_name](type_name, type_data) |
| OLD | NEW |