| 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 system to generate | 6 """This module provides shared functionality for the system to generate |
| 7 dart:html APIs from the IDL database.""" | 7 dart:html APIs from the IDL database.""" |
| 8 | 8 |
| 9 from generator import AnalyzeOperation, ConstantOutputOrder, \ | 9 from generator import AnalyzeOperation, ConstantOutputOrder, \ |
| 10 DartDomNameOfAttribute, FindMatchingAttribute, IsDartCollectionType, \ | 10 DartDomNameOfAttribute, FindMatchingAttribute, IsDartCollectionType, \ |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 info - The operation info of the operation to be added. | 180 info - The operation info of the operation to be added. |
| 181 declare_only- True if the operation should be declared as an abstract | 181 declare_only- True if the operation should be declared as an abstract |
| 182 member and not include invocation code. | 182 member and not include invocation code. |
| 183 """ | 183 """ |
| 184 # FIXME: When we pass in operations[0] below, we're assuming all | 184 # FIXME: When we pass in operations[0] below, we're assuming all |
| 185 # overloaded operations have the same security attributes. This | 185 # overloaded operations have the same security attributes. This |
| 186 # is currently true, but we should consider filtering earlier or | 186 # is currently true, but we should consider filtering earlier or |
| 187 # merging the relevant data into info itself. | 187 # merging the relevant data into info itself. |
| 188 method_name = self._renamer.RenameMember(self._interface.id, | 188 method_name = self._renamer.RenameMember(self._interface.id, |
| 189 info.operations[0], | 189 info.operations[0], |
| 190 info.name) | 190 info.name, |
| 191 'call:') |
| 191 if not method_name: | 192 if not method_name: |
| 192 if info.name == 'item': | 193 if info.name == 'item': |
| 193 # FIXME: item should be renamed to operator[], not removed. | 194 # FIXME: item should be renamed to operator[], not removed. |
| 194 self.EmitOperation(info, '_item') | 195 self.EmitOperation(info, '_item') |
| 195 return | 196 return |
| 196 | 197 |
| 197 if declare_only: | 198 if declare_only: |
| 198 self.DeclareOperation(info, | 199 self.DeclareOperation(info, |
| 199 self.SecureOutputType(info.type_name), method_name) | 200 self.SecureOutputType(info.type_name), method_name) |
| 200 else: | 201 else: |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 walk(interface.parents) | 472 walk(interface.parents) |
| 472 else: | 473 else: |
| 473 walk(interface.parents[1:]) | 474 walk(interface.parents[1:]) |
| 474 return result | 475 return result |
| 475 | 476 |
| 476 def _DartType(self, type_name): | 477 def _DartType(self, type_name): |
| 477 return self._type_registry.DartType(type_name) | 478 return self._type_registry.DartType(type_name) |
| 478 | 479 |
| 479 def _IsPrivate(self, name): | 480 def _IsPrivate(self, name): |
| 480 return name.startswith('_') | 481 return name.startswith('_') |
| OLD | NEW |