nitc: remove some useless truisms.
authorJean Privat <jean@pryen.org>
Wed, 28 Jun 2017 19:14:18 +0000 (15:14 -0400)
committerJean Privat <jean@pryen.org>
Wed, 28 Jun 2017 19:14:18 +0000 (15:14 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/interpreter/naive_interpreter.nit
src/metrics/detect_covariance.nit
src/metrics/method_analyze_metrics.nit
src/model/model.nit
src/vm/virtual_machine.nit

index 991d8b5..616977a 100644 (file)
@@ -839,7 +839,7 @@ redef class ANode
                        abort
                end
 
-               if v.modelbuilder.toolcontext.opt_no_color.value == true then
+               if v.modelbuilder.toolcontext.opt_no_color.value then
                        sys.stderr.write("Runtime error: {message} ({location.file.filename}:{location.line_start})\n")
                else
                        sys.stderr.write("{location}: Runtime error: {message}\n{location.colored_line("0;31")}\n")
index 643679a..ba6a684 100644 (file)
@@ -494,7 +494,7 @@ redef class MType
                if anchor == null then anchor = sub # UGLY: any anchor will work
                var resolved_sub = sub.anchor_to(mmodule, anchor)
                var res = resolved_sub.collect_mclasses(mmodule).has(sup.mclass)
-               if res == false then return false
+               if not res then return false
                if not sup isa MGenericType then return true
                var sub2 = sub.supertype_to(mmodule, anchor, sup.mclass)
                assert sub2.mclass == sup.mclass
@@ -502,10 +502,10 @@ redef class MType
                        var sub_arg = sub2.arguments[i]
                        var sup_arg = sup.arguments[i]
                        res = sub_arg.is_subtype(mmodule, anchor, sup_arg)
-                       if res == false then return false
+                       if not res then return false
                        # The two new lines
                        res = sup_arg.is_subtype(mmodule, anchor, sub_arg)
-                       if res == false then return false
+                       if not res then return false
                        # End of the two new lines
                end
                return true
index 6aee2a9..7adbd49 100644 (file)
@@ -69,7 +69,7 @@ public class MethodAnalyzeMetrics
                        var callsite = n.callsite
                        if callsite != null then
                                self.total_call += 1
-                               if callsite.recv_is_self == true then self.total_self_call += 1
+                               if callsite.recv_is_self then self.total_self_call += 1
                        end
                end
        end
index 58fe944..70edaec 100644 (file)
@@ -885,7 +885,7 @@ abstract class MType
                if anchor == null then anchor = sub # UGLY: any anchor will work
                var resolved_sub = sub.anchor_to(mmodule, anchor)
                var res = resolved_sub.collect_mclasses(mmodule).has(sup.mclass)
-               if res == false then return false
+               if not res then return false
                if not sup isa MGenericType then return true
                var sub2 = sub.supertype_to(mmodule, anchor, sup.mclass)
                assert sub2.mclass == sup.mclass
@@ -893,7 +893,7 @@ abstract class MType
                        var sub_arg = sub2.arguments[i]
                        var sup_arg = sup.arguments[i]
                        res = sub_arg.is_subtype(mmodule, anchor, sup_arg)
-                       if res == false then return false
+                       if not res then return false
                end
                return true
        end
index 07ad951..c7e57c6 100644 (file)
@@ -116,7 +116,7 @@ class VirtualMachine super NaiveInterpreter
                var mask = sub.mclass.vtable.mask
 
                var res = inter_is_subtype_ph(super_id, mask, sub.mclass.vtable.internal_vtable)
-               if res == false then return false
+               if not res then return false
                # sub and sup can be generic types, each argument of generics has to be tested
 
                if not sup isa MGenericType then return true
@@ -127,7 +127,7 @@ class VirtualMachine super NaiveInterpreter
                        var sub_arg = sub2.arguments[i]
                        var sup_arg = sup.arguments[i]
                        var res2 = is_subtype(sub_arg, sup_arg)
-                       if res2 == false then return false
+                       if not res2 then return false
                end
                return true
        end