Documentation
¶
Index ¶
- func CompileSourceToTypeScript(source string, packageName string) (string, error)
- func FormatDiagnostic(diag Diagnostic) string
- func FormatDiagnostics(diagnostics []Diagnostic) string
- type CompilationResult
- type CompileError
- type CompileRequest
- type CompileRequestOwner
- type CompileService
- func (s *CompileService) Compile(ctx context.Context, req *CompileRequest) (*CompilationResult, error)
- func (s *CompileService) LoweringOwner() *LoweringOwner
- func (s *CompileService) OverrideRegistryOwner() *OverrideRegistryOwner
- func (s *CompileService) PackageGraphOwner() *PackageGraphOwner
- func (s *CompileService) RequestOwner() *CompileRequestOwner
- func (s *CompileService) RuntimeContractOwner() *RuntimeContractOwner
- func (s *CompileService) SemanticModelOwner() *SemanticModelOwner
- func (s *CompileService) TypeScriptEmitOwner() *TypeScriptEmitOwner
- type Compiler
- type Config
- type DependencyMode
- type Diagnostic
- type DiagnosticPosition
- type DiagnosticSeverity
- type LoweredProgram
- type LoweringOptions
- type LoweringOwner
- type OverrideFacts
- type OverrideMetadata
- type OverrideParityVerifier
- type OverrideRegistryOwner
- func (o *OverrideRegistryOwner) CopyPackages(ctx context.Context, req *CompileRequest, plan *overrideCopyPlan) ([]string, []Diagnostic)
- func (o *OverrideRegistryOwner) CopyPlan(ctx context.Context, req *CompileRequest, graph *PackageGraph) (*overrideCopyPlan, []Diagnostic)
- func (o *OverrideRegistryOwner) Facts(ctx context.Context) (*OverrideFacts, []Diagnostic)
- func (o *OverrideRegistryOwner) IsFunctionAsync(pkgPath, function string) (bool, error)
- func (o *OverrideRegistryOwner) IsMethodAsync(pkgPath, method string) (bool, error)
- func (o *OverrideRegistryOwner) Metadata(pkgPath string) (*OverrideMetadata, error)
- type PackageGraph
- type PackageGraphNode
- type PackageGraphOwner
- type PackageTestFunction
- type PackageTestGraph
- type PackageTestGraphPackage
- type PackageTestGraphVariant
- type RuntimeContractOwner
- func (o *RuntimeContractOwner) BuiltinImport() RuntimeImport
- func (o *RuntimeContractOwner) Helper(helper RuntimeHelper) (RuntimeHelperContract, bool)
- func (o *RuntimeContractOwner) HelperName(helper RuntimeHelper) (string, bool)
- func (o *RuntimeContractOwner) Helpers() []RuntimeHelperContract
- func (o *RuntimeContractOwner) HelpersByCategory(category RuntimeHelperCategory) []RuntimeHelperContract
- func (o *RuntimeContractOwner) MissingRuntimeExports() ([]string, error)
- func (o *RuntimeContractOwner) QualifiedHelper(helper RuntimeHelper) string
- type RuntimeEmissionMode
- type RuntimeHelper
- type RuntimeHelperCategory
- type RuntimeHelperContract
- type RuntimeImport
- type SemanticModel
- type SemanticModelOwner
- type TypeScriptEmitOwner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileSourceToTypeScript ¶ added in v0.0.71
CompileSourceToTypeScript is the WASM adapter for browser source compilation.
func FormatDiagnostic ¶ added in v0.2.1
func FormatDiagnostic(diag Diagnostic) string
FormatDiagnostic returns the canonical human-readable form of one diagnostic.
func FormatDiagnostics ¶ added in v0.2.1
func FormatDiagnostics(diagnostics []Diagnostic) string
FormatDiagnostics returns the canonical human-readable diagnostic summary.
Types ¶
type CompilationResult ¶ added in v0.0.25
type CompilationResult struct {
// CompiledPackages contains package paths compiled to TypeScript.
CompiledPackages []string
// CopiedPackages contains package paths copied from override packages.
CopiedPackages []string
// OriginalPackages contains the package patterns or package paths requested.
OriginalPackages []string
// Diagnostics contains all diagnostics produced by the compile request.
Diagnostics []Diagnostic
}
CompilationResult describes a compiler run after adapter normalization.
type CompileError ¶ added in v0.1.0
type CompileError struct {
// Diagnostics are the structured compiler diagnostics.
Diagnostics []Diagnostic
}
CompileError wraps structured diagnostics for ordinary Go error paths.
func NewCompileError ¶ added in v0.1.0
func NewCompileError(diagnostics []Diagnostic) *CompileError
NewCompileError creates a compile error from diagnostics.
func (*CompileError) Error ¶ added in v0.1.0
func (e *CompileError) Error() string
Error returns the human-readable diagnostic summary.
type CompileRequest ¶ added in v0.1.0
type CompileRequest struct {
// Patterns are the Go package patterns requested by the caller.
Patterns []string
// Dir is the working directory for package loading.
Dir string
// OutputPath is the root where TypeScript output would be written.
OutputPath string
// BuildFlags are forwarded to the Go package loader.
BuildFlags []string
// OverrideDirs are additional GoScript override roots.
OverrideDirs []string
// DependencyMode controls whether dependencies are included in the graph.
DependencyMode DependencyMode
// RuntimeEmissionMode controls runtime package emission policy.
RuntimeEmissionMode RuntimeEmissionMode
// ProtobufTypeScriptBinding binds .pb.go files to sibling .pb.ts files.
ProtobufTypeScriptBinding bool
// Tests controls whether package loading includes Go package-test variants.
Tests bool
// AllDependencies controls whether the package graph should include deps.
AllDependencies bool
// DisableEmitBuiltin controls whether runtime packages are emitted.
DisableEmitBuiltin bool
}
CompileRequest describes one compiler invocation after adapter normalization.
type CompileRequestOwner ¶ added in v0.1.0
type CompileRequestOwner struct{}
CompileRequestOwner owns adapter input normalization and validation.
func NewCompileRequestOwner ¶ added in v0.1.0
func NewCompileRequestOwner() *CompileRequestOwner
NewCompileRequestOwner creates a compile request owner.
func (*CompileRequestOwner) NewRequest ¶ added in v0.1.0
func (o *CompileRequestOwner) NewRequest(conf Config, patterns []string) *CompileRequest
NewRequest builds a request from public compiler config and package patterns.
func (*CompileRequestOwner) Validate ¶ added in v0.1.0
func (o *CompileRequestOwner) Validate(req *CompileRequest) []Diagnostic
Validate returns request diagnostics that must stop compilation before output.
type CompileService ¶ added in v0.1.0
type CompileService struct {
// contains filtered or unexported fields
}
CompileService owns the v2 compiler pipeline.
func NewCompileService ¶ added in v0.1.0
func NewCompileService(overrideDirs ...string) *CompileService
NewCompileService creates a compile service with every pipeline owner.
func (*CompileService) Compile ¶ added in v0.1.0
func (s *CompileService) Compile(ctx context.Context, req *CompileRequest) (*CompilationResult, error)
Compile runs one request through the v2 pipeline.
func (*CompileService) LoweringOwner ¶ added in v0.1.0
func (s *CompileService) LoweringOwner() *LoweringOwner
LoweringOwner returns the lowering owner.
func (*CompileService) OverrideRegistryOwner ¶ added in v0.1.0
func (s *CompileService) OverrideRegistryOwner() *OverrideRegistryOwner
OverrideRegistryOwner returns the override registry owner.
func (*CompileService) PackageGraphOwner ¶ added in v0.1.0
func (s *CompileService) PackageGraphOwner() *PackageGraphOwner
PackageGraphOwner returns the package graph owner.
func (*CompileService) RequestOwner ¶ added in v0.1.0
func (s *CompileService) RequestOwner() *CompileRequestOwner
RequestOwner returns the compile request owner.
func (*CompileService) RuntimeContractOwner ¶ added in v0.1.0
func (s *CompileService) RuntimeContractOwner() *RuntimeContractOwner
RuntimeContractOwner returns the runtime contract owner.
func (*CompileService) SemanticModelOwner ¶ added in v0.1.0
func (s *CompileService) SemanticModelOwner() *SemanticModelOwner
SemanticModelOwner returns the semantic model owner.
func (*CompileService) TypeScriptEmitOwner ¶ added in v0.1.0
func (s *CompileService) TypeScriptEmitOwner() *TypeScriptEmitOwner
TypeScriptEmitOwner returns the TypeScript emit owner.
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
Compiler is the public Go adapter for the v2 compile service.
func NewCompiler ¶
NewCompiler builds a compiler adapter over the v2 compile service.
func (*Compiler) CompilePackages ¶
func (c *Compiler) CompilePackages(ctx context.Context, patterns ...string) (*CompilationResult, error)
CompilePackages compiles Go package patterns through the v2 pipeline.
type Config ¶
type Config struct {
// Dir is the working directory for the compiler.
Dir string
// OutputPath is the output path root.
OutputPath string
// BuildFlags are the Go build flags to use during package loading.
BuildFlags []string
// OverrideDirs are additional GoScript override roots.
OverrideDirs []string
// AllDependencies controls whether dependencies are included in the graph.
AllDependencies bool
// DisableEmitBuiltin controls whether runtime packages are emitted.
DisableEmitBuiltin bool
// ProtobufTypeScriptBinding binds .pb.go files to sibling .pb.ts files.
ProtobufTypeScriptBinding bool
// contains filtered or unexported fields
}
Config is the public compiler configuration.
type DependencyMode ¶ added in v0.1.0
type DependencyMode string
DependencyMode describes how much of the loaded package graph to keep.
const ( // DependencyModeRequested keeps only requested package nodes. DependencyModeRequested DependencyMode = "requested" // DependencyModeAll keeps reachable dependency package nodes. DependencyModeAll DependencyMode = "all" )
type Diagnostic ¶ added in v0.1.0
type Diagnostic struct {
// Severity is the diagnostic severity.
Severity DiagnosticSeverity
// Code is a stable machine-readable diagnostic code.
Code string
// Message is the short human-readable diagnostic.
Message string
// Detail carries optional longer guidance.
Detail string
// Position is the optional source point that caused the diagnostic.
Position *DiagnosticPosition
}
Diagnostic is a structured compiler message surfaced by every adapter.
type DiagnosticPosition ¶ added in v0.2.1
type DiagnosticPosition struct {
// File is the raw file identity from the compiler source owner.
File string
// DisplayFile is the request-relative file identity for human output.
DisplayFile string
// Line is the 1-based source line.
Line int
// Column is the 1-based source column.
Column int
}
DiagnosticPosition identifies the source point that caused a diagnostic.
type DiagnosticSeverity ¶ added in v0.1.0
type DiagnosticSeverity string
DiagnosticSeverity is the severity of a compiler diagnostic.
const ( // DiagnosticSeverityError marks a diagnostic that stops compilation. DiagnosticSeverityError DiagnosticSeverity = "error" // DiagnosticSeverityWarning marks a diagnostic that does not stop compilation. DiagnosticSeverityWarning DiagnosticSeverity = "warning" )
type LoweredProgram ¶ added in v0.1.0
type LoweredProgram struct {
// contains filtered or unexported fields
}
LoweredProgram is the compiler-owned IR consumed by TypeScript emission.
type LoweringOptions ¶ added in v0.2.0
type LoweringOptions struct {
// SourceRoot is the request source root that may contain sibling protobuf TypeScript files.
SourceRoot string
// DisplayRoot is the request root used to format source file names in diagnostics.
DisplayRoot string
// OutputPath is the TypeScript output root used for generated relative imports.
OutputPath string
// ProtobufTypeScriptBinding binds .pb.go files to sibling .pb.ts files.
ProtobufTypeScriptBinding bool
}
LoweringOptions are request-scoped lowering switches.
type LoweringOwner ¶ added in v0.1.0
type LoweringOwner struct {
// contains filtered or unexported fields
}
LoweringOwner owns conversion from the semantic model to compiler IR.
func NewLoweringOwner ¶ added in v0.1.0
func NewLoweringOwner(runtimeOwner *RuntimeContractOwner, overrideOwner *OverrideRegistryOwner) *LoweringOwner
NewLoweringOwner creates the lowering owner.
func (*LoweringOwner) Build ¶ added in v0.1.0
func (o *LoweringOwner) Build(ctx context.Context, model *SemanticModel, opts ...LoweringOptions) (*LoweredProgram, []Diagnostic)
Build converts the semantic model into the compiler IR.
type OverrideFacts ¶ added in v0.1.1
type OverrideFacts struct {
// contains filtered or unexported fields
}
OverrideFacts is the immutable compiler-visible view of GoScript overrides.
func (*OverrideFacts) HasPackage ¶ added in v0.1.1
func (f *OverrideFacts) HasPackage(pkgPath string) bool
HasPackage returns true when pkgPath has a GoScript override package.
func (*OverrideFacts) IsFunctionAsync ¶ added in v0.1.1
func (f *OverrideFacts) IsFunctionAsync(pkgPath, function string) bool
IsFunctionAsync returns true when override metadata marks a package-level function async.
func (*OverrideFacts) IsMethodAsync ¶ added in v0.1.1
func (f *OverrideFacts) IsMethodAsync(pkgPath, method string) bool
IsMethodAsync returns true when override metadata marks a method async.
func (*OverrideFacts) Metadata ¶ added in v0.1.1
func (f *OverrideFacts) Metadata(pkgPath string) OverrideMetadata
Metadata returns compiler-visible override metadata for a package path.
type OverrideMetadata ¶ added in v0.1.0
type OverrideMetadata struct {
// Dependencies are override package dependencies.
Dependencies []string
// AsyncFunctions maps package-level function names to async status.
AsyncFunctions map[string]bool
// AsyncMethods maps Type.Method keys to async status.
AsyncMethods map[string]bool
}
OverrideMetadata describes compiler-visible facts from a package override.
type OverrideParityVerifier ¶ added in v0.2.0
type OverrideParityVerifier struct{}
OverrideParityVerifier owns compiler-side parity checks for ledgered overrides.
func NewOverrideParityVerifier ¶ added in v0.2.0
func NewOverrideParityVerifier() *OverrideParityVerifier
NewOverrideParityVerifier creates the override parity verifier.
func (*OverrideParityVerifier) Verify ¶ added in v0.2.0
func (v *OverrideParityVerifier) Verify( ctx context.Context, graph *PackageGraph, facts *OverrideFacts, ) []Diagnostic
Verify checks ledgered override packages against JS/WASM Go exports and effective TypeScript package exports.
func (*OverrideParityVerifier) VerifyNoDeferred ¶ added in v0.2.0
func (v *OverrideParityVerifier) VerifyNoDeferred(facts *OverrideFacts, pkgPaths ...string) []Diagnostic
VerifyNoDeferred reports transient parity entries that remain in packages whose parity surface is expected to be closed.
type OverrideRegistryOwner ¶ added in v0.1.0
type OverrideRegistryOwner struct {
// contains filtered or unexported fields
}
OverrideRegistryOwner owns GoScript override package metadata and copy plans.
func NewOverrideRegistryOwner ¶ added in v0.1.0
func NewOverrideRegistryOwner(overrideDirs ...string) *OverrideRegistryOwner
NewOverrideRegistryOwner creates the override registry owner.
func (*OverrideRegistryOwner) CopyPackages ¶ added in v0.1.0
func (o *OverrideRegistryOwner) CopyPackages( ctx context.Context, req *CompileRequest, plan *overrideCopyPlan, ) ([]string, []Diagnostic)
CopyPackages writes override packages from a copy plan to the request output tree.
func (*OverrideRegistryOwner) CopyPlan ¶ added in v0.1.0
func (o *OverrideRegistryOwner) CopyPlan( ctx context.Context, req *CompileRequest, graph *PackageGraph, ) (*overrideCopyPlan, []Diagnostic)
CopyPlan builds the ordered override package copy plan for a request.
func (*OverrideRegistryOwner) Facts ¶ added in v0.1.1
func (o *OverrideRegistryOwner) Facts(ctx context.Context) (*OverrideFacts, []Diagnostic)
Facts returns the immutable compiler-visible override facts.
func (*OverrideRegistryOwner) IsFunctionAsync ¶ added in v0.1.1
func (o *OverrideRegistryOwner) IsFunctionAsync(pkgPath, function string) (bool, error)
IsFunctionAsync returns true when override metadata marks a package-level function async.
func (*OverrideRegistryOwner) IsMethodAsync ¶ added in v0.1.0
func (o *OverrideRegistryOwner) IsMethodAsync(pkgPath, method string) (bool, error)
IsMethodAsync returns true when override metadata marks a method async.
func (*OverrideRegistryOwner) Metadata ¶ added in v0.1.0
func (o *OverrideRegistryOwner) Metadata(pkgPath string) (*OverrideMetadata, error)
Metadata returns compiler-visible override metadata for a package path.
type PackageGraph ¶ added in v0.1.0
type PackageGraph struct {
// RequestedPatterns are the package patterns from the compile request.
RequestedPatterns []string
// RequestedPackagePaths are the loaded package paths for requested patterns.
RequestedPackagePaths []string
// Nodes are the deterministic package graph nodes.
Nodes []*PackageGraphNode
// NodesByPackagePath maps package path to graph node.
NodesByPackagePath map[string]*PackageGraphNode
// contains filtered or unexported fields
}
PackageGraph is the immutable package graph produced for a compile request.
type PackageGraphNode ¶ added in v0.1.0
type PackageGraphNode struct {
// ID is the go/packages package identity.
ID string
// PkgPath is the stable Go package path.
PkgPath string
// Name is the Go package name.
Name string
// ModulePath is the owning module path when known.
ModulePath string
// ModuleDir is the owning module directory when known.
ModuleDir string
// ForTest is the package path under test for Go test variants.
ForTest string
// GoFiles are the package source files.
GoFiles []string
// CompiledGoFiles are files selected by build constraints.
CompiledGoFiles []string
// Imports are imported package paths.
Imports []string
// Requested marks packages matched by request patterns.
Requested bool
// OverrideCandidate marks packages with a matching GoScript override package.
OverrideCandidate bool
}
PackageGraphNode is one package in the loaded graph.
type PackageGraphOwner ¶ added in v0.1.0
type PackageGraphOwner struct {
// contains filtered or unexported fields
}
PackageGraphOwner owns Go package loading and graph identity.
func NewPackageGraphOwner ¶ added in v0.1.0
func NewPackageGraphOwner(overrideOwners ...*OverrideRegistryOwner) *PackageGraphOwner
NewPackageGraphOwner creates the package graph owner.
func (*PackageGraphOwner) Load ¶ added in v0.1.0
func (o *PackageGraphOwner) Load(ctx context.Context, req *CompileRequest) (*PackageGraph, []Diagnostic)
Load builds the package graph for a validated request.
func (*PackageGraphOwner) LoadTestGraph ¶ added in v0.1.1
func (o *PackageGraphOwner) LoadTestGraph(ctx context.Context, req *CompileRequest) (*PackageTestGraph, []Diagnostic)
LoadTestGraph builds package-scoped test graph facts for a validated request.
type PackageTestFunction ¶ added in v0.1.1
type PackageTestFunction struct {
// Name is the Go TestXxx function name.
Name string
// PackagePath is the package variant that exports the function.
PackagePath string
}
PackageTestFunction describes one discovered ordinary Go test function.
type PackageTestGraph ¶ added in v0.1.1
type PackageTestGraph struct {
// RequestedPatterns are the package patterns from the compile request.
RequestedPatterns []string
// Packages are deterministic package-test facts keyed by package under test.
Packages []*PackageTestGraphPackage
// contains filtered or unexported fields
}
PackageTestGraph is the package-scoped graph used by GoScript test runners.
func (*PackageTestGraph) PackageByPath ¶ added in v0.1.1
func (g *PackageTestGraph) PackageByPath(path string) *PackageTestGraphPackage
PackageByPath returns the package facts for a package under test.
type PackageTestGraphPackage ¶ added in v0.1.1
type PackageTestGraphPackage struct {
// PackagePath is the package under test.
PackagePath string
// PackageName is the base package name.
PackageName string
// PackageID is the go/packages package identity for the package under test.
PackageID string
// GoFiles are the package source files.
GoFiles []string
// CompiledGoFiles are files selected by build constraints.
CompiledGoFiles []string
// SamePackageTests is the same-package test variant when present.
SamePackageTests *PackageTestGraphVariant
// ExternalPackageTests is the external-package test variant when present.
ExternalPackageTests *PackageTestGraphVariant
// Diagnostics are package or variant load diagnostics attached to this package.
Diagnostics []Diagnostic
}
PackageTestGraphPackage describes one requested package under test.
func (*PackageTestGraphPackage) HasTests ¶ added in v0.1.1
func (p *PackageTestGraphPackage) HasTests() bool
HasTests returns true when the package has any loaded test variant.
type PackageTestGraphVariant ¶ added in v0.1.1
type PackageTestGraphVariant struct {
// ID is the go/packages package identity.
ID string
// PkgPath is the stable Go package path for this variant.
PkgPath string
// Name is the Go package name for this variant.
Name string
// ForTest is the package path this variant tests.
ForTest string
// GoFiles are the package source files.
GoFiles []string
// CompiledGoFiles are files selected by build constraints.
CompiledGoFiles []string
// Imports are packages imported directly by this test variant.
Imports []string
// Diagnostics are load diagnostics attached to this variant.
Diagnostics []Diagnostic
// Tests are ordinary TestXxx functions discovered in this variant.
Tests []PackageTestFunction
}
PackageTestGraphVariant describes one Go test package variant.
type RuntimeContractOwner ¶ added in v0.1.0
type RuntimeContractOwner struct {
// contains filtered or unexported fields
}
RuntimeContractOwner owns generated-code helper names and runtime capabilities.
func NewRuntimeContractOwner ¶ added in v0.1.0
func NewRuntimeContractOwner() *RuntimeContractOwner
NewRuntimeContractOwner creates the runtime contract owner.
func (*RuntimeContractOwner) BuiltinImport ¶ added in v0.1.0
func (o *RuntimeContractOwner) BuiltinImport() RuntimeImport
BuiltinImport returns the runtime import used by generated package modules.
func (*RuntimeContractOwner) Helper ¶ added in v0.1.0
func (o *RuntimeContractOwner) Helper(helper RuntimeHelper) (RuntimeHelperContract, bool)
Helper returns one runtime helper contract.
func (*RuntimeContractOwner) HelperName ¶ added in v0.1.0
func (o *RuntimeContractOwner) HelperName(helper RuntimeHelper) (string, bool)
HelperName returns the exported runtime symbol for a helper.
func (*RuntimeContractOwner) Helpers ¶ added in v0.1.0
func (o *RuntimeContractOwner) Helpers() []RuntimeHelperContract
Helpers returns every compiler-visible runtime helper contract.
func (*RuntimeContractOwner) HelpersByCategory ¶ added in v0.1.0
func (o *RuntimeContractOwner) HelpersByCategory(category RuntimeHelperCategory) []RuntimeHelperContract
HelpersByCategory returns helper contracts in a category.
func (*RuntimeContractOwner) MissingRuntimeExports ¶ added in v0.1.1
func (o *RuntimeContractOwner) MissingRuntimeExports() ([]string, error)
MissingRuntimeExports returns helper exports absent from the real runtime source.
func (*RuntimeContractOwner) QualifiedHelper ¶ added in v0.1.0
func (o *RuntimeContractOwner) QualifiedHelper(helper RuntimeHelper) string
QualifiedHelper returns a generated-code reference to a runtime helper.
type RuntimeEmissionMode ¶ added in v0.1.0
type RuntimeEmissionMode string
RuntimeEmissionMode describes how runtime packages should be handled.
const ( // RuntimeEmissionModeEmit emits required runtime packages with output. RuntimeEmissionModeEmit RuntimeEmissionMode = "emit" // RuntimeEmissionModeReference references runtime packages without emitting them. RuntimeEmissionModeReference RuntimeEmissionMode = "reference" )
type RuntimeHelper ¶ added in v0.1.0
type RuntimeHelper string
RuntimeHelper identifies one compiler-visible helper exported by @goscript/builtin.
const ( RuntimeHelperPrintln RuntimeHelper = "builtin.println" RuntimeHelperPrint RuntimeHelper = "builtin.print" RuntimeHelperInt RuntimeHelper = "builtin.int" RuntimeHelperUint RuntimeHelper = "builtin.uint" RuntimeHelperByte RuntimeHelper = "builtin.byte" RuntimeHelperLen RuntimeHelper = "builtin.len" RuntimeHelperCap RuntimeHelper = "builtin.cap" RuntimeHelperClear RuntimeHelper = "builtin.clear" RuntimeHelperPanic RuntimeHelper = "builtin.panic" RuntimeHelperRecover RuntimeHelper = "builtin.recover" RuntimeHelperMin RuntimeHelper = "builtin.min" RuntimeHelperMax RuntimeHelper = "builtin.max" RuntimeHelperComplex RuntimeHelper = "builtin.complex" RuntimeHelperReal RuntimeHelper = "builtin.real" RuntimeHelperImag RuntimeHelper = "builtin.imag" RuntimeHelperUint64Shl RuntimeHelper = "builtin.uint64Shl" RuntimeHelperUint64Shr RuntimeHelper = "builtin.uint64Shr" RuntimeHelperInt64Shl RuntimeHelper = "builtin.int64Shl" RuntimeHelperInt64Shr RuntimeHelper = "builtin.int64Shr" RuntimeHelperUintShr RuntimeHelper = "builtin.uintShr" RuntimeHelperUint64Div RuntimeHelper = "builtin.uint64Div" RuntimeHelperUint64Mod RuntimeHelper = "builtin.uint64Mod" RuntimeHelperUint64Mul RuntimeHelper = "builtin.uint64Mul" RuntimeHelperUint64Add RuntimeHelper = "builtin.uint64Add" RuntimeHelperUint64Sub RuntimeHelper = "builtin.uint64Sub" RuntimeHelperUint64And RuntimeHelper = "builtin.uint64And" RuntimeHelperUint64Or RuntimeHelper = "builtin.uint64Or" RuntimeHelperUint64Xor RuntimeHelper = "builtin.uint64Xor" RuntimeHelperInt64Div RuntimeHelper = "builtin.int64Div" RuntimeHelperInt64Mod RuntimeHelper = "builtin.int64Mod" RuntimeHelperInt64Mul RuntimeHelper = "builtin.int64Mul" RuntimeHelperInt64Add RuntimeHelper = "builtin.int64Add" RuntimeHelperInt64Sub RuntimeHelper = "builtin.int64Sub" RuntimeHelperInt64And RuntimeHelper = "builtin.int64And" RuntimeHelperInt64Or RuntimeHelper = "builtin.int64Or" RuntimeHelperInt64Xor RuntimeHelper = "builtin.int64Xor" RuntimeHelperAssignStruct RuntimeHelper = "value.assignStruct" RuntimeHelperMarkAsStructValue RuntimeHelper = "value.markAsStructValue" RuntimeHelperCloneStructValue RuntimeHelper = "value.cloneStructValue" RuntimeHelperCloneArrayValue RuntimeHelper = "value.cloneArrayValue" RuntimeHelperPointerValue RuntimeHelper = "value.pointerValue" RuntimeHelperPointerValueOrNil RuntimeHelper = "value.pointerValueOrNil" RuntimeHelperArrayEqual RuntimeHelper = "value.arrayEqual" RuntimeHelperComparableEqual RuntimeHelper = "value.comparableEqual" RuntimeHelperVarRef RuntimeHelper = "varref.varRef" RuntimeHelperFieldRef RuntimeHelper = "varref.fieldRef" RuntimeHelperUnref RuntimeHelper = "varref.unref" RuntimeHelperIsVarRef RuntimeHelper = "varref.isVarRef" RuntimeHelperUnsupportedPointerRef RuntimeHelper = "varref.unsupportedPointerRef" RuntimeHelperMakeSlice RuntimeHelper = "slice.makeSlice" RuntimeHelperGoSlice RuntimeHelper = "slice.goSlice" RuntimeHelperArrayToSlice RuntimeHelper = "slice.arrayToSlice" RuntimeHelperArrayPointerFromIndexRef RuntimeHelper = "slice.arrayPointerFromIndexRef" RuntimeHelperSliceToArray RuntimeHelper = "slice.sliceToArray" RuntimeHelperSliceToArrayPointer RuntimeHelper = "slice.sliceToArrayPointer" RuntimeHelperAppend RuntimeHelper = "slice.append" RuntimeHelperCopy RuntimeHelper = "slice.copy" RuntimeHelperAsArray RuntimeHelper = "slice.asArray" RuntimeHelperStringToRunes RuntimeHelper = "slice.stringToRunes" RuntimeHelperRangeString RuntimeHelper = "slice.rangeString" RuntimeHelperStringToRune RuntimeHelper = "slice.stringToRune" RuntimeHelperRunesToString RuntimeHelper = "slice.runesToString" RuntimeHelperStringToBytes RuntimeHelper = "slice.stringToBytes" RuntimeHelperBytesToString RuntimeHelper = "slice.bytesToString" RuntimeHelperStringEqual RuntimeHelper = "slice.stringEqual" RuntimeHelperStringCompare RuntimeHelper = "slice.stringCompare" RuntimeHelperStringHeaderRef RuntimeHelper = "slice.stringHeaderRef" RuntimeHelperSliceHeaderRef RuntimeHelper = "slice.sliceHeaderRef" RuntimeHelperGenericBytesOrStringToString RuntimeHelper = "slice.genericBytesOrStringToString" RuntimeHelperIndexStringOrBytes RuntimeHelper = "slice.indexStringOrBytes" RuntimeHelperSliceStringOrBytes RuntimeHelper = "slice.sliceStringOrBytes" RuntimeHelperIndexRef RuntimeHelper = "slice.indexRef" RuntimeHelperIndexAddress RuntimeHelper = "slice.indexAddress" RuntimeHelperIndexByteAddress RuntimeHelper = "slice.indexByteAddress" RuntimeHelperUnsafePointerRef RuntimeHelper = "slice.unsafePointerRef" RuntimeHelperMakeMap RuntimeHelper = "map.makeMap" RuntimeHelperMapGet RuntimeHelper = "map.mapGet" RuntimeHelperMapSet RuntimeHelper = "map.mapSet" RuntimeHelperMapHas RuntimeHelper = "map.mapHas" RuntimeHelperDeleteMapEntry RuntimeHelper = "map.deleteMapEntry" RuntimeHelperNewError RuntimeHelper = "error.newError" RuntimeHelperToGoError RuntimeHelper = "error.toGoError" RuntimeHelperWrapPrimitiveError RuntimeHelper = "error.wrapPrimitiveError" RuntimeHelperTypeKind RuntimeHelper = "type.TypeKind" RuntimeHelperRegisterStructType RuntimeHelper = "type.registerStructType" RuntimeHelperRegisterInterfaceType RuntimeHelper = "type.registerInterfaceType" RuntimeHelperGetTypeByName RuntimeHelper = "type.getTypeByName" RuntimeHelperTypeAssert RuntimeHelper = "type.typeAssert" RuntimeHelperTypeAssertTuple RuntimeHelper = "type.typeAssertTuple" RuntimeHelperMustTypeAssert RuntimeHelper = "type.mustTypeAssert" RuntimeHelperIs RuntimeHelper = "type.is" RuntimeHelperTypeSwitch RuntimeHelper = "type.typeSwitch" RuntimeHelperTypedNil RuntimeHelper = "type.typedNil" RuntimeHelperInterfaceValue RuntimeHelper = "type.interfaceValue" RuntimeHelperNamedValueInterfaceValue RuntimeHelper = "type.namedValueInterfaceValue" RuntimeHelperFunctionValue RuntimeHelper = "type.functionValue" RuntimeHelperNamedFunction RuntimeHelper = "type.namedFunction" RuntimeHelperGenericZero RuntimeHelper = "type.genericZero" RuntimeHelperCallGenericMethod RuntimeHelper = "type.callGenericMethod" RuntimeHelperMakeChannel RuntimeHelper = "channel.makeChannel" RuntimeHelperMakeChannelRef RuntimeHelper = "channel.makeChannelRef" RuntimeHelperChanSend RuntimeHelper = "channel.chanSend" RuntimeHelperChanRecv RuntimeHelper = "channel.chanRecv" RuntimeHelperChanRecvWithOk RuntimeHelper = "channel.chanRecvWithOk" RuntimeHelperSelectStatement RuntimeHelper = "channel.selectStatement" RuntimeHelperDisposableStack RuntimeHelper = "defer.DisposableStack" RuntimeHelperAsyncDisposableStack RuntimeHelper = "defer.AsyncDisposableStack" RuntimeHelperGetHostRuntime RuntimeHelper = "host.getHostRuntime" RuntimeHelperWriteHostStdoutText RuntimeHelper = "host.writeHostStdoutText" RuntimeHelperWriteHostStderrText RuntimeHelper = "host.writeHostStderrText" RuntimeHelperIsMainScript RuntimeHelper = "host.isMainScript" )
type RuntimeHelperCategory ¶ added in v0.1.0
type RuntimeHelperCategory string
RuntimeHelperCategory names a runtime helper family owned by the contract.
const ( RuntimeHelperCategoryBuiltin RuntimeHelperCategory = "builtin" RuntimeHelperCategoryValue RuntimeHelperCategory = "value" RuntimeHelperCategoryVarRef RuntimeHelperCategory = "varref" RuntimeHelperCategorySlice RuntimeHelperCategory = "slice" RuntimeHelperCategoryMap RuntimeHelperCategory = "map" RuntimeHelperCategoryError RuntimeHelperCategory = "error" RuntimeHelperCategoryType RuntimeHelperCategory = "type" RuntimeHelperCategoryChannel RuntimeHelperCategory = "channel" RuntimeHelperCategoryDefer RuntimeHelperCategory = "defer" RuntimeHelperCategoryHost RuntimeHelperCategory = "host" )
type RuntimeHelperContract ¶ added in v0.1.0
type RuntimeHelperContract struct {
Helper RuntimeHelper
Export string
Category RuntimeHelperCategory
}
RuntimeHelperContract describes one helper exported by the runtime package.
type RuntimeImport ¶ added in v0.1.0
RuntimeImport is a generated TypeScript import owned by the runtime contract.
type SemanticModel ¶ added in v0.1.0
type SemanticModel struct {
// contains filtered or unexported fields
}
SemanticModel is the immutable compiler semantic surface consumed by lowering.
type SemanticModelOwner ¶ added in v0.1.0
type SemanticModelOwner struct {
// contains filtered or unexported fields
}
SemanticModelOwner owns immutable Go semantic facts used by lowering.
func NewSemanticModelOwner ¶ added in v0.1.0
func NewSemanticModelOwner(overrideOwners ...*OverrideRegistryOwner) *SemanticModelOwner
NewSemanticModelOwner creates the semantic model owner.
func (*SemanticModelOwner) Build ¶ added in v0.1.0
func (o *SemanticModelOwner) Build(ctx context.Context, graph *PackageGraph) (*SemanticModel, []Diagnostic)
Build constructs semantic facts for a package graph.
type TypeScriptEmitOwner ¶ added in v0.1.0
type TypeScriptEmitOwner struct {
// contains filtered or unexported fields
}
TypeScriptEmitOwner owns deterministic TypeScript file emission.
func NewTypeScriptEmitOwner ¶ added in v0.1.0
func NewTypeScriptEmitOwner(runtimeOwners ...*RuntimeContractOwner) *TypeScriptEmitOwner
NewTypeScriptEmitOwner creates the TypeScript emit owner.
func (*TypeScriptEmitOwner) Emit ¶ added in v0.1.0
func (o *TypeScriptEmitOwner) Emit( ctx context.Context, req *CompileRequest, program *LoweredProgram, ) ([]string, []Diagnostic)
Emit writes a lowered program to the configured TypeScript output tree.
func (*TypeScriptEmitOwner) EmitToMemory ¶ added in v0.1.1
func (o *TypeScriptEmitOwner) EmitToMemory( ctx context.Context, program *LoweredProgram, ) (map[string]string, []Diagnostic)
EmitToMemory renders a lowered program into deterministic slash-path files.
Source Files
¶
- build-flags.go
- compile-request.go
- compiler.go
- config.go
- diagnostic.go
- lowered-program.go
- lowering.go
- override-facts.go
- override-parity-verifier.go
- override-parity.go
- override-registry.go
- package-graph.go
- package-test-function.go
- package-test-graph-package.go
- package-test-graph-variant.go
- package-test-graph.go
- protobuf-ts-binding.go
- result.go
- runtime-contract.go
- semantic-model-types.go
- semantic-model.go
- service.go
- typescript-emitter.go
- wasm-api.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package gotest owns GoScript package-test execution.
|
Package gotest owns GoScript package-test execution. |
|
Package wasm provides the WASM-friendly compiler adapter surface.
|
Package wasm provides the WASM-friendly compiler adapter surface. |