Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: lib/dom/scripts/systemhtml.py

Issue 10334003: Rework static method support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 return 746 return
747 raise Exception('Unexpected getter/setter combination %s %s' % 747 raise Exception('Unexpected getter/setter combination %s %s' %
748 (getter, setter)) 748 (getter, setter))
749 749
750 def AddOperation(self, info): 750 def AddOperation(self, info):
751 """ 751 """
752 Arguments: 752 Arguments:
753 operations - contains the overloads, one or more operations with the same 753 operations - contains the overloads, one or more operations with the same
754 name. 754 name.
755 """ 755 """
756 if info.IsStatic():
757 return
758
756 html_name = self._shared.RenameInHtmlLibrary( 759 html_name = self._shared.RenameInHtmlLibrary(
757 self._interface, info.name) 760 self._interface, info.name)
758 if html_name and not self._shared.IsPrivate(html_name): 761 if html_name and not self._shared.IsPrivate(html_name):
759 self._members_emitter.Emit('\n /** @domName $DOMINTERFACE.$DOMNAME */', 762 self._members_emitter.Emit('\n /** @domName $DOMINTERFACE.$DOMNAME */',
760 DOMINTERFACE=info.overloads[0].doc_js_interface_name, 763 DOMINTERFACE=info.overloads[0].doc_js_interface_name,
761 DOMNAME=info.name) 764 DOMNAME=info.name)
762 765
763 self._members_emitter.Emit('\n' 766 self._members_emitter.Emit('\n'
764 ' $TYPE $NAME($PARAMS);\n', 767 ' $TYPE $NAME($PARAMS);\n',
765 TYPE=info.type_name, 768 TYPE=info.type_name,
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 ' native "this.$NAME = value;";\n', 1027 ' native "this.$NAME = value;";\n',
1025 HTML_NAME=html_name, 1028 HTML_NAME=html_name,
1026 NAME=attr.id, 1029 NAME=attr.id,
1027 TYPE=self._NarrowInputType(attr.type.id)) 1030 TYPE=self._NarrowInputType(attr.type.id))
1028 1031
1029 def AddOperation(self, info): 1032 def AddOperation(self, info):
1030 """ 1033 """
1031 Arguments: 1034 Arguments:
1032 info: An OperationInfo object. 1035 info: An OperationInfo object.
1033 """ 1036 """
1037 if info.IsStatic():
1038 return
1039
1034 html_name = self._shared.RenameInHtmlLibrary( 1040 html_name = self._shared.RenameInHtmlLibrary(
1035 self._interface, info.name, implementation_class=True) 1041 self._interface, info.name, implementation_class=True)
1036 if not html_name: 1042 if not html_name:
1037 return 1043 return
1038 1044
1039 # Do we need a native body? 1045 # Do we need a native body?
1040 if html_name != info.declared_name: 1046 if html_name != info.declared_name:
1041 return_type = self._NarrowOutputType(info.type_name) 1047 return_type = self._NarrowOutputType(info.type_name)
1042 1048
1043 operation_emitter = self._members_emitter.Emit('$!SCOPE', 1049 operation_emitter = self._members_emitter.Emit('$!SCOPE',
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 ' }\n', 1552 ' }\n',
1547 THIS=self.DomObjectName(), 1553 THIS=self.DomObjectName(),
1548 TYPE=DartType(element_type), 1554 TYPE=DartType(element_type),
1549 METHOD=method_name) 1555 METHOD=method_name)
1550 1556
1551 def AddOperation(self, info): 1557 def AddOperation(self, info):
1552 """ 1558 """
1553 Arguments: 1559 Arguments:
1554 info: An OperationInfo object. 1560 info: An OperationInfo object.
1555 """ 1561 """
1562 if info.IsStatic():
1563 return
1564
1556 html_name = self._shared.RenameInHtmlLibrary( 1565 html_name = self._shared.RenameInHtmlLibrary(
1557 self._interface, info.name, implementation_class=True) 1566 self._interface, info.name, implementation_class=True)
1558 1567
1559 if not html_name: 1568 if not html_name:
1560 return 1569 return
1561 1570
1562 body = self._members_emitter.Emit( 1571 body = self._members_emitter.Emit(
1563 '\n' 1572 '\n'
1564 ' $TYPE $HTML_NAME($PARAMS) {\n' 1573 ' $TYPE $HTML_NAME($PARAMS) {\n'
1565 '$!BODY' 1574 '$!BODY'
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee 1706 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee
1698 # that Y = Z-X, so we need to check for Y. 1707 # that Y = Z-X, so we need to check for Y.
1699 true_code = emitter.Emit( 1708 true_code = emitter.Emit(
1700 '$(INDENT)if ($COND) {\n' 1709 '$(INDENT)if ($COND) {\n'
1701 '$!TRUE' 1710 '$!TRUE'
1702 '$(INDENT)}\n', 1711 '$(INDENT)}\n',
1703 COND=test, INDENT=indent) 1712 COND=test, INDENT=indent)
1704 self.GenerateDispatch( 1713 self.GenerateDispatch(
1705 true_code, info, indent + ' ', position + 1, positive) 1714 true_code, info, indent + ' ', position + 1, positive)
1706 return True 1715 return True
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698