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 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 # Constants are already defined on the interface. | 1353 # Constants are already defined on the interface. |
1354 pass | 1354 pass |
1355 | 1355 |
1356 def _MethodName(self, prefix, name): | 1356 def _MethodName(self, prefix, name): |
1357 method_name = prefix + name | 1357 method_name = prefix + name |
1358 if name in self._base_members: # Avoid illegal Dart 'static override'. | 1358 if name in self._base_members: # Avoid illegal Dart 'static override'. |
1359 method_name = method_name + '_' + self._interface.id | 1359 method_name = method_name + '_' + self._interface.id |
1360 return method_name | 1360 return method_name |
1361 | 1361 |
1362 def AddAttribute(self, getter, setter): | 1362 def AddAttribute(self, getter, setter): |
| 1363 dom_name = DartDomNameOfAttribute(getter or setter) |
1363 html_getter_name = self._shared.RenameInHtmlLibrary( | 1364 html_getter_name = self._shared.RenameInHtmlLibrary( |
1364 self._interface, getter.id, 'get:') | 1365 self._interface, dom_name, 'get:') |
1365 html_setter_name = self._shared.RenameInHtmlLibrary( | 1366 html_setter_name = self._shared.RenameInHtmlLibrary( |
1366 self._interface, getter.id, 'set:') | 1367 self._interface, dom_name, 'set:') |
1367 | 1368 |
1368 if getter and html_getter_name: | 1369 if getter and html_getter_name: |
1369 self._AddGetter(getter, html_getter_name) | 1370 self._AddGetter(getter, html_getter_name) |
1370 if setter and html_setter_name: | 1371 if setter and html_setter_name: |
1371 self._AddSetter(setter, html_setter_name) | 1372 self._AddSetter(setter, html_setter_name) |
1372 | 1373 |
1373 def _AddGetter(self, attr, html_name): | 1374 def _AddGetter(self, attr, html_name): |
1374 if self._shared.MaybeReturnDocument(attr.type.id): | 1375 if self._shared.MaybeReturnDocument(attr.type.id): |
1375 self._members_emitter.Emit( | 1376 self._members_emitter.Emit( |
1376 '\n' | 1377 '\n' |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee | 1773 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee |
1773 # that Y = Z-X, so we need to check for Y. | 1774 # that Y = Z-X, so we need to check for Y. |
1774 true_code = emitter.Emit( | 1775 true_code = emitter.Emit( |
1775 '$(INDENT)if ($COND) {\n' | 1776 '$(INDENT)if ($COND) {\n' |
1776 '$!TRUE' | 1777 '$!TRUE' |
1777 '$(INDENT)}\n', | 1778 '$(INDENT)}\n', |
1778 COND=test, INDENT=indent) | 1779 COND=test, INDENT=indent) |
1779 self.GenerateDispatch( | 1780 self.GenerateDispatch( |
1780 true_code, info, indent + ' ', position + 1, positive) | 1781 true_code, info, indent + ' ', position + 1, positive) |
1781 return True | 1782 return True |
OLD | NEW |