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

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

Issue 1057453002: bindings: Throw TypeError when required dictionary member is undefined (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 for member in self.members: 215 for member in self.members:
216 member.accept(visitor) 216 member.accept(visitor)
217 217
218 218
219 class IdlDictionaryMember(TypedObject): 219 class IdlDictionaryMember(TypedObject):
220 def __init__(self, idl_name, node): 220 def __init__(self, idl_name, node):
221 self.default_value = None 221 self.default_value = None
222 self.extended_attributes = {} 222 self.extended_attributes = {}
223 self.idl_type = None 223 self.idl_type = None
224 self.idl_name = idl_name 224 self.idl_name = idl_name
225 self.is_required = bool(node.GetProperty('REQUIRED'))
225 self.name = node.GetName() 226 self.name = node.GetName()
226 for child in node.GetChildren(): 227 for child in node.GetChildren():
227 child_class = child.GetClass() 228 child_class = child.GetClass()
228 if child_class == 'Type': 229 if child_class == 'Type':
229 self.idl_type = type_node_to_type(child) 230 self.idl_type = type_node_to_type(child)
230 elif child_class == 'Default': 231 elif child_class == 'Default':
231 self.default_value = default_node_to_idl_literal(child) 232 self.default_value = default_node_to_idl_literal(child)
232 elif child_class == 'ExtAttributes': 233 elif child_class == 'ExtAttributes':
233 self.extended_attributes = ( 234 self.extended_attributes = (
234 ext_attributes_node_to_extended_attributes(idl_name, child)) 235 ext_attributes_node_to_extended_attributes(idl_name, child))
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 self.visit_typed_object(argument) 1062 self.visit_typed_object(argument)
1062 1063
1063 def visit_iterable(self, iterable): 1064 def visit_iterable(self, iterable):
1064 self.visit_typed_object(iterable) 1065 self.visit_typed_object(iterable)
1065 1066
1066 def visit_maplike(self, maplike): 1067 def visit_maplike(self, maplike):
1067 self.visit_typed_object(maplike) 1068 self.visit_typed_object(maplike)
1068 1069
1069 def visit_setlike(self, setlike): 1070 def visit_setlike(self, setlike):
1070 self.visit_typed_object(setlike) 1071 self.visit_typed_object(setlike)
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/idl-dictionary-unittest-expected.txt ('k') | Source/bindings/scripts/v8_dictionary.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698