operand: doc for exported symbols (#9)

This commit is contained in:
Michael McLoughlin
2019-01-04 21:38:23 -08:00
parent 52a501c7be
commit 2e250a6f4c
2 changed files with 19 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package operand
import "fmt"
// Constant represents a constant literal.
type Constant interface {
Op
Bytes() int
@@ -13,9 +14,13 @@ type Constant interface {
// String is a string constant.
type String string
// Asm returns an assembly syntax representation of the string s.
func (s String) Asm() string { return fmt.Sprintf("$%q", s) }
func (s String) Bytes() int { return len(s) }
func (s String) constant() {}
// Bytes returns the length of s.
func (s String) Bytes() int { return len(s) }
func (s String) constant() {}
// Imm returns an unsigned integer constant with size guessed from x.
func Imm(x uint64) Constant {