rename

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

func (*Conflict) Error

func (c *Conflict) Error() string

Error describes the conflict, naming what the new name would mean.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL