Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Can I save an exception to a local variable? #77

Closed
Horcrux7 opened this issue Feb 23, 2019 · 2 comments
Closed

Can I save an exception to a local variable? #77

Horcrux7 opened this issue Feb 23, 2019 · 2 comments

Comments

@Horcrux7
Copy link

Exist an exception value of type except_ref only on the stack or can I safe it also in a local variable? Which type should the local variable have?

I try the follow code with wabt:

(module
  (func $foo (result i32) (local $ex anyref)
    try
      i32.const 5
      i32.const 0
      i32.div_s
      return
    catch
      local.set 0
      i32.const 2
      return
    end
  )
)

and receive:
error: type mismatch in local.set, expected [anyref] but got [except_ref]

The using of a local type except_ref work also not.

If there would be some test code then it can be very helpful.

@rossberg
Copy link
Member

Either should work, but probably isn't fully implemented yet.

@aheejin
Copy link
Member

aheejin commented Oct 20, 2019

I think this should work in in v8 by now.

@aheejin aheejin closed this as completed Oct 20, 2019
ioannad pushed a commit to ioannad/exception-handling that referenced this issue Jun 6, 2020
ioannad pushed a commit to ioannad/exception-handling that referenced this issue Jun 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants