packageextension

package
v0.3.15 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package packageextension defines versioned, data-only boundaries used by compiler-integrated packages. Providers never receive parser, checker, or typed-IR objects.

Index

Constants

View Source
const DeclarationProtocolVersion = 1
View Source
const ProjectDeclarationInputProtocolVersion = 2
View Source
const ProjectGenerationProtocolVersion = 1
View Source
const ProtocolVersion = 1

Variables

This section is empty.

Functions

func RegisterCallProvider

func RegisterCallProvider(name string, provider CallProvider)

func ValidateDeclarationCatalog added in v0.3.14

func ValidateDeclarationCatalog(catalog DeclarationCatalog) error

func ValidateProjectDeclarationInput added in v0.3.14

func ValidateProjectDeclarationInput(input ProjectDeclarationInput) error

func ValidateProjectGenerationResponse added in v0.3.15

func ValidateProjectGenerationResponse(response ProjectGenerationResponse) error

Types

type CallSite

type CallSite struct {
	ID         string `json:"id"`
	ModulePath string `json:"modulePath"`
}

type DeclarationCatalog added in v0.3.14

type DeclarationCatalog struct {
	ProtocolVersion                int                                     `json:"protocolVersion"`
	Provider                       string                                  `json:"provider"`
	Types                          []DeclaredType                          `json:"types,omitempty"`
	Modules                        []DeclaredModule                        `json:"modules,omitempty"`
	FunctionBlockRules             []DeclaredFunctionBlockRule             `json:"functionBlockRules,omitempty"`
	FunctionArgumentReferenceRules []DeclaredFunctionArgumentReferenceRule `json:"functionArgumentReferenceRules,omitempty"`
	RuntimeTypes                   []DeclaredModuleRuntimeTypes            `json:"runtimeTypes,omitempty"`
}

DeclarationCatalog is the versioned, mode-independent output of a package declaration provider. It contains semantic data only: the compiler host validates and converts it before resolution and checking.

type DeclaredBlock added in v0.3.14

type DeclaredBlock struct {
	Parameters      []Type `json:"parameters,omitempty"`
	ControlBoundary bool   `json:"controlBoundary,omitempty"`
	Return          Type   `json:"return,omitempty"`
	ResultBoundary  Type   `json:"resultBoundary,omitempty"`
	Structured      bool   `json:"structured,omitempty"`
}

type DeclaredFunctionArgumentReferenceRule added in v0.3.14

type DeclaredFunctionArgumentReferenceRule struct {
	Package  string              `json:"package"`
	Function string              `json:"function"`
	Argument int                 `json:"argument"`
	Owner    DeclaredReference   `json:"owner"`
	Targets  []DeclaredReference `json:"targets,omitempty"`
}

type DeclaredFunctionBlockRule added in v0.3.14

type DeclaredFunctionBlockRule struct {
	Package             string `json:"package"`
	Function            string `json:"function"`
	EnclosingSuperclass string `json:"enclosingSuperclass,omitempty"`
	TypeArgument        int    `json:"typeArgument"`
	ParameterTypeSuffix string `json:"parameterTypeSuffix,omitempty"`
}

type DeclaredMember added in v0.3.14

type DeclaredMember struct {
	Name             string              `json:"name"`
	Kind             string              `json:"kind"`
	RuntimeOperation string              `json:"runtimeOperation,omitempty"`
	CallSpecializer  string              `json:"callSpecializer,omitempty"`
	Parameters       []DeclaredParameter `json:"parameters,omitempty"`
	MinimumArguments int                 `json:"minimumArguments,omitempty"`
	MaximumArguments int                 `json:"maximumArguments,omitempty"`
	Return           Type                `json:"return"`
	Variadic         bool                `json:"variadic,omitempty"`
	TypeParameters   []string            `json:"typeParameters,omitempty"`
	Alternatives     []DeclaredSignature `json:"alternatives,omitempty"`
	Block            *DeclaredBlock      `json:"block,omitempty"`
}

type DeclaredModule added in v0.3.14

type DeclaredModule struct {
	Name            string           `json:"name"`
	InstanceMembers []DeclaredMember `json:"instanceMembers,omitempty"`
}

type DeclaredModuleRuntimeTypes added in v0.3.14

type DeclaredModuleRuntimeTypes struct {
	ModulePath string `json:"modulePath"`
	Types      []Type `json:"types"`
}

type DeclaredParameter added in v0.3.14

type DeclaredParameter struct {
	Name                 string     `json:"name"`
	Type                 Type       `json:"type"`
	Keyword              bool       `json:"keyword,omitempty"`
	Optional             bool       `json:"optional,omitempty"`
	LiteralValues        []string   `json:"literalValues,omitempty"`
	LiteralArrays        [][]string `json:"literalArrays,omitempty"`
	LiteralArrayElements []string   `json:"literalArrayElements,omitempty"`
}

type DeclaredReference added in v0.3.14

