| Index: Source/bindings/scripts/idl_definitions.py
|
| diff --git a/Source/bindings/scripts/idl_definitions.py b/Source/bindings/scripts/idl_definitions.py
|
| index 50664ba12ef7addd5cb3cbc69484e0629231ba3d..896bd4320da7b92e596bf7f2dd5839350dda5e79 100644
|
| --- a/Source/bindings/scripts/idl_definitions.py
|
| +++ b/Source/bindings/scripts/idl_definitions.py
|
| @@ -48,8 +48,10 @@ IdlDefinitions
|
| IdlInterface
|
| IdlAttribute < TypedObject
|
| IdlConstant < TypedObject
|
| + IdlLiteral
|
| IdlOperation < TypedObject
|
| IdlArgument < TypedObject
|
| + IdlStringifier
|
| IdlException < IdlInterface
|
| (same contents as IdlInterface)
|
|
|
| @@ -261,6 +263,7 @@ class IdlInterface(object):
|
| self.extended_attributes = {}
|
| self.operations = []
|
| self.parent = None
|
| + self.stringifier = None
|
| if not node: # Early exit for IdlException.__init__
|
| return
|
|
|
| @@ -287,6 +290,9 @@ class IdlInterface(object):
|
| self.operations.append(IdlOperation(child))
|
| elif child_class == 'Inherit':
|
| self.parent = child.GetName()
|
| + elif child_class == 'Stringifier':
|
| + self.stringifier = IdlStringifier(child)
|
| + self.process_stringifier()
|
| else:
|
| raise ValueError('Unrecognized node class: %s' % child_class)
|
|
|
| @@ -302,6 +308,14 @@ class IdlInterface(object):
|
| for operation in self.operations:
|
| operation.resolve_typedefs(typedefs)
|
|
|
| + def process_stringifier(self):
|
| + """Add the stringifier's attribute or named operation child, if it has
|
| + one, as a regular attribute/operation of this interface."""
|
| + if self.stringifier.attribute:
|
| + self.attributes.append(self.stringifier.attribute)
|
| + elif self.stringifier.operation:
|
| + self.operations.append(self.stringifier.operation)
|
| +
|
| def merge(self, other):
|
| """Merge in another interface's members (e.g., partial interface)"""
|
| self.attributes.extend(other.attributes)
|
| @@ -562,6 +576,36 @@ def arguments_node_to_arguments(node):
|
|
|
|
|
| ################################################################################
|
| +# Stringifiers
|
| +################################################################################
|
| +
|
| +class IdlStringifier(object):
|
| + def __init__(self, node):
|
| + self.attribute = None
|
| + self.operation = None
|
| + self.extended_attributes = {}
|
| +
|
| + for child in node.GetChildren():
|
| + child_class = child.GetClass()
|
| + if child_class == 'Attribute':
|
| + self.attribute = IdlAttribute(child)
|
| + elif child_class == 'Operation':
|
| + operation = IdlOperation(child)
|
| + if operation.name:
|
| + self.operation = operation
|
| + elif child_class == 'ExtAttributes':
|
| + self.extended_attributes = ext_attributes_node_to_extended_attributes(child)
|
| + else:
|
| + raise ValueError('Unrecognized node class: %s' % child_class)
|
| +
|
| + # Copy the stringifier's extended attributes (such as [Unforgable]) onto
|
| + # the underlying attribute or operation, if there is one.
|
| + if self.attribute or self.operation:
|
| + (self.attribute or self.operation).extended_attributes.update(
|
| + self.extended_attributes)
|
| +
|
| +
|
| +################################################################################
|
| # Extended attributes
|
| ################################################################################
|
|
|
|
|