representation

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 4 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 representation identifies authored physical representations shared by code generators. Runtime codec selection belongs to the corresponding runtime capability helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConcreteAttribute

func ConcreteAttribute(att *expr.AttributeExpr) *expr.AttributeExpr

ConcreteAttribute returns the representation of the concrete value inside a root presence carrier. It detaches the root and each nullable named alias in that root chain, preserving nominal identity and all child declarations, recursive edges, layout, constraints, and authored default ownership. It does not remove presence from structural children or mutate the supplied graph.

func ContainsCustomString

func ContainsCustomString(attribute *expr.AttributeExpr) bool

ContainsCustomString reports whether the occurrence's reachable storage graph contains an authored String representation. Cycles are visited once.

func CustomString

func CustomString(attribute *expr.AttributeExpr) bool

CustomString reports a semantic String with authored custom physical storage. Explicit raw JSON keeps its own representation contract.

func IntegerCapabilityAssertion

func IntegerCapabilityAssertion(ref string) string

IntegerCapabilityAssertion returns a declaration that compiles only when the referenced external type has integer storage.

func IntegerLossCondition

func IntegerLossCondition(sourceRef, value, converted string) string

IntegerLossCondition returns the boolean expression that reports a value changed by converting value to converted, given the source reference.

func IntegerLossError

func IntegerLossError(targetRef, value string) string

IntegerLossError returns the error expression reporting that value cannot be represented by the target reference.

func IntegerStorage

func IntegerStorage(attribute *expr.AttributeExpr) *types.Basic

IntegerStorage returns the predeclared Go type that physically stores the attribute, following named declarations to their authored storage. It returns nil for external storage that is not a predeclared Go type.

func IsIntegerKind

func IsIntegerKind(dt expr.DataType) bool

IsIntegerKind reports whether the semantic type, after aliases, is one of the DSL integer primitives.

Types

type IntegerConversion

type IntegerConversion struct {
	// Checked reports that some source value may be unrepresentable in the
	// target, so the conversion must round-trip and compare signs.
	Checked bool
	// SourceOpaque and TargetOpaque report external storage whose declaration
	// the generator cannot inspect. Emitters assert integer capability for them.
	SourceOpaque, TargetOpaque bool
}

IntegerConversion describes the value-level contract of converting one integer representation to another. Storage overrides remain admitted; only values that the destination cannot represent are rejected at runtime.

func ClassifyIntegerConversion

func ClassifyIntegerConversion(source, target *expr.AttributeExpr) (conversion IntegerConversion, ok bool, err error)

ClassifyIntegerConversion reports the conversion contract between two integer attributes. ok is false when either side is not a semantic integer. Known non-integer storage cannot carry integer values and is an error. Conversions are checked when any value is lossy on the 386 or amd64 sizes.

Jump to

Keyboard shortcuts

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