From: Jean Privat Date: Fri, 12 Jul 2019 19:53:15 +0000 (-0400) Subject: Merge: typing: get_method refactoring X-Git-Url: http://nitlanguage.org?hp=d72e5f9f46247621b77234ca0f36493d51cbe14e Merge: typing: get_method refactoring Split the get_method to three different entry points. These new entry points make it possible to adapt the treatment to the actual context. This avoids creating callsites manually and in the same time do the verification if the researched method exist (display an error if not exist) Signed-off-by: Florian Deljarry Pull-Request: #2760 Reviewed-by: Alexandre Terrasa Reviewed-by: Jean Privat --- diff --git a/src/compiler/abstract_compiler.nit b/src/compiler/abstract_compiler.nit index e786374..f04c86d 100644 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_compiler.nit @@ -196,7 +196,7 @@ class MakefileToolchain var time1 = get_time self.toolcontext.info("*** END WRITING C: {time1-time0} ***", 2) - if not toolcontext.check_errors then return + toolcontext.check_errors # Execute the Makefile diff --git a/tests/nit.args b/tests/nit.args index ba1a276..5eff78e 100644 --- a/tests/nit.args +++ b/tests/nit.args @@ -6,3 +6,4 @@ base_simple3.nit -n -e 'print line' test_prog/README.md test_prog/test_prog.nit test_ffi_c_interpreter.nit - +--keep-going test_keep_going.nit --run --dir out/ diff --git a/tests/nitc.args b/tests/nitc.args index b68b2f2..d590e01 100644 --- a/tests/nitc.args +++ b/tests/nitc.args @@ -9,3 +9,4 @@ test_define.nit -D text=hello -D num=42 -D flag --dir out/ ; out/test_define --log --log-dir $WRITE test_prog -o out/test_prog.bin test_define.nit --semi-global -D text=hello -D num=42 -D flag --dir out/ ; out/test_define --run ../examples/print_arguments.nit 1 2 3 --dir out/ +--keep-going test_keep_going.nit --run --dir out/ diff --git a/tests/niti.skip b/tests/niti.skip index 0d24e60..4beb4fb 100644 --- a/tests/niti.skip +++ b/tests/niti.skip @@ -5,6 +5,7 @@ nit_args4 nit_args5 nit_args6 nit_args8 +nit_args9 nitvm_args1 nitvm_args3 nitin diff --git a/tests/nitvm.skip b/tests/nitvm.skip index 697b17e..097ca87 100644 --- a/tests/nitvm.skip +++ b/tests/nitvm.skip @@ -5,6 +5,7 @@ nit_args4 nit_args5 nit_args6 nit_args8 +nit_args9 nitvm_args1 nitvm_args3 nitin diff --git a/tests/sav/nit_args9.res b/tests/sav/nit_args9.res new file mode 100644 index 0000000..1a3a40c --- /dev/null +++ b/tests/sav/nit_args9.res @@ -0,0 +1,25 @@ +test_keep_going.nit:15,11--14: Error: class `Fail` not found in module `test_keep_going`. + fun plop: Fail + ^ +test_keep_going.nit:40,2--11: Error: unreachable statement. + 999.output + ^ +test_keep_going.nit:26,2--5: Error: method or variable `fail` unknown in `Sys`. + fail + ^ +test_keep_going.nit:30,14--17: Error: class `Fail` not found in module `test_keep_going`. + var x = new Fail + ^ +test_keep_going.nit:35,5: Type Error: expected `Bool`, got `Int`. + if 1 then abort + ^ +test_keep_going.nit:44,18--21: Error: method `fail` does not exists in `Sys`. + var a = new Sys.fail + ^ +1 +2 +3 +4 +5 +6 +7 diff --git a/tests/sav/nitc_args12.res b/tests/sav/nitc_args12.res new file mode 100644 index 0000000..4181eb7 --- /dev/null +++ b/tests/sav/nitc_args12.res @@ -0,0 +1,26 @@ +test_keep_going.nit:15,11--14: Error: class `Fail` not found in module `test_keep_going`. + fun plop: Fail + ^ +test_keep_going.nit:40,2--11: Error: unreachable statement. + 999.output + ^ +test_keep_going.nit:26,2--5: Error: method or variable `fail` unknown in `Sys`. + fail + ^ +test_keep_going.nit:30,14--17: Error: class `Fail` not found in module `test_keep_going`. + var x = new Fail + ^ +test_keep_going.nit:35,5: Type Error: expected `Bool`, got `Int`. + if 1 then abort + ^ +test_keep_going.nit:44,18--21: Error: method `fail` does not exists in `Sys`. + var a = new Sys.fail + ^ +Errors: 6. Warnings: 0. +1 +2 +3 +4 +5 +6 +7