| 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 systems to generate | 6 """This module provides shared functionality for the systems to generate |
| 7 dart2js binding from the IDL database.""" | 7 dart2js binding from the IDL database.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 from generator import * | 10 from generator import * |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 def _NarrowInputType(self, type_name): | 172 def _NarrowInputType(self, type_name): |
| 173 return self._NarrowToImplementationType(type_name) | 173 return self._NarrowToImplementationType(type_name) |
| 174 | 174 |
| 175 def _NarrowOutputType(self, type_name): | 175 def _NarrowOutputType(self, type_name): |
| 176 return self._NarrowToImplementationType(type_name) | 176 return self._NarrowToImplementationType(type_name) |
| 177 | 177 |
| 178 def AddConstant(self, constant): | 178 def AddConstant(self, constant): |
| 179 # Since we are currently generating native classes without interfaces, | 179 # Since we are currently generating native classes without interfaces, |
| 180 # generate the constants as part of the class. This will need to go away | 180 # generate the constants as part of the class. This will need to go away |
| 181 # if we revert back to generating interfaces. | 181 # if we revert back to generating interfaces. |
| 182 self._members_emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n', | 182 self._members_emitter.Emit('\n static const $TYPE $NAME = $VALUE;\n', |
| 183 NAME=constant.id, | 183 NAME=constant.id, |
| 184 TYPE=self._DartType(constant.type.id), | 184 TYPE=self._DartType(constant.type.id), |
| 185 VALUE=constant.value) | 185 VALUE=constant.value) |
| 186 | 186 |
| 187 pass | 187 pass |
| 188 | 188 |
| 189 def OverrideMember(self, member): | 189 def OverrideMember(self, member): |
| 190 return self._interface.id + '.' + member in _dom_dart2js_omitted_members | 190 return self._interface.id + '.' + member in _dom_dart2js_omitted_members |
| 191 | 191 |
| 192 def AddAttribute(self, attribute): | 192 def AddAttribute(self, attribute): |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 if info.declared_name != info.name: | 377 if info.declared_name != info.name: |
| 378 native_string = " '%s'" % info.declared_name | 378 native_string = " '%s'" % info.declared_name |
| 379 | 379 |
| 380 self._members_emitter.Emit( | 380 self._members_emitter.Emit( |
| 381 '\n' | 381 '\n' |
| 382 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', | 382 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', |
| 383 TYPE=self._NarrowOutputType(info.type_name), | 383 TYPE=self._NarrowOutputType(info.type_name), |
| 384 NAME=info.name, | 384 NAME=info.name, |
| 385 PARAMS=params, | 385 PARAMS=params, |
| 386 NATIVESTRING=native_string) | 386 NATIVESTRING=native_string) |
| OLD | NEW |