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) |