// TODO(tsandall): improve errors to include location information.
174565
func (p *Planner) planExpr(e *ast.Expr, iter planiter) error {

	if e.Negated {
		return p.planNot(e, iter)
	}

	if len(e.With) > 0 {
		return fmt.Errorf("with keyword not implemented")
	}

	if e.IsCall() {
		return p.planExprCall(e, iter)
	}

	return p.planExprTerm(e, iter)
}
271239
func Dial(kind string, config Config) (Location, error) {
	fn, ok := locations[kind]
	if !ok {
		return nil, errUnknownKind(kind)
	}
	return fn(config)
}
261242
func SystemLocation() *time.Location {
	loc, err := LoadLocation(systemTZ)
	if err != nil {
		return time.Local
	}
	return loc
}
638265
func (g HTTPGeocoder) Geocode(address string) (*Location, error) {
	responseParser := g.ResponseParserFactory()

	ctx, cancel := context.WithTimeout(context.TODO(), DefaultTimeout)
	defer cancel()

	type geoResp struct {
		l *Location
		e error
	}
	ch := make(chan geoResp, 1)

	go func(ch chan geoResp) {
		if err := response(ctx, g.GeocodeURL(url.QueryEscape(address)), responseParser); err != nil {
			ch <- geoResp{
				l: nil,
				e: err,
			}
		}

		loc, err := responseParser.Location()
		ch <- geoResp{
			l: loc,
			e: err,
		}
	}(ch)

	select {
	case <-ctx.Done():
		return nil, ErrTimeout
	case res := <-ch:
		return res.l, res.e
	}
}
976842
func (e *Error) Location() (file string, line int) {
	return e.file, e.line
}
433473
func (c *Client) GetLocationByLabel(label string) (common.Location, error) {
	locations, _ := c.GetLocations()
	for _, location := range locations {
		if label == location.GetLabel() {
			return location, nil
		}
	}

	var timeout <-chan time.Time
	if c.timeout > 0 {
		timeout = time.After(c.timeout)
	} else {
		timeout = make(<-chan time.Time)
	}

	sub := c.protocol.Subscribe()
	defer func() {
		if err := sub.Close(); err != nil {
			common.Log.Warnf("Failed closing location subscription: %+v", err)
		}
	}()
	events := sub.Events()

	for {
		select {
		case event, ok := <-events:
			if !ok {
				return nil, common.ErrClosed
			}
			switch event := event.(type) {
			case common.EventNewLocation:
				if label == event.Location.GetLabel() {
					return event.Location, nil
				}
			}
		case <-timeout:
			return nil, common.ErrNotFound
		}
	}
}
791914
func (db *geoDB) location(ip string) *geoLocation {
	location := db.lookup(net.ParseIP(ip))
	return &geoLocation{
		Country:   location.Country.Names.English,
		City:      location.City.Names.English,
		Latitude:  location.Location.Latitude,
		Longitude: location.Location.Longitude,
	}
}
47874
func getLocation(resp *http.Response) string {
	if resp == nil {
		return ""
	}

	return resp.Header.Get("Location")
}
1108158
func (self FunctionCall) CallerLocation() string {
	// see error.go for location()
	return self.runtime.scope.outer.frame.location()
}
13906
func (c *Client) EditInlineMessageLiveLocation(inlineMessageID string, latitude, longitude float64, opts ...sendOption) error {
	req := url.Values{}
	req.Set("inline_message_id", inlineMessageID)
	req.Set("latitude", fmt.Sprint(latitude))
	req.Set("longitude", fmt.Sprint(longitude))
	for _, opt := range opts {
		opt(req)
	}
	var edited bool
	err := c.doRequest("editMessageLiveLocation", req, &edited)
	return err
}
938662
func (h *HereError) Location() string {
	lastSlash := strings.LastIndex(h.loc, "/")
	secondLastSlash := strings.LastIndex(h.loc[:lastSlash], "/")

	return h.loc[secondLastSlash+1:]
}
618394
func (i Itinerary) InitialDepartureLocation() location.UNLocode {
	if i.IsEmpty() {
		return location.UNLocode("")
	}
	return i.Legs[0].LoadLocation
}
989745
func (bot *TgBot) LocationFn(f func(TgBot, Message, float64, float64)) *TgBot {
	bot.addToConditionalFuncs(LocationConditionalCall{f})
	return bot
}
362818
func LocationsByName(locations []Location) (interface{}, func(_, _ int) bool) {
	return locations, func(i, j int) bool {
		return locations[i].Name < locations[j].Name
	}
}
1080040
func (p *Parser) parseLocation() (*time.Location, error) {
	// Parse the expression first.
	tok, _, lit := p.ScanIgnoreWhitespace()
	p.Unscan()
	if tok != IDENT || strings.ToLower(lit) != "tz" {
		return nil, nil
	}

	expr, err := p.ParseExpr()
	if err != nil {
		return nil, err
	}
	tz, ok := expr.(*Call)
	if !ok {
		return nil, errors.New("tz must be a function call")
	} else if len(tz.Args) != 1 {
		return nil, errors.New("tz requires exactly one argument")
	}

	tzname, ok := tz.Args[0].(*StringLiteral)
	if !ok {
		return nil, errors.New("expected string argument in tz()")
	}

	loc, err := time.LoadLocation(tzname.Val)
	if err != nil {
		// Do not pass the same error message as the error may contain sensitive pathnames.
		return nil, fmt.Errorf("unable to find time zone %s", tzname.Val)
	}
	return loc, nil
}
1128480
func getLocation() (*Data, error) {
	response, err := http.Get(URL)
	if err != nil {
		return nil, err
	}
	defer response.Body.Close()

	result, err := ioutil.ReadAll(response.Body)
	if err != nil {
		return nil, err
	}

	r := &Data{}
	if err = json.Unmarshal(result, &r); err != nil {
		return nil, err
	}
	return r, nil
}
787726
func (r Product_Package) GetAvailableLocations() (resp []datatypes.Product_Package_Locations, err error) {
	err = r.Session.DoRequest("SoftLayer_Product_Package", "getAvailableLocations", nil, &r.Options, &resp)
	return
}