| 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 providesfunctionality for systems to generate | 6 """This module providesfunctionality for systems to generate |
| 7 Dart interfaces from the IDL database.""" | 7 Dart interfaces from the IDL database.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import systembase | 10 import systembase |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 extends_str = '' | 99 extends_str = '' |
| 100 if extends: | 100 if extends: |
| 101 extends_str += ' extends ' + ', '.join(extends) | 101 extends_str += ' extends ' + ', '.join(extends) |
| 102 comment = ',' | 102 comment = ',' |
| 103 if suppressed_extends: | 103 if suppressed_extends: |
| 104 extends_str += ' /*%s %s */' % (comment, ', '.join(suppressed_extends)) | 104 extends_str += ' /*%s %s */' % (comment, ', '.join(suppressed_extends)) |
| 105 | 105 |
| 106 factory_provider = None | 106 factory_provider = None |
| 107 constructor_info = AnalyzeConstructor(self._interface) | 107 constructor_info = AnalyzeConstructor(self._interface) |
| 108 if constructor_info: | 108 if constructor_info: |
| 109 factory_provider = '_' + typename + 'FactoryProvider'; | 109 factory_provider = '_' + typename + 'FactoryProvider' |
| 110 | 110 |
| 111 if typename in interface_factories: | 111 if typename in interface_factories: |
| 112 factory_provider = interface_factories[typename] | 112 factory_provider = interface_factories[typename] |
| 113 | 113 |
| 114 if factory_provider: | 114 if factory_provider: |
| 115 extends_str += ' default ' + factory_provider | 115 extends_str += ' default ' + factory_provider |
| 116 | 116 |
| 117 # TODO(vsm): Add appropriate package / namespace syntax. | 117 # TODO(vsm): Add appropriate package / namespace syntax. |
| 118 (self._members_emitter, | 118 (self._members_emitter, |
| 119 self._top_level_emitter) = self._emitter.Emit( | 119 self._top_level_emitter) = self._emitter.Emit( |
| 120 self._template + '$!TOP_LEVEL', | 120 self._template + '$!TOP_LEVEL', |
| 121 ID=typename, | 121 ID=typename, |
| 122 EXTENDS=extends_str) | 122 EXTENDS=extends_str) |
| 123 | 123 |
| 124 if constructor_info: | 124 if constructor_info: |
| 125 self._members_emitter.Emit( | 125 self._members_emitter.Emit( |
| 126 '\n' | 126 '\n' |
| 127 ' $CTOR($PARAMS);\n', | 127 ' $CTOR($PARAMS);\n', |
| 128 CTOR=typename, | 128 CTOR=typename, |
| 129 PARAMS=constructor_info.ParametersInterfaceDeclaration()); | 129 PARAMS=constructor_info.ParametersInterfaceDeclaration()) |
| 130 | 130 |
| 131 element_type = MaybeTypedArrayElementTypeInHierarchy( | 131 element_type = MaybeTypedArrayElementTypeInHierarchy( |
| 132 self._interface, self._system._database) | 132 self._interface, self._system._database) |
| 133 if element_type: | 133 if element_type: |
| 134 self._members_emitter.Emit( | 134 self._members_emitter.Emit( |
| 135 '\n' | 135 '\n' |
| 136 ' $CTOR(int length);\n' | 136 ' $CTOR(int length);\n' |
| 137 '\n' | 137 '\n' |
| 138 ' $CTOR.fromList(List<$TYPE> list);\n' | 138 ' $CTOR.fromList(List<$TYPE> list);\n' |
| 139 '\n' | 139 '\n' |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 """ | 190 """ |
| 191 Arguments: | 191 Arguments: |
| 192 operations - contains the overloads, one or more operations with the same | 192 operations - contains the overloads, one or more operations with the same |
| 193 name. | 193 name. |
| 194 """ | 194 """ |
| 195 self._members_emitter.Emit('\n' | 195 self._members_emitter.Emit('\n' |
| 196 ' $TYPE $NAME($PARAMS);\n', | 196 ' $TYPE $NAME($PARAMS);\n', |
| 197 TYPE=info.type_name, | 197 TYPE=info.type_name, |
| 198 NAME=info.name, | 198 NAME=info.name, |
| 199 PARAMS=info.ParametersInterfaceDeclaration()) | 199 PARAMS=info.ParametersInterfaceDeclaration()) |
| OLD | NEW |