func (a *Agent) GetThisEnvironment() binding.Environment {
	lex := a.RunningExecutionContext().LexicalEnvironment
	for !lex.HasThisBinding() {
		lex = lex.Outer()
		if lex == nil {
			panic("Outer environment cannot be nil, this means that the global object does not have a this binding, which must not happen, or that an environment which is not the global environment has a nil reference as an outer environment.")
		}
	}
	return lex
}
GetThisEnvironment returns the current environment that currently supplies
the binding for the keyword 'this'.
GetThisEnvironment is specified in 8.3.3.
package agent
import (
	"fmt"
	"math/rand"
	"sync"
	"time"
	"github.com/gojisvm/gojis/internal/runtime/agent/job"
	"github.com/gojisvm/gojis/internal/runtime/binding"
	"github.com/gojisvm/gojis/internal/runtime/errors"
	"github.com/gojisvm/gojis/internal/runtime/lang"
	"github.com/gojisvm/gojis/internal/runtime/realm"
	"github.com/oklog/ulid"
)
type QueueKind uint8
const (
	QueueUnknown QueueKind = iota
	QueueScript
	QueuePromise
)
type ID ulid.ULID
var (
	entropyLock sync.Mutex
	entropy     = ulid.Monotonic(rand.New(rand.NewSource(time.Now().Unix())), 0)
)
func NewID() ID {
	entropyLock.Lock()
	defer entropyLock.Unlock()
	return ID(ulid.MustNew(ulid.Timestamp(time.Now()), entropy))
}
type Agent struct {
	ExecutionContextStack *ExecutionContextStack
	LittleEndian       bool
	CanBlock           bool
	Signifier          ID
	IsLockFree1        bool
	IsLockFree2        bool
	CandidateExecution interface{}  
	ScriptJobs  *job.Queue
	PromiseJobs *job.Queue
}
func New() *Agent {
	a := new(Agent)
	a.ExecutionContextStack = NewExecutionContextStack()
	a.LittleEndian = false
	a.CanBlock = false
	a.Signifier = NewID()
	a.ScriptJobs = job.NewQueue()
	a.PromiseJobs = job.NewQueue()
	return a
}
func (a *Agent) AgentSignifier() ID {
	return a.Signifier
}
func (a *Agent) AgentCanSuspend() bool {
	return a.CanBlock
}
func (a *Agent) RunningExecutionContext() *ExecutionContext {
	return a.ExecutionContextStack.Peek()
}
func (a *Agent) GetActiveScriptOrModule() lang.InternalValue {
	if a.ExecutionContextStack.IsEmpty() {
		return lang.Null
	}
	panic("#40: 8.3.1")
}
func (a *Agent) ResolveBinding(name lang.String, env binding.Environment) *binding.Reference {
	if env == nil {
		env = a.RunningExecutionContext().LexicalEnvironment
		_ = env
	}
	strict := false  
	_ = strict
	panic("#38: 8.3.2, Step 3")
}