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 systemfrog import * | 9 from systemfrog import * |
10 from systeminterface import * | 10 from systeminterface import * |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 PARAMS=constructor_info.ParametersInterfaceDeclaration()); | 644 PARAMS=constructor_info.ParametersInterfaceDeclaration()); |
645 | 645 |
646 element_type = MaybeTypedArrayElementType(self._interface) | 646 element_type = MaybeTypedArrayElementType(self._interface) |
647 if element_type: | 647 if element_type: |
648 self._members_emitter.Emit( | 648 self._members_emitter.Emit( |
649 '\n' | 649 '\n' |
650 ' $CTOR(int length);\n' | 650 ' $CTOR(int length);\n' |
651 '\n' | 651 '\n' |
652 ' $CTOR.fromList(List<$TYPE> list);\n' | 652 ' $CTOR.fromList(List<$TYPE> list);\n' |
653 '\n' | 653 '\n' |
654 ' $CTOR.fromBuffer(ArrayBuffer buffer,' | 654 ' $CTOR.fromBuffer(ArrayBuffer buffer);\n', |
655 ' [int byteOffset, int length]);\n', | |
656 CTOR=self._interface.id, | 655 CTOR=self._interface.id, |
657 TYPE=DartType(element_type)) | 656 TYPE=DartType(element_type)) |
658 | 657 |
659 emit_events, events = self._shared.GetEventAttributes(self._interface) | 658 emit_events, events = self._shared.GetEventAttributes(self._interface) |
660 if not emit_events: | 659 if not emit_events: |
661 return | 660 return |
662 elif events: | 661 elif events: |
663 self.AddEventAttributes(events) | 662 self.AddEventAttributes(events) |
664 else: | 663 else: |
665 self._EmitEventGetter(self._shared.GetParentEventsClass(self._interface)) | 664 self._EmitEventGetter(self._shared.GetParentEventsClass(self._interface)) |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee | 1713 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee |
1715 # that Y = Z-X, so we need to check for Y. | 1714 # that Y = Z-X, so we need to check for Y. |
1716 true_code = emitter.Emit( | 1715 true_code = emitter.Emit( |
1717 '$(INDENT)if ($COND) {\n' | 1716 '$(INDENT)if ($COND) {\n' |
1718 '$!TRUE' | 1717 '$!TRUE' |
1719 '$(INDENT)}\n', | 1718 '$(INDENT)}\n', |
1720 COND=test, INDENT=indent) | 1719 COND=test, INDENT=indent) |
1721 self.GenerateDispatch( | 1720 self.GenerateDispatch( |
1722 true_code, info, indent + ' ', position + 1, positive) | 1721 true_code, info, indent + ' ', position + 1, positive) |
1723 return True | 1722 return True |
OLD | NEW |