From 7d1a2d5aa35bb61904a320f36f2fa575c7211dcd Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 28 Jun 2017 15:14:18 -0400 Subject: [PATCH] nitc: remove some useless truisms. Signed-off-by: Jean Privat --- src/interpreter/naive_interpreter.nit | 2 +- src/metrics/detect_covariance.nit | 6 +++--- src/metrics/method_analyze_metrics.nit | 2 +- src/model/model.nit | 4 ++-- src/vm/virtual_machine.nit | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/interpreter/naive_interpreter.nit b/src/interpreter/naive_interpreter.nit index 991d8b5..616977a 100644 --- a/src/interpreter/naive_interpreter.nit +++ b/src/interpreter/naive_interpreter.nit @@ -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") diff --git a/src/metrics/detect_covariance.nit b/src/metrics/detect_covariance.nit index 643679a..ba6a684 100644 --- a/src/metrics/detect_covariance.nit +++ b/src/metrics/detect_covariance.nit @@ -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 diff --git a/src/metrics/method_analyze_metrics.nit b/src/metrics/method_analyze_metrics.nit index 6aee2a9..7adbd49 100644 --- a/src/metrics/method_analyze_metrics.nit +++ b/src/metrics/method_analyze_metrics.nit @@ -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 diff --git a/src/model/model.nit b/src/model/model.nit index 58fe944..70edaec 100644 --- a/src/model/model.nit +++ b/src/model/model.nit @@ -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 diff --git a/src/vm/virtual_machine.nit b/src/vm/virtual_machine.nit index 07ad951..c7e57c6 100644 --- a/src/vm/virtual_machine.nit +++ b/src/vm/virtual_machine.nit @@ -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 -- 1.7.9.5