comp: rename --no-check-other to --no-check-null, because it is what it does
authorJean Privat <jean@pryen.org>
Wed, 13 Aug 2014 14:02:35 +0000 (10:02 -0400)
committerJean Privat <jean@pryen.org>
Wed, 13 Aug 2014 14:02:35 +0000 (10:02 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/abstract_compiler.nit
src/global_compiler.nit
src/separate_compiler.nit

index 720be46..7c5d9a6 100644 (file)
@@ -51,8 +51,8 @@ redef class ToolContext
        var opt_no_check_assert: OptionBool = new OptionBool("Disable the evaluation of explicit 'assert' and 'as' (dangerous)", "--no-check-assert")
        # --no-check-autocast
        var opt_no_check_autocast: OptionBool = new OptionBool("Disable implicit casts on unsafe expression usage (dangerous)", "--no-check-autocast")
-       # --no-check-other
-       var opt_no_check_other: OptionBool = new OptionBool("Disable implicit tests: unset attribute, null receiver (dangerous)", "--no-check-other")
+       # --no-check-null
+       var opt_no_check_null: OptionBool = new OptionBool("Disable tests of null receiver (dangerous)", "--no-check-null")
        # --typing-test-metrics
        var opt_typing_test_metrics: OptionBool = new OptionBool("Enable static and dynamic count of all type tests", "--typing-test-metrics")
        # --invocation-metrics
@@ -70,7 +70,7 @@ redef class ToolContext
        do
                super
                self.option_context.add_option(self.opt_output, self.opt_dir, self.opt_no_cc, self.opt_no_main, self.opt_make_flags, self.opt_compile_dir, self.opt_hardening, self.opt_no_shortcut_range)
-               self.option_context.add_option(self.opt_no_check_covariance, self.opt_no_check_attr_isset, self.opt_no_check_assert, self.opt_no_check_autocast, self.opt_no_check_other)
+               self.option_context.add_option(self.opt_no_check_covariance, self.opt_no_check_attr_isset, self.opt_no_check_assert, self.opt_no_check_autocast, self.opt_no_check_null)
                self.option_context.add_option(self.opt_typing_test_metrics, self.opt_invocation_metrics, self.opt_isset_checks_metrics)
                self.option_context.add_option(self.opt_stacktrace)
                self.option_context.add_option(self.opt_no_gcc_directive)
@@ -1155,7 +1155,7 @@ abstract class AbstractCompilerVisitor
        # Add a check and an abort for a null reciever if needed
        fun check_recv_notnull(recv: RuntimeVariable)
        do
-               if self.compiler.modelbuilder.toolcontext.opt_no_check_other.value then return
+               if self.compiler.modelbuilder.toolcontext.opt_no_check_null.value then return
 
                var maybenull = recv.mcasttype isa MNullableType or recv.mcasttype isa MNullType
                if maybenull then
index 60b1c50..b18e9d2 100644 (file)
@@ -400,7 +400,7 @@ class GlobalCompilerVisitor
                        if res != null then self.assign(res, res2.as(not null))
                        return res
                end
-               var consider_null = not self.compiler.modelbuilder.toolcontext.opt_no_check_other.value or m.name == "==" or m.name == "!="
+               var consider_null = not self.compiler.modelbuilder.toolcontext.opt_no_check_null.value or m.name == "==" or m.name == "!="
                if args.first.mcasttype isa MNullableType or args.first.mcasttype isa MNullType and consider_null then
                        # The reciever is potentially null, so we have to 3 cases: ==, != or NullPointerException
                        self.add("if ({args.first} == NULL) \{ /* Special null case */")
index 273451f..7dd57b0 100644 (file)
@@ -1007,7 +1007,7 @@ class SeparateCompilerVisitor
        do
                var res: nullable RuntimeVariable = null
                var recv = arguments.first
-               var consider_null = not self.compiler.modelbuilder.toolcontext.opt_no_check_other.value or mmethod.name == "==" or mmethod.name == "!="
+               var consider_null = not self.compiler.modelbuilder.toolcontext.opt_no_check_null.value or mmethod.name == "==" or mmethod.name == "!="
                var maybenull = recv.mcasttype isa MNullableType and consider_null
                if maybenull then
                        self.add("if ({recv} == NULL) \{")