statemachine

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2018 License: BSD-3-Clause Imports: 9 Imported by: 1

Documentation

Overview

statemachine package contains the helper code for generating a state machine representing the statement and expression level of the ES5 generator.

Index

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) Len

func (s *ResourceStack) Len() int

Return the stack's length

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

Jump to

Keyboard shortcuts

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