Documentation
¶
Overview ¶
Package pass provides a visitor framework for source code analysis and transformation.
Index ¶
- type ASTPass
- type Base
- func (*Base) Apply(p ASTPass, node *ast.Apply, ctx Context)
- func (*Base) ApplyBrace(p ASTPass, node *ast.ApplyBrace, ctx Context)
- func (*Base) Arguments(p ASTPass, l *ast.Fodder, args *ast.Arguments, r *ast.Fodder, ctx Context)
- func (*Base) Array(p ASTPass, node *ast.Array, ctx Context)
- func (*Base) ArrayComp(p ASTPass, node *ast.ArrayComp, ctx Context)
- func (*Base) Assert(p ASTPass, node *ast.Assert, ctx Context)
- func (*Base) BaseContext(ASTPass) Context
- func (*Base) Binary(p ASTPass, node *ast.Binary, ctx Context)
- func (*Base) Conditional(p ASTPass, node *ast.Conditional, ctx Context)
- func (*Base) Dollar(p ASTPass, node *ast.Dollar, ctx Context)
- func (*Base) Error(p ASTPass, node *ast.Error, ctx Context)
- func (*Base) FieldParams(p ASTPass, field *ast.ObjectField, ctx Context)
- func (*Base) File(p ASTPass, node *ast.Node, finalFodder *ast.Fodder)
- func (*Base) Fodder(p ASTPass, fodder *ast.Fodder, ctx Context)
- func (*Base) FodderElement(p ASTPass, element *ast.FodderElement, ctx Context)
- func (*Base) ForSpec(p ASTPass, forSpec *ast.ForSpec, ctx Context)
- func (*Base) Function(p ASTPass, node *ast.Function, ctx Context)
- func (*Base) Import(p ASTPass, node *ast.Import, ctx Context)
- func (*Base) ImportBin(p ASTPass, node *ast.ImportBin, ctx Context)
- func (*Base) ImportStr(p ASTPass, node *ast.ImportStr, ctx Context)
- func (*Base) InSuper(p ASTPass, node *ast.InSuper, ctx Context)
- func (*Base) Index(p ASTPass, node *ast.Index, ctx Context)
- func (*Base) LiteralBoolean(p ASTPass, node *ast.LiteralBoolean, ctx Context)
- func (*Base) LiteralNull(p ASTPass, node *ast.LiteralNull, ctx Context)
- func (*Base) LiteralNumber(p ASTPass, node *ast.LiteralNumber, ctx Context)
- func (*Base) LiteralString(p ASTPass, node *ast.LiteralString, ctx Context)
- func (*Base) Local(p ASTPass, node *ast.Local, ctx Context)
- func (*Base) Object(p ASTPass, node *ast.Object, ctx Context)
- func (*Base) ObjectComp(p ASTPass, node *ast.ObjectComp, ctx Context)
- func (*Base) ObjectField(p ASTPass, field *ast.ObjectField, ctx Context)
- func (*Base) ObjectFields(p ASTPass, fields *ast.ObjectFields, ctx Context)
- func (*Base) Parameters(p ASTPass, l *ast.Fodder, params *[]ast.Parameter, r *ast.Fodder, ctx Context)
- func (*Base) Parens(p ASTPass, node *ast.Parens, ctx Context)
- func (*Base) Self(p ASTPass, node *ast.Self, ctx Context)
- func (*Base) Slice(p ASTPass, node *ast.Slice, ctx Context)
- func (*Base) SuperIndex(p ASTPass, node *ast.SuperIndex, ctx Context)
- func (*Base) Unary(p ASTPass, node *ast.Unary, ctx Context)
- func (*Base) Var(p ASTPass, node *ast.Var, ctx Context)
- func (*Base) Visit(p ASTPass, node *ast.Node, ctx Context)
- type Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASTPass ¶
type ASTPass interface { FodderElement(ASTPass, *ast.FodderElement, Context) Fodder(ASTPass, *ast.Fodder, Context) ForSpec(ASTPass, *ast.ForSpec, Context) Parameters(ASTPass, *ast.Fodder, *[]ast.Parameter, *ast.Fodder, Context) Arguments(ASTPass, *ast.Fodder, *ast.Arguments, *ast.Fodder, Context) FieldParams(ASTPass, *ast.ObjectField, Context) ObjectField(ASTPass, *ast.ObjectField, Context) ObjectFields(ASTPass, *ast.ObjectFields, Context) Apply(ASTPass, *ast.Apply, Context) ApplyBrace(ASTPass, *ast.ApplyBrace, Context) Array(ASTPass, *ast.Array, Context) ArrayComp(ASTPass, *ast.ArrayComp, Context) Assert(ASTPass, *ast.Assert, Context) Binary(ASTPass, *ast.Binary, Context) Conditional(ASTPass, *ast.Conditional, Context) Dollar(ASTPass, *ast.Dollar, Context) Error(ASTPass, *ast.Error, Context) Function(ASTPass, *ast.Function, Context) Import(ASTPass, *ast.Import, Context) ImportStr(ASTPass, *ast.ImportStr, Context) ImportBin(ASTPass, *ast.ImportBin, Context) Index(ASTPass, *ast.Index, Context) Slice(ASTPass, *ast.Slice, Context) Local(ASTPass, *ast.Local, Context) LiteralBoolean(ASTPass, *ast.LiteralBoolean, Context) LiteralNull(ASTPass, *ast.LiteralNull, Context) LiteralNumber(ASTPass, *ast.LiteralNumber, Context) LiteralString(ASTPass, *ast.LiteralString, Context) Object(ASTPass, *ast.Object, Context) ObjectComp(ASTPass, *ast.ObjectComp, Context) Parens(ASTPass, *ast.Parens, Context) Self(ASTPass, *ast.Self, Context) SuperIndex(ASTPass, *ast.SuperIndex, Context) InSuper(ASTPass, *ast.InSuper, Context) Unary(ASTPass, *ast.Unary, Context) Var(ASTPass, *ast.Var, Context) Visit(ASTPass, *ast.Node, Context) BaseContext(ASTPass) Context File(ASTPass, *ast.Node, *ast.Fodder) }
ASTPass is an interface for a pass that transforms the AST in some way.
type Base ¶
type Base struct { }
Base implements basic traversal so other passes can extend it.
func (*Base) ApplyBrace ¶
func (*Base) ApplyBrace(p ASTPass, node *ast.ApplyBrace, ctx Context)
ApplyBrace traverses that kind of node
func (*Base) Conditional ¶
func (*Base) Conditional(p ASTPass, node *ast.Conditional, ctx Context)
Conditional traverses that kind of node
func (*Base) FieldParams ¶
func (*Base) FieldParams(p ASTPass, field *ast.ObjectField, ctx Context)
FieldParams is factored out of ObjectField
func (*Base) FodderElement ¶
func (*Base) FodderElement(p ASTPass, element *ast.FodderElement, ctx Context)
FodderElement cannot descend any further
func (*Base) LiteralBoolean ¶
func (*Base) LiteralBoolean(p ASTPass, node *ast.LiteralBoolean, ctx Context)
LiteralBoolean cannot descend any further
func (*Base) LiteralNull ¶
func (*Base) LiteralNull(p ASTPass, node *ast.LiteralNull, ctx Context)
LiteralNull cannot descend any further
func (*Base) LiteralNumber ¶
func (*Base) LiteralNumber(p ASTPass, node *ast.LiteralNumber, ctx Context)
LiteralNumber cannot descend any further
func (*Base) LiteralString ¶
func (*Base) LiteralString(p ASTPass, node *ast.LiteralString, ctx Context)
LiteralString cannot descend any further
func (*Base) ObjectComp ¶
func (*Base) ObjectComp(p ASTPass, node *ast.ObjectComp, ctx Context)
ObjectComp traverses that kind of node
func (*Base) ObjectField ¶
func (*Base) ObjectField(p ASTPass, field *ast.ObjectField, ctx Context)
ObjectField traverses a single field
func (*Base) ObjectFields ¶
func (*Base) ObjectFields(p ASTPass, fields *ast.ObjectFields, ctx Context)
ObjectFields traverses object fields
func (*Base) Parameters ¶
func (*Base) Parameters(p ASTPass, l *ast.Fodder, params *[]ast.Parameter, r *ast.Fodder, ctx Context)
Parameters traverses the list of parameters
func (*Base) SuperIndex ¶
func (*Base) SuperIndex(p ASTPass, node *ast.SuperIndex, ctx Context)
SuperIndex traverses that kind of node