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

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

Issue 2581613002: Use real IDL types in unit test stubs. (Closed)
Patch Set: Without early returns. Created 4 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: 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 739fa8858b62cfa7ec373e45f01814d0db7f1470..8dc6a3376fad1a94e639dd9bb8558091b161d928 100644
--- a/third_party/WebKit/Source/bindings/scripts/idl_definitions.py
+++ b/third_party/WebKit/Source/bindings/scripts/idl_definitions.py
@@ -441,23 +441,23 @@ class IdlException(IdlInterface):
################################################################################
class IdlAttribute(TypedObject):
- def __init__(self, node):
- self.is_read_only = bool(node.GetProperty('READONLY'))
- self.is_static = bool(node.GetProperty('STATIC'))
- self.name = node.GetName()
- # Defaults, overridden below
+ def __init__(self, node=None):
+ self.is_read_only = bool(node.GetProperty('READONLY')) if node else False
+ self.is_static = bool(node.GetProperty('STATIC')) if node else False
+ self.name = node.GetName() if node else None
self.idl_type = None
self.extended_attributes = {}
- children = node.GetChildren()
- for child in children:
- child_class = child.GetClass()
- if child_class == 'Type':
- self.idl_type = type_node_to_type(child)
- elif child_class == 'ExtAttributes':
- self.extended_attributes = ext_attributes_node_to_extended_attributes(child)
- else:
- raise ValueError('Unrecognized node class: %s' % child_class)
+ if node:
+ children = node.GetChildren()
+ for child in children:
+ child_class = child.GetClass()
+ if child_class == 'Type':
+ self.idl_type = type_node_to_type(child)
+ elif child_class == 'ExtAttributes':
+ self.extended_attributes = ext_attributes_node_to_extended_attributes(child)
+ else:
+ raise ValueError('Unrecognized node class: %s' % child_class)
def accept(self, visitor):
visitor.visit_attribute(self)

Powered by Google App Engine
This is Rietveld 408576698