shared

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateFunctionNormalSync           StateFunctionType = "sync"
	StateFunctionNormalAsync                            = "async"
	StateFunctionSyncOrAsyncGenerator                   = "sync-or-async-generator"
)

Variables

This section is empty.

Functions

func SourceMapWrap

SourceMapWrap wraps a builder statement or expression with its source mapping location.

func SourceMapWrapExpr

func SourceMapWrapExpr(builder esbuilder.ExpressionBuilder, expression codedom.Expression, srg *srg.SRG) esbuilder.ExpressionBuilder

SourceMapWrapExpr wraps a builder expression with its source mapping location.

Types

type Pather

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

Pather defines a helper type for generating paths.

func NewPather

func NewPather(scopegraph *scopegraph.ScopeGraph) Pather

NewPather creates a new path generator for the given graph.

func (Pather) GetMemberName

func (p Pather) GetMemberName(member typegraph.TGMember) string

GetMemberName returns the name of the given member.

func (Pather) GetModulePath

func (p Pather) GetModulePath(module typegraph.TGModule) string

GetModulePath returns the global path for the given module.

func (Pather) GetRelativeModulePath

func (p Pather) GetRelativeModulePath(module typegraph.TGModule) string

GetRelativeModulePath returns the relative path for the given module.

func (Pather) GetSetterName

func (p Pather) GetSetterName(member typegraph.TGMember) string

GetSetterName returns the name of the setter for the given member.

func (Pather) GetStaticMemberPath

func (p Pather) GetStaticMemberPath(member typegraph.TGMember, referenceType typegraph.TypeReference) string

GetStaticMemberPath returns the global path for the given statically defined type member.

func (Pather) GetStaticTypePath

func (p Pather) GetStaticTypePath(typedecl typegraph.TGTypeDecl, referenceType typegraph.TypeReference) string

GetStaticTypePath returns the global path for the given defined type.

func (Pather) GetTypePath

func (p Pather) GetTypePath(typedecl typegraph.TGTypeDecl) string

GetTypePath returns the global path for the given type.

func (Pather) InnerInstanceName

func (p Pather) InnerInstanceName(innerType typegraph.TypeReference) string

InnerInstanceName returns the name of an inner instance of the given type, when accessed under a type instance which structurally composes it.

func (Pather) TypeReferenceCall

func (p Pather) TypeReferenceCall(typeRef typegraph.TypeReference) string

TypeReferenceCall returns source for retrieving an object reference to the type defined by the given type reference.

type StateFunctionTraits

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

StateFunctionTraits is a simple struct for tracking the various traits of a function being generated.

func FunctionTraits

func FunctionTraits(isAsync bool, isGenerator bool, managesResources bool) StateFunctionTraits

FunctionTraits creates and returns a StateFunctionTraits struct for the given traits of a function.

func (StateFunctionTraits) IsAsynchronous

func (sft StateFunctionTraits) IsAsynchronous() bool

IsAsynchronous returns true if the function is asynchronous, therefore returning a Promise.

func (StateFunctionTraits) IsGenerator

func (sft StateFunctionTraits) IsGenerator() bool

IsGenerator returns true if a function is a generator, therefore returning a Stream<T>. (note that it can also be async, and therefore return a Promise<Stream<T>>)

func (StateFunctionTraits) ManagesResources

func (sft StateFunctionTraits) ManagesResources() bool

ManagesResources returns true if the function manages any resources under a `with` block.

func (StateFunctionTraits) Type

Type returns an enumeration representing the aggregated traits for the function.

type StateFunctionType

type StateFunctionType string

StateFunctionType defines an enumeration of types for a function.

type Templater

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

Templater is a helper type for running go templates.

func NewTemplater

func NewTemplater() *Templater

func (*Templater) Execute

func (temp *Templater) Execute(name string, templateStr string, context interface{}) string

execute runs the given go-template over the given context.

Jump to

Keyboard shortcuts

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