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

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

Issue 12964003: Allowing renaming on DOM members on a per-method basis (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « tools/dom/idl/dart/dart.idl ('k') | tools/dom/scripts/htmlrenamer.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 30ccdd03614008e848de99e8d068467101e381d9..393d7b4164f991354dbae39ad204b2860636e728 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -82,16 +82,12 @@ class HtmlDartGenerator(object):
self.AmendIndexer(parent_type_info.list_item_type())
break
- # Group overloaded operations by id.
- operationsById = {}
- for operation in interface.operations:
- if operation.id not in operationsById:
- operationsById[operation.id] = []
- operationsById[operation.id].append(operation)
+ # Group overloaded operations by name.
+ operationsByName = self._OperationsByName(interface)
# Generate operations.
- for id in sorted(operationsById.keys()):
- operations = operationsById[id]
+ for id in sorted(operationsByName.keys()):
+ operations = operationsByName[id]
info = AnalyzeOperation(interface, operations)
self.AddOperation(info, declare_only)
if ('%s.%s' % (interface.id, info.declared_name) in
@@ -112,21 +108,24 @@ class HtmlDartGenerator(object):
self.SecondaryContext(parent_interface)
self.AddAttribute(attr)
- # Group overloaded operations by id.
- operationsById = {}
- for operation in parent_interface.operations:
- if operation.id not in operationsById:
- operationsById[operation.id] = []
- operationsById[operation.id].append(operation)
+ # Group overloaded operations by name.
+ operationsByName =self._OperationsByName(parent_interface)
# Generate operations.
- for id in sorted(operationsById.keys()):
+ for id in sorted(operationsByName.keys()):
if not any(op.id == id for op in interface.operations):
- operations = operationsById[id]
+ operations = operationsByName[id]
info = AnalyzeOperation(interface, operations)
self.SecondaryContext(parent_interface)
self.AddOperation(info)
+ def _OperationsByName(self, interface):
+ operationsByName = {}
+ for operation in interface.operations:
+ name = operation.ext_attrs.get('DartName', operation.id)
+ operationsByName.setdefault(name, []).append(operation)
+ return operationsByName
+
def AddConstant(self, constant):
const_name = self._renamer.RenameMember(
self._interface.id, constant, constant.id, 'get:', dartify_name=False)
« no previous file with comments | « tools/dom/idl/dart/dart.idl ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698