| 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 'boolean': 'bool', | 22 'boolean': 'bool', |
| 23 'DOMObject': 'Object', | 23 'DOMObject': 'Object', |
| 24 'DOMString': 'String', | 24 'DOMString': 'String', |
| 25 'DOMStringList': 'List<String>', |
| 25 'DOMTimeStamp': 'int', | 26 'DOMTimeStamp': 'int', |
| 26 'Date': 'Date', | 27 'Date': 'Date', |
| 27 # Map to num to enable callers to pass in Dart int, rational | 28 # Map to num to enable callers to pass in Dart int, rational |
| 28 # types. Our implementations will need to convert these to | 29 # types. Our implementations will need to convert these to |
| 29 # doubles or floats as needed. | 30 # doubles or floats as needed. |
| 30 'double': 'num', | 31 'double': 'num', |
| 31 'float': 'num', | 32 'float': 'num', |
| 32 'int': 'int', | 33 'int': 'int', |
| 33 # Map to extra precision - int is a bignum in Dart. | 34 # Map to extra precision - int is a bignum in Dart. |
| 34 'long': 'int', | 35 'long': 'int', |
| (...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 Arguments: | 1948 Arguments: |
| 1948 info: An OperationInfo object. | 1949 info: An OperationInfo object. |
| 1949 """ | 1950 """ |
| 1950 # TODO(vsm): Handle overloads. | 1951 # TODO(vsm): Handle overloads. |
| 1951 self._members_emitter.Emit( | 1952 self._members_emitter.Emit( |
| 1952 '\n' | 1953 '\n' |
| 1953 ' $TYPE $NAME($ARGS) native;\n', | 1954 ' $TYPE $NAME($ARGS) native;\n', |
| 1954 TYPE=info.type_name, | 1955 TYPE=info.type_name, |
| 1955 NAME=info.name, | 1956 NAME=info.name, |
| 1956 ARGS=info.arg_implementation_declaration) | 1957 ARGS=info.arg_implementation_declaration) |
| OLD | NEW |