| 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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 | 789 |
| 790 self._members_emitter = self._dart_code.Emit( | 790 self._members_emitter = self._dart_code.Emit( |
| 791 self._template, | 791 self._template, |
| 792 #class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 792 #class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 793 #$!MEMBERS | 793 #$!MEMBERS |
| 794 #} | 794 #} |
| 795 CLASSNAME=self._class_name, | 795 CLASSNAME=self._class_name, |
| 796 EXTENDS=extends, | 796 EXTENDS=extends, |
| 797 IMPLEMENTS=' implements ' + ', '.join(implements), | 797 IMPLEMENTS=' implements ' + ', '.join(implements), |
| 798 NATIVESPEC=' native "' + native_spec + '"') | 798 NATIVESPEC=' native "' + native_spec + '"') |
| 799 if self._members_emitter == None: |
| 800 raise Exception("Class %s doesn't use the $!MEMBERS variable" % |
| 801 self._class_name) |
| 799 | 802 |
| 800 # Emit a factory provider class for the constructor. | 803 # Emit a factory provider class for the constructor. |
| 801 constructor_info = AnalyzeConstructor(interface) | 804 constructor_info = AnalyzeConstructor(interface) |
| 802 if constructor_info: | 805 if constructor_info: |
| 803 self._EmitFactoryProvider(interface_name, constructor_info) | 806 self._EmitFactoryProvider(interface_name, constructor_info) |
| 804 | 807 |
| 805 emit_events, events = self._shared.GetEventAttributes(self._interface) | 808 emit_events, events = self._shared.GetEventAttributes(self._interface) |
| 806 if not emit_events: | 809 if not emit_events: |
| 807 return | 810 return |
| 808 elif events: | 811 elif events: |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee | 1720 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee |
| 1718 # that Y = Z-X, so we need to check for Y. | 1721 # that Y = Z-X, so we need to check for Y. |
| 1719 true_code = emitter.Emit( | 1722 true_code = emitter.Emit( |
| 1720 '$(INDENT)if ($COND) {\n' | 1723 '$(INDENT)if ($COND) {\n' |
| 1721 '$!TRUE' | 1724 '$!TRUE' |
| 1722 '$(INDENT)}\n', | 1725 '$(INDENT)}\n', |
| 1723 COND=test, INDENT=indent) | 1726 COND=test, INDENT=indent) |
| 1724 self.GenerateDispatch( | 1727 self.GenerateDispatch( |
| 1725 true_code, info, indent + ' ', position + 1, positive) | 1728 true_code, info, indent + ' ', position + 1, positive) |
| 1726 return True | 1729 return True |
| OLD | NEW |