summaryrefslogtreecommitdiffstats
path: root/dom/bindings/Configuration.py
diff options
context:
space:
mode:
Diffstat (limited to 'dom/bindings/Configuration.py')
-rw-r--r--dom/bindings/Configuration.py91
1 files changed, 48 insertions, 43 deletions
diff --git a/dom/bindings/Configuration.py b/dom/bindings/Configuration.py
index 354a450de6..cfcb2dcf39 100644
--- a/dom/bindings/Configuration.py
+++ b/dom/bindings/Configuration.py
@@ -43,6 +43,52 @@ class Configuration(DescriptorProvider):
the configuration file.
"""
+ class IDLAttrGetterOrSetterTemplate:
+ class TemplateAdditionalArg:
+ def __init__(self, type, name, value=None):
+ self.type = type
+ self.name = name
+ self.value = value
+
+ def __init__(self, template, getter, setter, argument, attrName):
+ self.descriptor = None
+ self.usedInOtherInterfaces = False
+ self.getter = getter
+ self.setter = setter
+ self.argument = (
+ Configuration.IDLAttrGetterOrSetterTemplate.TemplateAdditionalArg(
+ *argument
+ )
+ )
+ self.attrNameString = attrName
+ self.attr = None
+
+ class TemplateIDLAttribute:
+ def __init__(self, attr):
+ assert attr.isAttr()
+ assert not attr.isMaplikeOrSetlikeAttr()
+ assert not attr.slotIndices
+
+ self.identifier = attr.identifier
+ self.type = attr.type
+ self.extendedAttributes = attr.getExtendedAttributes()
+ self.slotIndices = None
+
+ def getExtendedAttribute(self, name):
+ return self.extendedAttributes.get(name)
+
+ def isAttr(self):
+ return True
+
+ def isMaplikeOrSetlikeAttr(self):
+ return False
+
+ def isMethod(self):
+ return False
+
+ def isStatic(self):
+ return False
+
def __init__(self, filename, webRoots, parseData, generatedEvents=[]):
DescriptorProvider.__init__(self)
@@ -51,28 +97,12 @@ class Configuration(DescriptorProvider):
exec(io.open(filename, encoding="utf-8").read(), glbl)
config = glbl["DOMInterfaces"]
- class IDLAttrGetterOrSetterTemplate:
- def __init__(self, template, getter, setter, argument, attrName):
- class TemplateAdditionalArg:
- def __init__(self, type, name, value=None):
- self.type = type
- self.name = name
- self.value = value
-
- self.descriptor = None
- self.usedInOtherInterfaces = False
- self.getter = getter
- self.setter = setter
- self.argument = TemplateAdditionalArg(*argument)
- self.attrNameString = attrName
- self.attr = None
-
self.attributeTemplates = dict()
attributeTemplatesByInterface = dict()
for interface, templates in glbl["TemplatedAttributes"].items():
for template in templates:
name = template.get("template")
- t = IDLAttrGetterOrSetterTemplate(**template)
+ t = Configuration.IDLAttrGetterOrSetterTemplate(**template)
self.attributeTemplates[name] = t
attributeTemplatesByInterface.setdefault(interface, list()).append(t)
@@ -351,33 +381,8 @@ class Configuration(DescriptorProvider):
)
# This mimics a real IDL attribute for templated bindings.
- class TemplateIDLAttribute:
- def __init__(self, attr):
- assert attr.isAttr()
- assert not attr.isMaplikeOrSetlikeAttr()
- assert not attr.slotIndices
-
- self.identifier = attr.identifier
- self.type = attr.type
- self.extendedAttributes = attr.getExtendedAttributes()
- self.slotIndices = None
-
- def getExtendedAttribute(self, name):
- return self.extendedAttributes.get(name)
-
- def isAttr(self):
- return True
-
- def isMaplikeOrSetlikeAttr(self):
- return False
-
- def isMethod(self):
- return False
-
- def isStatic(self):
- return False
- template.attr = TemplateIDLAttribute(firstAttribute)
+ template.attr = Configuration.TemplateIDLAttribute(firstAttribute)
def filterExtendedAttributes(extendedAttributes):
# These are the extended attributes that we allow to have