summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/d5/tengo/compiler/ast/empty_stmt.go
blob: a2ac6ffe53202fe8feb8a41588448605224bb6cb (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
28
29
package ast

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

// EmptyStmt represents an empty statement.
type EmptyStmt struct {
	Semicolon source.Pos
	Implicit  bool
}

func (s *EmptyStmt) stmtNode() {}

// Pos returns the position of first character belonging to the node.
func (s *EmptyStmt) Pos() source.Pos {
	return s.Semicolon
}

// End returns the position of first character immediately after the node.
func (s *EmptyStmt) End() source.Pos {
	if s.Implicit {
		return s.Semicolon
	}

	return s.Semicolon + 1
}

func (s *EmptyStmt) String() string {
	return ";"
}