mirror of
https://github.com/servo/servo.git
synced 2025-07-25 08:10:21 +01:00
Use dynamic dispatch in mozjs::panic::wrap_panic
Pick up https://github.com/servo/rust-mozjs/pull/512 Fixes https://github.com/servo/servo/issues/26585 This diff is best viewed with "ignore whitespace changes", because of indentation change.
This commit is contained in:
parent
6114b75403
commit
d103e06ba9
3 changed files with 105 additions and 102 deletions
|
@ -2573,9 +2573,19 @@ class CGAbstractMethod(CGThing):
|
|||
body = self.definition_body()
|
||||
|
||||
if self.catchPanic:
|
||||
body = CGWrapper(CGIndenter(body),
|
||||
pre="return wrap_panic(panic::AssertUnwindSafe(|| {\n",
|
||||
post=("""\n}), %s);""" % ("()" if self.returnType == "void" else "false")))
|
||||
if self.returnType == "void":
|
||||
pre = "wrap_panic(&mut || {\n"
|
||||
post = "\n})"
|
||||
else:
|
||||
pre = (
|
||||
"let mut result = false;\n"
|
||||
"wrap_panic(&mut || result = (|| {\n"
|
||||
)
|
||||
post = (
|
||||
"\n})());\n"
|
||||
"return result"
|
||||
)
|
||||
body = CGWrapper(CGIndenter(body), pre=pre, post=post)
|
||||
|
||||
return CGWrapper(CGIndenter(body),
|
||||
pre=self.definition_prologue(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue