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
- func RegisterCallProvider(name string, provider CallProvider)
- func ValidateDeclarationAdapterCatalog(catalog DeclarationAdapterCatalog) error
- func ValidateDeclarationCatalog(catalog DeclarationCatalog) error
- func ValidateProjectDeclarationInput(input ProjectDeclarationInput) error
- func ValidateProjectGenerationResponse(response ProjectGenerationResponse) error
- type CallProvider
- type CallSite
- type DeclarationAdapterCatalog
- type DeclarationAdapterExport
- type DeclarationAdapterField
- type DeclarationAdapterModule
- type DeclarationAdapterResultBridge
- type DeclarationAdapterType
- type DeclarationCatalog
- type DeclaredBlock
- type DeclaredFunctionArgumentReferenceRule
- type DeclaredFunctionBlockRule
- type DeclaredMember
- type DeclaredModule
- type DeclaredModuleRuntimeTypes
- type DeclaredParameter
- type DeclaredReference
- type DeclaredSignature
- type DeclaredType
- type Definition
- type Field
- type GeneratedSource
- type Issue
- type ProjectClass
- type ProjectDeclarationInput
- type ProjectDirective
- type ProjectDirectiveArgument
- type ProjectDirectiveBlock
- type ProjectEnum
- type ProjectEnumMember
- type ProjectGeneratedSource
- type ProjectGenerationIssue
- type ProjectGenerationResponse
- type ProjectImport
- type ProjectMethod
- type ProjectModule
- type ProjectParameter
- type ProjectTypeAlias
- type ProjectTypeReference
- type ProjectTypeUse
- type ProjectValue
- type Record
- type Replacement
- type RequiredImport
- type SourcePosition
- type SourceSpan
- type SpecializeCallRequest
- type SpecializeCallResponse
- type Type
- type ValueSource
Constants ¶
const DeclarationAdapterProtocolVersion = 2
const DeclarationProtocolVersion = 1
const ProjectDeclarationInputProtocolVersion = 2
const ProjectGenerationProtocolVersion = 1
const ProtocolVersion = 1
Variables ¶
This section is empty.
Functions ¶
func RegisterCallProvider ¶
func RegisterCallProvider(name string, provider CallProvider)
func ValidateDeclarationAdapterCatalog ¶ added in v0.3.16
func ValidateDeclarationAdapterCatalog(catalog DeclarationAdapterCatalog) error
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 CallProvider ¶
type CallProvider func(SpecializeCallRequest) SpecializeCallResponse
type DeclarationAdapterCatalog ¶ added in v0.3.16
type DeclarationAdapterCatalog struct {
ProtocolVersion int `json:"protocolVersion"`
Modules map[string]DeclarationAdapterModule `json:"modules"`
}
DeclarationAdapterCatalog is the versioned, mode-independent declaration input consumed by a native-ecosystem adapter. It contains semantic data only; an adapter validates target-specific bridge kinds before importing the declarations into the compiler.
type DeclarationAdapterExport ¶ added in v0.3.16
type DeclarationAdapterExport struct {
Kind string `json:"kind"`
Type DeclarationAdapterType `json:"type"`
AliasTarget *DeclarationAdapterType `json:"aliasTarget,omitempty"`
Parameters []DeclarationAdapterType `json:"parameters,omitempty"`
Required int `json:"required,omitempty"`
Variadic bool `json:"variadic,omitempty"`
TypeParameters []string `json:"typeParameters,omitempty"`
Fields []DeclarationAdapterField `json:"fields,omitempty"`
Members map[string]DeclarationAdapterExport `json:"members,omitempty"`
InstanceMembers map[string]DeclarationAdapterExport `json:"instanceMembers,omitempty"`
ClassMembers map[string]DeclarationAdapterExport `json:"classMembers,omitempty"`
UnsupportedFields map[string]string `json:"unsupportedFields,omitempty"`
}
type DeclarationAdapterField ¶ added in v0.3.16
type DeclarationAdapterField struct {
Name string `json:"name"`
Type DeclarationAdapterType `json:"type"`
Optional bool `json:"optional,omitempty"`
}
type DeclarationAdapterModule ¶ added in v0.3.16
type DeclarationAdapterModule struct {
Exports map[string]DeclarationAdapterExport `json:"exports,omitempty"`
Records map[string]DeclarationAdapterExport `json:"records,omitempty"`
}
type DeclarationAdapterResultBridge ¶ added in v0.3.16
type DeclarationAdapterResultBridge struct {
Kind string `json:"kind"`
Error DeclarationAdapterType `json:"error"`
}
type DeclarationAdapterType ¶ added in v0.3.16
type DeclarationAdapterType struct {
Kind string `json:"kind"`
Name string `json:"name,omitempty"`
Arguments []DeclarationAdapterType `json:"arguments,omitempty"`
ResultBridge *DeclarationAdapterResultBridge `json:"resultBridge,omitempty"`
Nullable bool `json:"nullable,omitempty"`
Readonly bool `json:"readonly,omitempty"`
}
DeclarationAdapterType is a backend-independent semantic TypeRB type. A result bridge is adapter metadata on a function boundary rather than a second TypeRB failure model.
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 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 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 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 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 GeneratedSource ¶
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 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 Replacement ¶
type Replacement struct {
Callee string `json:"callee"`
Arguments []ValueSource `json:"arguments"`
}
type RequiredImport ¶
type SourcePosition ¶ added in v0.3.14
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 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)