type DeclaredReference struct {
	ModulePath string `json:"modulePath"`
	Name       string `json:"name"`
}

type DeclaredSignature added in v0.3.14

type DeclaredSignature struct {
	Parameters []DeclaredParameter `json:"parameters,omitempty"`
	Return     Type                `json:"return"`
	Variadic   bool                `json:"variadic,omitempty"`
}

type DeclaredType added in v0.3.14

type DeclaredType struct {
	Name            string           `json:"name"`
	TypeParameters  []string         `json:"typeParameters,omitempty"`
	Superclass      string           `json:"superclass,omitempty"`
	SourceModule    string           `json:"sourceModule,omitempty"`
	InstanceMembers []DeclaredMember `json:"instanceMembers,omitempty"`
	ClassMembers    []DeclaredMember `json:"classMembers,omitempty"`
}

type Definition

type Definition struct {
	ModulePath string `json:"modulePath,omitempty"`
	ImportPath string `json:"importPath,omitempty"`
}

type Field

type Field struct {
	Name string `json:"name"`
	Type Type   `json:"type"`
}

type GeneratedSource

type GeneratedSource struct {
	ID     string `json:"id"`
	Source string `json:"source"`
}

type Issue

type Issue struct {
	Message string `json:"message"`
}

type ProjectClass added in v0.3.14

type ProjectClass struct {
	Name           string             `json:"name"`
	TypeParameters []string           `json:"typeParameters,omitempty"`
	Superclass     *ProjectTypeUse    `json:"superclass,omitempty"`
	Methods        []ProjectMethod    `json:"methods,omitempty"`
	Directives     []ProjectDirective `json:"directives,omitempty"`
	Span           SourceSpan         `json:"span"`
}

type ProjectDeclarationInput added in v0.3.14

type ProjectDeclarationInput struct {
	ProtocolVersion int             `json:"protocolVersion"`
	Provider        string          `json:"provider"`
	Modules         []ProjectModule `json:"modules,omitempty"`
}

ProjectDeclarationInput is a versioned, read-only snapshot of source declarations that a declaration provider may inspect. It intentionally excludes parser nodes, method bodies, resolver state, and filesystem access.

type ProjectDirective added in v0.3.14

type ProjectDirective struct {
	Name      string                     `json:"name"`
	Arguments []ProjectDirectiveArgument `json:"arguments,omitempty"`
	Block     *ProjectDirectiveBlock     `json:"block,omitempty"`
	Span      SourceSpan                 `json:"span"`
}

ProjectDirective is a direct class-body call. It retains only declarative argument values and a structural block summary, never executable block statements.

type ProjectDirectiveArgument added in v0.3.14

type ProjectDirectiveArgument struct {
	Name  string       `json:"name,omitempty"`
	Splat string       `json:"splat,omitempty"`
	Value ProjectValue `json:"value"`
	Span  SourceSpan   `json:"span"`
}

type ProjectDirectiveBlock added in v0.3.15

type ProjectDirectiveBlock struct {
	Parameters       []string   `json:"parameters,omitempty"`
	StatementCount   int        `json:"statementCount"`
	ResultExpression bool       `json:"resultExpression,omitempty"`
	Span             SourceSpan `json:"span"`
}

type ProjectEnum added in v0.3.15

type ProjectEnum struct {
	Name           string              `json:"name"`
	TypeParameters []string            `json:"typeParameters,omitempty"`
	Members        []ProjectEnumMember `json:"members,omitempty"`
	Span           SourceSpan          `json:"span"`
}

type ProjectEnumMember added in v0.3.15

type ProjectEnumMember struct {
	Name       string             `json:"name"`
	Parameters []ProjectParameter `json:"parameters,omitempty"`
	RawValue   *ProjectValue      `json:"rawValue,omitempty"`
	Span       SourceSpan         `json:"span"`
}

type ProjectGeneratedSource added in v0.3.15

type ProjectGeneratedSource struct {
	ID              string           `json:"id"`
	ModulePath      string           `json:"modulePath"`
	Source          string           `json:"source"`
	RequiredImports []RequiredImport `json:"requiredImports,omitempty"`
	Origin          SourceSpan       `json:"origin"`
}

type ProjectGenerationIssue added in v0.3.15

type ProjectGenerationIssue struct {
	ModulePath string     `json:"modulePath"`
	Message    string     `json:"message"`
	Span       SourceSpan `json:"span"`
}

type ProjectGenerationResponse added in v0.3.15

type ProjectGenerationResponse struct {
	ProtocolVersion int                      `json:"protocolVersion"`
	Provider        string                   `json:"provider"`
	Sources         []ProjectGeneratedSource `json:"sources,omitempty"`
	Issues          []ProjectGenerationIssue `json:"issues,omitempty"`
}

ProjectGenerationResponse is a versioned, data-only response from a project package provider. Sources are ordinary TypeRB fragments attached to existing project modules by the compiler host.

type ProjectImport added in v0.3.14

