lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remove redundant occurences of this-> (issue 258870043 by address@hi


From: dak
Subject: Re: Remove redundant occurences of this-> (issue 258870043 by address@hidden)
Date: Tue, 21 Jul 2015 05:02:23 +0000

Reviewers: Keith,

Message:
On 2015/07/21 04:07:14, Keith wrote:
Why bother ?

Because it's distracting and makes some things too long to fit a line.

It is probably not a good idea to remove the this-> where it was used
in
comments, particularly to distinguish the function() in
virtual-function table
for the object from function() in a parent class.

Huh?  As opposed to Type::function (), this->function () is perfectly
capable of meaning either.  It's also unsuitable for distinguishing
static and non-static member functions.  What it can do is distinguish
global and member functions.  It doesn't actually make a difference
here, either: it's just some sort of implied comment that this cannot be
anything other than a member function.

Which is comparatively weak sauce.

At any rate: point out any particular instance where you (and not some
hypothetical strawman) would prefer to keep seeing this-> in the patch.

Description:
Remove redundant occurences of this->

Please review this at https://codereview.appspot.com/258870043/

Affected files (+24, -24 lines):
  M lily/audio-element.cc
  M lily/context.cc
  M lily/grob.cc
  M lily/include/music-iterator.hh
  M lily/lexer.ll
  M lily/midi-item.cc
  M lily/prob.cc
  M lily/spanner.cc
  M lily/system.cc
  M lily/tie-configuration.cc


Index: lily/audio-element.cc
diff --git a/lily/audio-element.cc b/lily/audio-element.cc
index d8244d18004106739094b6edad6d800823b38700..87ed7fcb461868acc2fd7b2f0fbfa65569da97ed 100644
--- a/lily/audio-element.cc
+++ b/lily/audio-element.cc
@@ -31,5 +31,5 @@ Audio_element::~Audio_element ()
 char const *
 Audio_element::name () const
 {
-  return this->class_name ();
+  return class_name ();
 }
Index: lily/context.cc
diff --git a/lily/context.cc b/lily/context.cc
index 192cdaa3ee8e1a7b6eaa7cb2f18ee59c97165236..7e3c646a6f7e2569ea7451213e6ab9fe6b58c10c 100644
--- a/lily/context.cc
+++ b/lily/context.cc
@@ -70,7 +70,7 @@ Context::add_context (Context *child)
                               scm_cons (child->self_scm (), SCM_EOL));

   child->daddy_context_ = this;
-  this->events_below_->register_as_listener (child->events_below_);
+  events_below_->register_as_listener (child->events_below_);
 }

 Context::Context ()
@@ -315,7 +315,7 @@ Context::create_context_from_event (SCM sev)
                 ly_symbol2scm ("UnsetProperty"));

new_context->events_below_->register_as_listener (new_context->event_source_);
-  this->add_context (new_context);
+  add_context (new_context);

   new_context->unprotect ();

@@ -414,7 +414,7 @@ Context::get_default_interpreter (const string &context_id)
       if (!t)
         {
           warning (_f ("cannot find or create: `%s'", name.c_str ()));
-          t = unsmob<Context_def> (this->definition_);
+          t = unsmob<Context_def> (definition_);
         }
       if (scm_is_symbol (t->get_default_child (SCM_EOL)))
         {
@@ -572,8 +572,8 @@ Context::remove_context (SCM)
 void
 Context::disconnect_from_parent ()
 {
- daddy_context_->events_below_->unregister_as_listener (this->events_below_); - daddy_context_->context_list_ = scm_delq_x (this->self_scm (), daddy_context_->context_list_);
+  daddy_context_->events_below_->unregister_as_listener (events_below_);
+ daddy_context_->context_list_ = scm_delq_x (self_scm (), daddy_context_->context_list_);
   daddy_context_ = 0;
 }

Index: lily/grob.cc
diff --git a/lily/grob.cc b/lily/grob.cc
index e43c71186c14f591251bc06907bdbfebfd9dc708..bf4755c1e6e0afa9b4d3aa1837609983a6a0c499 100644
--- a/lily/grob.cc
+++ b/lily/grob.cc
@@ -229,7 +229,7 @@ Grob::get_system () const
   return 0;
 }

