| 60 | } |
| 61 | |
| 62 | func (s Scope) partMatches(target, parent Selector, options []Selector) bool { |
| 63 | for _, part := range options { |
| 64 | tm := target.Contains(part) |
| 65 | pm := parent.Contains(part) |
| 66 | if part.Negated && !pm { |
| 67 | if target.Has("raw") || target.Has("summary") { |
| 68 | // This can't apply to sized scopes. |
| 69 | return false |
| 70 | } |
| 71 | } else if (!part.Negated && !tm) || (part.Negated && pm) { |
| 72 | return false |
| 73 | } |
| 74 | } |
| 75 | return true |
| 76 | } |
| 77 | |
| 78 | // Sections splits a Selector into its parts -- e.g., text.comment.line.py -> |
| 79 | // []string{"text", "comment", "line", "py"}. |