valuestest

package
v0.58.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2020 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ScopeComparer = cmp.Comparer(func(l, r values.Scope) bool {
	for {
		if l == nil && r == nil {
			return true
		}
		if l == nil && r != nil || l != nil && r == nil {
			return false
		}
		equal := true
		l.LocalRange(func(k string, lv values.Value) {
			rv, ok := r.LocalLookup(k)
			if lv.PolyType().Nature() == semantic.Function {

				equal = equal && ok && lv.PolyType().Equal(rv.PolyType())
			} else {
				equal = equal && ok && lv.Equal(rv)
			}
		})
		if !equal {
			return false
		}
		r.LocalRange(func(k string, rv values.Value) {
			_, ok := l.LocalLookup(k)
			equal = equal && ok
		})
		if !equal {
			return false
		}

		l = l.Pop()
		r = r.Pop()
	}
})

ScopeComparer checks that two scopes are equal in both nesting and contents. Functions cannot be compared for equality so only function types are checked.

Functions

func NowScope

func NowScope() values.Scope

NowScope generates scope with the prelude + the now option.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL