Documentation
¶
Overview ¶
Package representation identifies authored physical representations shared by code generators. Runtime codec selection belongs to the corresponding runtime capability helpers.
Index ¶
- func ConcreteAttribute(att *expr.AttributeExpr) *expr.AttributeExpr
- func ContainsCustomString(attribute *expr.AttributeExpr) bool
- func CustomString(attribute *expr.AttributeExpr) bool
- func IntegerCapabilityAssertion(ref string) string
- func IntegerLossCondition(sourceRef, value, converted string) string
- func IntegerLossError(targetRef, value string) string
- func IntegerStorage(attribute *expr.AttributeExpr) *types.Basic
- func IsIntegerKind(dt expr.DataType) bool
- type IntegerConversion
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 ¶
IntegerCapabilityAssertion returns a declaration that compiles only when the referenced external type has integer storage.
func IntegerLossCondition ¶
IntegerLossCondition returns the boolean expression that reports a value changed by converting value to converted, given the source reference.
func IntegerLossError ¶
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 ¶
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.