Documentation ¶
Index ¶
- Variables
- func ExprNotConvertible(destType Type, expr Expression) *hcl.Diagnostic
- func GetCollectionTypes(collectionType Type, rng hcl.Range) (Type, Type, hcl.Diagnostics)
- func IsOptionalType(t Type) bool
- func SourceOrderBody(body *hclsyntax.Body) []hclsyntax.Node
- func SourceOrderLess(a, b hcl.Range) bool
- func UnifyTypes(types ...Type) (safeType Type, unsafeType Type)
- type AnonymousFunctionExpression
- func (x *AnonymousFunctionExpression) Format(f fmt.State, c rune)
- func (x *AnonymousFunctionExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *AnonymousFunctionExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *AnonymousFunctionExpression) HasLeadingTrivia() bool
- func (x *AnonymousFunctionExpression) HasTrailingTrivia() bool
- func (x *AnonymousFunctionExpression) NodeTokens() syntax.NodeTokens
- func (x *AnonymousFunctionExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *AnonymousFunctionExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *AnonymousFunctionExpression) SyntaxNode() hclsyntax.Node
- func (x *AnonymousFunctionExpression) Type() Type
- type Attribute
- type BinaryOpExpression
- func (x *BinaryOpExpression) Format(f fmt.State, c rune)
- func (x *BinaryOpExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *BinaryOpExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *BinaryOpExpression) HasLeadingTrivia() bool
- func (x *BinaryOpExpression) HasTrailingTrivia() bool
- func (x *BinaryOpExpression) NodeTokens() syntax.NodeTokens
- func (x *BinaryOpExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *BinaryOpExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *BinaryOpExpression) SyntaxNode() hclsyntax.Node
- func (x *BinaryOpExpression) Type() Type
- type Block
- type Body
- type BodyItem
- type BodyItemVisitor
- type ConditionalExpression
- func (x *ConditionalExpression) Format(f fmt.State, c rune)
- func (x *ConditionalExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *ConditionalExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *ConditionalExpression) HasLeadingTrivia() bool
- func (x *ConditionalExpression) HasTrailingTrivia() bool
- func (x *ConditionalExpression) NodeTokens() syntax.NodeTokens
- func (x *ConditionalExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *ConditionalExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *ConditionalExpression) SyntaxNode() hclsyntax.Node
- func (x *ConditionalExpression) Type() Type
- type ConversionKind
- type Definition
- type ErrorExpression
- func (x *ErrorExpression) Format(f fmt.State, c rune)
- func (x *ErrorExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *ErrorExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *ErrorExpression) HasLeadingTrivia() bool
- func (x *ErrorExpression) HasTrailingTrivia() bool
- func (x *ErrorExpression) NodeTokens() syntax.NodeTokens
- func (x *ErrorExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *ErrorExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *ErrorExpression) SyntaxNode() hclsyntax.Node
- func (x *ErrorExpression) Type() Type
- type Expression
- func BindExpression(syntax hclsyntax.Node, scope *Scope, tokens _syntax.TokenMap) (Expression, hcl.Diagnostics)
- func BindExpressionText(source string, scope *Scope, initialPos hcl.Pos) (Expression, hcl.Diagnostics)
- func IdentityVisitor(n Expression) (Expression, hcl.Diagnostics)
- func VisitExpression(n Expression, pre, post ExpressionVisitor) (Expression, hcl.Diagnostics)
- type ExpressionVisitor
- type ForExpression
- func (x *ForExpression) Format(f fmt.State, c rune)
- func (x *ForExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *ForExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *ForExpression) HasLeadingTrivia() bool
- func (x *ForExpression) HasTrailingTrivia() bool
- func (x *ForExpression) NodeTokens() syntax.NodeTokens
- func (x *ForExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *ForExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *ForExpression) SyntaxNode() hclsyntax.Node
- func (x *ForExpression) Type() Type
- type Function
- type FunctionCallExpression
- func (x *FunctionCallExpression) Format(f fmt.State, c rune)
- func (x *FunctionCallExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *FunctionCallExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *FunctionCallExpression) HasLeadingTrivia() bool
- func (x *FunctionCallExpression) HasTrailingTrivia() bool
- func (x *FunctionCallExpression) NodeTokens() syntax.NodeTokens
- func (x *FunctionCallExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *FunctionCallExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *FunctionCallExpression) SyntaxNode() hclsyntax.Node
- func (x *FunctionCallExpression) Type() Type
- type FunctionSignature
- type GenericFunctionSignature
- type IndexExpression
- func (x *IndexExpression) Format(f fmt.State, c rune)
- func (x *IndexExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *IndexExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *IndexExpression) HasLeadingTrivia() bool
- func (x *IndexExpression) HasTrailingTrivia() bool
- func (x *IndexExpression) NodeTokens() syntax.NodeTokens
- func (x *IndexExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *IndexExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *IndexExpression) SyntaxNode() hclsyntax.Node
- func (x *IndexExpression) Type() Type
- type Keyword
- type ListType
- type LiteralValueExpression
- func (x *LiteralValueExpression) Format(f fmt.State, c rune)
- func (x *LiteralValueExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *LiteralValueExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *LiteralValueExpression) HasLeadingTrivia() bool
- func (x *LiteralValueExpression) HasTrailingTrivia() bool
- func (x *LiteralValueExpression) NodeTokens() syntax.NodeTokens
- func (x *LiteralValueExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *LiteralValueExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *LiteralValueExpression) SyntaxNode() hclsyntax.Node
- func (x *LiteralValueExpression) Type() Type
- type MapType
- type ObjectConsExpression
- func (x *ObjectConsExpression) Format(f fmt.State, c rune)
- func (x *ObjectConsExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *ObjectConsExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *ObjectConsExpression) HasLeadingTrivia() bool
- func (x *ObjectConsExpression) HasTrailingTrivia() bool
- func (x *ObjectConsExpression) NodeTokens() syntax.NodeTokens
- func (x *ObjectConsExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *ObjectConsExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *ObjectConsExpression) SyntaxNode() hclsyntax.Node
- func (x *ObjectConsExpression) Type() Type
- type ObjectConsItem
- type ObjectType
- type OpaqueType
- type OutputType
- type Parameter
- type PromiseType
- type RelativeTraversalExpression
- func (x *RelativeTraversalExpression) Format(f fmt.State, c rune)
- func (x *RelativeTraversalExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *RelativeTraversalExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *RelativeTraversalExpression) HasLeadingTrivia() bool
- func (x *RelativeTraversalExpression) HasTrailingTrivia() bool
- func (x *RelativeTraversalExpression) NodeTokens() syntax.NodeTokens
- func (x *RelativeTraversalExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *RelativeTraversalExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *RelativeTraversalExpression) SyntaxNode() hclsyntax.Node
- func (x *RelativeTraversalExpression) Type() Type
- type Scope
- func (s *Scope) BindFunctionReference(name string) (*Function, bool)
- func (s *Scope) BindReference(name string) (Definition, bool)
- func (s *Scope) Define(name string, def Definition) bool
- func (s *Scope) DefineFunction(name string, def *Function) bool
- func (s *Scope) DefineScope(name string, syntax hclsyntax.Node) (*Scope, bool)
- func (s *Scope) Pop() *Scope
- func (s *Scope) Push(syntax hclsyntax.Node) *Scope
- func (s *Scope) SyntaxNode() hclsyntax.Node
- func (s *Scope) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
- type ScopeTraversalExpression
- func (x *ScopeTraversalExpression) Format(f fmt.State, c rune)
- func (x *ScopeTraversalExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *ScopeTraversalExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *ScopeTraversalExpression) HasLeadingTrivia() bool
- func (x *ScopeTraversalExpression) HasTrailingTrivia() bool
- func (x *ScopeTraversalExpression) NodeTokens() syntax.NodeTokens
- func (x *ScopeTraversalExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *ScopeTraversalExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *ScopeTraversalExpression) SyntaxNode() hclsyntax.Node
- func (x *ScopeTraversalExpression) Type() Type
- type Scopes
- type SetType
- type SplatExpression
- func (x *SplatExpression) Format(f fmt.State, c rune)
- func (x *SplatExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *SplatExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *SplatExpression) HasLeadingTrivia() bool
- func (x *SplatExpression) HasTrailingTrivia() bool
- func (x *SplatExpression) NodeTokens() syntax.NodeTokens
- func (x *SplatExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *SplatExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *SplatExpression) SyntaxNode() hclsyntax.Node
- func (x *SplatExpression) Type() Type
- type StaticFunctionSignature
- type TemplateExpression
- func (x *TemplateExpression) Format(f fmt.State, c rune)
- func (x *TemplateExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *TemplateExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *TemplateExpression) HasLeadingTrivia() bool
- func (x *TemplateExpression) HasTrailingTrivia() bool
- func (x *TemplateExpression) NodeTokens() syntax.NodeTokens
- func (x *TemplateExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *TemplateExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *TemplateExpression) SyntaxNode() hclsyntax.Node
- func (x *TemplateExpression) Type() Type
- type TemplateJoinExpression
- func (x *TemplateJoinExpression) Format(f fmt.State, c rune)
- func (x *TemplateJoinExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *TemplateJoinExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *TemplateJoinExpression) HasLeadingTrivia() bool
- func (x *TemplateJoinExpression) HasTrailingTrivia() bool
- func (x *TemplateJoinExpression) NodeTokens() syntax.NodeTokens
- func (x *TemplateJoinExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *TemplateJoinExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *TemplateJoinExpression) SyntaxNode() hclsyntax.Node
- func (x *TemplateJoinExpression) Type() Type
- type Traversable
- type TupleConsExpression
- func (x *TupleConsExpression) Format(f fmt.State, c rune)
- func (x *TupleConsExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *TupleConsExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *TupleConsExpression) HasLeadingTrivia() bool
- func (x *TupleConsExpression) HasTrailingTrivia() bool
- func (x *TupleConsExpression) NodeTokens() syntax.NodeTokens
- func (x *TupleConsExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *TupleConsExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *TupleConsExpression) SyntaxNode() hclsyntax.Node
- func (x *TupleConsExpression) Type() Type
- type TupleType
- type Type
- func GetTraversableType(t Traversable) Type
- func GetTraverserKey(t hcl.Traverser) (cty.Value, Type)
- func InputType(t Type) Type
- func NewOptionalType(t Type) Type
- func NewTupleType(elementTypes ...Type) Type
- func NewUnionType(types ...Type) Type
- func ResolveOutputs(t Type) Type
- func ResolvePromises(t Type) Type
- type TypedTraversable
- type UnaryOpExpression
- func (x *UnaryOpExpression) Format(f fmt.State, c rune)
- func (x *UnaryOpExpression) GetLeadingTrivia() syntax.TriviaList
- func (x *UnaryOpExpression) GetTrailingTrivia() syntax.TriviaList
- func (x *UnaryOpExpression) HasLeadingTrivia() bool
- func (x *UnaryOpExpression) HasTrailingTrivia() bool
- func (x *UnaryOpExpression) NodeTokens() syntax.NodeTokens
- func (x *UnaryOpExpression) SetLeadingTrivia(t syntax.TriviaList)
- func (x *UnaryOpExpression) SetTrailingTrivia(t syntax.TriviaList)
- func (x *UnaryOpExpression) SyntaxNode() hclsyntax.Node
- func (x *UnaryOpExpression) Type() Type
- type UnionType
- type Variable
Constants ¶
This section is empty.
Variables ¶
var ( // NoneType represents the undefined value. NoneType Type = noneType(0) // BoolType represents the set of boolean values. BoolType = MustNewOpaqueType("boolean") // IntType represents the set of 32-bit integer values. IntType = MustNewOpaqueType("int") // NumberType represents the set of arbitrary-precision values. NumberType = MustNewOpaqueType("number") // StringType represents the set of UTF-8 string values. StringType = MustNewOpaqueType("string") // DynamicType represents the set of all values. DynamicType = MustNewOpaqueType("dynamic") )
Functions ¶
func ExprNotConvertible ¶
func ExprNotConvertible(destType Type, expr Expression) *hcl.Diagnostic
func GetCollectionTypes ¶ added in v1.14.1
GetCollectionTypes returns the key and value types of the given type if it is a collection.
func IsOptionalType ¶
IsOptionalType returns true if t is an optional type.
func SourceOrderBody ¶
SourceOrderBody sorts the contents of an HCL2 body in source order.
func SourceOrderLess ¶
func SourceOrderLess(a, b hcl.Range) bool
SourceOrderLess returns true if the first range precedes the second when ordered by source position. Positions are ordered first by filename, then by byte offset.
func UnifyTypes ¶
UnifyTypes chooses the most general type that is convertible from all of the input types.
Types ¶
type AnonymousFunctionExpression ¶
type AnonymousFunctionExpression struct { // The signature for the anonymous function. Signature StaticFunctionSignature // The parameter definitions for the anonymous function. Parameters []*Variable // The body of the anonymous function. Body Expression }
AnonymousFunctionExpression represents a semantically-analyzed anonymous function expression.
These expressions are not the result of semantically analyzing syntax nodes. Instead, they may be synthesized by transforms over the IR for a program (e.g. the Apply transform).
func (*AnonymousFunctionExpression) Format ¶ added in v1.14.1
func (x *AnonymousFunctionExpression) Format(f fmt.State, c rune)
func (*AnonymousFunctionExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *AnonymousFunctionExpression) GetLeadingTrivia() syntax.TriviaList
func (*AnonymousFunctionExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *AnonymousFunctionExpression) GetTrailingTrivia() syntax.TriviaList
func (*AnonymousFunctionExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *AnonymousFunctionExpression) HasLeadingTrivia() bool
func (*AnonymousFunctionExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *AnonymousFunctionExpression) HasTrailingTrivia() bool
func (*AnonymousFunctionExpression) NodeTokens ¶ added in v1.14.1
func (x *AnonymousFunctionExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the body of the anonymous function.
func (*AnonymousFunctionExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *AnonymousFunctionExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*AnonymousFunctionExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *AnonymousFunctionExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*AnonymousFunctionExpression) SyntaxNode ¶
func (x *AnonymousFunctionExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the body of the anonymous function.
func (*AnonymousFunctionExpression) Type ¶
func (x *AnonymousFunctionExpression) Type() Type
Type returns the type of the anonymous function expression.
TODO: currently this returns the any type. Instead, it should return a function type.
type Attribute ¶
type Attribute struct { // The syntax node for the attribute, if any. Syntax *hclsyntax.Attribute // The tokens for the attribute. Tokens *syntax.AttributeTokens // The attribute's name. Name string // The attribute's value. Value Expression }
Attribute represents an HCL2 attribute.
func BindAttribute ¶
func BindAttribute(attribute *hclsyntax.Attribute, scope *Scope, tokens syntax.TokenMap) (*Attribute, hcl.Diagnostics)
BindAttribute binds an HCL2 attribute using the given scope and token map.
func (*Attribute) HasLeadingTrivia ¶ added in v1.14.1
func (*Attribute) HasTrailingTrivia ¶ added in v1.14.1
func (*Attribute) SyntaxNode ¶
SyntaxNode returns the syntax node of the attribute, and will either return an *hclsyntax.Attribute or syntax.None.
type BinaryOpExpression ¶
type BinaryOpExpression struct { // The syntax node associated with the binary operation. Syntax *hclsyntax.BinaryOpExpr // The tokens associated with the expression, if any. Tokens *syntax.BinaryOpTokens // The left-hand operand of the operation. LeftOperand Expression // The operation. Operation *hclsyntax.Operation // The right-hand operand of the operation. RightOperand Expression // contains filtered or unexported fields }
BinaryOpExpression represents a semantically-analyzed binary operation.
func (*BinaryOpExpression) Format ¶ added in v1.14.1
func (x *BinaryOpExpression) Format(f fmt.State, c rune)
func (*BinaryOpExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *BinaryOpExpression) GetLeadingTrivia() syntax.TriviaList
func (*BinaryOpExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *BinaryOpExpression) GetTrailingTrivia() syntax.TriviaList
func (*BinaryOpExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *BinaryOpExpression) HasLeadingTrivia() bool
func (*BinaryOpExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *BinaryOpExpression) HasTrailingTrivia() bool
func (*BinaryOpExpression) NodeTokens ¶ added in v1.14.1
func (x *BinaryOpExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the binary operation.
func (*BinaryOpExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *BinaryOpExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*BinaryOpExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *BinaryOpExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*BinaryOpExpression) SyntaxNode ¶
func (x *BinaryOpExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the binary operation.
func (*BinaryOpExpression) Type ¶
func (x *BinaryOpExpression) Type() Type
Type returns the type of the binary operation.
type Block ¶
type Block struct { // The syntax node for the block, if any. Syntax *hclsyntax.Block // The tokens for the block. Tokens *syntax.BlockTokens // The block's type. Type string // The block's labels. Labels []string // The block's body. Body *Body }
Block represents an HCL2 block.
func BindBlock ¶
func BindBlock(block *hclsyntax.Block, scopes Scopes, tokens syntax.TokenMap) (*Block, hcl.Diagnostics)
BindBlock binds an HCL2 block using the given scopes and token map.
func (*Block) HasLeadingTrivia ¶ added in v1.14.1
func (*Block) HasTrailingTrivia ¶ added in v1.14.1
func (*Block) SyntaxNode ¶
SyntaxNode returns the syntax node of the block, and will either return an *hclsyntax.Block or syntax.None.
type Body ¶
type Body struct { // The syntax node for the body, if any. Syntax *hclsyntax.Body // The tokens for the body. Tokens *syntax.BodyTokens // The items that make up the body's contents. Items []BodyItem }
Body represents an HCL2 body. A Body may be the root of an HCL2 file or the contents of an HCL2 block.
func (*Body) Attribute ¶ added in v1.14.1
Attribute returns the attribute with the givne in the body if any exists.
func (*Body) HasLeadingTrivia ¶ added in v1.14.1
func (*Body) HasTrailingTrivia ¶ added in v1.14.1
func (*Body) SyntaxNode ¶
SyntaxNode returns the syntax node of the body, and will either return an *hclsyntax.Body or syntax.None.
type BodyItem ¶
type BodyItem interface { // SyntaxNode returns syntax node of the item. SyntaxNode() hclsyntax.Node // contains filtered or unexported methods }
BodyItem represents either an *Attribute or a *Block that is part of an HCL2 Body.
func IdentityBodyItemVisitor ¶ added in v1.14.1
func VisitBodyItem ¶ added in v1.14.1
func VisitBodyItem(n BodyItem, pre, post BodyItemVisitor) (BodyItem, hcl.Diagnostics)
type BodyItemVisitor ¶ added in v1.14.1
A BodyItemVisitor is a function that visits and optionally replaces the contents of a body item.
type ConditionalExpression ¶
type ConditionalExpression struct { // The syntax node associated with the conditional expression. Syntax *hclsyntax.ConditionalExpr // The tokens associated with the expression, if any. Tokens syntax.NodeTokens // The condition. Condition Expression // The result of the expression if the condition evaluates to true. TrueResult Expression // The result of the expression if the condition evaluates to false. FalseResult Expression // contains filtered or unexported fields }
ConditionalExpression represents a semantically-analzed conditional expression (i.e. <condition> '?' <true> ':' <false>).
func (*ConditionalExpression) Format ¶ added in v1.14.1
func (x *ConditionalExpression) Format(f fmt.State, c rune)
func (*ConditionalExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *ConditionalExpression) GetLeadingTrivia() syntax.TriviaList
func (*ConditionalExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *ConditionalExpression) GetTrailingTrivia() syntax.TriviaList
func (*ConditionalExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *ConditionalExpression) HasLeadingTrivia() bool
func (*ConditionalExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *ConditionalExpression) HasTrailingTrivia() bool
func (*ConditionalExpression) NodeTokens ¶ added in v1.14.1
func (x *ConditionalExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the conditional expression.
func (*ConditionalExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *ConditionalExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*ConditionalExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *ConditionalExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*ConditionalExpression) SyntaxNode ¶
func (x *ConditionalExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the conditional expression.
func (*ConditionalExpression) Type ¶
func (x *ConditionalExpression) Type() Type
Type returns the type of the conditional expression.
type ConversionKind ¶
type ConversionKind int
const ( NoConversion ConversionKind = 0 UnsafeConversion ConversionKind = 1 SafeConversion ConversionKind = 2 )
func (ConversionKind) Exists ¶
func (k ConversionKind) Exists() bool
type Definition ¶
type Definition interface { Traversable SyntaxNode() hclsyntax.Node }
Definition represents a single definition in a Scope.
type ErrorExpression ¶
type ErrorExpression struct { // The syntax node associated with the error, if any. Syntax hclsyntax.Node // The tokens associated with the error. Tokens syntax.NodeTokens // The message associated with the error. Message string // contains filtered or unexported fields }
ErrorExpression represents an expression that could not be bound due to an error.
func (*ErrorExpression) Format ¶ added in v1.14.1
func (x *ErrorExpression) Format(f fmt.State, c rune)
func (*ErrorExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *ErrorExpression) GetLeadingTrivia() syntax.TriviaList
func (*ErrorExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *ErrorExpression) GetTrailingTrivia() syntax.TriviaList
func (*ErrorExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *ErrorExpression) HasLeadingTrivia() bool
func (*ErrorExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *ErrorExpression) HasTrailingTrivia() bool
func (*ErrorExpression) NodeTokens ¶ added in v1.14.1
func (x *ErrorExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the error expression.
func (*ErrorExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *ErrorExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*ErrorExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *ErrorExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*ErrorExpression) SyntaxNode ¶
func (x *ErrorExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the error expression.
func (*ErrorExpression) Type ¶
func (x *ErrorExpression) Type() Type
Type returns the type of the error expression.
type Expression ¶
type Expression interface { // SyntaxNode returns the hclsyntax.Node associated with the expression. SyntaxNode() hclsyntax.Node // NodeTokens returns the syntax.Tokens associated with the expression. NodeTokens() syntax.NodeTokens // GetLeadingTrivia returns the leading trivia associated with the expression. GetLeadingTrivia() syntax.TriviaList // SetLeadingTrivia sets the leading trivia associated with the expression. SetLeadingTrivia(syntax.TriviaList) // GetTrailingTrivia returns the trailing trivia associated with the expression. GetTrailingTrivia() syntax.TriviaList // SetTrailingTrivia sets the trailing trivia associated with the expression. SetTrailingTrivia(syntax.TriviaList) // Type returns the type of the expression. Type() Type // contains filtered or unexported methods }
Expression represents a semantically-analyzed HCL2 expression.
func BindExpression ¶
func BindExpression(syntax hclsyntax.Node, scope *Scope, tokens _syntax.TokenMap) (Expression, hcl.Diagnostics)
BindExpression binds an HCL2 expression using the given scope and token map.
func BindExpressionText ¶
func BindExpressionText(source string, scope *Scope, initialPos hcl.Pos) (Expression, hcl.Diagnostics)
BindExpressionText parses and binds an HCL2 expression using the given scope.
func IdentityVisitor ¶
func IdentityVisitor(n Expression) (Expression, hcl.Diagnostics)
IdentityVisitor is a ExpressionVisitor that returns the input node unchanged.
func VisitExpression ¶
func VisitExpression(n Expression, pre, post ExpressionVisitor) (Expression, hcl.Diagnostics)
VisitExpression visits each node in an expression tree using the given pre- and post-order visitors. If the preorder visitor returns a new node, that node's descendents will be visited. VisitExpression returns the result of the post-order visitor. All diagnostics are accumulated.
type ExpressionVisitor ¶
type ExpressionVisitor func(n Expression) (Expression, hcl.Diagnostics)
An ExpressionVisitor is a function that visits and optionally replaces a node in an expression tree.
type ForExpression ¶
type ForExpression struct { // The syntax node associated with the for expression. Syntax *hclsyntax.ForExpr // The tokens associated with the expression, if any. Tokens syntax.NodeTokens // The key variable, if any. KeyVariable *Variable // The value variable. ValueVariable *Variable // The collection being iterated. Collection Expression // The expression that generates the keys of the result, if any. If this field is non-nil, the result is a map. Key Expression // The expression that generates the values of the result. Value Expression // The condition that filters the items of the result, if any. Condition Expression // True if the value expression is being grouped. Group bool // contains filtered or unexported fields }
ForExpression represents a semantically-analyzed for expression.
func (*ForExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *ForExpression) GetLeadingTrivia() syntax.TriviaList
func (*ForExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *ForExpression) GetTrailingTrivia() syntax.TriviaList
func (*ForExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *ForExpression) HasLeadingTrivia() bool
func (*ForExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *ForExpression) HasTrailingTrivia() bool
func (*ForExpression) NodeTokens ¶ added in v1.14.1
func (x *ForExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the for expression.
func (*ForExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *ForExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*ForExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *ForExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*ForExpression) SyntaxNode ¶
func (x *ForExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the for expression.
func (*ForExpression) Type ¶
func (x *ForExpression) Type() Type
Type returns the type of the for expression.
type Function ¶
type Function struct {
// contains filtered or unexported fields
}
Function represents a function definition.
func NewFunction ¶
func NewFunction(signature FunctionSignature) *Function
NewFunction creates a new function with the given signature.
func (*Function) GetSignature ¶
func (f *Function) GetSignature(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics)
GetSignature returns the static signature of the function when it is invoked with the given arguments.
func (*Function) SyntaxNode ¶
SyntaxNode returns the syntax node for the function, which is always syntax.None.
func (*Function) Traverse ¶
func (f *Function) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the function definition. This will always fail: functions are not traversable.
type FunctionCallExpression ¶
type FunctionCallExpression struct { // The syntax node associated with the function call expression. Syntax *hclsyntax.FunctionCallExpr // The tokens associated with the expression, if any. Tokens *syntax.FunctionCallTokens // The name of the called function. Name string // The signature of the called function. Signature StaticFunctionSignature // The arguments to the function call. Args []Expression }
FunctionCallExpression represents a semantically-analyzed function call expression.
func (*FunctionCallExpression) Format ¶ added in v1.14.1
func (x *FunctionCallExpression) Format(f fmt.State, c rune)
func (*FunctionCallExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *FunctionCallExpression) GetLeadingTrivia() syntax.TriviaList
func (*FunctionCallExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *FunctionCallExpression) GetTrailingTrivia() syntax.TriviaList
func (*FunctionCallExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *FunctionCallExpression) HasLeadingTrivia() bool
func (*FunctionCallExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *FunctionCallExpression) HasTrailingTrivia() bool
func (*FunctionCallExpression) NodeTokens ¶ added in v1.14.1
func (x *FunctionCallExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the function call expression.
func (*FunctionCallExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *FunctionCallExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*FunctionCallExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *FunctionCallExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*FunctionCallExpression) SyntaxNode ¶
func (x *FunctionCallExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the function call expression.
func (*FunctionCallExpression) Type ¶
func (x *FunctionCallExpression) Type() Type
Type returns the type of the function call expression.
type FunctionSignature ¶
type FunctionSignature interface { // GetSignature returns the static signature for the function when invoked with the given arguments. GetSignature(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics) }
FunctionSignature represents a possibly-type-polymorphic function signature.
type GenericFunctionSignature ¶
type GenericFunctionSignature func(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics)
GenericFunctionSignature represents a type-polymorphic function signature. The underlying function will be invoked by GenericFunctionSignature.GetSignature to compute the static signature of the function.
func (GenericFunctionSignature) GetSignature ¶
func (fs GenericFunctionSignature) GetSignature(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics)
GetSignature returns the static function signature when it is invoked with the given arguments.
type IndexExpression ¶
type IndexExpression struct { // The syntax node associated with the index expression. Syntax *hclsyntax.IndexExpr // The tokens associated with the expression, if any. Tokens *syntax.IndexTokens // The collection being indexed. Collection Expression // The index key. Key Expression // contains filtered or unexported fields }
IndexExpression represents a semantically-analyzed index expression.
func (*IndexExpression) Format ¶ added in v1.14.1
func (x *IndexExpression) Format(f fmt.State, c rune)
func (*IndexExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *IndexExpression) GetLeadingTrivia() syntax.TriviaList
func (*IndexExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *IndexExpression) GetTrailingTrivia() syntax.TriviaList
func (*IndexExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *IndexExpression) HasLeadingTrivia() bool
func (*IndexExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *IndexExpression) HasTrailingTrivia() bool
func (*IndexExpression) NodeTokens ¶ added in v1.14.1
func (x *IndexExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the index expression.
func (*IndexExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *IndexExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*IndexExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *IndexExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*IndexExpression) SyntaxNode ¶
func (x *IndexExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the index expression.
func (*IndexExpression) Type ¶
func (x *IndexExpression) Type() Type
Type returns the type of the index expression.
type Keyword ¶
type Keyword string
A Keyword is a non-traversable definition that allows scope traversals to bind to arbitrary keywords.
func (Keyword) SyntaxNode ¶
SyntaxNode returns the syntax node for the keyword, which is always syntax.None.
func (Keyword) Traverse ¶
func (kw Keyword) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the keyword, and always fails.
type ListType ¶
type ListType struct { // ElementType is the element type of the list. ElementType Type // contains filtered or unexported fields }
ListType represents lists of particular element types.
func NewListType ¶
NewListType creates a new list type with the given element type.
func (*ListType) AssignableFrom ¶
AssignableFrom returns true if this type is assignable from the indicated source type. A list(T) is assignable from values of type list(U) where T is assignable from U.
func (*ListType) ConversionFrom ¶
func (t *ListType) ConversionFrom(src Type) ConversionKind
func (*ListType) SyntaxNode ¶
SyntaxNode returns the syntax node for the type. This is always syntax.None.
func (*ListType) Traverse ¶
func (t *ListType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the optional type with the given traverser. The result type of traverse(list(T)) is T; the traversal fails if the traverser is not a number.
type LiteralValueExpression ¶
type LiteralValueExpression struct { // The syntax node associated with the literal value expression. Syntax *hclsyntax.LiteralValueExpr // The tokens associated with the expression, if any. Tokens *syntax.LiteralValueTokens // The value of the expression. Value cty.Value // contains filtered or unexported fields }
LiteralValueExpression represents a semantically-analyzed literal value expression.
func (*LiteralValueExpression) Format ¶ added in v1.14.1
func (x *LiteralValueExpression) Format(f fmt.State, c rune)
func (*LiteralValueExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *LiteralValueExpression) GetLeadingTrivia() syntax.TriviaList
func (*LiteralValueExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *LiteralValueExpression) GetTrailingTrivia() syntax.TriviaList
func (*LiteralValueExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *LiteralValueExpression) HasLeadingTrivia() bool
func (*LiteralValueExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *LiteralValueExpression) HasTrailingTrivia() bool
func (*LiteralValueExpression) NodeTokens ¶ added in v1.14.1
func (x *LiteralValueExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the literal value expression.
func (*LiteralValueExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *LiteralValueExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*LiteralValueExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *LiteralValueExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*LiteralValueExpression) SyntaxNode ¶
func (x *LiteralValueExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the literal value expression.
func (*LiteralValueExpression) Type ¶
func (x *LiteralValueExpression) Type() Type
Type returns the type of the literal value expression.
type MapType ¶
type MapType struct { // ElementType is the element type of the map. ElementType Type // contains filtered or unexported fields }
MapType represents maps from strings to particular element types.
func NewMapType ¶
NewMapType creates a new map type with the given element type.
func (*MapType) AssignableFrom ¶
AssignableFrom returns true if this type is assignable from the indicated source type. A map(T) is assignable from values of type map(U) where T is assignable from U or object(K_0=U_0, ..., K_N=U_N) if T is assignable from the unified type of U_0 through U_N.
func (*MapType) ConversionFrom ¶
func (t *MapType) ConversionFrom(src Type) ConversionKind
func (*MapType) SyntaxNode ¶
SyntaxNode returns the syntax node for the type. This is always syntax.None.
func (*MapType) Traverse ¶
func (t *MapType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the optional type with the given traverser. The result type of traverse(map(T)) is T; the traversal fails if the traverser is not a string.
type ObjectConsExpression ¶
type ObjectConsExpression struct { // The syntax node associated with the object construction expression. Syntax *hclsyntax.ObjectConsExpr // The tokens associated with the expression, if any. Tokens *syntax.ObjectConsTokens // The items that comprise the object construction expression. Items []ObjectConsItem // contains filtered or unexported fields }
ObjectConsExpression represents a semantically-analyzed object construction expression.
func (*ObjectConsExpression) Format ¶ added in v1.14.1
func (x *ObjectConsExpression) Format(f fmt.State, c rune)
func (*ObjectConsExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *ObjectConsExpression) GetLeadingTrivia() syntax.TriviaList
func (*ObjectConsExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *ObjectConsExpression) GetTrailingTrivia() syntax.TriviaList
func (*ObjectConsExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *ObjectConsExpression) HasLeadingTrivia() bool
func (*ObjectConsExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *ObjectConsExpression) HasTrailingTrivia() bool
func (*ObjectConsExpression) NodeTokens ¶ added in v1.14.1
func (x *ObjectConsExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the object construction expression.
func (*ObjectConsExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *ObjectConsExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*ObjectConsExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *ObjectConsExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*ObjectConsExpression) SyntaxNode ¶
func (x *ObjectConsExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the object construction expression.
func (*ObjectConsExpression) Type ¶
func (x *ObjectConsExpression) Type() Type
Type returns the type of the object construction expression.
type ObjectConsItem ¶
type ObjectConsItem struct { // The key. Key Expression // The value. Value Expression }
ObjectConsItem records a key-value pair that is part of object construction expression.
type ObjectType ¶
type ObjectType struct { // Properties records the types of the object's properties. Properties map[string]Type // contains filtered or unexported fields }
ObjectType represents schematized maps from strings to particular types.
func NewObjectType ¶
func NewObjectType(properties map[string]Type) *ObjectType
NewObjectType creates a new object type with the given properties.
func (*ObjectType) AssignableFrom ¶
func (t *ObjectType) AssignableFrom(src Type) bool
AssignableFrom returns true if this type is assignable from the indicated source type. An object({K_0 = T_0, ..., K_N = T_N}) is assignable from U = object({K_0 = U_0, ... K_M = U_M}), where T_I is assignable from U[K_I] for all I from 0 to N.
func (*ObjectType) ConversionFrom ¶
func (t *ObjectType) ConversionFrom(src Type) ConversionKind
func (*ObjectType) String ¶
func (t *ObjectType) String() string
func (*ObjectType) SyntaxNode ¶
func (*ObjectType) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node for the type. This is always syntax.None.
func (*ObjectType) Traverse ¶
func (t *ObjectType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the optional type with the given traverser. The result type of traverse(object({K_0 = T_0, ..., K_N = T_N})) is T_i if the traverser is the string literal K_i. If the traverser is a string but not a literal, the result type is any.
type OpaqueType ¶
type OpaqueType struct { // Name is the type's name. Name string // contains filtered or unexported fields }
OpaqueType represents a type that is named by a string.
func GetOpaqueType ¶
func GetOpaqueType(name string) (*OpaqueType, bool)
GetOpaqueType fetches the opaque type for the given name.
func MustNewOpaqueType ¶
func MustNewOpaqueType(name string) *OpaqueType
MustNewOpaqueType creates a new opaque type with the given name.
func NewOpaqueType ¶
func NewOpaqueType(name string) (*OpaqueType, error)
NewOpaqueType creates a new opaque type with the given name.
func (*OpaqueType) AssignableFrom ¶
func (t *OpaqueType) AssignableFrom(src Type) bool
AssignableFrom returns true if this type is assignable from the indicated source type. A token(name) is assignable from token(name).
func (*OpaqueType) ConversionFrom ¶
func (t *OpaqueType) ConversionFrom(src Type) ConversionKind
func (*OpaqueType) String ¶
func (t *OpaqueType) String() string
func (*OpaqueType) SyntaxNode ¶
func (*OpaqueType) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node for the type. This is always syntax.None.
func (*OpaqueType) Traverse ¶
func (t *OpaqueType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the opaque type with the given traverser. The result type of traverse(opaque(name)) is dynamic if name is "dynamic"; otherwise the traversal fails.
type OutputType ¶
type OutputType struct { // ElementType is the element type of the output. ElementType Type // contains filtered or unexported fields }
OutputType represents eventual values that carry additional application-specific information.
func NewOutputType ¶
func NewOutputType(elementType Type) *OutputType
NewOutputType creates a new output type with the given element type after replacing any output or promise types within the element type with their respective element types.
func (*OutputType) AssignableFrom ¶
func (t *OutputType) AssignableFrom(src Type) bool
AssignableFrom returns true if this type is assignable from the indicated source type. An output(T) is assignable from values of type output(U), promise(U), and U, where T is assignable from U.
func (*OutputType) ConversionFrom ¶
func (t *OutputType) ConversionFrom(src Type) ConversionKind
func (*OutputType) String ¶
func (t *OutputType) String() string
func (*OutputType) SyntaxNode ¶
func (*OutputType) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node for the type. This is always syntax.None.
func (*OutputType) Traverse ¶
func (t *OutputType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the output type with the given traverser. The result type of traverse(output(T)) is output(traverse(T)).
type Parameter ¶
type Parameter struct { Name string // The name of the parameter. Type Type // The type of the parameter. }
Parameter represents a single function parameter.
type PromiseType ¶
type PromiseType struct { // ElementType is the element type of the promise. ElementType Type // contains filtered or unexported fields }
PromiseType represents eventual values that do not carry additional information.
func NewPromiseType ¶
func NewPromiseType(elementType Type) *PromiseType
NewPromiseType creates a new promise type with the given element type after replacing any promise types within the element type with their respective element types.
func (*PromiseType) AssignableFrom ¶
func (t *PromiseType) AssignableFrom(src Type) bool
AssignableFrom returns true if this type is assignable from the indicated source type. A promise(T) is assignable from values of type promise(U) and U, where T is assignable from U.
func (*PromiseType) ConversionFrom ¶
func (t *PromiseType) ConversionFrom(src Type) ConversionKind
func (*PromiseType) String ¶
func (t *PromiseType) String() string
func (*PromiseType) SyntaxNode ¶
func (*PromiseType) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node for the type. This is always syntax.None.
func (*PromiseType) Traverse ¶
func (t *PromiseType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the promise type with the given traverser. The result type of traverse(promise(T)) is promise(traverse(T)).
type RelativeTraversalExpression ¶
type RelativeTraversalExpression struct { // The syntax node associated with the relative traversal expression. Syntax *hclsyntax.RelativeTraversalExpr // The tokens associated with the expression, if any. Tokens *syntax.RelativeTraversalTokens // The expression that computes the value being traversed. Source Expression // The traversal's parts. Parts []Traversable // The traversers. Traversal hcl.Traversal }
RelativeTraversalExpression represents a semantically-analyzed relative traversal expression.
func (*RelativeTraversalExpression) Format ¶ added in v1.14.1
func (x *RelativeTraversalExpression) Format(f fmt.State, c rune)
func (*RelativeTraversalExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *RelativeTraversalExpression) GetLeadingTrivia() syntax.TriviaList
func (*RelativeTraversalExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *RelativeTraversalExpression) GetTrailingTrivia() syntax.TriviaList
func (*RelativeTraversalExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *RelativeTraversalExpression) HasLeadingTrivia() bool
func (*RelativeTraversalExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *RelativeTraversalExpression) HasTrailingTrivia() bool
func (*RelativeTraversalExpression) NodeTokens ¶ added in v1.14.1
func (x *RelativeTraversalExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the relative traversal expression.
func (*RelativeTraversalExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *RelativeTraversalExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*RelativeTraversalExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *RelativeTraversalExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*RelativeTraversalExpression) SyntaxNode ¶
func (x *RelativeTraversalExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the relative traversal expression.
func (*RelativeTraversalExpression) Type ¶
func (x *RelativeTraversalExpression) Type() Type
Type returns the type of the relative traversal expression.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
A Scope is used to map names to definitions during expression binding.
A scope has two namespaces: one that is exclusive to functions and one that contains both variables and functions. When binding a reference, only the latter is checked; when binding a function, only the former is checked.
var TypeScope *Scope
func NewRootScope ¶
NewRootScope returns a new unparented scope associated with the given syntax node.
func (*Scope) BindFunctionReference ¶
BindFunctionReference returns the function definition that corresponds to the given name, if any. Each parent scope is checked until a definition is found or no parent scope remains.
func (*Scope) BindReference ¶
func (s *Scope) BindReference(name string) (Definition, bool)
BindReference returns the definition that corresponds to the given name, if any. Each parent scope is checked until a definition is found or no parent scope remains.
func (*Scope) Define ¶
func (s *Scope) Define(name string, def Definition) bool
Define maps the given name to the given definition. If the name is already defined in this scope, the existing definition is not overwritten and Define returns false.
func (*Scope) DefineFunction ¶
DefineFunction maps the given function name to the given function definition. If the function is alreadu defined in this scope, the definition is not overwritten and DefineFunction returns false.
func (*Scope) DefineScope ¶
DefineScope defines a child scope with the given name. If the name is already defined in this scope, the existing definition is not overwritten and DefineScope returns false.
func (*Scope) SyntaxNode ¶
SyntaxNode returns the syntax node associated with the scope, if any.
func (*Scope) Traverse ¶
func (s *Scope) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the scope using the given traverser. If the traverser is a literal string that refers to a name defined within the scope or one of its ancestors, the traversal returns the corresponding definition.
type ScopeTraversalExpression ¶
type ScopeTraversalExpression struct { // The syntax node associated with the scope traversal expression. Syntax *hclsyntax.ScopeTraversalExpr // The tokens associated with the expression, if any. Tokens *syntax.ScopeTraversalTokens // The traversal's parts. Parts []Traversable // The root name. RootName string // The traversers. Traversal hcl.Traversal }
ScopeTraversalExpression represents a semantically-analyzed scope traversal expression.
func (*ScopeTraversalExpression) Format ¶ added in v1.14.1
func (x *ScopeTraversalExpression) Format(f fmt.State, c rune)
func (*ScopeTraversalExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *ScopeTraversalExpression) GetLeadingTrivia() syntax.TriviaList
func (*ScopeTraversalExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *ScopeTraversalExpression) GetTrailingTrivia() syntax.TriviaList
func (*ScopeTraversalExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *ScopeTraversalExpression) HasLeadingTrivia() bool
func (*ScopeTraversalExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *ScopeTraversalExpression) HasTrailingTrivia() bool
func (*ScopeTraversalExpression) NodeTokens ¶ added in v1.14.1
func (x *ScopeTraversalExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the scope traversal expression.
func (*ScopeTraversalExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *ScopeTraversalExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*ScopeTraversalExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *ScopeTraversalExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*ScopeTraversalExpression) SyntaxNode ¶
func (x *ScopeTraversalExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the scope traversal expression.
func (*ScopeTraversalExpression) Type ¶
func (x *ScopeTraversalExpression) Type() Type
Type returns the type of the scope traversal expression.
type Scopes ¶
type Scopes interface { // GetScopesForBlock returns the Scopes that should be used when binding the given block. GetScopesForBlock(block *hclsyntax.Block) (Scopes, hcl.Diagnostics) // GetScopeForAttribute returns the *Scope that should be used when binding the given attribute. GetScopeForAttribute(attribute *hclsyntax.Attribute) (*Scope, hcl.Diagnostics) }
Scopes is the interface that is used fetch the scope that should be used when binding a block or attribute.
func StaticScope ¶
StaticScope returns a Scopes that uses the given *Scope for all blocks and attributes.
type SetType ¶
type SetType struct { // ElementType is the element type of the set. ElementType Type // contains filtered or unexported fields }
SetType represents sets of particular element types.
func NewSetType ¶
NewSetType creates a new set type with the given element type.
func (*SetType) AssignableFrom ¶
AssignableFrom returns true if this type is assignable from the indicated source type. A set(T) is assignable from values of type set(U) where T is assignable from U.
func (*SetType) ConversionFrom ¶
func (t *SetType) ConversionFrom(src Type) ConversionKind
func (*SetType) SyntaxNode ¶
SyntaxNode returns the syntax node for the type. This is always syntax.None.
func (*SetType) Traverse ¶
func (t *SetType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the optional type with the given traverser. This always fails.
type SplatExpression ¶
type SplatExpression struct { // The syntax node associated with the splat expression. Syntax *hclsyntax.SplatExpr // The tokens associated with the expression, if any. Tokens *syntax.SplatTokens // The expression being splatted. Source Expression // The expression applied to each element of the splat. Each Expression // The local variable definition associated with the current item being processed. This definition is not part of // a scope, and can only be referenced by an AnonSymbolExpr. Item *Variable // contains filtered or unexported fields }
SplatExpression represents a semantically-analyzed splat expression.
func (*SplatExpression) Format ¶ added in v1.14.1
func (x *SplatExpression) Format(f fmt.State, c rune)
func (*SplatExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *SplatExpression) GetLeadingTrivia() syntax.TriviaList
func (*SplatExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *SplatExpression) GetTrailingTrivia() syntax.TriviaList
func (*SplatExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *SplatExpression) HasLeadingTrivia() bool
func (*SplatExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *SplatExpression) HasTrailingTrivia() bool
func (*SplatExpression) NodeTokens ¶ added in v1.14.1
func (x *SplatExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the splat expression.
func (*SplatExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *SplatExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*SplatExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *SplatExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*SplatExpression) SyntaxNode ¶
func (x *SplatExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the splat expression.
func (*SplatExpression) Type ¶
func (x *SplatExpression) Type() Type
Type returns the type of the splat expression.
type StaticFunctionSignature ¶
type StaticFunctionSignature struct { // The function's fixed parameters. Parameters []Parameter // The function's variadic parameter, if any. Any arguments that follow a function's fixed arguments must be // assignable to this parameter. VarargsParameter *Parameter // The return type of the function. ReturnType Type }
StaticFunctionSignature records the parameters and return type of a function.
func (StaticFunctionSignature) GetSignature ¶
func (fs StaticFunctionSignature) GetSignature(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics)
GetSignature returns the static signature itself.
type TemplateExpression ¶
type TemplateExpression struct { // The syntax node associated with the template expression. Syntax *hclsyntax.TemplateExpr // The tokens associated with the expression, if any. Tokens *syntax.TemplateTokens // The parts of the template expression. Parts []Expression // contains filtered or unexported fields }
TemplateExpression represents a semantically-analyzed template expression.
func (*TemplateExpression) Format ¶ added in v1.14.1
func (x *TemplateExpression) Format(f fmt.State, c rune)
func (*TemplateExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *TemplateExpression) GetLeadingTrivia() syntax.TriviaList
func (*TemplateExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *TemplateExpression) GetTrailingTrivia() syntax.TriviaList
func (*TemplateExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *TemplateExpression) HasLeadingTrivia() bool
func (*TemplateExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *TemplateExpression) HasTrailingTrivia() bool
func (*TemplateExpression) NodeTokens ¶ added in v1.14.1
func (x *TemplateExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the template expression.
func (*TemplateExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *TemplateExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*TemplateExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *TemplateExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*TemplateExpression) SyntaxNode ¶
func (x *TemplateExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the template expression.
func (*TemplateExpression) Type ¶
func (x *TemplateExpression) Type() Type
Type returns the type of the template expression.
type TemplateJoinExpression ¶
type TemplateJoinExpression struct { // The syntax node associated with the template join expression. Syntax *hclsyntax.TemplateJoinExpr // The tuple being joined. Tuple Expression // contains filtered or unexported fields }
TemplateJoinExpression represents a semantically-analyzed template join expression.
func (*TemplateJoinExpression) Format ¶ added in v1.14.1
func (x *TemplateJoinExpression) Format(f fmt.State, c rune)
func (*TemplateJoinExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *TemplateJoinExpression) GetLeadingTrivia() syntax.TriviaList
func (*TemplateJoinExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *TemplateJoinExpression) GetTrailingTrivia() syntax.TriviaList
func (*TemplateJoinExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *TemplateJoinExpression) HasLeadingTrivia() bool
func (*TemplateJoinExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *TemplateJoinExpression) HasTrailingTrivia() bool
func (*TemplateJoinExpression) NodeTokens ¶ added in v1.14.1
func (x *TemplateJoinExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the template join expression.
func (*TemplateJoinExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *TemplateJoinExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*TemplateJoinExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *TemplateJoinExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*TemplateJoinExpression) SyntaxNode ¶
func (x *TemplateJoinExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the template join expression.
func (*TemplateJoinExpression) Type ¶
func (x *TemplateJoinExpression) Type() Type
Type returns the type of the template join expression.
type Traversable ¶
type Traversable interface { // Traverse attempts to traverse the receiver using the given traverser. Traverse(t hcl.Traverser) (Traversable, hcl.Diagnostics) }
Traversable represents an entity that can be traversed by an HCL2 traverser.
type TupleConsExpression ¶
type TupleConsExpression struct { // The syntax node associated with the tuple construction expression. Syntax *hclsyntax.TupleConsExpr // The tokens associated with the expression, if any. Tokens *syntax.TupleConsTokens // The elements of the tuple. Expressions []Expression // contains filtered or unexported fields }
TupleConsExpression represents a semantically-analyzed tuple construction expression.
func (*TupleConsExpression) Format ¶ added in v1.14.1
func (x *TupleConsExpression) Format(f fmt.State, c rune)
func (*TupleConsExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *TupleConsExpression) GetLeadingTrivia() syntax.TriviaList
func (*TupleConsExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *TupleConsExpression) GetTrailingTrivia() syntax.TriviaList
func (*TupleConsExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *TupleConsExpression) HasLeadingTrivia() bool
func (*TupleConsExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *TupleConsExpression) HasTrailingTrivia() bool
func (*TupleConsExpression) NodeTokens ¶ added in v1.14.1
func (x *TupleConsExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the tuple construction expression.
func (*TupleConsExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *TupleConsExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*TupleConsExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *TupleConsExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*TupleConsExpression) SyntaxNode ¶
func (x *TupleConsExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the tuple construction expression.
func (*TupleConsExpression) Type ¶
func (x *TupleConsExpression) Type() Type
Type returns the type of the tuple construction expression.
type TupleType ¶
type TupleType struct { // ElementTypes are the types of the tuple's elements. ElementTypes []Type // contains filtered or unexported fields }
TupleType represents values that are a sequence of independently-typed elements.
func (*TupleType) AssignableFrom ¶
AssignableFrom returns true if this type is assignable from the indicated source type..
func (*TupleType) ConversionFrom ¶
func (t *TupleType) ConversionFrom(src Type) ConversionKind
func (*TupleType) SyntaxNode ¶
SyntaxNode returns the syntax node for the type. This is always syntax.None.
func (*TupleType) Traverse ¶
func (t *TupleType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the tuple type with the given traverser. This always fails.
type Type ¶
type Type interface { Definition AssignableFrom(src Type) bool ConversionFrom(src Type) ConversionKind String() string // contains filtered or unexported methods }
Type represents a datatype in the Pulumi Schema. Types created by this package are identical if they are equal values.
func GetTraversableType ¶
func GetTraversableType(t Traversable) Type
GetTraversableType returns the type of the given Traversable: - If the Traversable is a TypedTraversable, this returns t.Type() - If the Traversable is a Type, this returns t - Otherwise, this returns DynamicType
func GetTraverserKey ¶
GetTraverserKey extracts the value and type of the key associated with the given traverser.
func NewOptionalType ¶
NewOptionalType returns a new union(T, None).
func NewTupleType ¶
NewTupleType creates a new tuple type with the given element types.
func NewUnionType ¶
NewUnionType creates a new union type with the given element types. Any element types that are union types are replaced with their element types.
func ResolveOutputs ¶
ResolveOutputs recursively replaces all output(T) and promise(T) types in the input type with their element type.
func ResolvePromises ¶
ResolvePromises recursively replaces all promise(T) types in the input type with their element type.
type TypedTraversable ¶
type TypedTraversable interface { Traversable Type() Type }
TypedTraversable is a Traversable that has an associated type.
type UnaryOpExpression ¶
type UnaryOpExpression struct { // The syntax node associated with the unary operation. Syntax *hclsyntax.UnaryOpExpr // The tokens associated with the expression, if any. Tokens *syntax.UnaryOpTokens // The operation. Operation *hclsyntax.Operation // The operand of the operation. Operand Expression // contains filtered or unexported fields }
UnaryOpExpression represents a semantically-analyzed unary operation.
func (*UnaryOpExpression) Format ¶ added in v1.14.1
func (x *UnaryOpExpression) Format(f fmt.State, c rune)
func (*UnaryOpExpression) GetLeadingTrivia ¶ added in v1.14.1
func (x *UnaryOpExpression) GetLeadingTrivia() syntax.TriviaList
func (*UnaryOpExpression) GetTrailingTrivia ¶ added in v1.14.1
func (x *UnaryOpExpression) GetTrailingTrivia() syntax.TriviaList
func (*UnaryOpExpression) HasLeadingTrivia ¶ added in v1.14.1
func (x *UnaryOpExpression) HasLeadingTrivia() bool
func (*UnaryOpExpression) HasTrailingTrivia ¶ added in v1.14.1
func (x *UnaryOpExpression) HasTrailingTrivia() bool
func (*UnaryOpExpression) NodeTokens ¶ added in v1.14.1
func (x *UnaryOpExpression) NodeTokens() syntax.NodeTokens
NodeTokens returns the tokens associated with the unary operation.
func (*UnaryOpExpression) SetLeadingTrivia ¶ added in v1.14.1
func (x *UnaryOpExpression) SetLeadingTrivia(t syntax.TriviaList)
func (*UnaryOpExpression) SetTrailingTrivia ¶ added in v1.14.1
func (x *UnaryOpExpression) SetTrailingTrivia(t syntax.TriviaList)
func (*UnaryOpExpression) SyntaxNode ¶
func (x *UnaryOpExpression) SyntaxNode() hclsyntax.Node
SyntaxNode returns the syntax node associated with the unary operation.
func (*UnaryOpExpression) Type ¶
func (x *UnaryOpExpression) Type() Type
Type returns the type of the unary operation.
type UnionType ¶
type UnionType struct { // ElementTypes are the allowable types for the union type. ElementTypes []Type // contains filtered or unexported fields }
UnionType represents values that may be any one of a specified set of types.
func (*UnionType) AssignableFrom ¶
AssignableFrom returns true if this type is assignable from the indicated source type. A union(T_0, ..., T_N) from values of type union(U_0, ..., U_M) where all of U_0 through U_M are assignable to some type in (T_0, ..., T_N) and V where V is assignable to at least one of (T_0, ..., T_N).
func (*UnionType) ConversionFrom ¶
func (t *UnionType) ConversionFrom(src Type) ConversionKind
func (*UnionType) SyntaxNode ¶
SyntaxNode returns the syntax node for the type. This is always syntax.None.
func (*UnionType) Traverse ¶
func (t *UnionType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the union type with the given traverser. This always fails.
type Variable ¶
type Variable struct { // The syntax node associated with the variable definition, if any. Syntax hclsyntax.Node // The name of the variable. Name string // The type of the variable. VariableType Type }
A Variable is a traversable, typed definition that represents a named value.
func (*Variable) SyntaxNode ¶
SyntaxNode returns the variable's syntax node or syntax.None.
func (*Variable) Traverse ¶
func (v *Variable) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)
Traverse attempts to traverse the variable's type.
Source Files ¶
- attribute.go
- binder_expression.go
- block.go
- body.go
- diagnostics.go
- expression.go
- functions.go
- printer.go
- scope.go
- traversable.go
- type.go
- type_collection.go
- type_eventuals.go
- type_list.go
- type_map.go
- type_none.go
- type_object.go
- type_opaque.go
- type_output.go
- type_promise.go
- type_scope.go
- type_set.go
- type_tuple.go
- type_union.go
- utilities.go
- visitor.go