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

Unified Diff: lib/dom/scripts/databasebuilder.py

Issue 10704100: Do not split attributes on getters and setters in databasebuilder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 5 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 | « lib/dom/idl/dart/dart.idl ('k') | lib/dom/scripts/generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/scripts/databasebuilder.py
diff --git a/lib/dom/scripts/databasebuilder.py b/lib/dom/scripts/databasebuilder.py
index f3816762ff8b1a660a6e844f003695854509e8a8..8021ea4cc3797a8e1614d52c828bfbf3f1a713d7 100755
--- a/lib/dom/scripts/databasebuilder.py
+++ b/lib/dom/scripts/databasebuilder.py
@@ -103,32 +103,6 @@ class DatabaseBuilder(object):
# TODO: Decide which attributes are uninteresting.
pass
- def _split_declarations(self, interface, optional_argument_whitelist):
- """Splits read-write attributes and operations with optional
- arguments into multiple declarations"""
-
- # split attributes into setters and getters
- new_attributes = []
- for attribute in interface.attributes:
- if attribute.is_fc_getter or attribute.is_fc_setter:
- new_attributes.append(attribute)
- continue
- getter_attr = copy.deepcopy(attribute)
- getter_attr.is_fc_getter = True
- new_attributes.append(getter_attr)
- if not attribute.is_read_only:
- setter_attr = copy.deepcopy(attribute)
- setter_attr.is_fc_setter = True
- new_attributes.append(setter_attr)
- interface.attributes = new_attributes
-
- # Add 'Optional' attribute to whitelisted arguments.
- for op in interface.operations:
- for argument in op.arguments:
- in_optional_whitelist = (interface.id, op.id, argument.id) in optional_argument_whitelist
- if in_optional_whitelist:
- argument.ext_attrs['Optional'] = None
-
def _rename_types(self, idl_file, import_options):
"""Rename interface and type names with names provided in the
options. Also clears scopes from scoped names"""
@@ -204,10 +178,8 @@ class DatabaseBuilder(object):
res.append(self._sign(node.type))
elif isinstance(node, IDLAttribute):
res = []
- if node.is_fc_getter:
- res.append('getter')
- elif node.is_fc_setter:
- res.append('setter')
+ if node.is_read_only:
+ res.append('readonly')
res.append(node.id)
res.append(self._sign(node.type))
elif isinstance(node, IDLConstant):
@@ -408,7 +380,12 @@ class DatabaseBuilder(object):
# Step 1: Pre process imported interfaces
for interface, module_name, import_options in self._imported_interfaces:
- self._split_declarations(interface, optional_argument_whitelist)
+ # Add 'Optional' attribute to whitelisted arguments.
+ for op in interface.operations:
+ for argument in op.arguments:
+ in_optional_whitelist = (interface.id, op.id, argument.id) in optional_argument_whitelist
+ if in_optional_whitelist:
+ argument.ext_attrs['Optional'] = None
self._annotate(interface, module_name, import_options)
# Step 2: Add all new interfaces and merge overlapping ones
@@ -566,8 +543,6 @@ class DatabaseBuilder(object):
def fetch_constructor_data(self, options):
window_interface = self._database.GetInterface('Window')
for attr in window_interface.attributes:
- if not attr.is_fc_getter:
- continue
type = attr.type.id
if not type.endswith('Constructor'):
continue
« no previous file with comments | « lib/dom/idl/dart/dart.idl ('k') | lib/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698