| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 def _EmitConstant(self, emitter, constant): | 176 def _EmitConstant(self, emitter, constant): |
| 177 emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n', | 177 emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n', |
| 178 NAME=constant.id, | 178 NAME=constant.id, |
| 179 TYPE=DartType(constant.type.id), | 179 TYPE=DartType(constant.type.id), |
| 180 VALUE=constant.value) | 180 VALUE=constant.value) |
| 181 | 181 |
| 182 def AddAttribute(self, getter, setter): | 182 def AddAttribute(self, getter, setter): |
| 183 if getter and setter and getter.type.id == setter.type.id: | 183 if getter and setter and getter.type.id == setter.type.id: |
| 184 self._members_emitter.Emit('\n $TYPE $NAME;\n', | 184 self._members_emitter.Emit('\n $TYPE $NAME;\n', |
| 185 NAME=getter.id, TYPE=DartType(getter.type.id)); | 185 NAME=DartDomNameOfAttribute(getter), |
| 186 TYPE=DartType(getter.type.id)); |
| 186 return | 187 return |
| 187 if getter and not setter: | 188 if getter and not setter: |
| 188 self._members_emitter.Emit('\n final $TYPE $NAME;\n', | 189 self._members_emitter.Emit('\n final $TYPE $NAME;\n', |
| 189 NAME=getter.id, TYPE=DartType(getter.type.id)); | 190 NAME=DartDomNameOfAttribute(getter), |
| 191 TYPE=DartType(getter.type.id)); |
| 190 return | 192 return |
| 191 raise Exception('Unexpected getter/setter combination %s %s' % | 193 raise Exception('Unexpected getter/setter combination %s %s' % |
| 192 (getter, setter)) | 194 (getter, setter)) |
| 193 | 195 |
| 194 def AddIndexer(self, element_type): | 196 def AddIndexer(self, element_type): |
| 195 # Interface inherits all operations from List<element_type>. | 197 # Interface inherits all operations from List<element_type>. |
| 196 pass | 198 pass |
| 197 | 199 |
| 198 def AddOperation(self, info): | 200 def AddOperation(self, info): |
| 199 """ | 201 """ |
| 200 Arguments: | 202 Arguments: |
| 201 operations - contains the overloads, one or more operations with the same | 203 operations - contains the overloads, one or more operations with the same |
| 202 name. | 204 name. |
| 203 """ | 205 """ |
| 204 self._members_emitter.Emit('\n' | 206 self._members_emitter.Emit('\n' |
| 205 ' $TYPE $NAME($PARAMS);\n', | 207 ' $TYPE $NAME($PARAMS);\n', |
| 206 TYPE=info.type_name, | 208 TYPE=info.type_name, |
| 207 NAME=info.name, | 209 NAME=info.name, |
| 208 PARAMS=info.ParametersInterfaceDeclaration()) | 210 PARAMS=info.ParametersInterfaceDeclaration()) |
| 209 | 211 |
| 210 # Interfaces get secondary members directly via the superinterfaces. | 212 # Interfaces get secondary members directly via the superinterfaces. |
| 211 def AddSecondaryAttribute(self, interface, getter, setter): | 213 def AddSecondaryAttribute(self, interface, getter, setter): |
| 212 pass | 214 pass |
| 213 | 215 |
| 214 def AddSecondaryOperation(self, interface, attr): | 216 def AddSecondaryOperation(self, interface, attr): |
| 215 pass | 217 pass |
| OLD | NEW |