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

Side by Side Diff: Source/bindings/scripts/idl_definitions.py

Issue 203193015: Bindings: inherit enums and callbacks from partial interface files. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/bindings/tests/idls/TestPartialInterfacePython.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 continue 157 continue
158 158
159 # Merge partial to existing interface 159 # Merge partial to existing interface
160 try: 160 try:
161 self.interfaces[interface_name].merge(new_interface) 161 self.interfaces[interface_name].merge(new_interface)
162 except KeyError: 162 except KeyError:
163 raise Exception('Tried to merge partial interface for {0}, ' 163 raise Exception('Tried to merge partial interface for {0}, '
164 'but no existing interface by that name' 164 'but no existing interface by that name'
165 .format(interface_name)) 165 .format(interface_name))
166 166
167 # Merge callbacks and enumerations
168 self.enumerations.update(other.enumerations)
169 self.callback_functions.update(other.callback_functions)
170
167 171
168 ################################################################################ 172 ################################################################################
169 # Callback Functions 173 # Callback Functions
170 ################################################################################ 174 ################################################################################
171 175
172 class IdlCallbackFunction(TypedObject): 176 class IdlCallbackFunction(TypedObject):
173 def __init__(self, node): 177 def __init__(self, node):
174 children = node.GetChildren() 178 children = node.GetChildren()
175 num_children = len(children) 179 num_children = len(children)
176 if num_children != 2: 180 if num_children != 2:
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 child_class = child.GetClass() 646 child_class = child.GetClass()
643 if child_class != 'Type': 647 if child_class != 'Type':
644 raise ValueError('Unrecognized node class: %s' % child_class) 648 raise ValueError('Unrecognized node class: %s' % child_class)
645 return type_node_to_type(child) 649 return type_node_to_type(child)
646 650
647 651
648 def union_type_node_to_idl_union_type(node, is_nullable=False): 652 def union_type_node_to_idl_union_type(node, is_nullable=False):
649 member_types = [type_node_to_type(member_type_node) 653 member_types = [type_node_to_type(member_type_node)
650 for member_type_node in node.GetChildren()] 654 for member_type_node in node.GetChildren()]
651 return IdlUnionType(member_types, is_nullable=is_nullable) 655 return IdlUnionType(member_types, is_nullable=is_nullable)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/idls/TestPartialInterfacePython.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698