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

Unified Diff: tools/dom/scripts/htmldartgenerator.py

Issue 22933003: Removing overloaded operations in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/web_audio/dart2js/web_audio_dart2js.dart ('k') | tools/dom/scripts/idlnode.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/htmldartgenerator.py
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index 52d1de8e3ab088443839ffe0af5c66cfcc22efc5..0692740560c880650d35bf940e03e0b15b3288dd 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -93,6 +93,9 @@ class HtmlDartGenerator(object):
# Group overloaded operations by name.
self._AddRenamedOverloads(interface)
operationsByName = self._OperationsByName(interface)
+ if self.OmitOperationOverrides():
+ self._RemoveShadowingOperationsWithSameSignature(operationsByName,
+ interface)
# Generate operations.
for id in sorted(operationsByName.keys()):
@@ -121,6 +124,10 @@ class HtmlDartGenerator(object):
# Group overloaded operations by name.
operationsByName =self._OperationsByName(parent_interface)
+ if self.OmitOperationOverrides():
+ self._RemoveShadowingOperationsWithSameSignature(operationsByName,
+ interface)
+
# Generate operations.
for id in sorted(operationsByName.keys()):
if not any(op.id == id for op in interface.operations):
@@ -129,6 +136,21 @@ class HtmlDartGenerator(object):
self.SecondaryContext(parent_interface)
self.AddOperation(info)
+ def _RemoveShadowingOperationsWithSameSignature(self, operationsByName,
+ interface):
+ if not interface.parents:
+ return
+
+ parent = self._database.GetInterface(interface.parents[0].type.id)
+ if parent == self._interface or parent == interface:
+ return
+ for operation in parent.operations:
+ if operation.id in operationsByName:
+ operations = operationsByName[operation.id]
+ for existing_operation in operations:
+ if existing_operation.SameSignatureAs(operation):
+ del operationsByName[operation.id]
+
def _AddRenamedOverloads(self, interface):
"""The IDL has a number of functions with the same name but that accept
different types. This is fine for JavaScript, but results in vague type
@@ -201,6 +223,9 @@ class HtmlDartGenerator(object):
operationsByName.setdefault(name, []).append(operation)
return operationsByName
+ def OmitOperationOverrides(self):
+ return False
+
def AddConstant(self, constant):
const_name = self._renamer.RenameMember(
self._interface.id, constant, constant.id, 'get:', dartify_name=False)
« no previous file with comments | « sdk/lib/web_audio/dart2js/web_audio_dart2js.dart ('k') | tools/dom/scripts/idlnode.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698