summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/d5/tengo/compiler/ast/map_element_lit.go
blob: 3d7fca9ed1a19c2a0874bf1331794aec96a086ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package ast

import "github.com/d5/tengo/compiler/source"

// MapElementLit represents a map element.
type MapElementLit struct {
	Key      string
	KeyPos   source.Pos
	ColonPos source.Pos
	Value    Expr
}

func (e *MapElementLit) exprNode() {}

// Pos returns the position of first character belonging to the node.
func (e *MapElementLit) Pos() source.Pos {
	return e.KeyPos
}

// End returns the position of first character immediately after the node.
func (e *MapElementLit) End() source.Pos {
	return e.Value.End()
}

func (e *MapElementLit) String() string {
	return e.Key + ": " + e.Value.String()
}