diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-04-24 23:52:25 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-04-24 23:52:27 +0200 |
commit | a6a06e0ffc1e84af1ec5d105c439fc23a59eec95 (patch) | |
tree | e222842703ac8002447ca34429880e0de09a6ff9 /src/components/script/dom/bindings/codegen/CodegenRust.py | |
parent | 82afae123e772c7a4eefa7c0fb3ef9e99eed38ed (diff) | |
download | servo-a6a06e0ffc1e84af1ec5d105c439fc23a59eec95.tar.gz servo-a6a06e0ffc1e84af1ec5d105c439fc23a59eec95.zip |
Inline CGAbstractBindingMethod.getThis.
There's no good reason to keep this separate; it's only called once, and
inlining the function makes the code a little clearer.
This commit does not make any change to the generated code.
Diffstat (limited to 'src/components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r-- | src/components/script/dom/bindings/codegen/CodegenRust.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index a0bbc521f5a..769674a0b3a 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -2493,21 +2493,18 @@ class CGAbstractBindingMethod(CGAbstractExternMethod): # we're someone's consequential interface. But for this-unwrapping, we # know that we're the real deal. So fake a descriptor here for # consumption by FailureFatalCastableObjectUnwrapper. - unwrapThis = CGIndenter(CGGeneric( - "this = " + str(CastableObjectUnwrapper( + unwrapThis = str(CastableObjectUnwrapper( FakeCastableDescriptor(self.descriptor), - "obj", self.unwrapFailureCode)) + ";\n")) - return CGList([ self.getThis(), unwrapThis, - self.generate_code() ], "\n").define() - - def getThis(self): - return CGIndenter( + "obj", self.unwrapFailureCode)) + unwrapThis = CGIndenter( CGGeneric("let obj: *JSObject = JS_THIS_OBJECT(cx, vp as *mut JSVal);\n" "if obj.is_null() {\n" " return false as JSBool;\n" "}\n" "\n" - "let this: JS<%s>;" % self.descriptor.concreteType)) + "let this: JS<%s>;\n" + "this = %s;\n" % (self.descriptor.concreteType, unwrapThis))) + return CGList([ unwrapThis, self.generate_code() ], "\n").define() def generate_code(self): assert(False) # Override me |