Commit graph

13 commits

Author SHA1 Message Date
Leonardo de Moura
d87ad9eb7e refactor(util/lua): propagate C++ Lean exceptions in Lua
The following call sequence is possible:
C++ -> Lua -> C++ -> Lua -> C++

The first block of C++ is the Lean main function.
The main function invokes the Lua interpreter.
The Lua interpreter invokes a C++ Lean API.
Then the Lean API invokes a callback implemented in Lua.
The Lua callback invokes another Lean API.
Now, suppose the Lean API throws an exception.
We want the C++ exception to propagate over the mixed C++/Lua call stack.
We use the clone/rethrow exception idiom to achieve this goal.

Before this commit, the C++ exceptions were converted into strings
using the method what(), and then they were propagated over the Lua
stack using lua_error. A lua_error was then converted into a lua_exception when going back to C++.
This solution was very unsatisfactory, since all C++ exceptions were being converted into a lua_exception, and consequently the structure of the exception was being lost.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 12:25:29 -08:00
Leonardo de Moura
1315378ebb test(*): add missing tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-18 09:13:34 -08:00
Leonardo de Moura
449454efdb fix(debug): remove typeid information from assertion, the names are mangled and are not very useful
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 16:41:51 -07:00
Soonho Kong
841a1fb20c fix(debug): print type in lean_assert, print bool correctly
- use typeinfo to print out a type of value when an assertion fails.
   need to use "c++filt --types" to demangle names for non-basic types.
 - use std::boolalpha and std::noboolalpha to control the printed values
   for "true" and "false"
2013-09-28 23:38:21 -07:00
Leonardo de Moura
24c173a519 feat(debug): add assert_ne (not equal) macro
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 18:18:20 -07:00
Leonardo de Moura
6477708d78 refactor(debug): improve lean_unreachable(), now we can avoid 'fake' return statements
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 21:27:20 -07:00
Leonardo de Moura
1452e9319e feat(debug): improve lean_assert macro
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 17:29:00 -07:00
Leonardo de Moura
e9106f7512 Delete obsolete function continue_on_violation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:02:28 -07:00
Leonardo de Moura
ed13132c12 Add has_free_var, lower_free_vars
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-26 12:27:55 -07:00
Leonardo de Moura
c581990f67 Clean white-spaces
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-19 10:29:33 -07:00
Leonardo de Moura
8353181fd1 Add basic mpq tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-18 11:10:15 -07:00
Leonardo de Moura
e559bf73a9 Add basic testing infrastructure using CTest
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-18 09:12:07 -07:00
Leonardo de Moura
4f5cafdebf Add support files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-15 18:43:32 -07:00