// Goto moves the machine to the specified state. An error is returned if the
// transition is not valid.
762626
func (f *Machine) Goto(state uint8) error {
	t := f.transitions.Search(serialize(f.state, state))
	if t == nil {
		return fmt.Errorf("can't transition from state %d to %d", f.state, state)
	}

	f.state = state
	if t.fn != nil {
		t.fn(f)
	}

	return nil
}
1156246
func (h *HandlerT) GoTrace(file string, nsec uint) error {
	if err := h.StartGoTrace(file); err != nil {
		return err
	}
	time.Sleep(time.Duration(nsec) * time.Second)
	h.StopGoTrace()
	return nil
}
1160450
func (a *Automaton) transition(state, index int, t *Transition) {
	i := a.states[2*state] + 3*index
	t.source = state
	t.dest = a.transitions[i]
	t.min = a.transitions[i+1]
	t.max = a.transitions[i+2]
}
1278975
func (g *Group) Goto() *Statement {
	// notest
	s := Goto()
	g.items = append(g.items, s)
	return s
}
436673
func (c *Debugger) StepInto(breakOnAsyncCall bool) (*gcdmessage.ChromeResponse, error) {
	var v DebuggerStepIntoParams
	v.BreakOnAsyncCall = breakOnAsyncCall
	return c.StepIntoWithParams(&v)
}
1253546
func (f *FSM) Transition() error {
	f.eventMu.Lock()
	defer f.eventMu.Unlock()
	return f.doTransition()
}
1325212
func (us *UndoStack) Redo(hard bool) {
	if us.position >= len(us.actions) {
		// No more actions to redo
		return
	}
	to := us.index(1, hard)
	if to == -1 {
		to = len(us.actions)
	}
	for us.position < to {
		us.actions[us.position].Apply()
		us.position++
	}
}
211012
func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool {
	if h, ok := a.t.(tHelper); ok {
		h.Helper()
	}
	return NotZero(a.t, i, msgAndArgs...)
}
683075
func branch(list []Stmt, last *State, env Env) (*State, int) {
	branch, ok := last.Last.(*BranchStmt)
	if !ok {
		return last, 0
	}

	// breaks should go to the next stmt, goto should go to the labeled stmt
	brk := 0
	if branch.Tok == token.GOTO {
		brk = -1
	}
	for i, stmt := range list {
		switch s := stmt.(type) {
		case *LabeledStmt:
			if branch.Label != nil && branch.Label.Name == s.Label.Name {
				return nil, i+brk
			}
		// TODO[crc] add SelectStmt and RangeStmt here when implemented
		case *ForStmt, *SwitchStmt, *TypeSwitchStmt:
			if branch.Label == nil {
				return nil, i+brk
			}
		}
	}
	return last, 0
}
540393
func (q *Query) RunOne(model Model) error {
	tx := q.pool.NewTransaction()
	newTransactionQuery(q.query, tx).RunOne(model)
	return tx.Exec()
}
901547
func getIO(inFile, outFile string) (*os.File, io.Writer, error) {
	input, err := getInput(inFile)
	if err != nil {
		return nil, nil, fmt.Errorf("can't open %s for reading: %s", inFile, err)
	}

	output, err := getOutput(outFile)
	if err != nil {
		return nil, nil, fmt.Errorf("can't open %s for writing: %s", outFile, err)
	}

	return input, output, nil
}
721844
func (g *G) Go() Location {
	pc := g.GoPC
	if fn := g.variable.bi.PCToFunc(pc); fn != nil {
		// Backup to CALL instruction.
		// Mimics runtime/traceback.go:677.
		if g.GoPC > fn.Entry {
			pc--
		}
	}
	f, l, fn := g.variable.bi.PCToLine(pc)
	return Location{PC: g.GoPC, File: f, Line: l, Fn: fn}
}
1138988
func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescriptorProto) (typ string, wire string) {
	// TODO: Options.
	switch *field.Type {
	case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
		typ, wire = "float64", "fixed64"
	case descriptor.FieldDescriptorProto_TYPE_FLOAT:
		typ, wire = "float32", "fixed32"
	case descriptor.FieldDescriptorProto_TYPE_INT64:
		typ, wire = "int64", "varint"
	case descriptor.FieldDescriptorProto_TYPE_UINT64:
		typ, wire = "uint64", "varint"
	case descriptor.FieldDescriptorProto_TYPE_INT32:
		typ, wire = "int32", "varint"
	case descriptor.FieldDescriptorProto_TYPE_UINT32:
		typ, wire = "uint32", "varint"
	case descriptor.FieldDescriptorProto_TYPE_FIXED64:
		typ, wire = "uint64", "fixed64"
	case descriptor.FieldDescriptorProto_TYPE_FIXED32:
		typ, wire = "uint32", "fixed32"
	case descriptor.FieldDescriptorProto_TYPE_BOOL:
		typ, wire = "bool", "varint"
	case descriptor.FieldDescriptorProto_TYPE_STRING:
		typ, wire = "string", "bytes"
	case descriptor.FieldDescriptorProto_TYPE_GROUP:
		desc := g.ObjectNamed(field.GetTypeName())
		typ, wire = "*"+g.TypeName(desc), "group"
	case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
		desc := g.ObjectNamed(field.GetTypeName())
		typ, wire = "*"+g.TypeName(desc), "bytes"
	case descriptor.FieldDescriptorProto_TYPE_BYTES:
		typ, wire = "[]byte", "bytes"
	case descriptor.FieldDescriptorProto_TYPE_ENUM:
		desc := g.ObjectNamed(field.GetTypeName())
		typ, wire = g.TypeName(desc), "varint"
	case descriptor.FieldDescriptorProto_TYPE_SFIXED32:
		typ, wire = "int32", "fixed32"
	case descriptor.FieldDescriptorProto_TYPE_SFIXED64:
		typ, wire = "int64", "fixed64"
	case descriptor.FieldDescriptorProto_TYPE_SINT32:
		typ, wire = "int32", "zigzag32"
	case descriptor.FieldDescriptorProto_TYPE_SINT64:
		typ, wire = "int64", "zigzag64"
	default:
		g.Fail("unknown type for", field.GetName())
	}
	if isRepeated(field) {
		typ = "[]" + typ
	} else if message != nil && message.proto3() {
		return
	} else if field.OneofIndex != nil && message != nil {
		return
	} else if needsStar(*field.Type) {
		typ = "*" + typ
	}
	return
}
663462
func (a *AAgent) Transition(name string, version string, path string, id string, transition string) error {
	m := a.findMachine(name, version, path, id)
	if m == nil {
		return fmt.Errorf("could not find machine with id %s", id)
	}

	if !m.machine.Can(transition) {
		return fmt.Errorf("transition %s is not valid while in %v state", transition, m.machine.State())
	}

	err := m.machine.Transition(transition)
	if err != nil {
		return err
	}

	return nil
}
1358912
func (s *sentinel) ObservablesDo(f func(o Observable) error) error {
	s.mux.Lock()
	defer s.mux.Unlock()
	var errs []error
	for observable := range s.observables {
		if err := f(observable); err != nil {
			errs = append(errs, err)
		}
	}
	if len(errs) > 0 {
		return errors.Collect(errs...)
	}
	return nil
}
253803
func (c *Client) GetOS() ([]OS, error) {
	var osMap map[string]OS
	if err := c.get(`os/list`, &osMap); err != nil {
		return nil, err
	}

	var osList []OS
	for _, os := range osMap {
		osList = append(osList, os)
	}
	sort.Sort(oses(osList))
	return osList, nil
}
281186
func (self *Stack) EmptyInto(s *Stack) {
	if !self.IsEmpty() {
		for i := self.Length() - 1; i >= 0; i-- {
			s.Push(self.Pop())
		}
	}
}