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

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

Issue 10517004: Move splitting operations with optional arguments to generator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 6 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 | « no previous file | 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 9ad31bf0783f4c0e29c4940d1717f78a9868b426..05824f1fcf8db479762a3086a9feabdc2c73fe97 100755
--- a/lib/dom/scripts/databasebuilder.py
+++ b/lib/dom/scripts/databasebuilder.py
@@ -121,35 +121,13 @@ class DatabaseBuilder(object):
new_attributes.append(setter_attr)
interface.attributes = new_attributes
- # Remove optional annotations from legacy optional arguments.
+ # Add 'Optional' attribute to whitelisted arguments.
for op in interface.operations:
- for i in range(0, len(op.arguments)):
- argument = op.arguments[i]
-
+ for argument in op.arguments:
in_optional_whitelist = (interface.id, op.id, argument.id) in optional_argument_whitelist
if in_optional_whitelist or set(['Optional', 'Callback']).issubset(argument.ext_attrs.keys()):
- argument.is_optional = True
argument.ext_attrs['Optional'] = None
argument.ext_attrs['RequiredCppParameter'] = None
- continue
-
- if 'Optional' in argument.ext_attrs:
- optional_value = argument.ext_attrs['Optional']
- if optional_value:
- argument.is_optional = False
- del argument.ext_attrs['Optional']
-
- # split operations with optional args into multiple operations
- new_ops = []
- for op in interface.operations:
- for i in range(0, len(op.arguments)):
- if op.arguments[i].is_optional:
- op.arguments[i].is_optional = False
- new_op = copy.deepcopy(op)
- new_op.arguments = new_op.arguments[:i]
- new_ops.append(new_op)
- new_ops.append(op)
- interface.operations = new_ops
def _rename_types(self, idl_file, import_options):
"""Rename interface and type names with names provided in the
« no previous file with comments | « no previous file | lib/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698