aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2013-09-11 23:49:02 -0700
committerbors-servo <release+servo@mozilla.com>2013-09-11 23:49:02 -0700
commit5aa207a7f72bab500220beef7b7a890841e33bce (patch)
treead87fc64f1efd93953ae48c1c82219533707ca6f /src/components/script/dom/bindings/codegen/CodegenRust.py
parent2372a841494dce56bc56467f2bcdb77ffa997cdd (diff)
parentdb38639c172903459859c34fa181aa9156c5f825 (diff)
downloadservo-5aa207a7f72bab500220beef7b7a890841e33bce.tar.gz
servo-5aa207a7f72bab500220beef7b7a890841e33bce.zip
auto merge of #912 : brson/servo/longcat, r=jdm
This also comes with a longcat demo, including about 35k of images that I don't know the copyright status of.
Diffstat (limited to 'src/components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--src/components/script/dom/bindings/codegen/CodegenRust.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py
index 44946cef991..92f1f73c17d 100644
--- a/src/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/src/components/script/dom/bindings/codegen/CodegenRust.py
@@ -3115,8 +3115,8 @@ class CGGetterCall(CGPerSignatureCall):
A class to generate a native object getter call for a particular IDL
getter.
"""
- def __init__(self, returnType, nativeMethodName, descriptor, attr):
- CGPerSignatureCall.__init__(self, returnType, [], [],
+ def __init__(self, argsPre, returnType, nativeMethodName, descriptor, attr):
+ CGPerSignatureCall.__init__(self, returnType, argsPre, [],
nativeMethodName, False, descriptor,
attr, getter=True)
@@ -3290,6 +3290,8 @@ class CGSpecializedGetter(CGAbstractExternMethod):
def definition_body(self):
name = self.attr.identifier.name
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
+ extraPre = ''
+ argsPre = []
# resultOutParam does not depend on whether resultAlreadyAddRefed is set
(_, resultOutParam) = getRetvalDeclarationForType(self.attr.type,
self.descriptor,
@@ -3297,11 +3299,16 @@ class CGSpecializedGetter(CGAbstractExternMethod):
infallible = ('infallible' in
self.descriptor.getExtendedAttributes(self.attr,
getter=True))
+ if name in self.descriptor.needsAbstract:
+ abstractName = re.sub(r'<\w+>', '', self.descriptor.nativeType)
+ extraPre = ' let abstract_this = %s::from_box(this);\n' % abstractName
+ argsPre = ['abstract_this']
if resultOutParam or self.attr.type.nullable() or not infallible:
nativeName = "Get" + nativeName
- return CGWrapper(CGIndenter(CGGetterCall(self.attr.type, nativeName,
+ return CGWrapper(CGIndenter(CGGetterCall(argsPre, self.attr.type, nativeName,
self.descriptor, self.attr)),
- pre=" let obj = (*obj.unnamed);\n" +
+ pre=extraPre +
+ " let obj = (*obj.unnamed);\n" +
" let this = &mut (*this).payload;\n").define()
class CGGenericSetter(CGAbstractBindingMethod):