| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 BASE=self._super_interface) | 156 BASE=self._super_interface) |
| 157 for const in sorted(self._interface.constants, ConstantOutputOrder): | 157 for const in sorted(self._interface.constants, ConstantOutputOrder): |
| 158 self._EmitConstant(consts_emitter, const) | 158 self._EmitConstant(consts_emitter, const) |
| 159 | 159 |
| 160 def AddConstant(self, constant): | 160 def AddConstant(self, constant): |
| 161 if (not self._super_interface or | 161 if (not self._super_interface or |
| 162 self._interface.id is self._super_interface): | 162 self._interface.id is self._super_interface): |
| 163 self._EmitConstant(self._members_emitter, constant) | 163 self._EmitConstant(self._members_emitter, constant) |
| 164 | 164 |
| 165 def _EmitConstant(self, emitter, constant): | 165 def _EmitConstant(self, emitter, constant): |
| 166 emitter.Emit('\n static final $TYPE$NAME = $VALUE;\n', | 166 emitter.Emit('\n static const $TYPE$NAME = $VALUE;\n', |
| 167 NAME=constant.id, | 167 NAME=constant.id, |
| 168 TYPE=TypeOrNothing(self._DartType(constant.type.id), | 168 TYPE=TypeOrNothing(self._DartType(constant.type.id), |
| 169 constant.type.id), | 169 constant.type.id), |
| 170 VALUE=constant.value) | 170 VALUE=constant.value) |
| 171 | 171 |
| 172 def AddAttribute(self, attribute): | 172 def AddAttribute(self, attribute): |
| 173 getter = attribute | 173 getter = attribute |
| 174 setter = attribute if not systembase.IsReadOnly(attribute) else None | 174 setter = attribute if not systembase.IsReadOnly(attribute) else None |
| 175 if getter and setter and getter.type.id == setter.type.id: | 175 if getter and setter and getter.type.id == setter.type.id: |
| 176 self._members_emitter.Emit('\n $TYPE $NAME;\n', | 176 self._members_emitter.Emit('\n $TYPE $NAME;\n', |
| (...skipping 14 matching lines...) Expand all Loading... |
| 191 """ | 191 """ |
| 192 Arguments: | 192 Arguments: |
| 193 operations - contains the overloads, one or more operations with the same | 193 operations - contains the overloads, one or more operations with the same |
| 194 name. | 194 name. |
| 195 """ | 195 """ |
| 196 self._members_emitter.Emit('\n' | 196 self._members_emitter.Emit('\n' |
| 197 ' $TYPE $NAME($PARAMS);\n', | 197 ' $TYPE $NAME($PARAMS);\n', |
| 198 TYPE=self._DartType(info.type_name), | 198 TYPE=self._DartType(info.type_name), |
| 199 NAME=info.name, | 199 NAME=info.name, |
| 200 PARAMS=info.ParametersInterfaceDeclaration(self._
DartType)) | 200 PARAMS=info.ParametersInterfaceDeclaration(self._
DartType)) |
| OLD | NEW |