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

Unified Diff: third_party/WebKit/Source/bindings/scripts/idl_definitions.py

Issue 2290113002: Add extended attributes to IdlCallbackFunction (Closed)
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/scripts/idl_definitions.py
diff --git a/third_party/WebKit/Source/bindings/scripts/idl_definitions.py b/third_party/WebKit/Source/bindings/scripts/idl_definitions.py
index 95006780d7a86c881725b4764acddda8bf4c3ade..d5b059766e2a5ee89904ebe75f0bf71d2b2a7243 100644
--- a/third_party/WebKit/Source/bindings/scripts/idl_definitions.py
+++ b/third_party/WebKit/Source/bindings/scripts/idl_definitions.py
@@ -173,9 +173,15 @@ class IdlCallbackFunction(TypedObject):
def __init__(self, idl_name, node):
children = node.GetChildren()
num_children = len(children)
- if num_children != 2:
- raise ValueError('Expected 2 children, got %s' % num_children)
- type_node, arguments_node = children
+ self.extended_attributes = {}
+ if num_children == 2:
+ type_node, arguments_node = children
+ elif num_children == 3:
+ type_node, arguments_node, extended_attributes_node = children
+ self.extended_attributes = (
+ ext_attributes_node_to_extended_attributes(idl_name, extended_attributes_node))
+ else:
+ raise ValueError('Expected 2 or 3 children, got %s' % num_children)
haraken 2016/08/30 05:27:57 I'd prefer the following pattern: if num_children
Yuki 2016/08/30 05:49:11 Lisa's code looks more Python's way than haraken's
lkawai 2016/08/30 05:57:01 Done.
lkawai 2016/08/30 05:57:01 Acknowledged.
arguments_node_class = arguments_node.GetClass()
if arguments_node_class != 'Arguments':
raise ValueError('Expected Arguments node, got %s' % arguments_node_class)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698