Documentation
¶
Overview ¶
codedom package contains types representing a lower-level IR for easier construction of ES5. Expressions and Statements found in the codedom represent a set of primitives to which the SRG can be translated while not losing semantic meaning.
Index ¶
- Constants
- func IsAsynchronous(statementOrExpression StatementOrExpression, scopegraph *scopegraph.ScopeGraph) bool
- func IsManagingResources(statementOrExpression StatementOrExpression) bool
- func IsMaybePromisingMember(member typegraph.TGMember) bool
- type AnonymousClosureCallNode
- type ArrayLiteralNode
- type ArrowPromiseNode
- func (j *ArrowPromiseNode) IsJump() bool
- func (s *ArrowPromiseNode) IsLocallyAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (sb *ArrowPromiseNode) IsReferenceable() bool
- func (sb *ArrowPromiseNode) ManagesResources() bool
- func (sb *ArrowPromiseNode) MarkReferenceable()
- func (sb *ArrowPromiseNode) ReleasesFlow() bool
- func (s *ArrowPromiseNode) WalkExpressions(walker expressionWalker) bool
- func (s *ArrowPromiseNode) WalkStatements(walker statementWalker) bool
- type AwaitPromiseNode
- type BinaryOperationNode
- type CompoundExpressionNode
- type ConditionalJumpNode
- func (j *ConditionalJumpNode) IsJump() bool
- func (sb *ConditionalJumpNode) IsReferenceable() bool
- func (sb *ConditionalJumpNode) ManagesResources() bool
- func (sb *ConditionalJumpNode) MarkReferenceable()
- func (sb *ConditionalJumpNode) ReleasesFlow() bool
- func (s *ConditionalJumpNode) WalkExpressions(walker expressionWalker) bool
- func (s *ConditionalJumpNode) WalkStatements(walker statementWalker) bool
- type DynamicAccessNode
- func (n *DynamicAccessNode) ExprName() string
- func (e *DynamicAccessNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (eb *DynamicAccessNode) IsExpression()
- func (eb *DynamicAccessNode) ManagesResources() bool
- func (eb *DynamicAccessNode) ReferencedMember() (typegraph.TGMember, bool)
- type EmptyStatementNode
- type Expression
- func AnonymousClosureCall(closure *FunctionDefinitionNode, arguments []Expression, ...) Expression
- func AreEqual(leftExpr Expression, rightExpr Expression, ...) Expression
- func ArrayLiteral(values []Expression, basis compilergraph.GraphNode) Expression
- func AwaitPromise(childExpression Expression, basis compilergraph.GraphNode) Expression
- func BinaryOperation(leftExpr Expression, operator string, rightExpr Expression, ...) Expression
- func CompoundExpression(inputVarName string, inputValue Expression, expressions []Expression, ...) Expression
- func DynamicAccess(childExpression Expression, name string, isPossiblyPromising bool, ...) Expression
- func FunctionCall(childExpression Expression, arguments []Expression, ...) Expression
- func GenericSpecification(childExpression Expression, typeArguments []Expression, ...) Expression
- func InvokeFunction(callExpr Expression, arguments []Expression, ...) Expression
- func LiteralValue(value string, basis compilergraph.GraphNode) Expression
- func LocalAssignment(target string, value Expression, basis compilergraph.GraphNode) Expression
- func LocalReference(name string, basis compilergraph.GraphNode) Expression
- func MemberAssignment(target typegraph.TGMember, nameExpr Expression, value Expression, ...) Expression
- func MemberCall(childExpression Expression, member typegraph.TGMember, arguments []Expression, ...) Expression
- func MemberCallWithCallType(childExpression Expression, member typegraph.TGMember, arguments []Expression, ...) Expression
- func MemberReference(childExpression Expression, member typegraph.TGMember, ...) Expression
- func NativeAccess(childExpr Expression, name string, basis compilergraph.GraphNode) Expression
- func NativeAssign(target Expression, value Expression, basis compilergraph.GraphNode) Expression
- func NativeIndexing(childExpression Expression, index Expression, basis compilergraph.GraphNode) Expression
- func NativeMemberAccess(childExpression Expression, nativeName string, member typegraph.TGMember, ...) Expression
- func NestedTypeAccess(childExpression Expression, innerType typegraph.TypeReference, ...) Expression
- func NominalRefWrapping(childExpression Expression, childExprType typegraph.TypeReference, ...) Expression
- func NominalUnwrapping(childExpression Expression, childExprType typegraph.TypeReference, ...) Expression
- func NominalWrapping(childExpression Expression, nominalType typegraph.TGTypeDecl, ...) Expression
- func NullableMemberCall(childExpression Expression, member typegraph.TGMember, arguments []Expression, ...) Expression
- func NullableMemberReference(childExpression Expression, member typegraph.TGMember, ...) Expression
- func ObjectLiteral(entries []ObjectLiteralEntryNode, basis compilergraph.GraphNode) Expression
- func RuntimeFunctionCall(function RuntimeFunction, arguments []Expression, ...) Expression
- func StaticMemberReference(member typegraph.TGMember, parentType typegraph.TypeReference, ...) Expression
- func StaticTypeReference(typeDecl typegraph.TGTypeDecl, basis compilergraph.GraphNode) Expression
- func Ternary(checkExpr Expression, thenExpr Expression, elseExpr Expression, ...) Expression
- func TypeLiteral(typeRef typegraph.TypeReference, basis compilergraph.GraphNode) Expression
- func UnaryOperation(operator string, childExpr Expression, basis compilergraph.GraphNode) Expression
- type ExpressionStatementNode
- func (nsb *ExpressionStatementNode) GetNext() Statement
- func (nsb *ExpressionStatementNode) SetNext(nextStatement Statement)
- func (s *ExpressionStatementNode) WalkExpressions(walker expressionWalker) bool
- func (nsb *ExpressionStatementNode) WalkNextStatements(walker statementWalker) bool
- func (s *ExpressionStatementNode) WalkStatements(walker statementWalker) bool
- type FunctionCallNode
- type FunctionDefinitionNode
- func (f FunctionDefinitionNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (eb *FunctionDefinitionNode) IsExpression()
- func (f FunctionDefinitionNode) IsGenerator() bool
- func (f FunctionDefinitionNode) ManagesResources() bool
- func (eb *FunctionDefinitionNode) ReferencedMember() (typegraph.TGMember, bool)
- func (f FunctionDefinitionNode) UniqueId() string
- func (f FunctionDefinitionNode) WorkerExecute() bool
- type GenericSpecificationNode
- type HasNextStatement
- type LiteralValueNode
- type LocalAssignmentNode
- type LocalReferenceNode
- func (n LocalReferenceNode) ExprName() string
- func (sb *LocalReferenceNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (eb *LocalReferenceNode) IsExpression()
- func (eb *LocalReferenceNode) ManagesResources() bool
- func (eb *LocalReferenceNode) ReferencedMember() (typegraph.TGMember, bool)
- type LocallyAsynchronousStatement
- type MemberAssignmentNode
- func (e *MemberAssignmentNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (eb *MemberAssignmentNode) IsExpression()
- func (ma *MemberAssignmentNode) IsPromise(sg *scopegraph.ScopeGraph) bool
- func (eb *MemberAssignmentNode) ManagesResources() bool
- func (eb *MemberAssignmentNode) ReferencedMember() (typegraph.TGMember, bool)
- type MemberCallNode
- func (e *MemberCallNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (eb *MemberCallNode) IsExpression()
- func (mc *MemberCallNode) IsPromise(sg *scopegraph.ScopeGraph) bool
- func (eb *MemberCallNode) ManagesResources() bool
- func (eb *MemberCallNode) ReferencedMember() (typegraph.TGMember, bool)
- type MemberReferenceNode
- func (n MemberReferenceNode) ExprName() string
- func (e *MemberReferenceNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (eb *MemberReferenceNode) IsExpression()
- func (mr *MemberReferenceNode) IsPromise(sg *scopegraph.ScopeGraph) bool
- func (eb *MemberReferenceNode) ManagesResources() bool
- func (e *MemberReferenceNode) ReferencedMember() (typegraph.TGMember, bool)
- type Named
- type NativeAccessNode
- type NativeAssignNode
- type NativeIndexingNode
- type NativeMemberAccessNode
- func (n *NativeMemberAccessNode) ExprName() string
- func (e *NativeMemberAccessNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (eb *NativeMemberAccessNode) IsExpression()
- func (mr *NativeMemberAccessNode) IsPromise(sg *scopegraph.ScopeGraph) bool
- func (eb *NativeMemberAccessNode) ManagesResources() bool
- func (e *NativeMemberAccessNode) ReferencedMember() (typegraph.TGMember, bool)
- type NestedTypeAccessNode
- type NominalUnwrappingNode
- type NominalWrappingNode
- type ObjectLiteralEntryNode
- type ObjectLiteralNode
- type RejectionNode
- func (sb *RejectionNode) IsJump() bool
- func (sb *RejectionNode) IsReferenceable() bool
- func (sb *RejectionNode) ManagesResources() bool
- func (sb *RejectionNode) MarkReferenceable()
- func (sb *RejectionNode) ReleasesFlow() bool
- func (s *RejectionNode) WalkExpressions(walker expressionWalker) bool
- func (s *RejectionNode) WalkStatements(walker statementWalker) bool
- type ResolutionNode
- func (sb *ResolutionNode) IsJump() bool
- func (sb *ResolutionNode) IsReferenceable() bool
- func (sb *ResolutionNode) ManagesResources() bool
- func (sb *ResolutionNode) MarkReferenceable()
- func (sb *ResolutionNode) ReleasesFlow() bool
- func (s *ResolutionNode) WalkExpressions(walker expressionWalker) bool
- func (s *ResolutionNode) WalkStatements(walker statementWalker) bool
- type ResolveExpressionNode
- func (j *ResolveExpressionNode) IsJump() bool
- func (sb *ResolveExpressionNode) IsReferenceable() bool
- func (sb *ResolveExpressionNode) ManagesResources() bool
- func (sb *ResolveExpressionNode) MarkReferenceable()
- func (sb *ResolveExpressionNode) ReleasesFlow() bool
- func (s *ResolveExpressionNode) WalkExpressions(walker expressionWalker) bool
- func (s *ResolveExpressionNode) WalkStatements(walker statementWalker) bool
- type ResourceBlockNode
- func (nsb *ResourceBlockNode) GetNext() Statement
- func (s *ResourceBlockNode) HasAsyncRelease(sg *scopegraph.ScopeGraph) bool
- func (s *ResourceBlockNode) IsLocallyAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (nsb *ResourceBlockNode) SetNext(nextStatement Statement)
- func (s *ResourceBlockNode) WalkExpressions(walker expressionWalker) bool
- func (nsb *ResourceBlockNode) WalkNextStatements(walker statementWalker) bool
- func (s *ResourceBlockNode) WalkStatements(walker statementWalker) bool
- type RuntimeFunction
- type RuntimeFunctionCallNode
- type SpecializedFunction
- type Statement
- func ArrowPromise(childExpr Expression, resolution Expression, rejection Expression, ...) Statement
- func AssignNextStatement(statement Statement, nextStatement Statement) Statement
- func ConditionalJump(branchExpression Expression, trueTarget Statement, falseTarget Statement, ...) Statement
- func EmptyStatement(basis compilergraph.GraphNode) Statement
- func ExpressionStatement(expression Expression, basis compilergraph.GraphNode) Statement
- func Rejection(value Expression, basis compilergraph.GraphNode) Statement
- func Resolution(value Expression, basis compilergraph.GraphNode) Statement
- func ResolveExpression(childExpr Expression, resolutionName string, rejectionName string, ...) Statement
- func ResourceBlock(resourceName string, resource Expression, statement Statement, ...) Statement
- func UnconditionalJump(target Statement, basis compilergraph.GraphNode) Statement
- func VarDefinition(name string, basis compilergraph.GraphNode) Statement
- func VarDefinitionWithInit(name string, initializer Expression, basis compilergraph.GraphNode) Statement
- func YieldBreak(basis compilergraph.GraphNode) Statement
- func YieldStream(streamValue Expression, streamType typegraph.TypeReference, ...) Statement
- func YieldValue(value Expression, basis compilergraph.GraphNode) Statement
- type StatementOrExpression
- type StaticMemberReferenceNode
- func (n *StaticMemberReferenceNode) ExprName() string
- func (sb *StaticMemberReferenceNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (eb *StaticMemberReferenceNode) IsExpression()
- func (eb *StaticMemberReferenceNode) ManagesResources() bool
- func (e *StaticMemberReferenceNode) ReferencedMember() (typegraph.TGMember, bool)
- type StaticTypeReferenceNode
- func (n StaticTypeReferenceNode) ExprName() string
- func (sb *StaticTypeReferenceNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
- func (eb *StaticTypeReferenceNode) IsExpression()
- func (eb *StaticTypeReferenceNode) ManagesResources() bool
- func (eb *StaticTypeReferenceNode) ReferencedMember() (typegraph.TGMember, bool)
- type TernaryNode
- type TypeLiteralNode
- type UnaryOperationNode
- type UnconditionalJumpNode
- func (j *UnconditionalJumpNode) IsJump() bool
- func (sb *UnconditionalJumpNode) IsReferenceable() bool
- func (sb *UnconditionalJumpNode) ManagesResources() bool
- func (sb *UnconditionalJumpNode) MarkReferenceable()
- func (sb *UnconditionalJumpNode) ReleasesFlow() bool
- func (sb *UnconditionalJumpNode) WalkExpressions(walker expressionWalker) bool
- func (s *UnconditionalJumpNode) WalkStatements(walker statementWalker) bool
- type VarDefinitionNode
- func (nsb *VarDefinitionNode) GetNext() Statement
- func (nsb *VarDefinitionNode) SetNext(nextStatement Statement)
- func (s *VarDefinitionNode) WalkExpressions(walker expressionWalker) bool
- func (nsb *VarDefinitionNode) WalkNextStatements(walker statementWalker) bool
- func (s *VarDefinitionNode) WalkStatements(walker statementWalker) bool
- type YieldNode
- func (nsb *YieldNode) GetNext() Statement
- func (s *YieldNode) IsLocallyAsynchronous(sg *scopegraph.ScopeGraph) bool
- func (yn *YieldNode) ReleasesFlow() bool
- func (nsb *YieldNode) SetNext(nextStatement Statement)
- func (s *YieldNode) WalkExpressions(walker expressionWalker) bool
- func (nsb *YieldNode) WalkNextStatements(walker statementWalker) bool
- func (s *YieldNode) WalkStatements(walker statementWalker) bool
Constants ¶
const ( CastFunction RuntimeFunction = "$t.cast" IsTypeFunction RuntimeFunction = "$t.istype" DynamicAccessFunction RuntimeFunction = "$t.dynamicaccess" AssertNotNullFunction RuntimeFunction = "$t.assertnotnull" StreamMemberAccessFunction RuntimeFunction = "$t.streamaccess" BoxFunction RuntimeFunction = "$t.box" FastBoxFunction RuntimeFunction = "$t.fastbox" UnboxFunction RuntimeFunction = "$t.unbox" NullableInvokeFunction RuntimeFunction = "$t.nullableinvoke" AsyncNullableComparisonFunction RuntimeFunction = "$t.asyncnullcompare" SyncNullableComparisonFunction RuntimeFunction = "$t.syncnullcompare" NewPromiseFunction RuntimeFunction = "$promise.new" ResolvePromiseFunction RuntimeFunction = "$promise.resolve" TranslatePromiseFunction RuntimeFunction = "$promise.translate" ShortCircuitPromiseFunction RuntimeFunction = "$promise.shortcircuit" MaybePromiseFunction RuntimeFunction = "$promise.maybe" StatePushResourceFunction RuntimeFunction = "$resources.pushr" StatePopResourceFunction RuntimeFunction = "$resources.popr" EmptyGeneratorDirect RuntimeFunction = "$generator.directempty" BoxedDataProperty string = "$wrapped" )
Variables ¶
This section is empty.
Functions ¶
func IsAsynchronous ¶
func IsAsynchronous(statementOrExpression StatementOrExpression, scopegraph *scopegraph.ScopeGraph) bool
IsAsynchronous returns true if the statementOrExpression or one of its child expressions is asynchronous.
func IsManagingResources ¶
func IsManagingResources(statementOrExpression StatementOrExpression) bool
IsManagingResources returns true if the statement or any of its child statements are a ResourceBlockNode.
func IsMaybePromisingMember ¶
IsMaybePromisingMember returns true if the given member *might* be promising (will return false for those that are known to promise).
Types ¶
type AnonymousClosureCallNode ¶
type AnonymousClosureCallNode struct {
Closure *FunctionDefinitionNode // The closure to call.
Arguments []Expression // The arguments to the function call.
// contains filtered or unexported fields
}
AnonymousClosureCallNode wraps a function call to an anonymous closure, properly handling whether to await the result.
func (*AnonymousClosureCallNode) IsAsynchronous ¶
func (e *AnonymousClosureCallNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*AnonymousClosureCallNode) IsExpression ¶
func (eb *AnonymousClosureCallNode) IsExpression()
func (*AnonymousClosureCallNode) ManagesResources ¶
func (eb *AnonymousClosureCallNode) ManagesResources() bool
func (*AnonymousClosureCallNode) ReferencedMember ¶
type ArrayLiteralNode ¶
type ArrayLiteralNode struct {
Values []Expression
// contains filtered or unexported fields
}
ArrayLiteralNode represents a literal array definition.
func (*ArrayLiteralNode) IsAsynchronous ¶
func (e *ArrayLiteralNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*ArrayLiteralNode) IsExpression ¶
func (eb *ArrayLiteralNode) IsExpression()
func (*ArrayLiteralNode) ManagesResources ¶
func (eb *ArrayLiteralNode) ManagesResources() bool
func (*ArrayLiteralNode) ReferencedMember ¶
type ArrowPromiseNode ¶
type ArrowPromiseNode struct {
ChildExpression Expression // The child expression containing the promise.
ResolutionAssignment Expression // Expression assigning the resolution value, if any.
RejectionAssignment Expression // Expression assigning the rejection value, if any.
Target Statement // The statement to which the await will jump.
// contains filtered or unexported fields
}
ArrowPromiseNode represents a wait on a promise expression and assignment to a resolution expression and/or rejection expression once the promise returns.
func (*ArrowPromiseNode) IsJump ¶
func (j *ArrowPromiseNode) IsJump() bool
func (*ArrowPromiseNode) IsLocallyAsynchronous ¶
func (s *ArrowPromiseNode) IsLocallyAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*ArrowPromiseNode) IsReferenceable ¶
func (sb *ArrowPromiseNode) IsReferenceable() bool
func (*ArrowPromiseNode) ManagesResources ¶
func (sb *ArrowPromiseNode) ManagesResources() bool
func (*ArrowPromiseNode) MarkReferenceable ¶
func (sb *ArrowPromiseNode) MarkReferenceable()
func (*ArrowPromiseNode) ReleasesFlow ¶
func (sb *ArrowPromiseNode) ReleasesFlow() bool
func (*ArrowPromiseNode) WalkExpressions ¶
func (s *ArrowPromiseNode) WalkExpressions(walker expressionWalker) bool
func (*ArrowPromiseNode) WalkStatements ¶
func (s *ArrowPromiseNode) WalkStatements(walker statementWalker) bool
type AwaitPromiseNode ¶
type AwaitPromiseNode struct {
ChildExpression Expression // The child expression.
// contains filtered or unexported fields
}
AwaitPromiseNode wraps a child expression that returns a promise, waiting for it to complete and return.
func (*AwaitPromiseNode) IsAsynchronous ¶
func (e *AwaitPromiseNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*AwaitPromiseNode) IsExpression ¶
func (eb *AwaitPromiseNode) IsExpression()
func (*AwaitPromiseNode) ManagesResources ¶
func (eb *AwaitPromiseNode) ManagesResources() bool
func (*AwaitPromiseNode) ReferencedMember ¶
type BinaryOperationNode ¶
type BinaryOperationNode struct {
Operator string // The operator.
LeftExpr Expression // The left expression.
RightExpr Expression // The right expression.
// contains filtered or unexported fields
}
BinaryOperationNode wraps a call to a binary operator.
func (*BinaryOperationNode) IsAsynchronous ¶
func (e *BinaryOperationNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*BinaryOperationNode) IsExpression ¶
func (eb *BinaryOperationNode) IsExpression()
func (*BinaryOperationNode) ManagesResources ¶
func (eb *BinaryOperationNode) ManagesResources() bool
func (*BinaryOperationNode) ReferencedMember ¶
type CompoundExpressionNode ¶
type CompoundExpressionNode struct {
InputVarName string
InputValue Expression
Expressions []Expression
OutputValue Expression
// contains filtered or unexported fields
}
CompoundExpressionNode represents an expression that executes multiple sub-expressions with an input and output value expression.
func (*CompoundExpressionNode) IsAsynchronous ¶
func (e *CompoundExpressionNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*CompoundExpressionNode) IsExpression ¶
func (eb *CompoundExpressionNode) IsExpression()
func (*CompoundExpressionNode) ManagesResources ¶
func (eb *CompoundExpressionNode) ManagesResources() bool
func (*CompoundExpressionNode) ReferencedMember ¶
type ConditionalJumpNode ¶
type ConditionalJumpNode struct {
True Statement // The statement executed if the branch is true.
False Statement // The statement executed if the branch is false.
BranchExpression Expression // The expression for branching. Must be a Boolean expression.
// contains filtered or unexported fields
}
ConditionalJumpNode represents a jump to a true statement if an expression is true, and otherwise to a false statement.
func BranchOn ¶
func BranchOn(branchExpression Expression, basis compilergraph.GraphNode) *ConditionalJumpNode
func (*ConditionalJumpNode) IsJump ¶
func (j *ConditionalJumpNode) IsJump() bool
func (*ConditionalJumpNode) IsReferenceable ¶
func (sb *ConditionalJumpNode) IsReferenceable() bool
func (*ConditionalJumpNode) ManagesResources ¶
func (sb *ConditionalJumpNode) ManagesResources() bool
func (*ConditionalJumpNode) MarkReferenceable ¶
func (sb *ConditionalJumpNode) MarkReferenceable()
func (*ConditionalJumpNode) ReleasesFlow ¶
func (sb *ConditionalJumpNode) ReleasesFlow() bool
func (*ConditionalJumpNode) WalkExpressions ¶
func (s *ConditionalJumpNode) WalkExpressions(walker expressionWalker) bool
func (*ConditionalJumpNode) WalkStatements ¶
func (s *ConditionalJumpNode) WalkStatements(walker statementWalker) bool
type DynamicAccessNode ¶
type DynamicAccessNode struct {
ChildExpression Expression // The child expression.
Name string // The name of the member being accessed.
IsPossiblyPromising bool // Whether the dynamic access is possibily promising.
// contains filtered or unexported fields
}
DynamicAccessNode is the access of an unknown named member under a child expression.
func (*DynamicAccessNode) ExprName ¶
func (n *DynamicAccessNode) ExprName() string
func (*DynamicAccessNode) IsAsynchronous ¶
func (e *DynamicAccessNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*DynamicAccessNode) IsExpression ¶
func (eb *DynamicAccessNode) IsExpression()
func (*DynamicAccessNode) ManagesResources ¶
func (eb *DynamicAccessNode) ManagesResources() bool
func (*DynamicAccessNode) ReferencedMember ¶
type EmptyStatementNode ¶
type EmptyStatementNode struct {
// contains filtered or unexported fields
}
EmptyStatementNode represents an empty statement. Typically used as a the target of jumps.
func (*EmptyStatementNode) SetNext ¶
func (nsb *EmptyStatementNode) SetNext(nextStatement Statement)
func (*EmptyStatementNode) WalkNextStatements ¶
func (nsb *EmptyStatementNode) WalkNextStatements(walker statementWalker) bool
func (*EmptyStatementNode) WalkStatements ¶
func (s *EmptyStatementNode) WalkStatements(walker statementWalker) bool
type Expression ¶
type Expression interface {
// Marks the expression as an expression in the Go type system.
IsExpression()
// BasisNode is the node that is the basis of the expression for source mapping.
BasisNode() compilergraph.GraphNode
// IsAsynchronous returns true if the expression or one of its child expressions are
// async.
IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
// ReferencedMember returns the member referenced by this expression, if any.
ReferencedMember() (typegraph.TGMember, bool)
}
Expression represents an expression.
func AnonymousClosureCall ¶
func AnonymousClosureCall(closure *FunctionDefinitionNode, arguments []Expression, basis compilergraph.GraphNode) Expression
func AreEqual ¶
func AreEqual(leftExpr Expression, rightExpr Expression, comparisonType typegraph.TypeReference, tdg *typegraph.TypeGraph, basis compilergraph.GraphNode) Expression
AreEqual returns a call to the comparison operator between the two expressions.
func ArrayLiteral ¶
func ArrayLiteral(values []Expression, basis compilergraph.GraphNode) Expression
func AwaitPromise ¶
func AwaitPromise(childExpression Expression, basis compilergraph.GraphNode) Expression
func BinaryOperation ¶
func BinaryOperation(leftExpr Expression, operator string, rightExpr Expression, basis compilergraph.GraphNode) Expression
func CompoundExpression ¶
func CompoundExpression(inputVarName string, inputValue Expression, expressions []Expression, outputValue Expression, basis compilergraph.GraphNode) Expression
func DynamicAccess ¶
func DynamicAccess(childExpression Expression, name string, isPossiblyPromising bool, basis compilergraph.GraphNode) Expression
func FunctionCall ¶
func FunctionCall(childExpression Expression, arguments []Expression, basis compilergraph.GraphNode) Expression
func GenericSpecification ¶
func GenericSpecification(childExpression Expression, typeArguments []Expression, basis compilergraph.GraphNode) Expression
func InvokeFunction ¶
func InvokeFunction(callExpr Expression, arguments []Expression, callType scopegraph.PromisingAccessType, sg *scopegraph.ScopeGraph, basisNode compilergraph.GraphNode) Expression
InvokeFunction generates the CodeDOM for a function call, properly handling promise awaiting, including maybe wrapping.
func LiteralValue ¶
func LiteralValue(value string, basis compilergraph.GraphNode) Expression
func LocalAssignment ¶
func LocalAssignment(target string, value Expression, basis compilergraph.GraphNode) Expression
func LocalReference ¶
func LocalReference(name string, basis compilergraph.GraphNode) Expression
func MemberAssignment ¶
func MemberAssignment(target typegraph.TGMember, nameExpr Expression, value Expression, basis compilergraph.GraphNode) Expression
func MemberCall ¶
func MemberCall(childExpression Expression, member typegraph.TGMember, arguments []Expression, basis compilergraph.GraphNode) Expression
func MemberCallWithCallType ¶
func MemberCallWithCallType(childExpression Expression, member typegraph.TGMember, arguments []Expression, callType scopegraph.PromisingAccessType, basis compilergraph.GraphNode) Expression
func MemberReference ¶
func MemberReference(childExpression Expression, member typegraph.TGMember, basis compilergraph.GraphNode) Expression
func NativeAccess ¶
func NativeAccess(childExpr Expression, name string, basis compilergraph.GraphNode) Expression
func NativeAssign ¶
func NativeAssign(target Expression, value Expression, basis compilergraph.GraphNode) Expression
func NativeIndexing ¶
func NativeIndexing(childExpression Expression, index Expression, basis compilergraph.GraphNode) Expression
func NativeMemberAccess ¶
func NativeMemberAccess(childExpression Expression, nativeName string, member typegraph.TGMember, basis compilergraph.GraphNode) Expression
func NestedTypeAccess ¶
func NestedTypeAccess(childExpression Expression, innerType typegraph.TypeReference, basis compilergraph.GraphNode) Expression
func NominalRefWrapping ¶
func NominalRefWrapping(childExpression Expression, childExprType typegraph.TypeReference, nominalTypeRef typegraph.TypeReference, basis compilergraph.GraphNode) Expression
func NominalUnwrapping ¶
func NominalUnwrapping(childExpression Expression, childExprType typegraph.TypeReference, basis compilergraph.GraphNode) Expression
func NominalWrapping ¶
func NominalWrapping(childExpression Expression, nominalType typegraph.TGTypeDecl, basis compilergraph.GraphNode) Expression
func NullableMemberCall ¶
func NullableMemberCall(childExpression Expression, member typegraph.TGMember, arguments []Expression, basis compilergraph.GraphNode) Expression
func NullableMemberReference ¶
func NullableMemberReference(childExpression Expression, member typegraph.TGMember, basis compilergraph.GraphNode) Expression
func ObjectLiteral ¶
func ObjectLiteral(entries []ObjectLiteralEntryNode, basis compilergraph.GraphNode) Expression
func RuntimeFunctionCall ¶
func RuntimeFunctionCall(function RuntimeFunction, arguments []Expression, basis compilergraph.GraphNode) Expression
func StaticMemberReference ¶
func StaticMemberReference(member typegraph.TGMember, parentType typegraph.TypeReference, basis compilergraph.GraphNode) Expression
func StaticTypeReference ¶
func StaticTypeReference(typeDecl typegraph.TGTypeDecl, basis compilergraph.GraphNode) Expression
func Ternary ¶
func Ternary(checkExpr Expression, thenExpr Expression, elseExpr Expression, basis compilergraph.GraphNode) Expression
func TypeLiteral ¶
func TypeLiteral(typeRef typegraph.TypeReference, basis compilergraph.GraphNode) Expression
func UnaryOperation ¶
func UnaryOperation(operator string, childExpr Expression, basis compilergraph.GraphNode) Expression
type ExpressionStatementNode ¶
type ExpressionStatementNode struct {
Expression Expression // The expression being executed.
// contains filtered or unexported fields
}
ExpressionStatementNode represents a statement of a single expression being executed.
func (*ExpressionStatementNode) SetNext ¶
func (nsb *ExpressionStatementNode) SetNext(nextStatement Statement)
func (*ExpressionStatementNode) WalkExpressions ¶
func (s *ExpressionStatementNode) WalkExpressions(walker expressionWalker) bool
func (*ExpressionStatementNode) WalkNextStatements ¶
func (nsb *ExpressionStatementNode) WalkNextStatements(walker statementWalker) bool
func (*ExpressionStatementNode) WalkStatements ¶
func (s *ExpressionStatementNode) WalkStatements(walker statementWalker) bool
type FunctionCallNode ¶
type FunctionCallNode struct {
ChildExpression Expression // The child expression.
Arguments []Expression // The arguments to the function call.
// contains filtered or unexported fields
}
FunctionCallNode wraps a function call.
func (*FunctionCallNode) IsAsynchronous ¶
func (e *FunctionCallNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*FunctionCallNode) IsExpression ¶
func (eb *FunctionCallNode) IsExpression()
func (*FunctionCallNode) ManagesResources ¶
func (eb *FunctionCallNode) ManagesResources() bool
func (*FunctionCallNode) ReferencedMember ¶
type FunctionDefinitionNode ¶
type FunctionDefinitionNode struct {
Generics []string // The names of the generics of the function, if any.
Parameters []string // The names of the parameters of the function, if any.
Body StatementOrExpression // The body for the function.
RequiresThis bool // Whether the function needs '$this' defined.
GeneratorYieldType *typegraph.TypeReference // The type of items being yielded, if this is a generator.
Specialization SpecializedFunction // The specialization for this function, if any.
// contains filtered or unexported fields
}
FunctionDefinitionNode represents the definition of a function.
func FunctionDefinition ¶
func FunctionDefinition(generics []string, parameters []string, body StatementOrExpression, requiresThis bool, specialization SpecializedFunction, basisNode compilergraph.GraphNode) *FunctionDefinitionNode
FunctionDefinition constructs a new function definition.
func GeneratorDefinition ¶ added in v0.3.0
func GeneratorDefinition(generics []string, parameters []string, body StatementOrExpression, requiresThis bool, yieldType typegraph.TypeReference, basisNode compilergraph.GraphNode) *FunctionDefinitionNode
GeneratorDefinition constructs a new function definition for a generator function.
func (FunctionDefinitionNode) IsAsynchronous ¶
func (f FunctionDefinitionNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
IsAsynchronous returns whether the function's implementation is asynchronous in some way.
func (*FunctionDefinitionNode) IsExpression ¶
func (eb *FunctionDefinitionNode) IsExpression()
func (FunctionDefinitionNode) IsGenerator ¶
func (f FunctionDefinitionNode) IsGenerator() bool
IsGenerator returns whether the function is a generator.
func (FunctionDefinitionNode) ManagesResources ¶
func (f FunctionDefinitionNode) ManagesResources() bool
ManagesResources returns whether any of the statements in the function's body are ResourceBlock's.
func (*FunctionDefinitionNode) ReferencedMember ¶
func (FunctionDefinitionNode) UniqueId ¶
func (f FunctionDefinitionNode) UniqueId() string
UniqueId returns a unique ID for this function definition. Note that this is intended to be stable across compilations if the input source has not changed.
func (FunctionDefinitionNode) WorkerExecute ¶
func (f FunctionDefinitionNode) WorkerExecute() bool
WorkerExecute returns whether the function should be executed by an async web worker.
type GenericSpecificationNode ¶
type GenericSpecificationNode struct {
ChildExpression Expression // The child expression.
TypeArguments []Expression // The specified generic types.
// contains filtered or unexported fields
}
GenericSpecificationNode wraps a generic specification.
func (*GenericSpecificationNode) IsAsynchronous ¶
func (e *GenericSpecificationNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*GenericSpecificationNode) IsExpression ¶
func (eb *GenericSpecificationNode) IsExpression()
func (*GenericSpecificationNode) ManagesResources ¶
func (eb *GenericSpecificationNode) ManagesResources() bool
func (*GenericSpecificationNode) ReferencedMember ¶
func (e *GenericSpecificationNode) ReferencedMember() (typegraph.TGMember, bool)
type HasNextStatement ¶
type HasNextStatement interface {
GetNext() Statement // Returns the next statement, if any.
SetNext(Statement) // Sets the next statement to thatg specified.
}
HasNextStatement marks a statement as having a next statement in a linked chain of statements.
type LiteralValueNode ¶
type LiteralValueNode struct {
Value string // The literal value.
// contains filtered or unexported fields
}
LiteralValueNode refers to a literal value to be emitted.
func (*LiteralValueNode) IsAsynchronous ¶
func (sb *LiteralValueNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*LiteralValueNode) IsExpression ¶
func (eb *LiteralValueNode) IsExpression()
func (*LiteralValueNode) ManagesResources ¶
func (eb *LiteralValueNode) ManagesResources() bool
func (*LiteralValueNode) ReferencedMember ¶
type LocalAssignmentNode ¶
type LocalAssignmentNode struct {
Target string // The item being assigned.
Value Expression // The value of the assignment.
// contains filtered or unexported fields
}
LocalAssignmentNode represents assignment of a value to a target variable or parameter.
func (*LocalAssignmentNode) IsAsynchronous ¶
func (e *LocalAssignmentNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*LocalAssignmentNode) IsExpression ¶
func (eb *LocalAssignmentNode) IsExpression()
func (*LocalAssignmentNode) ManagesResources ¶
func (eb *LocalAssignmentNode) ManagesResources() bool
func (*LocalAssignmentNode) ReferencedMember ¶
type LocalReferenceNode ¶
type LocalReferenceNode struct {
Name string // The name of the variable or parameter.
// contains filtered or unexported fields
}
LocalReferenceNode is a named reference to a local variable or parameter.
func (LocalReferenceNode) ExprName ¶
func (n LocalReferenceNode) ExprName() string
func (*LocalReferenceNode) IsAsynchronous ¶
func (sb *LocalReferenceNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*LocalReferenceNode) IsExpression ¶
func (eb *LocalReferenceNode) IsExpression()
func (*LocalReferenceNode) ManagesResources ¶
func (eb *LocalReferenceNode) ManagesResources() bool
func (*LocalReferenceNode) ReferencedMember ¶
type LocallyAsynchronousStatement ¶
type LocallyAsynchronousStatement interface {
IsLocallyAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
}
LocallyAsynchronousStatement matches statements that themselves can be async, outside of their child expressions.
type MemberAssignmentNode ¶
type MemberAssignmentNode struct {
Target typegraph.TGMember // The item being assigned.
NameExpression Expression // The expression referring to the member.
Value Expression // The value of the assignment.
// contains filtered or unexported fields
}
MemberAssignmentNode represents assignment of a value to a target member.
func (*MemberAssignmentNode) IsAsynchronous ¶
func (e *MemberAssignmentNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*MemberAssignmentNode) IsExpression ¶
func (eb *MemberAssignmentNode) IsExpression()
func (*MemberAssignmentNode) IsPromise ¶
func (ma *MemberAssignmentNode) IsPromise(sg *scopegraph.ScopeGraph) bool
func (*MemberAssignmentNode) ManagesResources ¶
func (eb *MemberAssignmentNode) ManagesResources() bool
func (*MemberAssignmentNode) ReferencedMember ¶
type MemberCallNode ¶
type MemberCallNode struct {
ChildExpression Expression // The child expression.
Member typegraph.TGMember // The member being accessed.
Arguments []Expression // The arguments to the function call.
Nullable bool // Whether the call is on a nullable access.
CallType scopegraph.PromisingAccessType // The access type for this call.
// contains filtered or unexported fields
}
MemberCallNode is the function call of a known named member under a child expression.
func (*MemberCallNode) IsAsynchronous ¶
func (e *MemberCallNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*MemberCallNode) IsExpression ¶
func (eb *MemberCallNode) IsExpression()
func (*MemberCallNode) IsPromise ¶
func (mc *MemberCallNode) IsPromise(sg *scopegraph.ScopeGraph) bool
func (*MemberCallNode) ManagesResources ¶
func (eb *MemberCallNode) ManagesResources() bool
func (*MemberCallNode) ReferencedMember ¶
type MemberReferenceNode ¶
type MemberReferenceNode struct {
ChildExpression Expression // The child expression.
Member typegraph.TGMember // The member being accessed.
Nullable bool // Whether the access is a nullable access (`?.`)
// contains filtered or unexported fields
}
MemberReferenceNode is a reference of a known named member under a child expression.
func (MemberReferenceNode) ExprName ¶
func (n MemberReferenceNode) ExprName() string
func (*MemberReferenceNode) IsAsynchronous ¶
func (e *MemberReferenceNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*MemberReferenceNode) IsExpression ¶
func (eb *MemberReferenceNode) IsExpression()
func (*MemberReferenceNode) IsPromise ¶
func (mr *MemberReferenceNode) IsPromise(sg *scopegraph.ScopeGraph) bool
func (*MemberReferenceNode) ManagesResources ¶
func (eb *MemberReferenceNode) ManagesResources() bool
func (*MemberReferenceNode) ReferencedMember ¶
func (e *MemberReferenceNode) ReferencedMember() (typegraph.TGMember, bool)
type Named ¶
type Named interface {
ExprName() string
}
Named marks an expression with a source mapping name.
type NativeAccessNode ¶
type NativeAccessNode struct {
ChildExpression Expression // The child expression.
Name string // The name of the member being accessed.
// contains filtered or unexported fields
}
NativeAccessNode is the access of an unknown native member under a child expression.
func (*NativeAccessNode) ExprName ¶
func (n *NativeAccessNode) ExprName() string
func (*NativeAccessNode) IsAsynchronous ¶
func (e *NativeAccessNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*NativeAccessNode) IsExpression ¶
func (eb *NativeAccessNode) IsExpression()
func (*NativeAccessNode) ManagesResources ¶
func (eb *NativeAccessNode) ManagesResources() bool
func (*NativeAccessNode) ReferencedMember ¶
type NativeAssignNode ¶
type NativeAssignNode struct {
TargetExpression Expression // The target expression.
ValueExpression Expression // The value expression.
// contains filtered or unexported fields
}
NativeAssignNode is the assignment of one expression to another expression.
func (*NativeAssignNode) IsAsynchronous ¶
func (e *NativeAssignNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*NativeAssignNode) IsExpression ¶
func (eb *NativeAssignNode) IsExpression()
func (*NativeAssignNode) ManagesResources ¶
func (eb *NativeAssignNode) ManagesResources() bool
func (*NativeAssignNode) ReferencedMember ¶
type NativeIndexingNode ¶
type NativeIndexingNode struct {
ChildExpression Expression // The child expression.
IndexExpression Expression // The index expression.
// contains filtered or unexported fields
}
NativeIndexingNode is the indexing of one expression by another expression.
func (*NativeIndexingNode) IsAsynchronous ¶
func (e *NativeIndexingNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*NativeIndexingNode) IsExpression ¶
func (eb *NativeIndexingNode) IsExpression()
func (*NativeIndexingNode) ManagesResources ¶
func (eb *NativeIndexingNode) ManagesResources() bool
func (*NativeIndexingNode) ReferencedMember ¶
type NativeMemberAccessNode ¶
type NativeMemberAccessNode struct {
ChildExpression Expression // The child expression.
NativeName string // The native name to access to reference the member,
Member typegraph.TGMember // The member being accessed.
// contains filtered or unexported fields
}
NativeMemberAccessNode is the access of a named member under a child expression. Unlike a NativeAccessNode, this node is decorated with the referenced member for proper async handling.
func (*NativeMemberAccessNode) ExprName ¶
func (n *NativeMemberAccessNode) ExprName() string
func (*NativeMemberAccessNode) IsAsynchronous ¶
func (e *NativeMemberAccessNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*NativeMemberAccessNode) IsExpression ¶
func (eb *NativeMemberAccessNode) IsExpression()
func (*NativeMemberAccessNode) IsPromise ¶
func (mr *NativeMemberAccessNode) IsPromise(sg *scopegraph.ScopeGraph) bool
func (*NativeMemberAccessNode) ManagesResources ¶
func (eb *NativeMemberAccessNode) ManagesResources() bool
func (*NativeMemberAccessNode) ReferencedMember ¶
func (e *NativeMemberAccessNode) ReferencedMember() (typegraph.TGMember, bool)
type NestedTypeAccessNode ¶
type NestedTypeAccessNode struct {
ChildExpression Expression // The child expression.
InnerType typegraph.TypeReference // The inner type.
// contains filtered or unexported fields
}
NestedTypeAccessNode is a reference to an inner type under a structurally inherited class.
func (*NestedTypeAccessNode) IsAsynchronous ¶
func (e *NestedTypeAccessNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*NestedTypeAccessNode) IsExpression ¶
func (eb *NestedTypeAccessNode) IsExpression()
func (*NestedTypeAccessNode) ManagesResources ¶
func (eb *NestedTypeAccessNode) ManagesResources() bool
func (*NestedTypeAccessNode) ReferencedMember ¶
type NominalUnwrappingNode ¶
type NominalUnwrappingNode struct {
ChildExpression Expression
ChildExpressionType typegraph.TypeReference
// contains filtered or unexported fields
}
NominalUnwrappingNode is the unwrapping of an instance of a nominal type back to its original type.
func (*NominalUnwrappingNode) IsAsynchronous ¶
func (e *NominalUnwrappingNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*NominalUnwrappingNode) IsExpression ¶
func (eb *NominalUnwrappingNode) IsExpression()
func (*NominalUnwrappingNode) ManagesResources ¶
func (eb *NominalUnwrappingNode) ManagesResources() bool
func (*NominalUnwrappingNode) ReferencedMember ¶
type NominalWrappingNode ¶
type NominalWrappingNode struct {
ChildExpression Expression
ChildExpressionType typegraph.TypeReference
NominalTypeRef typegraph.TypeReference
IsLiteralWrap bool
// contains filtered or unexported fields
}
NominalWrappingNode is the wrapping of an instance in a nominal type.
func (*NominalWrappingNode) IsAsynchronous ¶
func (e *NominalWrappingNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*NominalWrappingNode) IsExpression ¶
func (eb *NominalWrappingNode) IsExpression()
func (*NominalWrappingNode) ManagesResources ¶
func (eb *NominalWrappingNode) ManagesResources() bool
func (*NominalWrappingNode) ReferencedMember ¶
type ObjectLiteralEntryNode ¶
type ObjectLiteralEntryNode struct {
KeyExpression Expression
ValueExpression Expression
BasisNode compilergraph.GraphNode
}
ObjectLiteralEntryNode represents an entry in an object literal.
func (*ObjectLiteralEntryNode) IsAsynchronous ¶
func (e *ObjectLiteralEntryNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
type ObjectLiteralNode ¶
type ObjectLiteralNode struct {
Entries []ObjectLiteralEntryNode
// contains filtered or unexported fields
}
ObjectLiteralNode represents a literal object definition.
func (*ObjectLiteralNode) IsAsynchronous ¶
func (e *ObjectLiteralNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*ObjectLiteralNode) IsExpression ¶
func (eb *ObjectLiteralNode) IsExpression()
func (*ObjectLiteralNode) ManagesResources ¶
func (eb *ObjectLiteralNode) ManagesResources() bool
func (*ObjectLiteralNode) ReferencedMember ¶
type RejectionNode ¶
type RejectionNode struct {
Value Expression // The value rejected, if any.
// contains filtered or unexported fields
}
RejectionNode represents the rejection of a function.
func (*RejectionNode) IsReferenceable ¶
func (sb *RejectionNode) IsReferenceable() bool
func (*RejectionNode) ManagesResources ¶
func (sb *RejectionNode) ManagesResources() bool
func (*RejectionNode) MarkReferenceable ¶
func (sb *RejectionNode) MarkReferenceable()
func (*RejectionNode) ReleasesFlow ¶
func (sb *RejectionNode) ReleasesFlow() bool
func (*RejectionNode) WalkExpressions ¶
func (s *RejectionNode) WalkExpressions(walker expressionWalker) bool
func (*RejectionNode) WalkStatements ¶
func (s *RejectionNode) WalkStatements(walker statementWalker) bool
type ResolutionNode ¶
type ResolutionNode struct {
Value Expression // The value resolved, if any.
// contains filtered or unexported fields
}
ResolutionNode represents the resolution of a function.
func (*ResolutionNode) IsReferenceable ¶
func (sb *ResolutionNode) IsReferenceable() bool
func (*ResolutionNode) ManagesResources ¶
func (sb *ResolutionNode) ManagesResources() bool
func (*ResolutionNode) MarkReferenceable ¶
func (sb *ResolutionNode) MarkReferenceable()
func (*ResolutionNode) ReleasesFlow ¶
func (sb *ResolutionNode) ReleasesFlow() bool
func (*ResolutionNode) WalkExpressions ¶
func (s *ResolutionNode) WalkExpressions(walker expressionWalker) bool
func (*ResolutionNode) WalkStatements ¶
func (s *ResolutionNode) WalkStatements(walker statementWalker) bool
type ResolveExpressionNode ¶
type ResolveExpressionNode struct {
ChildExpression Expression // The child expression to be executed.
ResolutionName string // Variable to which the resolution value is assigned, if any.
RejectionName string // Variable to which the rejection value is assigned, if any.
Target Statement // The statement to which the resolve will jump.
// contains filtered or unexported fields
}
ResolveExpressionNode represents a resolution of an arbitrary expression, with assignment to either a resolved value or a rejected value.
func (*ResolveExpressionNode) IsJump ¶
func (j *ResolveExpressionNode) IsJump() bool
func (*ResolveExpressionNode) IsReferenceable ¶
func (sb *ResolveExpressionNode) IsReferenceable() bool
func (*ResolveExpressionNode) ManagesResources ¶
func (sb *ResolveExpressionNode) ManagesResources() bool
func (*ResolveExpressionNode) MarkReferenceable ¶
func (sb *ResolveExpressionNode) MarkReferenceable()
func (*ResolveExpressionNode) ReleasesFlow ¶
func (sb *ResolveExpressionNode) ReleasesFlow() bool
func (*ResolveExpressionNode) WalkExpressions ¶
func (s *ResolveExpressionNode) WalkExpressions(walker expressionWalker) bool
func (*ResolveExpressionNode) WalkStatements ¶
func (s *ResolveExpressionNode) WalkStatements(walker statementWalker) bool
type ResourceBlockNode ¶
type ResourceBlockNode struct {
ResourceName string // The name for the resource.
Resource Expression // The resource itself.
Statement Statement // The statement to execute with the resource.
ReleaseMethod typegraph.TGMember // The Release() for the resource.
// contains filtered or unexported fields
}
ResourceBlockNode represents a resource placed on the resource stack for the duration of a statement call.
func (*ResourceBlockNode) HasAsyncRelease ¶
func (s *ResourceBlockNode) HasAsyncRelease(sg *scopegraph.ScopeGraph) bool
HasAsyncRelease returns true if the Release() call on the resource managed by this block is async.
func (*ResourceBlockNode) IsLocallyAsynchronous ¶
func (s *ResourceBlockNode) IsLocallyAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*ResourceBlockNode) WalkExpressions ¶
func (s *ResourceBlockNode) WalkExpressions(walker expressionWalker) bool
func (*ResourceBlockNode) WalkNextStatements ¶
func (nsb *ResourceBlockNode) WalkNextStatements(walker statementWalker) bool
func (*ResourceBlockNode) WalkStatements ¶
func (s *ResourceBlockNode) WalkStatements(walker statementWalker) bool
type RuntimeFunction ¶
type RuntimeFunction string
RuntimeFunction defines a function defined by the runtime.
type RuntimeFunctionCallNode ¶
type RuntimeFunctionCallNode struct {
Function RuntimeFunction // The runtime function being called.
Arguments []Expression // The arguments for the call.
// contains filtered or unexported fields
}
RuntimeFunctionCallNode represents a call to an internal runtime function defined for special handling of code.
func (*RuntimeFunctionCallNode) IsAsynchronous ¶
func (e *RuntimeFunctionCallNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*RuntimeFunctionCallNode) IsExpression ¶
func (eb *RuntimeFunctionCallNode) IsExpression()
func (*RuntimeFunctionCallNode) ManagesResources ¶
func (eb *RuntimeFunctionCallNode) ManagesResources() bool
func (*RuntimeFunctionCallNode) ReferencedMember ¶
type SpecializedFunction ¶
type SpecializedFunction int
const ( // None marks a function as having no specialization. NormalFunction SpecializedFunction = iota // AsynchronousWorkerFunction marks a function as being executed asynchronously via // a worker. AsynchronousWorkerFunction // GeneratorFunction marks a function as being a generator. GeneratorFunction )
type Statement ¶
type Statement interface {
// BasisNode is the node that is the basis of the statement for source mapping.
BasisNode() compilergraph.GraphNode
// IsJump returns whether this statement is a jump of some kind.
IsJump() bool
// IsReferencable returns whether this statement must be referenceable and therefore
// generated as its own statement.
IsReferenceable() bool
// MarkReferenceable marks a statement as being referencable.
MarkReferenceable()
// ReleasesFlow returns whether the statement releases the flow of the current
// state machine. Statements which yield will release flow.
ReleasesFlow() bool
// WalkStatements walks the full structure of the statements.
WalkStatements(walker statementWalker) bool
// WalkExpressions walks the list of expressions immediately under this statement.
WalkExpressions(walker expressionWalker) bool
}
Statement represents a statement.
func ArrowPromise ¶
func ArrowPromise(childExpr Expression, resolution Expression, rejection Expression, targetState Statement, basis compilergraph.GraphNode) Statement
func AssignNextStatement ¶
AssignNextStatement assigns the given statement the given next statement and returns the next statement. If the given statement is not next-able, it is returned.
func ConditionalJump ¶
func ConditionalJump(branchExpression Expression, trueTarget Statement, falseTarget Statement, basis compilergraph.GraphNode) Statement
func EmptyStatement ¶
func EmptyStatement(basis compilergraph.GraphNode) Statement
func ExpressionStatement ¶
func ExpressionStatement(expression Expression, basis compilergraph.GraphNode) Statement
func Rejection ¶
func Rejection(value Expression, basis compilergraph.GraphNode) Statement
func Resolution ¶
func Resolution(value Expression, basis compilergraph.GraphNode) Statement
func ResolveExpression ¶
func ResolveExpression(childExpr Expression, resolutionName string, rejectionName string, targetState Statement, basis compilergraph.GraphNode) Statement
func ResourceBlock ¶
func ResourceBlock(resourceName string, resource Expression, statement Statement, releaseMethod typegraph.TGMember, basis compilergraph.GraphNode) Statement
func UnconditionalJump ¶
func UnconditionalJump(target Statement, basis compilergraph.GraphNode) Statement
func VarDefinition ¶
func VarDefinition(name string, basis compilergraph.GraphNode) Statement
func VarDefinitionWithInit ¶
func VarDefinitionWithInit(name string, initializer Expression, basis compilergraph.GraphNode) Statement
func YieldBreak ¶
func YieldBreak(basis compilergraph.GraphNode) Statement
func YieldStream ¶
func YieldStream(streamValue Expression, streamType typegraph.TypeReference, basis compilergraph.GraphNode) Statement
func YieldValue ¶
func YieldValue(value Expression, basis compilergraph.GraphNode) Statement
type StatementOrExpression ¶
type StatementOrExpression interface {
BasisNode() compilergraph.GraphNode
}
StatementOrExpression represents a statement or expression.
type StaticMemberReferenceNode ¶
type StaticMemberReferenceNode struct {
Member typegraph.TGMember // The member to which we are referring statically.
ParentType typegraph.TypeReference // The full parent type (including resolved generics) for the member.
// contains filtered or unexported fields
}
StaticMemberReferenceNode refers statically to a member path.
func (*StaticMemberReferenceNode) ExprName ¶
func (n *StaticMemberReferenceNode) ExprName() string
func (*StaticMemberReferenceNode) IsAsynchronous ¶
func (sb *StaticMemberReferenceNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*StaticMemberReferenceNode) IsExpression ¶
func (eb *StaticMemberReferenceNode) IsExpression()
func (*StaticMemberReferenceNode) ManagesResources ¶
func (eb *StaticMemberReferenceNode) ManagesResources() bool
func (*StaticMemberReferenceNode) ReferencedMember ¶
func (e *StaticMemberReferenceNode) ReferencedMember() (typegraph.TGMember, bool)
type StaticTypeReferenceNode ¶
type StaticTypeReferenceNode struct {
Type typegraph.TGTypeDecl // The type to which we are referring statically.
// contains filtered or unexported fields
}
StaticTypeReferenceNode refers statically to a type path.
func (StaticTypeReferenceNode) ExprName ¶
func (n StaticTypeReferenceNode) ExprName() string
func (*StaticTypeReferenceNode) IsAsynchronous ¶
func (sb *StaticTypeReferenceNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*StaticTypeReferenceNode) IsExpression ¶
func (eb *StaticTypeReferenceNode) IsExpression()
func (*StaticTypeReferenceNode) ManagesResources ¶
func (eb *StaticTypeReferenceNode) ManagesResources() bool
func (*StaticTypeReferenceNode) ReferencedMember ¶
type TernaryNode ¶
type TernaryNode struct {
CheckExpr Expression // The check expression.
ThenExpr Expression // The then expression.
ElseExpr Expression // The else expression.
// contains filtered or unexported fields
}
TernaryNode wraps a call to a ternary expr.
func (*TernaryNode) IsAsynchronous ¶
func (e *TernaryNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*TernaryNode) IsExpression ¶
func (eb *TernaryNode) IsExpression()
func (*TernaryNode) ManagesResources ¶
func (eb *TernaryNode) ManagesResources() bool
func (*TernaryNode) ReferencedMember ¶
type TypeLiteralNode ¶
type TypeLiteralNode struct {
TypeRef typegraph.TypeReference // The type reference.
// contains filtered or unexported fields
}
TypeLiteralNode refers to a type instance.
func (TypeLiteralNode) ExprName ¶
func (n TypeLiteralNode) ExprName() string
func (*TypeLiteralNode) IsAsynchronous ¶
func (sb *TypeLiteralNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*TypeLiteralNode) IsExpression ¶
func (eb *TypeLiteralNode) IsExpression()
func (*TypeLiteralNode) ManagesResources ¶
func (eb *TypeLiteralNode) ManagesResources() bool
func (*TypeLiteralNode) ReferencedMember ¶
type UnaryOperationNode ¶
type UnaryOperationNode struct {
Operator string // The operator.
ChildExpression Expression // The child expression.
// contains filtered or unexported fields
}
UnaryOperationNode wraps a call to a unary operator.
func (*UnaryOperationNode) IsAsynchronous ¶
func (e *UnaryOperationNode) IsAsynchronous(scopegraph *scopegraph.ScopeGraph) bool
func (*UnaryOperationNode) IsExpression ¶
func (eb *UnaryOperationNode) IsExpression()
func (*UnaryOperationNode) ManagesResources ¶
func (eb *UnaryOperationNode) ManagesResources() bool
func (*UnaryOperationNode) ReferencedMember ¶
type UnconditionalJumpNode ¶
type UnconditionalJumpNode struct {
Target Statement // The target statement.
// contains filtered or unexported fields
}
UnconditionalJumpNode represents a jump to another statement.
func (*UnconditionalJumpNode) IsJump ¶
func (j *UnconditionalJumpNode) IsJump() bool
func (*UnconditionalJumpNode) IsReferenceable ¶
func (sb *UnconditionalJumpNode) IsReferenceable() bool
func (*UnconditionalJumpNode) ManagesResources ¶
func (sb *UnconditionalJumpNode) ManagesResources() bool
func (*UnconditionalJumpNode) MarkReferenceable ¶
func (sb *UnconditionalJumpNode) MarkReferenceable()
func (*UnconditionalJumpNode) ReleasesFlow ¶
func (sb *UnconditionalJumpNode) ReleasesFlow() bool
func (*UnconditionalJumpNode) WalkExpressions ¶
func (sb *UnconditionalJumpNode) WalkExpressions(walker expressionWalker) bool
func (*UnconditionalJumpNode) WalkStatements ¶
func (s *UnconditionalJumpNode) WalkStatements(walker statementWalker) bool
type VarDefinitionNode ¶
type VarDefinitionNode struct {
Name string // The name of the variable.
Initializer Expression // The initializer expression, if any.
// contains filtered or unexported fields
}
VarDefinitionNode represents a variable defined in the scope.
func (*VarDefinitionNode) WalkExpressions ¶
func (s *VarDefinitionNode) WalkExpressions(walker expressionWalker) bool
func (*VarDefinitionNode) WalkNextStatements ¶
func (nsb *VarDefinitionNode) WalkNextStatements(walker statementWalker) bool
func (*VarDefinitionNode) WalkStatements ¶
func (s *VarDefinitionNode) WalkStatements(walker statementWalker) bool
type YieldNode ¶
type YieldNode struct {
Value Expression // The value yielded, if any.
StreamValue Expression // The stream yielded, if any.
StreamType *typegraph.TypeReference // The type of the stream being yielded from, if any.
// contains filtered or unexported fields
}
YieldNode represents a yield of some sort under a generator function.
func (*YieldNode) IsLocallyAsynchronous ¶
func (s *YieldNode) IsLocallyAsynchronous(sg *scopegraph.ScopeGraph) bool
func (*YieldNode) ReleasesFlow ¶
func (*YieldNode) WalkExpressions ¶
func (*YieldNode) WalkNextStatements ¶
func (nsb *YieldNode) WalkNextStatements(walker statementWalker) bool