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

Unified Diff: Source/bindings/scripts/unstable/idl_definitions_builder.py

Issue 114813006: IDL compiler: [SetReference] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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
Index: Source/bindings/scripts/unstable/idl_definitions_builder.py
diff --git a/Source/bindings/scripts/unstable/idl_definitions_builder.py b/Source/bindings/scripts/unstable/idl_definitions_builder.py
index 720c014de245cb876a0e07ff26b49846db75fc54..c1446534d78b60b73377dff21a213fc6afb90c7d 100644
--- a/Source/bindings/scripts/unstable/idl_definitions_builder.py
+++ b/Source/bindings/scripts/unstable/idl_definitions_builder.py
@@ -362,28 +362,34 @@ def ext_attributes_node_to_extended_attributes(node):
for attribute in attribute_list:
name = attribute.GetName()
children = attribute.GetChildren()
- if name in ['Constructor', 'CustomConstructor', 'NamedConstructor']:
+ if children:
+ if len(children) > 1:
+ raise ValueError('ExtAttributes node with %s children, expected at most 1' % len(children))
+ child = children[0]
+ child_class = child.GetClass()
+ else:
child = None
child_class = None
- if children:
- if len(children) > 1:
- raise ValueError('ExtAttributes node with %s children, expected at most 1' % len(children))
- child = children[0]
- child_class = child.GetClass()
- if name == 'Constructor':
- if child_class and child_class != 'Arguments':
- raise ValueError('Constructor only supports Arguments as child, but has child of class: %s' % child_class)
- constructors.append(child)
- elif name == 'CustomConstructor':
- if child_class and child_class != 'Arguments':
- raise ValueError('Custom Constructor only supports Arguments as child, but has child of class: %s' % child_class)
- custom_constructors.append(child)
- else: # name == 'NamedConstructor'
- if child_class and child_class != 'Call':
- raise ValueError('Named Constructor only supports Call as child, but has child of class: %s' % child_class)
- extended_attributes[name] = child
+ if name == 'Constructor':
+ if child_class and child_class != 'Arguments':
+ raise ValueError('Constructor only supports Arguments as child, but has child of class: %s' % child_class)
+ constructors.append(child)
+ elif name == 'CustomConstructor':
+ if child_class and child_class != 'Arguments':
+ raise ValueError('[CustomConstructor] only supports Arguments as child, but has child of class: %s' % child_class)
+ custom_constructors.append(child)
+ elif name == 'NamedConstructor':
+ if child_class and child_class != 'Call':
+ raise ValueError('[NamedConstructor] only supports Call as child, but has child of class: %s' % child_class)
+ extended_attributes[name] = child
+ elif name == 'SetReference':
+ if not child:
+ raise ValueError('[SetReference] requires a child, but has none.')
+ if child_class != 'Arguments':
+ raise ValueError('[SetReference] only supports Arguments as child, but has child of class: %s' % child_class)
+ extended_attributes[name] = arguments_node_to_arguments(child)
elif children:
- raise ValueError('Non-constructor ExtAttributes node with children: %s' % name)
+ raise ValueError('ExtAttributes node with unexpected children: %s' % name)
else:
value = attribute.GetProperty('VALUE')
extended_attributes[name] = value
« no previous file with comments | « no previous file | Source/bindings/scripts/unstable/v8_interface.py » ('j') | Source/bindings/templates/interface.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698