github.com/bir3/gocompiler@v0.9.2202/src/go/types/util.go (about)

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // This file contains various functionality that is
     6  // different between go/types and types2. Factoring
     7  // out this code allows more of the rest of the code
     8  // to be shared.
     9  
    10  package types
    11  
    12  import "github.com/bir3/gocompiler/src/go/token"
    13  
    14  // cmpPos compares the positions p and q and returns a result r as follows:
    15  //
    16  // r <  0: p is before q
    17  // r == 0: p and q are the same position (but may not be identical)
    18  // r >  0: p is after q
    19  //
    20  // If p and q are in different files, p is before q if the filename
    21  // of p sorts lexicographically before the filename of q.
    22  func cmpPos(p, q token.Pos) int	{ return int(p - q) }