-/* This version of get_system is more reliable than this->get_system ()
+/* This version of get_system is more reliable than get_system ()
    before line-breaking has been done, at which point there is only
    one system in the whole score and we can find it just by following
    parent pointers. */
@@ -489,7 +489,7 @@ Grob::extent (Grob *refp, Axis a) const
     if(!isinf (offset))
       real_ext.translate(offset);
     else
-      this->warning(_f ("ignored infinite %s-offset",
+      warning(_f ("ignored infinite %s-offset",
                         a == X_AXIS ? "X" : "Y"));

   return real_ext;
@@ -765,7 +765,7 @@ Grob::name () const
   SCM meta = get_property ("meta");
   SCM nm = scm_assq (ly_symbol2scm ("name"), meta);
   nm = (scm_is_pair (nm)) ? scm_cdr (nm) : SCM_EOL;
-  return scm_is_symbol (nm) ? ly_symbol2string (nm) : this->class_name ();
+  return scm_is_symbol (nm) ? ly_symbol2string (nm) : class_name ();
 }

 ADD_INTERFACE (Grob,
Index: lily/include/music-iterator.hh
diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh
index de53608ed5d9fbaa13bc82248b0550e7a1f04709..61fd3d56e9c20577edf9e718221ab0ceb29eb975 100644
--- a/lily/include/music-iterator.hh
+++ b/lily/include/music-iterator.hh
@@ -43,10 +43,10 @@
    ok () -- events left ?

    pending_mom () -- time tag of the next event to be processed.
-   PRECONDITION: this->ok () holds.
+   PRECONDITION: ok () holds.

    process (M) -- process all at M (Precondition: no events exist
-   before M, this->ok () holds).  Side-effects:
+   before M, ok () holds).  Side-effects:

    * This removes all events at M from the pending queue.

Index: lily/lexer.ll
diff --git a/lily/lexer.ll b/lily/lexer.ll
index b8faf78e31ee7e9bf5ed8283bb721df090c52a97..bfd2449e6b3e23ba2ec88b7a509791851fef2751 100644
--- a/lily/lexer.ll
+++ b/lily/lexer.ll
@@ -188,7 +188,7 @@ BOM_UTF8    \357\273\277
    /* Use the trailing context feature. Otherwise, the BOM will not be
       found if the file starts with an identifier definition. */
 <INITIAL,chords,lyrics,figures,notes>{BOM_UTF8}/.* {
- if (this->lexloc_->line_number () != 1 || this->lexloc_->column_number () != 0)
+  if (lexloc_->line_number () != 1 || lexloc_->column_number () != 0)
     {
       LexerWarning (_ ("stray UTF-8 BOM encountered").c_str ());
       // exit (1);
@@ -244,7 +244,7 @@ BOM_UTF8    \357\273\277
        s = s.substr (0, s.rfind ('\"'));

        yy_pop_state ();
-       this->here_input().get_source_file ()->name_ = s;
+       here_input().get_source_file ()->name_ = s;
        message (_f ("Renaming input to: `%s'", s.c_str ()));
        progress_indication ("\n");
        scm_module_define (scm_car (scopes_),
@@ -258,7 +258,7 @@ BOM_UTF8    \357\273\277
        sscanf (YYText (), "%d", &i);

        yy_pop_state ();
- this->here_input ().get_source_file ()->set_line (here_input ().start (), i);
+       here_input ().get_source_file ()->set_line (here_input ().start (), i);
 }

 <version>{ANY_CHAR}      {
Index: lily/midi-item.cc
diff --git a/lily/midi-item.cc b/lily/midi-item.cc
index a08c60b89a4c7ccfc80c6265f8ed84cfa2686e5d..33dd9f11bde71fedb14e67b0174fc4b0e277fc1a 100644
--- a/lily/midi-item.cc
+++ b/lily/midi-item.cc
@@ -426,5 +426,5 @@ Midi_control_function_value_change::to_string () const
 char const *
 Midi_item::name () const
 {
-  return this->class_name ();
+  return class_name ();
 }
Index: lily/prob.cc
diff --git a/lily/prob.cc b/lily/prob.cc
index d4ea432f036e0f96d1ca9089b92c9074389a6bab..938f10686164e33d98460e5d1d2bc682b341e90e 100644
--- a/lily/prob.cc
+++ b/lily/prob.cc
@@ -192,5 +192,5 @@ Prob::name () const
   if (scm_is_symbol (nm))
     return ly_symbol2string (nm);
   else
-    return this->class_name ();
+    return class_name ();
 }
Index: lily/spanner.cc
diff --git a/lily/spanner.cc b/lily/spanner.cc
index 087331ab9ffabae48dfd45883b8226b204b67228..3f3d17fb270ffb70d1b76d126e998733a50fda7a 100644
--- a/lily/spanner.cc
+++ b/lily/spanner.cc
@@ -210,7 +210,7 @@ Spanner::set_bound (Direction d, Grob *s)
       original parent for alignment.
This happens e.g. for MultiMeasureRestNumbers and PercentRepeatCounters.
     */
-    if (!dynamic_cast <Spanner *> (this->get_parent (X_AXIS)))
+    if (!dynamic_cast <Spanner *> (get_parent (X_AXIS)))
       set_parent (i, X_AXIS);

   /*
Index: lily/system.cc
diff --git a/lily/system.cc b/lily/system.cc
index 528135ad60d046b2b02d7f77640381450f368664..91e3f0818163f4036eeba3c4f620ed059002d6d7 100644
--- a/lily/system.cc
+++ b/lily/system.cc
@@ -181,7 +181,7 @@ System::do_break_substitution_and_fixup_refpoints ()

   handle_broken_dependencies ();

-  /* Because the this->get_property (all-elements) contains items in 3
+  /* Because the get_property (all-elements) contains items in 3
      versions, handle_broken_dependencies () will leave duplicated
      items in all-elements.  Strictly speaking this is harmless, but
      it leads to duplicated symbols in the output.  uniq makes sure
@@ -550,7 +550,7 @@ System::post_processing ()

   vector<Grob *> all_elts_sorted (all_elements_->array ());
   uniquify (all_elts_sorted);
-  this->get_stencil ();
+  get_stencil ();
   for (vsize i = all_elts_sorted.size (); i--;)
     {
       Grob *g = all_elts_sorted[i];
@@ -637,14 +637,14 @@ System::get_paper_system ()
         }
     }

-  Grob *left_bound = this->get_bound (LEFT);
+  Grob *left_bound = get_bound (LEFT);
   SCM prop_init = left_bound->get_property ("line-break-system-details");
   Prob *pl = make_paper_system (prop_init);
   paper_system_set_stencil (pl, sys_stencil);

   /* information that the page breaker might need */
-  Grob *right_bound = this->get_bound (RIGHT);
- pl->set_property ("vertical-skylines", this->get_property ("vertical-skylines"));
+  Grob *right_bound = get_bound (RIGHT);
+ pl->set_property ("vertical-skylines", get_property ("vertical-skylines")); pl->set_property ("page-break-permission", right_bound->get_property ("page-break-permission")); pl->set_property ("page-turn-permission", right_bound->get_property ("page-turn-permission")); pl->set_property ("page-break-penalty", right_bound->get_property ("page-break-penalty"));
@@ -665,7 +665,7 @@ System::get_paper_system ()
     }

pl->set_property ("staff-refpoint-extent", ly_interval2scm (staff_refpoints));
-  pl->set_property ("system-grob", this->self_scm ());
+  pl->set_property ("system-grob", self_scm ());

   return pl->unprotect ();
 }
Index: lily/tie-configuration.cc
diff --git a/lily/tie-configuration.cc b/lily/tie-configuration.cc
index 7628753872f326c3d9db114d20a4c56d3e0bdbf5..19a2c68f724ec7c9a40da26540085b30b976c232 100644
--- a/lily/tie-configuration.cc
+++ b/lily/tie-configuration.cc
@@ -170,7 +170,7 @@ Ties_configuration::complete_tie_card (vsize i) const
   string s;
s += to_string ("%d (%.2f) %c: ", (*this)[i].position_, (*this)[i].delta_y_,
                   ((*this)[i].dir_ == UP ? 'u' : 'd'))
-       + (*this)[i].card () + (*this).tie_card (i);
+       + (*this)[i].card () + tie_card (i);

   /*
     this is a little awkward, but we must decide where to put





reply via email to

[Prev in Thread] Current Thread [Next in Thread]