// isVariable returns true if the line is a variable.
194393
func (ln *line) isVariable() bool {
	if !ln.isTopIndent() {
		return false
	}

	_, _, err := variableNV(ln)

	return err == nil
}
410908
func isVariadic(f *ast.FuncType) bool {
	nargs := len(f.Params.List)
	if nargs == 0 {
		return false
	}
	_, ok := f.Params.List[nargs-1].Type.(*ast.Ellipsis)
	return ok
}
701539
func (s *Service) UpdateVariable(ctx context.Context, id platform.ID, update *platform.VariableUpdate) (*platform.Variable, error) {
	op := OpPrefix + platform.OpUpdateVariable
	variable, err := s.FindVariableByID(ctx, id)
	if err != nil {
		return nil, &platform.Error{
			Op:  op,
			Err: err,
		}
	}

	if err := update.Apply(variable); err != nil {
		return nil, &platform.Error{
			Op:  op,
			Err: err,
		}
	}

	if err := s.ReplaceVariable(ctx, variable); err != nil {
		return nil, &platform.Error{
			Op:  op,
			Err: err,
		}
	}

	return variable, nil
}
992613
func (c *Client) UpdateVariable(ctx context.Context, id platform.ID, update *platform.VariableUpdate) (*platform.Variable, error) {
	op := getOp(platform.OpUpdateVariable)
	var variable *platform.Variable
	err := c.db.Update(func(tx *bolt.Tx) error {
		m, pe := c.findVariableByID(ctx, tx, id)
		if pe != nil {
			return &platform.Error{
				Op:  op,
				Err: pe,
			}
		}

		if err := update.Apply(m); err != nil {
			return &platform.Error{
				Op:  op,
				Err: err,
			}
		}

		variable = m
		if pe = c.putVariable(ctx, tx, variable); pe != nil {
			return &platform.Error{
				Op:  op,
				Err: pe,
			}
		}
		return nil
	})

	return variable, err
}
432218
func (t *precompilationTypeChecker) AcceptVariable(v tree.Variable) {
	t.result = fmt.Errorf("no variables allowed - this is probably a programmer error: %s", v.Name)
}
302962
func (rules *Rules) FindVariable(path string) (*Variable, error) {
	if len(path) <= 1 {
		return nil, ErrorMap[ErrInvalidPath]
	}

	rule, err := rules.FindParentRule(path)
	if err != nil {
		return nil, err
	}

	sep := "/"
	segments := strings.Split(path, sep)
	variableName := strings.ToLower(segments[len(segments)-1])
	for _, variable := range rule.Variables {
		if strings.ToLower(variable.Name) == variableName {
			return variable, nil
		}
	}

	return nil, ErrorMap[ErrVariableNotFound]
}
1362857
func SetVariableDefault(variable, value string) {
	if v := pprofVariables[variable]; v != nil {
		v.value = value
	}
}
813404
func (scope *EvalScope) SetVariable(name, value string) error {
	t, err := parser.ParseExpr(name)
	if err != nil {
		return err
	}

	xv, err := scope.evalAST(t)
	if err != nil {
		return err
	}

	if xv.Addr == 0 {
		return fmt.Errorf("Can not assign to \"%s\"", name)
	}

	if xv.Unreadable != nil {
		return fmt.Errorf("Expression \"%s\" is unreadable: %v", name, xv.Unreadable)
	}

	t, err = parser.ParseExpr(value)
	if err != nil {
		return err
	}

	yv, err := scope.evalAST(t)
	if err != nil {
		return err
	}

	return xv.setValue(yv, value)
}
1057150
func ValueBindVariable(v Value) *querypb.BindVariable {
	return &querypb.BindVariable{Type: v.typ, Value: v.val}
}
1334292
func (getter Getter) GetVar(name string) (Value, bool) {
	if getter == nil {
		return nilValue, false
	}
	v, ok := getter[name]
	return v, ok
}
458212
func (c *Compiler) DefineVariable(identifier string, value interface{}) (err error) {
	cid := C.CString(identifier)
	defer C.free(unsafe.Pointer(cid))
	switch value.(type) {
	case bool:
		var v int
		if value.(bool) {
			v = 1
		}
		err = newError(C.yr_compiler_define_boolean_variable(
			c.cptr, cid, C.int(v)))
	case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64:
		value := toint64(value)
		err = newError(C.yr_compiler_define_integer_variable(
			c.cptr, cid, C.int64_t(value)))
	case float64:
		err = newError(C.yr_compiler_define_float_variable(
			c.cptr, cid, C.double(value.(float64))))
	case string:
		cvalue := C.CString(value.(string))
		defer C.free(unsafe.Pointer(cvalue))
		err = newError(C.yr_compiler_define_string_variable(
			c.cptr, cid, cvalue))
	default:
		err = errors.New("wrong value type passed to DefineVariable; bool, int64, float64, string are accepted")
	}
	keepAlive(c)
	return
}
728437
func (s *VariableService) CreateVariable(ctx context.Context, m *platform.Variable) error {
	if err := m.Valid(); err != nil {
		return &platform.Error{
			Code: platform.EInvalid,
			Err:  err,
		}
	}

	url, err := newURL(s.Addr, variablePath)
	if err != nil {
		return err
	}

	octets, err := json.Marshal(m)
	if err != nil {
		return err
	}

	req, err := http.NewRequest("POST", url.String(), bytes.NewReader(octets))
	if err != nil {
		return err
	}

	req.Header.Set("Content-Type", "application/json")
	SetToken(s.Token, req)

	hc := newClient(url.Scheme, s.InsecureSkipVerify)

	resp, err := hc.Do(req)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	if err := CheckError(resp); err != nil {
		return err
	}

	return json.NewDecoder(resp.Body).Decode(m)
}
650420
func IsUnknown(v Variable) bool {
	// If it is unknown itself, return true
	if v.Type == TypeUnknown {
		return true
	}

	// If it is a container type, check the values
	switch v.Type {
	case TypeList:
		for _, el := range v.Value.([]Variable) {
			if IsUnknown(el) {
				return true
			}
		}
	case TypeMap:
		for _, el := range v.Value.(map[string]Variable) {
			if IsUnknown(el) {
				return true
			}
		}
	default:
	}

	// Not a container type or survive the above checks
	return false
}
440647
func (r *Regression) GetVar(i int) string {
	x := r.names.vars[i]
	if x == "" {
		s := []string{"X", strconv.Itoa(i)}
		return strings.Join(s, "")
	}
	return x
}
302259
func (s *Service) ReplaceVariable(ctx context.Context, m *platform.Variable) error {
	s.variableKV.Store(m.ID.String(), m)
	return nil
}
627034
func (s *Service) DeleteVariable(ctx context.Context, id platform.ID) error {
	op := OpPrefix + platform.OpDeleteVariable
	_, err := s.FindVariableByID(ctx, id)
	if err != nil {
		return &platform.Error{
			Op:  op,
			Err: err,
		}
	}

	s.variableKV.Delete(id.String())

	return nil
}
1286022
func (b *stdBackend) SetVariable(id string, v int64) {
	if b.ssvFilter != nil && !b.ssvFilter(id) {
		return
	}
	b.ssvChangeC <- &stdSSVChange{id, true, v}
}