Documentation ¶
Overview ¶
statemachine package contains the helper code for generating a state machine representing the statement and expression level of the ES5 generator.
Index ¶
- func GenerateExpressionResult(expressionNode compilergraph.GraphNode, scopegraph *scopegraph.ScopeGraph) expressiongenerator.ExpressionResult
- func GenerateFunctionSource(functionDef FunctionDef, scopegraph *scopegraph.ScopeGraph) esbuilder.SourceBuilder
- type FunctionDef
- type ResourceElement
- type ResourceStack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateExpressionResult ¶
func GenerateExpressionResult(expressionNode compilergraph.GraphNode, scopegraph *scopegraph.ScopeGraph) expressiongenerator.ExpressionResult
GenerateExpressionResult generates the expression result for an expression.
func GenerateFunctionSource ¶
func GenerateFunctionSource(functionDef FunctionDef, scopegraph *scopegraph.ScopeGraph) esbuilder.SourceBuilder
GenerateFunctionSource generates the source code for a function, including its internal state machine.
Types ¶
type FunctionDef ¶
type FunctionDef struct { Generics []string // Returns the names of the generics on the function, if any. Parameters []string // Returns the names of the parameters on the function, if any. RequiresThis bool // Returns if this function is requires the "this" var to be added. WorkerExecutes bool // Returns true if this function should be executed by a web worker. GeneratorYieldType *typegraph.TypeReference // Returns a non-nil value if the function being generated is a generator. BodyNode compilergraph.GraphNode // The parser root node for the function body. }
FunctionDef defines the struct for a function accepted by GenerateFunctionSource.
type ResourceElement ¶
type ResourceElement struct {
// contains filtered or unexported fields
}
type ResourceStack ¶
type ResourceStack struct {
// contains filtered or unexported fields
}
func (*ResourceStack) OutOfScope ¶
func (s *ResourceStack) OutOfScope(stateId stateId) []string
OutOfScope returns the names of any resource that will be out of scope when context changes to the given state.
func (*ResourceStack) Pop ¶
func (s *ResourceStack) Pop() (value resource)
Remove the top element from the stack and return it's value If the stack is empty, return nil
func (*ResourceStack) Push ¶
func (s *ResourceStack) Push(value resource)
Push a new element onto the stack
Click to show internal directories.
Click to hide internal directories.