binder

package
v0.0.0-...-563c3ff Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindSourceFile

func BindSourceFile(file *ast.SourceFile)

func FindUseStrictPrologue

func FindUseStrictPrologue(sourceFile *ast.SourceFile, statements []*ast.Node) *ast.Node

func GetLocalSymbolForExportDefault

func GetLocalSymbolForExportDefault(symbol *ast.Symbol) *ast.Symbol

func GetSymbolNameForPrivateIdentifier

func GetSymbolNameForPrivateIdentifier(containingClassSymbol *ast.Symbol, description string) string

func SetValueDeclaration

func SetValueDeclaration(symbol *ast.Symbol, node *ast.Node)

Types

type ActiveLabel

type ActiveLabel struct {
	// contains filtered or unexported fields
}

func (*ActiveLabel) BreakTarget

func (label *ActiveLabel) BreakTarget() *ast.FlowNode

func (*ActiveLabel) ContinueTarget

func (label *ActiveLabel) ContinueTarget() *ast.FlowNode

type Binder

type Binder struct {
	// contains filtered or unexported fields
}

type ContainerFlags

type ContainerFlags int32
const (
	// The current node is not a container, and no container manipulation should happen before
	// recursing into it.
	ContainerFlagsNone ContainerFlags = 0
	// The current node is a container.  It should be set as the current container (and block-
	// container) before recursing into it.  The current node does not have locals.  Examples:
	//
	//      Classes, ObjectLiterals, TypeLiterals, Interfaces...
	ContainerFlagsIsContainer ContainerFlags = 1 << 0
	// The current node is a block-scoped-container.  It should be set as the current block-
	// container before recursing into it.  Examples:
	//
	//      Blocks (when not parented by functions), Catch clauses, For/For-in/For-of statements...
	ContainerFlagsIsBlockScopedContainer ContainerFlags = 1 << 1
	// The current node is the container of a control flow path. The current control flow should
	// be saved and restored, and a new control flow initialized within the container.
	ContainerFlagsIsControlFlowContainer                           ContainerFlags = 1 << 2
	ContainerFlagsIsFunctionLike                                   ContainerFlags = 1 << 3
	ContainerFlagsIsFunctionExpression                             ContainerFlags = 1 << 4
	ContainerFlagsHasLocals                                        ContainerFlags = 1 << 5
	ContainerFlagsIsInterface                                      ContainerFlags = 1 << 6
	ContainerFlagsIsObjectLiteralOrClassExpressionMethodOrAccessor ContainerFlags = 1 << 7
	ContainerFlagsIsThisContainer                                  ContainerFlags = 1 << 8
)

func GetContainerFlags

func GetContainerFlags(node *ast.Node) ContainerFlags

type NameResolver

type NameResolver struct {
	CompilerOptions                  *core.CompilerOptions
	GetSymbolOfDeclaration           func(node *ast.Node) *ast.Symbol
	Error                            func(location *ast.Node, message *diagnostics.Message, args ...any) *ast.Diagnostic
	Globals                          ast.SymbolTable
	ArgumentsSymbol                  *ast.Symbol
	RequireSymbol                    *ast.Symbol
	GetModuleSymbol                  func(sourceFile *ast.Node) *ast.Symbol
	Lookup                           func(symbols ast.SymbolTable, name string, meaning ast.SymbolFlags) *ast.Symbol
	SymbolReferenced                 func(symbol *ast.Symbol, meaning ast.SymbolFlags)
	SetRequiresScopeChangeCache      func(node *ast.Node, value core.Tristate)
	GetRequiresScopeChangeCache      func(node *ast.Node) core.Tristate
	OnPropertyWithInvalidInitializer func(location *ast.Node, name string, declaration *ast.Node, result *ast.Symbol) bool
	OnFailedToResolveSymbol          func(location *ast.Node, name string, meaning ast.SymbolFlags, nameNotFoundMessage *diagnostics.Message)
	OnSuccessfullyResolvedSymbol     func(location *ast.Node, result *ast.Symbol, meaning ast.SymbolFlags, lastLocation *ast.Node, associatedDeclarationForContainingInitializerOrBindingName *ast.Node, withinDeferredContext bool)
}

func (*NameResolver) Resolve

func (r *NameResolver) Resolve(location *ast.Node, name string, meaning ast.SymbolFlags, nameNotFoundMessage *diagnostics.Message, isUse bool, excludeGlobals bool) *ast.Symbol

type ReferenceResolver

type ReferenceResolver interface {
	GetReferencedExportContainer(node *ast.IdentifierNode, prefixLocals bool) *ast.Node
	GetReferencedImportDeclaration(node *ast.IdentifierNode) *ast.Declaration
	GetReferencedValueDeclaration(node *ast.IdentifierNode) *ast.Declaration
	GetReferencedValueDeclarations(node *ast.IdentifierNode) []*ast.Declaration
}

func NewReferenceResolver

func NewReferenceResolver(options *core.CompilerOptions, hooks ReferenceResolverHooks) ReferenceResolver

type ReferenceResolverHooks

type ReferenceResolverHooks struct {
	ResolveName                            func(location *ast.Node, name string, meaning ast.SymbolFlags, nameNotFoundMessage *diagnostics.Message, isUse bool, excludeGlobals bool) *ast.Symbol
	GetResolvedSymbol                      func(*ast.Node) *ast.Symbol
	GetMergedSymbol                        func(*ast.Symbol) *ast.Symbol
	GetParentOfSymbol                      func(*ast.Symbol) *ast.Symbol
	GetSymbolOfDeclaration                 func(*ast.Declaration) *ast.Symbol
	GetTypeOnlyAliasDeclaration            func(symbol *ast.Symbol, include ast.SymbolFlags) *ast.Declaration
	GetExportSymbolOfValueSymbolIfExported func(*ast.Symbol) *ast.Symbol
}

Jump to

Keyboard shortcuts

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