| 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 import emitter | 9 import emitter |
| 10 from generator import AnalyzeOperation, ConstantOutputOrder, \ | 10 from generator import AnalyzeOperation, ConstantOutputOrder, \ |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 (',\n %s(error) { completer.completeError(error); }' % | 484 (',\n %s(error) { completer.completeError(error); }' % |
| 485 ('%s : ' % info.callback_args[1].name | 485 ('%s : ' % info.callback_args[1].name |
| 486 if info.requires_named_arguments and | 486 if info.requires_named_arguments and |
| 487 info.callback_args[1].is_optional else ''))), | 487 info.callback_args[1].is_optional else ''))), |
| 488 FUTURE_GENERIC = ('' if len(callback_info.param_infos) == 0 or | 488 FUTURE_GENERIC = ('' if len(callback_info.param_infos) == 0 or |
| 489 not callback_info.param_infos[0].type_id else | 489 not callback_info.param_infos[0].type_id else |
| 490 '<%s>' % self._DartType(callback_info.param_infos[0].type_id)), | 490 '<%s>' % self._DartType(callback_info.param_infos[0].type_id)), |
| 491 ORIGINAL_FUNCTION = html_name) | 491 ORIGINAL_FUNCTION = html_name) |
| 492 | 492 |
| 493 def EmitHelpers(self, base_class): | 493 def EmitHelpers(self, base_class): |
| 494 pass | 494 if not self._members_emitter: |
| 495 return |
| 496 |
| 497 if base_class != self.RootClassName(): |
| 498 self._members_emitter.Emit( |
| 499 ' // To suppress missing implicit constructor warnings.\n' |
| 500 ' factory $CLASSNAME._() { ' |
| 501 'throw new UnsupportedError("Not supported"); }\n', |
| 502 CLASSNAME=self._interface_type_info.implementation_name()) |
| 495 | 503 |
| 496 def DeclareAttribute(self, attribute, type_name, attr_name, read_only): | 504 def DeclareAttribute(self, attribute, type_name, attr_name, read_only): |
| 497 """ Declares an attribute but does not include the code to invoke it. | 505 """ Declares an attribute but does not include the code to invoke it. |
| 498 """ | 506 """ |
| 499 if read_only: | 507 if read_only: |
| 500 template = '\n $TYPE get $NAME;\n' | 508 template = '\n $TYPE get $NAME;\n' |
| 501 else: | 509 else: |
| 502 template = '\n $TYPE $NAME;\n' | 510 template = '\n $TYPE $NAME;\n' |
| 503 | 511 |
| 504 self._members_emitter.Emit(template, | 512 self._members_emitter.Emit(template, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 if interface.parents: | 593 if interface.parents: |
| 586 parent = interface.parents[0] | 594 parent = interface.parents[0] |
| 587 if IsPureInterface(parent.type.id): | 595 if IsPureInterface(parent.type.id): |
| 588 walk(interface.parents) | 596 walk(interface.parents) |
| 589 else: | 597 else: |
| 590 walk(interface.parents[1:]) | 598 walk(interface.parents[1:]) |
| 591 return result | 599 return result |
| 592 | 600 |
| 593 def _DartType(self, type_name): | 601 def _DartType(self, type_name): |
| 594 return self._type_registry.DartType(type_name) | 602 return self._type_registry.DartType(type_name) |
| OLD | NEW |