| 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 logging | 10 import logging |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 blinkClass = DeriveQualifiedName( | 186 blinkClass = DeriveQualifiedName( |
| 187 "_blink", DeriveBlinkClassName(interface_name)) | 187 "_blink", DeriveBlinkClassName(interface_name)) |
| 188 blinkInstance = DeriveQualifiedName(blinkClass, "instance") | 188 blinkInstance = DeriveQualifiedName(blinkClass, "instance") |
| 189 return DeriveQualifiedName(blinkInstance, name + "_") | 189 return DeriveQualifiedName(blinkInstance, name + "_") |
| 190 | 190 |
| 191 def NativeSpec(self): | 191 def NativeSpec(self): |
| 192 return '' | 192 return '' |
| 193 | 193 |
| 194 def StartInterface(self, members_emitter): | 194 def StartInterface(self, members_emitter): |
| 195 # Create emitters for c++ implementation. | 195 # Create emitters for c++ implementation. |
| 196 if not IsPureInterface(self._interface.id) and \ | 196 if not IsPureInterface(self._interface.id, self._database) and \ |
| 197 not IsCustomType(self._interface.id): | 197 not IsCustomType(self._interface.id): |
| 198 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter( | 198 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter( |
| 199 self._interface.id, | 199 self._interface.id, |
| 200 self._renamer.GetLibraryName(self._interface)) | 200 self._renamer.GetLibraryName(self._interface)) |
| 201 self._cpp_impl_emitter = \ | 201 self._cpp_impl_emitter = \ |
| 202 self._cpp_library_emitter.CreateSourceEmitter(self._interface.id) | 202 self._cpp_library_emitter.CreateSourceEmitter(self._interface.id) |
| 203 else: | 203 else: |
| 204 self._cpp_header_emitter = emitter.Emitter() | 204 self._cpp_header_emitter = emitter.Emitter() |
| 205 self._cpp_impl_emitter = emitter.Emitter() | 205 self._cpp_impl_emitter = emitter.Emitter() |
| 206 | 206 |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 actuals = ", ".join(['this'] + parameters) | 944 actuals = ", ".join(['this'] + parameters) |
| 945 else: | 945 else: |
| 946 formals = ", ".join(parameters) | 946 formals = ", ".join(parameters) |
| 947 actuals = ", ".join(parameters) | 947 actuals = ", ".join(parameters) |
| 948 | 948 |
| 949 if not emit_to_native: | 949 if not emit_to_native: |
| 950 caller_emitter = self._members_emitter | 950 caller_emitter = self._members_emitter |
| 951 full_dart_name = \ | 951 full_dart_name = \ |
| 952 self.DeriveQualifiedBlinkName(self._interface.id, | 952 self.DeriveQualifiedBlinkName(self._interface.id, |
| 953 dart_native_name) | 953 dart_native_name) |
| 954 if IsPureInterface(self._interface.id): | 954 if IsPureInterface(self._interface.id, self._database): |
| 955 caller_emitter.Emit( | 955 caller_emitter.Emit( |
| 956 '\n' | 956 '\n' |
| 957 ' $METADATA$DART_DECLARATION;\n', | 957 ' $METADATA$DART_DECLARATION;\n', |
| 958 METADATA=metadata, | 958 METADATA=metadata, |
| 959 DART_DECLARATION=dart_declaration) | 959 DART_DECLARATION=dart_declaration) |
| 960 else: | 960 else: |
| 961 emit_template = ''' | 961 emit_template = ''' |
| 962 $METADATA$DART_DECLARATION => $DART_NAME($ACTUALS); | 962 $METADATA$DART_DECLARATION => $DART_NAME($ACTUALS); |
| 963 ''' | 963 ''' |
| 964 if output_conversion and not dictionary_return: | 964 if output_conversion and not dictionary_return: |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1248 |
| 1249 def _IsCustom(op_or_attr): | 1249 def _IsCustom(op_or_attr): |
| 1250 assert(isinstance(op_or_attr, IDLMember)) | 1250 assert(isinstance(op_or_attr, IDLMember)) |
| 1251 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s | 1251 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s |
| 1252 | 1252 |
| 1253 def _IsCustomValue(op_or_attr, value): | 1253 def _IsCustomValue(op_or_attr, value): |
| 1254 if _IsCustom(op_or_attr): | 1254 if _IsCustom(op_or_attr): |
| 1255 return op_or_attr.ext_attrs.get('Custom') == value \ | 1255 return op_or_attr.ext_attrs.get('Custom') == value \ |
| 1256 or op_or_attr.ext_attrs.get('DartCustom') == value | 1256 or op_or_attr.ext_attrs.get('DartCustom') == value |
| 1257 return False | 1257 return False |
| OLD | NEW |