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