| 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 17 matching lines...) Expand all Loading... |
| 28 def ImplementsMergedMembers(self): | 28 def ImplementsMergedMembers(self): |
| 29 # We could not add merged functions to implementation class because | 29 # We could not add merged functions to implementation class because |
| 30 # underlying c++ object doesn't implement them. Merged functions are | 30 # underlying c++ object doesn't implement them. Merged functions are |
| 31 # generated on merged interface implementation instead. | 31 # generated on merged interface implementation instead. |
| 32 return False | 32 return False |
| 33 | 33 |
| 34 def CustomJSMembers(self): | 34 def CustomJSMembers(self): |
| 35 return {} | 35 return {} |
| 36 | 36 |
| 37 def GenerateCallback(self, info): | 37 def GenerateCallback(self, info): |
| 38 if IsPureInterface(self._interface.id): | 38 if IsPureInterface(self._interface.id) or IsCustomType(self._interface.id): |
| 39 return | 39 return |
| 40 | 40 |
| 41 cpp_impl_includes = set() | 41 cpp_impl_includes = set() |
| 42 cpp_header_handlers_emitter = emitter.Emitter() | 42 cpp_header_handlers_emitter = emitter.Emitter() |
| 43 cpp_impl_handlers_emitter = emitter.Emitter() | 43 cpp_impl_handlers_emitter = emitter.Emitter() |
| 44 class_name = 'Dart%s' % self._interface.id | 44 class_name = 'Dart%s' % self._interface.id |
| 45 for operation in self._interface.operations: | 45 for operation in self._interface.operations: |
| 46 parameters = [] | 46 parameters = [] |
| 47 arguments = [] | 47 arguments = [] |
| 48 conversion_includes = [] | 48 conversion_includes = [] |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return template | 108 return template |
| 109 | 109 |
| 110 def RootClassName(self): | 110 def RootClassName(self): |
| 111 return 'NativeFieldWrapperClass1' | 111 return 'NativeFieldWrapperClass1' |
| 112 | 112 |
| 113 def NativeSpec(self): | 113 def NativeSpec(self): |
| 114 return '' | 114 return '' |
| 115 | 115 |
| 116 def StartInterface(self, members_emitter): | 116 def StartInterface(self, members_emitter): |
| 117 # Create emitters for c++ implementation. | 117 # Create emitters for c++ implementation. |
| 118 if not IsPureInterface(self._interface.id): | 118 if not IsPureInterface(self._interface.id) and not IsCustomType(self._interf
ace.id): |
| 119 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter( | 119 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter( |
| 120 self._interface.id, | 120 self._interface.id, |
| 121 self._renamer.GetLibraryName(self._interface)) | 121 self._renamer.GetLibraryName(self._interface)) |
| 122 self._cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(sel
f._interface.id) | 122 self._cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(sel
f._interface.id) |
| 123 else: | 123 else: |
| 124 self._cpp_header_emitter = emitter.Emitter() | 124 self._cpp_header_emitter = emitter.Emitter() |
| 125 self._cpp_impl_emitter = emitter.Emitter() | 125 self._cpp_impl_emitter = emitter.Emitter() |
| 126 | 126 |
| 127 self._interface_type_info = self._TypeInfo(self._interface.id) | 127 self._interface_type_info = self._TypeInfo(self._interface.id) |
| 128 self._members_emitter = members_emitter | 128 self._members_emitter = members_emitter |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 917 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 918 ' return func;\n', | 918 ' return func;\n', |
| 919 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 919 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 920 | 920 |
| 921 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 921 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 922 return ( | 922 return ( |
| 923 interface.id.endswith('Event') and | 923 interface.id.endswith('Event') and |
| 924 operation.id.startswith('init') and | 924 operation.id.startswith('init') and |
| 925 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and | 925 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and |
| 926 argument.type.id == 'DOMString') | 926 argument.type.id == 'DOMString') |
| OLD | NEW |