- **summary**: Refactor Context::get_score_context () --> find_score_context () 
and find_global_context ()
- Description has changed:

Diff:

~~~~

--- old
+++ new
@@ -1,8 +1,23 @@
-Global_context::get_score_context () returns the first child, as
-before, but it is no longer a virtual method of Context.
+1: find_score_context ()
 
 Translator::find_score_context () finds the Score context enclosing
 the Translator in a way similar to (but slightly more direct than)
 \set Score.whatever = ... rather than depending on the global context.
 
-http://codereview.appspot.com/346750043
+Global_context::get_score_context () returns the first child, as
+before, but it is no longer a virtual method of Context, and it is used
+in fewer places.
+
+2: find_global_context ()
+
+Replace c->get_global_context () with find_global_context (c).  This
+function does not need to access any private information of Context, so
+pulling it out simplifies the interface of Context.  Calling it "find"
+rather than "get" is supposed to imply more work (walking the tree).
+
+Implement find_global_context (c) as find_top_context (c) plus a type
+check.  This increases code reuse and requires fewer dynamic casts.
+Abort the program if the top context is not a Global context, otherwise
+most callers would dereference null pointers.
+
+https://codereview.appspot.com/561290043/

~~~~

- **Needs**:  -->  
- **Patch**: new --> waiting
- **Type**:  --> Maintainability
- **Comment**:

This patch won't apply cleanly to master until after [#5650] (use of 
`override`) is merged.



---

** [issues:#5309] find_score_context () and find_global_context ()**

**Status:** Started
**Created:** Sat Apr 21, 2018 06:37 PM UTC by Dan Eble
**Last Updated:** Fri Jan 03, 2020 04:00 PM UTC
**Owner:** Dan Eble


1: find_score_context ()

Translator::find_score_context () finds the Score context enclosing
the Translator in a way similar to (but slightly more direct than)
\set Score.whatever = ... rather than depending on the global context.

Global_context::get_score_context () returns the first child, as
before, but it is no longer a virtual method of Context, and it is used
in fewer places.

2: find_global_context ()

Replace c->get_global_context () with find_global_context (c).  This
function does not need to access any private information of Context, so
pulling it out simplifies the interface of Context.  Calling it "find"
rather than "get" is supposed to imply more work (walking the tree).

Implement find_global_context (c) as find_top_context (c) plus a type
check.  This increases code reuse and requires fewer dynamic casts.
Abort the program if the top context is not a Global context, otherwise
most callers would dereference null pointers.

https://codereview.appspot.com/561290043/


---

Sent from sourceforge.net because [email protected] is 
subscribed to https://sourceforge.net/p/testlilyissues/issues/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/testlilyissues/admin/issues/options.  Or, if this is 
a mailing list, you can unsubscribe from the mailing list.
_______________________________________________
Testlilyissues-auto mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/testlilyissues-auto
  • ... Auto mailings of changes to Lily Issues via Testlilyissues-auto via Automated messages for lilypond development
    • ... Auto mailings of changes to Lily Issues via Testlilyissues-auto via Automated messages for lilypond development
    • ... Auto mailings of changes to Lily Issues via Testlilyissues-auto via Automated messages for lilypond development
    • ... Auto mailings of changes to Lily Issues via Testlilyissues-auto via Automated messages for lilypond development
    • ... Auto mailings of changes to Lily Issues via Testlilyissues-auto via Automated messages for lilypond development
    • ... Auto mailings of changes to Lily Issues via Testlilyissues-auto via Automated messages for lilypond development

Reply via email to