Merge branch 'super_init_call'
authorJean Privat <jean@pryen.org>
Thu, 27 Feb 2014 13:34:41 +0000 (08:34 -0500)
committerJean Privat <jean@pryen.org>
Thu, 27 Feb 2014 13:34:41 +0000 (08:34 -0500)
Current uses of explicit and implicit `super` in constructors are not
checked.

1. this series add required static verification (in `typing` and
`auto_super_int`) on the super init call (and remove two TODO).
2. the correct argument passing is implemented in the engines for the
super init calls
3. assertions are added in engines to check that the number of arguments
matches the number of parameters
4. tests are also provided (or updated)

This series is required to fix the current implementation so that the
implementation of the new style constructors can go on.

src/abstract_compiler.nit
tests/sav/nitg-s/fixme/base_attr_gen_alt1.res

index da4b877..8b587b6 100644 (file)
@@ -464,6 +464,11 @@ abstract class AbstractCompiler
                        end
                end
 
+               v.add_decl("void sig_handler(int signo)\{")
+               v.add_decl("printf(\"Caught signal : %s\\n\", strsignal(signo));")
+               v.add_decl("show_backtrace(signo);")
+               v.add_decl("\}")
+
                v.add_decl("void show_backtrace (int signo) \{")
                if not modelbuilder.toolcontext.opt_no_stacktrace.value then
                        v.add_decl("char* opt = getenv(\"NIT_NO_STACK\");")
@@ -499,12 +504,12 @@ abstract class AbstractCompiler
 
                v.add_decl("int main(int argc, char** argv) \{")
 
-               v.add("signal(SIGABRT, show_backtrace);")
-               v.add("signal(SIGFPE, show_backtrace);")
-               v.add("signal(SIGILL, show_backtrace);")
-               v.add("signal(SIGINT, show_backtrace);")
-               v.add("signal(SIGTERM, show_backtrace);")
-               v.add("signal(SIGSEGV, show_backtrace);")
+               v.add("signal(SIGABRT, sig_handler);")
+               v.add("signal(SIGFPE, sig_handler);")
+               v.add("signal(SIGILL, sig_handler);")
+               v.add("signal(SIGINT, sig_handler);")
+               v.add("signal(SIGTERM, sig_handler);")
+               v.add("signal(SIGSEGV, sig_handler);")
 
                v.add("glob_argc = argc; glob_argv = argv;")
                v.add("initialize_gc_option();")