diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-04-21 22:53:58 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-04-25 12:23:39 +0200 |
commit | 7e7b421db9ff15b8a9093cb0a7963b09594986b3 (patch) | |
tree | e6dbea4321fb38d7f7572a01e49e0276474c5de7 /components/script/dom/bindings/codegen/CodegenRust.py | |
parent | a3dafe49999d24e12b2f6b5cc74b468e58b7384a (diff) | |
download | servo-7e7b421db9ff15b8a9093cb0a7963b09594986b3.tar.gz servo-7e7b421db9ff15b8a9093cb0a7963b09594986b3.zip |
Fix generation of static JS methods
They now take a global argument.
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 960a84b1717..3f806ea05a5 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2616,7 +2616,11 @@ class CGAbstractStaticBindingMethod(CGAbstractMethod): CGAbstractMethod.__init__(self, descriptor, name, "JSBool", args, extern=True) def definition_body(self): - return self.generate_code() + preamble = CGGeneric("""\ +let global = global_object_for_js_object(JS_CALLEE(cx, vp).to_object()); +let global = global.root(); +""") + return CGList([preamble, self.generate_code()]) def generate_code(self): assert False # Override me @@ -2674,7 +2678,7 @@ class CGStaticMethod(CGAbstractStaticBindingMethod): def generate_code(self): nativeName = CGSpecializedMethod.makeNativeName(self.descriptor, self.method) - return CGMethodCall([], nativeName, True, self.descriptor, self.method) + return CGMethodCall(["global.r()"], nativeName, True, self.descriptor, self.method) class CGGenericGetter(CGAbstractBindingMethod): @@ -2748,7 +2752,7 @@ class CGStaticGetter(CGAbstractStaticBindingMethod): def generate_code(self): nativeName = CGSpecializedGetter.makeNativeName(self.descriptor, self.attr) - return CGGetterCall([], self.attr.type, nativeName, self.descriptor, + return CGGetterCall(["global.r()"], self.attr.type, nativeName, self.descriptor, self.attr) @@ -2827,7 +2831,7 @@ class CGStaticSetter(CGAbstractStaticBindingMethod): " throw_type_error(cx, \"Not enough arguments to %s setter.\");\n" " return 0;\n" "}" % self.attr.identifier.name) - call = CGSetterCall([], self.attr.type, nativeName, self.descriptor, + call = CGSetterCall(["global.r()"], self.attr.type, nativeName, self.descriptor, self.attr) return CGList([checkForArg, call]) |