type ProjectImport struct {
	Path       string     `json:"path"`
	ModulePath string     `json:"modulePath"`
	Symbols    []string   `json:"symbols,omitempty"`
	Alias      string     `json:"alias,omitempty"`
	Span       SourceSpan `json:"span"`
}

type ProjectMethod added in v0.3.14

type ProjectMethod struct {
	Name           string             `json:"name"`
	Class          bool               `json:"class,omitempty"`
	TypeParameters []string           `json:"typeParameters,omitempty"`
	Parameters     []ProjectParameter `json:"parameters,omitempty"`
	Return         *ProjectTypeUse    `json:"return,omitempty"`
	Span           SourceSpan         `json:"span"`
}

type ProjectModule added in v0.3.14

type ProjectModule struct {
	ModulePath  string             `json:"modulePath"`
	Imports     []ProjectImport    `json:"imports,omitempty"`
	TypeAliases []ProjectTypeAlias `json:"typeAliases,omitempty"`
	Enums       []ProjectEnum      `json:"enums,omitempty"`
	Classes     []ProjectClass     `json:"classes,omitempty"`
}

type ProjectParameter added in v0.3.14

type ProjectParameter struct {
	Name        string         `json:"name"`
	Type        ProjectTypeUse `json:"type"`
	Keyword     bool           `json:"keyword,omitempty"`
	Rest        bool           `json:"rest,omitempty"`
	KeywordRest bool           `json:"keywordRest,omitempty"`
	Optional    bool           `json:"optional,omitempty"`
	Span        SourceSpan     `json:"span"`
}

type ProjectTypeAlias added in v0.3.14

type ProjectTypeAlias struct {
	Name           string         `json:"name"`
	TypeParameters []string       `json:"typeParameters,omitempty"`
	Target         ProjectTypeUse `json:"target"`
	Span           SourceSpan     `json:"span"`
}

type ProjectTypeReference added in v0.3.14

type ProjectTypeReference struct {
	Name       string `json:"name"`
	ModulePath string `json:"modulePath"`
	ImportPath string `json:"importPath,omitempty"`
}

type ProjectTypeUse added in v0.3.14

type ProjectTypeUse struct {
	Authored       Type                   `json:"authored"`
	Resolved       Type                   `json:"resolved"`
	ResolutionPath []ProjectTypeReference `json:"resolutionPath,omitempty"`
	Span           SourceSpan             `json:"span"`
}

ProjectTypeUse separates the source spelling from the best resolved type available before checking. ResolutionPath records namespace-stable type identities traversed while resolving transparent aliases.

type ProjectValue added in v0.3.15

type ProjectValue struct {
	Kind      string                `json:"kind"`
	Raw       string                `json:"raw,omitempty"`
	Name      string                `json:"name,omitempty"`
	Reference *ProjectTypeReference `json:"reference,omitempty"`
}

type Record

type Record struct {
	Fields []Field `json:"fields"`
}

type Replacement

type Replacement struct {
	Callee    string        `json:"callee"`
	Arguments []ValueSource `json:"arguments"`
}

type RequiredImport

type RequiredImport struct {
	Path    string   `json:"path"`
	Symbols []string `json:"symbols"`
}

type SourcePosition added in v0.3.14

type SourcePosition struct {
	Offset int `json:"offset"`
	Line   int `json:"line"`
	Column int `json:"column"`
}

type SourceSpan added in v0.3.14

type SourceSpan struct {
	Start SourcePosition `json:"start"`
	End   SourcePosition `json:"end"`
}

SourceSpan is a half-open source range. An all-zero span means that source location is unavailable, which keeps programmatically assembled inputs valid.

type SpecializeCallRequest

type SpecializeCallRequest struct {
	ProtocolVersion int      `json:"protocolVersion"`
	Provider        string   `json:"provider"`
	CallSite        CallSite `json:"callSite"`
	TypeArguments   []Type   `json:"typeArguments"`
}

type SpecializeCallResponse

type SpecializeCallResponse struct {
	ProtocolVersion int              `json:"protocolVersion"`
	GeneratedSource *GeneratedSource `json:"generatedSource,omitempty"`
	Replacement     *Replacement     `json:"replacement,omitempty"`
	RequiredImports []RequiredImport `json:"requiredImports,omitempty"`
	Issues          []Issue          `json:"issues,omitempty"`
}

func SpecializeCall

func SpecializeCall(request SpecializeCallRequest) (SpecializeCallResponse, error)

type Type

type Type struct {
	Kind       string      `json:"kind"`
	Name       string      `json:"name,omitempty"`
	Nullable   bool        `json:"nullable,omitempty"`
	Arguments  []Type      `json:"arguments,omitempty"`
	Definition *Definition `json:"definition,omitempty"`
	Record     *Record     `json:"record,omitempty"`
}

type ValueSource

type ValueSource string
const ReceiverValue ValueSource = "receiver"

Jump to

Keyboard shortcuts

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