| 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 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 " EventListenerList get $NAME() => _get('$RAWNAME');\n", | 1387 " EventListenerList get $NAME() => _get('$RAWNAME');\n", |
| 1388 RAWNAME=event_name, | 1388 RAWNAME=event_name, |
| 1389 NAME=_html_event_names[event_name]) | 1389 NAME=_html_event_names[event_name]) |
| 1390 else: | 1390 else: |
| 1391 raise Exception('No known html even name for event: ' + event_name) | 1391 raise Exception('No known html even name for event: ' + event_name) |
| 1392 | 1392 |
| 1393 def _EmitEventGetter(self, events_class): | 1393 def _EmitEventGetter(self, events_class): |
| 1394 self._members_emitter.Emit( | 1394 self._members_emitter.Emit( |
| 1395 '\n' | 1395 '\n' |
| 1396 ' $TYPE get on() {\n' | 1396 ' $TYPE get on() {\n' |
| 1397 ' if (_on == null) _on = new $TYPE($EVENTTARGET);\n' | 1397 ' if (_on == null) _on = new $TYPE(this);\n' |
| 1398 ' return _on;\n' | 1398 ' return _on;\n' |
| 1399 ' }\n', | 1399 ' }\n', |
| 1400 TYPE=events_class, | 1400 TYPE=events_class) |
| 1401 EVENTTARGET='_wrappedDocumentPtr' if self._interface.id == 'Document' | |
| 1402 else 'this') | |
| 1403 | 1401 |
| 1404 def _SecondaryContext(self, interface): | 1402 def _SecondaryContext(self, interface): |
| 1405 if interface is not self._current_secondary_parent: | 1403 if interface is not self._current_secondary_parent: |
| 1406 self._current_secondary_parent = interface | 1404 self._current_secondary_parent = interface |
| 1407 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) | 1405 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) |
| 1408 | 1406 |
| 1409 # TODO(jacobr): change this to more directly match the frog version. | 1407 # TODO(jacobr): change this to more directly match the frog version. |
| 1410 def AddIndexer(self, element_type): | 1408 def AddIndexer(self, element_type): |
| 1411 """Adds all the methods required to complete implementation of List.""" | 1409 """Adds all the methods required to complete implementation of List.""" |
| 1412 # We would like to simply inherit the implementation of everything except | 1410 # We would like to simply inherit the implementation of everything except |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee | 1716 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee |
| 1719 # that Y = Z-X, so we need to check for Y. | 1717 # that Y = Z-X, so we need to check for Y. |
| 1720 true_code = emitter.Emit( | 1718 true_code = emitter.Emit( |
| 1721 '$(INDENT)if ($COND) {\n' | 1719 '$(INDENT)if ($COND) {\n' |
| 1722 '$!TRUE' | 1720 '$!TRUE' |
| 1723 '$(INDENT)}\n', | 1721 '$(INDENT)}\n', |
| 1724 COND=test, INDENT=indent) | 1722 COND=test, INDENT=indent) |
| 1725 self.GenerateDispatch( | 1723 self.GenerateDispatch( |
| 1726 true_code, info, indent + ' ', position + 1, positive) | 1724 true_code, info, indent + ' ', position + 1, positive) |
| 1727 return True | 1725 return True |
| OLD | NEW |