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 the systems to generate | 6 """This module provides shared functionality for the systems to generate |
7 native binding from the IDL database.""" | 7 native binding from the IDL database.""" |
8 | 8 |
9 import emitter | 9 import emitter |
10 import os | 10 import os |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 ''' | 1746 ''' |
1747 if wrap_unwrap_list and wrap_unwrap_list[0]: | 1747 if wrap_unwrap_list and wrap_unwrap_list[0]: |
1748 emit_jso_template = ''' | 1748 emit_jso_template = ''' |
1749 $METADATA$DART_DECLARATION => %s($DART_NAME($ACTUALS)); | 1749 $METADATA$DART_DECLARATION => %s($DART_NAME($ACTUALS)); |
1750 ''' | 1750 ''' |
1751 if return_type == 'Rectangle': | 1751 if return_type == 'Rectangle': |
1752 jso_util_method = 'make_dart_rectangle' | 1752 jso_util_method = 'make_dart_rectangle' |
1753 elif wrap_unwrap_list[0]: | 1753 elif wrap_unwrap_list[0]: |
1754 jso_util_method = 'wrap_jso' | 1754 jso_util_method = 'wrap_jso' |
1755 | 1755 |
1756 # Always return List<String> unwrapped. | 1756 emit_template = emit_jso_template % jso_util_method |
1757 if return_type != 'List<String>': | |
1758 emit_template = emit_jso_template % jso_util_method | |
1759 | 1757 |
1760 if caller_emitter: | 1758 if caller_emitter: |
1761 caller_emitter.Emit(emit_template, | 1759 caller_emitter.Emit(emit_template, |
1762 METADATA=metadata, | 1760 METADATA=metadata, |
1763 DART_DECLARATION=dart_declaration, | 1761 DART_DECLARATION=dart_declaration, |
1764 DART_NAME=full_dart_name, | 1762 DART_NAME=full_dart_name, |
1765 ACTUALS=actuals) | 1763 ACTUALS=actuals) |
1766 cpp_callback_name = '%s%s' % (idl_name, native_suffix) | 1764 cpp_callback_name = '%s%s' % (idl_name, native_suffix) |
1767 | 1765 |
1768 self._cpp_resolver_emitter.Emit( | 1766 self._cpp_resolver_emitter.Emit( |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 | 2032 |
2035 def _IsCustom(op_or_attr): | 2033 def _IsCustom(op_or_attr): |
2036 assert(isinstance(op_or_attr, IDLMember)) | 2034 assert(isinstance(op_or_attr, IDLMember)) |
2037 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s | 2035 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s |
2038 | 2036 |
2039 def _IsCustomValue(op_or_attr, value): | 2037 def _IsCustomValue(op_or_attr, value): |
2040 if _IsCustom(op_or_attr): | 2038 if _IsCustom(op_or_attr): |
2041 return op_or_attr.ext_attrs.get('Custom') == value \ | 2039 return op_or_attr.ext_attrs.get('Custom') == value \ |
2042 or op_or_attr.ext_attrs.get('DartCustom') == value | 2040 or op_or_attr.ext_attrs.get('DartCustom') == value |
2043 return False | 2041 return False |
OLD | NEW |