Documentation
¶
Overview ¶
Package rename refuses renames that would change what a name means: the new name taken where the element is declared, or a rewritten reference captured.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conflict ¶
type Conflict struct {
// Subject is the qualified name of the element being renamed.
Subject string
// NewName is the name refused.
NewName string
// Means is the qualified name NewName already means, or would at a reference.
Means string
// Site is the namespace of the captured reference; empty for a taken name.
Site string
// Ambiguity is how many elements the reference would name at once, where the
// rename would leave it ambiguous rather than reading another element.
Ambiguity int
}
Conflict is why a rename is refused: what the new name would mean instead.
func Check ¶
func Check(r *resolve.Resolver, sem *semantics.Model, sym *symbols.Symbol, name, newName string, occurrences []Occurrence) *Conflict
Check reports the first conflict renaming sym's written name to newName would create: the declaration's own scope first, then each occurrence in order. sem selects what a respelled call would run, as the checker selects it.
type Occurrence ¶
type Occurrence struct {
// Ref is the reference the segment belongs to, as the document walk collected it.
Ref resolve.Reference
// Part indexes the segment in Ref.QN.
Part int
}
Occurrence is one reference segment written with the name being renamed.
func (Occurrence) Span ¶
func (o Occurrence) Span() source.Span
Span is the segment's bytes in its document.