// AcceptVariable implements Visitor
432218
func (t *precompilationTypeChecker) AcceptVariable(v tree.Variable) {
	t.result = fmt.Errorf("no variables allowed - this is probably a programmer error: %s", v.Name)
}
1057150
func ValueBindVariable(v Value) *querypb.BindVariable {
	return &querypb.BindVariable{Type: v.typ, Value: v.val}
}
532191
func NewVariable(v interface{}) (result Variable, err error) {
	switch v := reflect.ValueOf(v); v.Kind() {
	case reflect.String:
		result.Type = TypeString
	default:
		err = fmt.Errorf("Unknown type: %s", v.Kind())
	}

	result.Value = v
	return
}
735989
func (m *Message) AddVariable(variable string, value interface{}) error {
	if m.variables == nil {
		m.variables = make(map[string]string)
	}

	j, err := json.Marshal(value)
	if err != nil {
		return err
	}

	encoded := string(j)
	v, err := strconv.Unquote(encoded)
	if err != nil {
		v = encoded
	}

	m.variables[variable] = v
	return nil
}
362043
func (l *ReaderLexer) AcceptRun(valid string) bool {
	guard := Mark("AcceptRun")
	defer guard()
	return AcceptRun(l, valid)
}
515732
func (s *Server) AcceptLoop(clr chan struct{}) {
	// If we were to exit before the listener is setup properly,
	// make sure we close the channel.
	defer func() {
		if clr != nil {
			close(clr)
		}
	}()

	// Snapshot server options.
	opts := s.getOpts()

	hp := net.JoinHostPort(opts.Host, strconv.Itoa(opts.Port))
	l, e := net.Listen("tcp", hp)
	if e != nil {
		s.Fatalf("Error listening on port: %s, %q", hp, e)
		return
	}
	s.Noticef("Listening for client connections on %s",
		net.JoinHostPort(opts.Host, strconv.Itoa(l.Addr().(*net.TCPAddr).Port)))

	// Alert of TLS enabled.
	if opts.TLSConfig != nil {
		s.Noticef("TLS required for client connections")
	}

	s.Noticef("Server id is %s", s.info.ID)
	s.Noticef("Server is ready")

	// Setup state that can enable shutdown
	s.mu.Lock()
	s.listener = l

	// If server was started with RANDOM_PORT (-1), opts.Port would be equal
	// to 0 at the beginning this function. So we need to get the actual port
	if opts.Port == 0 {
		// Write resolved port back to options.
		opts.Port = l.Addr().(*net.TCPAddr).Port
	}

	// Now that port has been set (if it was set to RANDOM), set the
	// server's info Host/Port with either values from Options or
	// ClientAdvertise. Also generate the JSON byte array.
	if err := s.setInfoHostPortAndGenerateJSON(); err != nil {
		s.Fatalf("Error setting server INFO with ClientAdvertise value of %s, err=%v", s.opts.ClientAdvertise, err)
		s.mu.Unlock()
		return
	}
	// Keep track of client connect URLs. We may need them later.
	s.clientConnectURLs = s.getClientConnectURLs()
	s.mu.Unlock()

	// Let the caller know that we are ready
	close(clr)
	clr = nil

	tmpDelay := ACCEPT_MIN_SLEEP

	for s.isRunning() {
		conn, err := l.Accept()
		if err != nil {
			if s.isLameDuckMode() {
				// Signal that we are not accepting new clients
				s.ldmCh <- true
				// Now wait for the Shutdown...
				<-s.quitCh
				return
			}
			tmpDelay = s.acceptError("Client", err, tmpDelay)
			continue
		}
		tmpDelay = ACCEPT_MIN_SLEEP
		s.startGoRoutine(func() {
			s.createClient(conn)
			s.grWG.Done()
		})
	}
	s.done <- true
}
129655
func (s *numericCompilerVisitor) AcceptNumericLiteral(v tree.NumericLiteral) {
	s.ctx.op(OP_LOAD_VAL, uint32(v.Value))
}
1099059
func (s *Server) Accept(addr string, listeners ...net.Listener) {
	for _, listener := range listeners {
		httpServer := &HTTPServer{
			srv: &http.Server{
				Addr: addr,
			},
			l: listener,
		}
		s.servers = append(s.servers, httpServer)
	}
}
318080
func BindVariableToValue(bv *querypb.BindVariable) (Value, error) {
	if bv.Type == querypb.Type_TUPLE {
		return NULL, errors.New("cannot convert a TUPLE bind var into a value")
	}
	return MakeTrusted(bv.Type, bv.Value), nil
}
302259
func (s *Service) ReplaceVariable(ctx context.Context, m *platform.Variable) error {
	s.variableKV.Store(m.ID.String(), m)
	return nil
}
88120
func (s *VariableService) ReplaceVariable(ctx context.Context, m *influxdb.Variable) error {
	m, err := s.FindVariableByID(ctx, m.ID)
	if err != nil {
		return err
	}

	if err := authorizeWriteVariable(ctx, m.OrganizationID, m.ID); err != nil {
		return err
	}

	return s.s.ReplaceVariable(ctx, m)
}
475348
func (s *numericCompilerVisitor) AcceptInclusion(v tree.Inclusion) {
	s.err = errors.New("an in-statement was found in an expression - this is likely a programmer error")
}
238349
func (b *stdBackend) ReadVariable(id string) (StaySetVariable, error) {
	resp, err := b.command(cmdStaySetVariableRead, id)
	if err != nil {
		return nil, err
	}
	return resp.(StaySetVariable), nil
}
348668
func WithVariable(v *runtimevar.Variable) source.Option {
	return func(o *source.Options) {
		if o.Context == nil {
			o.Context = context.Background()
		}
		o.Context = context.WithValue(o.Context, variableKey{}, v)
	}
}
1156801
func (s *Service) CreateVariable(ctx context.Context, m *platform.Variable) error {
	op := OpPrefix + platform.OpCreateVariable
	m.ID = s.IDGenerator.ID()
	err := s.ReplaceVariable(ctx, m)
	if err != nil {
		return &platform.Error{
			Op:  op,
			Err: err,
		}
	}

	return nil
}
571270
func (sv *StringVisitor) AcceptInclusion(v Inclusion) {
	name := "in"
	if !v.Positive {
		name = "notIn"
	}
	sv.result += "(" + name + " "
	v.Left.Accept(sv)
	sep := " "
	for _, a := range v.Rights {
		sv.result += sep
		a.Accept(sv)
	}
	sv.result += ")"
}
357912
func (b *Builder) AddVariable(varname string, typ dwarf.Offset, loc interface{}) dwarf.Offset {
	r := b.TagOpen(dwarf.TagVariable, varname)
	b.Attr(dwarf.AttrType, typ)
	b.Attr(dwarf.AttrLocation, loc)
	b.TagClose()
	return r
}