MCPcopy
hub / github.com/MadAppGang/dingo / ImmutabilityPlugin

Struct ImmutabilityPlugin

pkg/plugin/builtin/immutability.go:34–38  ·  view source on GitHub ↗

ImmutabilityPlugin detects reassignment to let-declared variables and reports compile-time errors for violations. This plugin enforces Rust-like immutability semantics: - Direct reassignment: x = value (error) - Compound assignment: x += 1 (error) - Increment/decrement: x++, x-- (error) - Pointer d

Source from the content-addressed store, hash-verified

32// - Index assignment: x[0] = value (ok)
33// - Map assignment: x["key"] = value (ok)
34type ImmutabilityPlugin struct {
35 ctx *plugin.Context
36 immutableVars map[string]token.Pos // varName -> declaration position
37 typeInfo *types.Info // For pointer type resolution
38}
39
40// NewImmutabilityPlugin creates a new immutability checking plugin
41func NewImmutabilityPlugin() *ImmutabilityPlugin {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected