| 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 |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 argtexts.append('[' + ', '.join(map(FormatArg, optional)) + ']') | 660 argtexts.append('[' + ', '.join(map(FormatArg, optional)) + ']') |
| 661 return ', '.join(argtexts) | 661 return ', '.join(argtexts) |
| 662 | 662 |
| 663 args = map(lambda *args: DartArg(args), | 663 args = map(lambda *args: DartArg(args), |
| 664 *(op.arguments for op in operations)) | 664 *(op.arguments for op in operations)) |
| 665 | 665 |
| 666 info = OperationInfo() | 666 info = OperationInfo() |
| 667 info.overloads = operations | 667 info.overloads = operations |
| 668 info.declared_name = operations[0].id | 668 info.declared_name = operations[0].id |
| 669 info.name = operations[0].ext_attrs.get('DartName', info.declared_name) | 669 info.name = operations[0].ext_attrs.get('DartName', info.declared_name) |
| 670 info.js_name = operations[0].ext_attrs.get('ImplementationFunction', | 670 info.js_name = info.declared_name |
| 671 info.declared_name) | |
| 672 info.type_name = operations[0].type.id # TODO: widen. | 671 info.type_name = operations[0].type.id # TODO: widen. |
| 673 info.arg_interface_declaration = FormatArgs(args, True) | 672 info.arg_interface_declaration = FormatArgs(args, True) |
| 674 info.arg_implementation_declaration = FormatArgs(args, False) | 673 info.arg_implementation_declaration = FormatArgs(args, False) |
| 675 info.arg_infos = args | 674 info.arg_infos = args |
| 676 return info | 675 return info |
| 677 | 676 |
| 678 | 677 |
| 679 def GenerateOldLibFile(self, lib_template, lib_file_path, file_paths): | 678 def GenerateOldLibFile(self, lib_template, lib_file_path, file_paths): |
| 680 """Generates a lib file from a template and a list of files.""" | 679 """Generates a lib file from a template and a list of files.""" |
| 681 # Generate the .lib file. | 680 # Generate the .lib file. |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 Arguments: | 1964 Arguments: |
| 1966 info: An OperationInfo object. | 1965 info: An OperationInfo object. |
| 1967 """ | 1966 """ |
| 1968 # TODO(vsm): Handle overloads. | 1967 # TODO(vsm): Handle overloads. |
| 1969 self._members_emitter.Emit( | 1968 self._members_emitter.Emit( |
| 1970 '\n' | 1969 '\n' |
| 1971 ' $TYPE $NAME($ARGS) native;\n', | 1970 ' $TYPE $NAME($ARGS) native;\n', |
| 1972 TYPE=info.type_name, | 1971 TYPE=info.type_name, |
| 1973 NAME=info.name, | 1972 NAME=info.name, |
| 1974 ARGS=info.arg_implementation_declaration) | 1973 ARGS=info.arg_implementation_declaration) |
| OLD | NEW |