Index: Source/bindings/scripts/idl_definitions.py |
diff --git a/Source/bindings/scripts/idl_definitions.py b/Source/bindings/scripts/idl_definitions.py |
index 2230c8f6e207153d8145a7d7dca1560077f1bf7b..94b006c49eb6d813bb8c010a11afdf952e5094f6 100644 |
--- a/Source/bindings/scripts/idl_definitions.py |
+++ b/Source/bindings/scripts/idl_definitions.py |
@@ -470,6 +470,7 @@ class IdlOperation(TypedObject): |
class IdlArgument(TypedObject): |
def __init__(self, node): |
+ self.default_value = None |
self.extended_attributes = {} |
self.idl_type = None |
self.is_optional = node.GetProperty('OPTIONAL') # syntax: (optional T) |
@@ -488,6 +489,8 @@ class IdlArgument(TypedObject): |
if child_name != '...': |
raise ValueError('Unrecognized Argument node; expected "...", got "%s"' % child_name) |
self.is_variadic = child.GetProperty('ELLIPSIS') or False |
+ elif child_class == 'Default': |
+ self.default_value = default_node_to_default_value(child) |
else: |
raise ValueError('Unrecognized node class: %s' % child_class) |
@@ -504,6 +507,19 @@ def arguments_node_to_arguments(node): |
################################################################################ |
+# Default value |
+################################################################################ |
+ |
+def default_node_to_default_value(node): |
+ # FIXME: IDL parser currently outputs literal values inconsistently(crbug.com/374178). |
Nils Barth (inactive)
2014/06/02 02:48:34
Please use complete URLs (so syntax matching detec
|
+ # This function should return node.GetProperty('VALUE') once this issue is fixed. |
+ if (node.GetProperty('TYPE') == "boolean" or |
Nils Barth (inactive)
2014/06/02 02:48:34
Single quotes.
|
+ node.GetProperty('TYPE') == "float"): |
Nils Barth (inactive)
2014/06/02 02:48:34
You can use |in| for checking against a list:
node
Nils Barth (inactive)
2014/06/02 02:54:15
BTW, since it's probably unfamiliar:
You can also
|
+ return node.GetProperty('VALUE') |
+ return node.GetName() |
+ |
+ |
+################################################################################ |
# Extended attributes |
################################################################################ |