| 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 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 | 1176 |
| 1177 def _EmitNativeIndexSetter(self, element_type): | 1177 def _EmitNativeIndexSetter(self, element_type): |
| 1178 return_type = 'void' | 1178 return_type = 'void' |
| 1179 formals = ', '.join(['int index', '%s value' % element_type]) | 1179 formals = ', '.join(['int index', '%s value' % element_type]) |
| 1180 parameters = ['index', 'value'] | 1180 parameters = ['index', 'value'] |
| 1181 dart_declaration = 'void operator[]=(%s)' % formals | 1181 dart_declaration = 'void operator[]=(%s)' % formals |
| 1182 self._GenerateNativeBinding('numericIndexSetter', 3, | 1182 self._GenerateNativeBinding('numericIndexSetter', 3, |
| 1183 dart_declaration, False, return_type, parameters, | 1183 dart_declaration, False, return_type, parameters, |
| 1184 'Callback', True, False) | 1184 'Callback', True, False) |
| 1185 | 1185 |
| 1186 def EmitOperation(self, info, html_name): | 1186 def EmitOperation(self, info, html_name, dart_js_interop=False): |
| 1187 """ | 1187 """ |
| 1188 Arguments: | 1188 Arguments: |
| 1189 info: An OperationInfo object. | 1189 info: An OperationInfo object. |
| 1190 """ | 1190 """ |
| 1191 return_type = self.SecureOutputType(info.type_name, False, True) | 1191 return_type = self.SecureOutputType(info.type_name, False, True) |
| 1192 | 1192 |
| 1193 formals = info.ParametersAsDeclaration(self._DartType) | 1193 formals = info.ParametersAsDeclaration(self._DartType) |
| 1194 | 1194 |
| 1195 parameters = info.ParametersAsListOfVariables(None, self._type_registry if s
elf._dart_use_blink else None) | 1195 parameters = info.ParametersAsListOfVariables(None, self._type_registry if s
elf._dart_use_blink else None, dart_js_interop) |
| 1196 dart_declaration = '%s%s %s(%s)' % ( | 1196 dart_declaration = '%s%s %s(%s)' % ( |
| 1197 'static ' if info.IsStatic() else '', | 1197 'static ' if info.IsStatic() else '', |
| 1198 return_type, | 1198 return_type, |
| 1199 html_name, | 1199 html_name, |
| 1200 formals) | 1200 formals) |
| 1201 | 1201 |
| 1202 operation = info.operations[0] | 1202 operation = info.operations[0] |
| 1203 | 1203 |
| 1204 is_custom = _IsCustom(operation) | 1204 is_custom = _IsCustom(operation) |
| 1205 has_optional_arguments = any(IsOptional(argument) for argument in operation.
arguments) | 1205 has_optional_arguments = any(IsOptional(argument) for argument in operation.
arguments) |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 | 2023 |
| 2024 def _IsCustom(op_or_attr): | 2024 def _IsCustom(op_or_attr): |
| 2025 assert(isinstance(op_or_attr, IDLMember)) | 2025 assert(isinstance(op_or_attr, IDLMember)) |
| 2026 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s | 2026 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s |
| 2027 | 2027 |
| 2028 def _IsCustomValue(op_or_attr, value): | 2028 def _IsCustomValue(op_or_attr, value): |
| 2029 if _IsCustom(op_or_attr): | 2029 if _IsCustom(op_or_attr): |
| 2030 return op_or_attr.ext_attrs.get('Custom') == value \ | 2030 return op_or_attr.ext_attrs.get('Custom') == value \ |
| 2031 or op_or_attr.ext_attrs.get('DartCustom') == value | 2031 or op_or_attr.ext_attrs.get('DartCustom') == value |
| 2032 return False | 2032 return False |
| OLD | NEW |