| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, 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 generates Dart APIs from the IDL database.""" | 6 """This module generates Dart APIs from the IDL database.""" |
| 7 | 7 |
| 8 import emitter | 8 import emitter |
| 9 import idlnode | 9 import idlnode |
| 10 import logging | 10 import logging |
| 11 import multiemitter | 11 import multiemitter |
| 12 import os | 12 import os |
| 13 import re | 13 import re |
| 14 import shutil | 14 import shutil |
| 15 import snippet_manager | 15 import snippet_manager |
| 16 | 16 |
| 17 _logger = logging.getLogger('dartgenerator') | 17 _logger = logging.getLogger('dartgenerator') |
| 18 | 18 |
| 19 # IDL->Dart primitive types conversion. | 19 # IDL->Dart primitive types conversion. |
| 20 _idl_to_dart_type_conversions = { | 20 _idl_to_dart_type_conversions = { |
| 21 'any': 'Object', | 21 'any': 'Object', |
| 22 'custom': 'Dynamic', |
| 22 'boolean': 'bool', | 23 'boolean': 'bool', |
| 23 'DOMObject': 'Object', | 24 'DOMObject': 'Object', |
| 24 'DOMString': 'String', | 25 'DOMString': 'String', |
| 25 'DOMStringList': 'List<String>', | 26 'DOMStringList': 'List<String>', |
| 26 'DOMTimeStamp': 'int', | 27 'DOMTimeStamp': 'int', |
| 27 'Date': 'Date', | 28 'Date': 'Date', |
| 28 # Map to num to enable callers to pass in Dart int, rational | 29 # Map to num to enable callers to pass in Dart int, rational |
| 29 # types. Our implementations will need to convert these to | 30 # types. Our implementations will need to convert these to |
| 30 # doubles or floats as needed. | 31 # doubles or floats as needed. |
| 31 'double': 'num', | 32 'double': 'num', |
| (...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1949 Arguments: | 1950 Arguments: |
| 1950 info: An OperationInfo object. | 1951 info: An OperationInfo object. |
| 1951 """ | 1952 """ |
| 1952 # TODO(vsm): Handle overloads. | 1953 # TODO(vsm): Handle overloads. |
| 1953 self._members_emitter.Emit( | 1954 self._members_emitter.Emit( |
| 1954 '\n' | 1955 '\n' |
| 1955 ' $TYPE $NAME($ARGS) native;\n', | 1956 ' $TYPE $NAME($ARGS) native;\n', |
| 1956 TYPE=info.type_name, | 1957 TYPE=info.type_name, |
| 1957 NAME=info.name, | 1958 NAME=info.name, |
| 1958 ARGS=info.arg_implementation_declaration) | 1959 ARGS=info.arg_implementation_declaration) |
| OLD | NEW |