blob: 32ea3d98cd2a8170d0084df429aa8d5c82496ce8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package protoreflect
// SourceLocations is a list of source locations.
type SourceLocations interface {
// Len reports the number of source locations in the proto file.
Len() int
// Get returns the ith SourceLocation. It panics if out of bounds.
Get(int) SourceLocation
doNotImplement
// TODO: Add ByPath and ByDescriptor helper methods.
}
// SourceLocation describes a source location and
// corresponds with the google.protobuf.SourceCodeInfo.Location message.
type SourceLocation struct {
// Path is the path to the declaration from the root file descriptor.
// The contents of this slice must not be mutated.
Path SourcePath
// StartLine and StartColumn are the zero-indexed starting location
// in the source file for the declaration.
StartLine, StartColumn int
// EndLine and EndColumn are the zero-indexed ending location
// in the source file for the declaration.
// In the descriptor.proto, the end line may be omitted if it is identical
// to the start line. Here, it is always populated.
EndLine, EndColumn int
// LeadingDetachedComments are the leading detached comments
// for the declaration. The contents of this slice must not be mutated.
LeadingDetachedComments []string
// LeadingComments is the leading attached comment for the declaration.
LeadingComments string
// TrailingComments is the trailing attached comment for the declaration.
TrailingComments string
}
// SourcePath identifies part of a file descriptor for a source location.
// The SourcePath is a sequence of either field numbers or indexes into
// a repeated field that form a path starting from the root file descriptor.
//
// See google.protobuf.SourceCodeInfo.Location.path.
type SourcePath []int32
// TODO: Add SourcePath.String method to pretty-print the path. For example:
// ".message_type[6].nested_type[15].field[3]"
|