Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommentOptimizer ¶ added in v0.0.7
type CommentOptimizer struct {
}
CommentOptimizer removes all comments from the code
type CompoundOptimizer ¶
type CompoundOptimizer struct {
// contains filtered or unexported fields
}
CompoundOptimizer wraps all other optimizers and executes them
func NewCompoundOptimizer ¶
func NewCompoundOptimizer() *CompoundOptimizer
NewCompoundOptimizer creates a new compound optimizer
type Optimizer ¶
type Optimizer interface {
// Optimize optimizes the given ast. The ast is mutated (obviously)
Optimize(prog *ast.Program) error
}
Optimizer is the common interface for all optimizers
type StaticExpressionOptimizer ¶
type StaticExpressionOptimizer struct {
}
StaticExpressionOptimizer evaluates static expressions at compile-time
func NewStaticExpressionOptimizer ¶
func NewStaticExpressionOptimizer() *StaticExpressionOptimizer
NewStaticExpressionOptimizer returns a new StaticExpressionOptimizer
type VariableNameOptimizer ¶
type VariableNameOptimizer struct {
// contains filtered or unexported fields
}
VariableNameOptimizer replaces variable names with sorter names Names of external variables will be left unchanged
func NewVariableNameOptimizer ¶
func NewVariableNameOptimizer() *VariableNameOptimizer
NewVariableNameOptimizer returns a new VariableNameOptimizer
func (*VariableNameOptimizer) Optimize ¶
func (o *VariableNameOptimizer) Optimize(prog ast.Node) error
Optimize is needed to implement Optimizer
func (*VariableNameOptimizer) SpecialReplacement ¶ added in v0.0.6
func (o *VariableNameOptimizer) SpecialReplacement(in string, out string)
SpecialReplacement registers aspecial replacement. Variables named in, will be renamed to out. No other variables will be renamed to out (no collions will occur)