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 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 if interface.parents: | 1274 if interface.parents: |
1275 supertype = interface.parents[0].type.id | 1275 supertype = interface.parents[0].type.id |
1276 if not IsDartListType(supertype): | 1276 if not IsDartListType(supertype): |
1277 base = self._ImplClassName(supertype) | 1277 base = self._ImplClassName(supertype) |
1278 if IsDartCollectionType(supertype): | 1278 if IsDartCollectionType(supertype): |
1279 # List methods are injected in AddIndexer. | 1279 # List methods are injected in AddIndexer. |
1280 pass | 1280 pass |
1281 else: | 1281 else: |
1282 base = self._ImplClassName(supertype) | 1282 base = self._ImplClassName(supertype) |
1283 | 1283 |
1284 # TODO(jacobr): this is fragile. There isn't a guarantee that dart:dom | 1284 # TODO(jacobr): this is fragile. There isn't a guarantee that |
1285 # will continue to exactly match the IDL names. | 1285 # dart:dom_deprecated will continue to exactly match the IDL |
| 1286 # names. |
1286 dom_name = interface.javascript_binding_name | 1287 dom_name = interface.javascript_binding_name |
1287 self._system._wrap_cases.append( | 1288 self._system._wrap_cases.append( |
1288 " case '%s': return new %s._wrap(domObject);" % | 1289 " case '%s': return new %s._wrap(domObject);" % |
1289 (dom_name, self._class_name)) | 1290 (dom_name, self._class_name)) |
1290 | 1291 |
1291 extends = ' extends ' + base if base else ' extends _DOMTypeBase' | 1292 extends = ' extends ' + base if base else ' extends _DOMTypeBase' |
1292 | 1293 |
1293 # TODO: Include all implemented interfaces, including other Lists. | 1294 # TODO: Include all implemented interfaces, including other Lists. |
1294 implements = [interface_name] | 1295 implements = [interface_name] |
1295 element_type = MaybeTypedArrayElementType(self._interface) | 1296 element_type = MaybeTypedArrayElementType(self._interface) |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 self._members_emitter.Emit( | 1579 self._members_emitter.Emit( |
1579 '\n' | 1580 '\n' |
1580 ' $TYPE $HTML_NAME($PARAMS) => $FUNCTION_CALL;\n', | 1581 ' $TYPE $HTML_NAME($PARAMS) => $FUNCTION_CALL;\n', |
1581 TYPE=info.type_name, | 1582 TYPE=info.type_name, |
1582 HTML_NAME=html_name, | 1583 HTML_NAME=html_name, |
1583 PARAMS=info.ParametersImplementationDeclaration(), | 1584 PARAMS=info.ParametersImplementationDeclaration(), |
1584 FUNCTION_CALL=function_call) | 1585 FUNCTION_CALL=function_call) |
1585 | 1586 |
1586 def AddStaticOperation(self, info): | 1587 def AddStaticOperation(self, info): |
1587 pass | 1588 pass |
OLD | NEW |