github.com/v2fly/tools@v0.100.0/godoc/analysis/json.go (about)

     1  // Copyright 2014 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  package analysis
     6  
     7  // This file defines types used by client-side JavaScript.
     8  
     9  type anchorJSON struct {
    10  	Text string // HTML
    11  	Href string // URL
    12  }
    13  
    14  type commOpJSON struct {
    15  	Op anchorJSON
    16  	Fn string
    17  }
    18  
    19  // JavaScript's onClickComm() expects a commJSON.
    20  type commJSON struct {
    21  	Ops []commOpJSON
    22  }
    23  
    24  // Indicates one of these forms of fact about a type T:
    25  // T "is implemented by <ByKind> type <Other>"  (ByKind != "", e.g. "array")
    26  // T "implements <Other>"                       (ByKind == "")
    27  type implFactJSON struct {
    28  	ByKind string `json:",omitempty"`
    29  	Other  anchorJSON
    30  }
    31  
    32  // Implements facts are grouped by form, for ease of reading.
    33  type implGroupJSON struct {
    34  	Descr string
    35  	Facts []implFactJSON
    36  }
    37  
    38  // JavaScript's onClickIdent() expects a TypeInfoJSON.
    39  type TypeInfoJSON struct {
    40  	Name        string // type name
    41  	Size, Align int64
    42  	Methods     []anchorJSON
    43  	ImplGroups  []implGroupJSON
    44  }
    45  
    46  // JavaScript's onClickCallees() expects a calleesJSON.
    47  type calleesJSON struct {
    48  	Descr   string
    49  	Callees []anchorJSON // markup for called function
    50  }
    51  
    52  type callerJSON struct {
    53  	Func  string
    54  	Sites []anchorJSON
    55  }
    56  
    57  // JavaScript's onClickCallers() expects a callersJSON.
    58  type callersJSON struct {
    59  	Callee  string
    60  	Callers []callerJSON
    61  }
    62  
    63  // JavaScript's cgAddChild requires a global array of PCGNodeJSON
    64  // called CALLGRAPH, representing the intra-package call graph.
    65  // The first element is special and represents "all external callers".
    66  type PCGNodeJSON struct {
    67  	Func    anchorJSON
    68  	Callees []int // indices within CALLGRAPH of nodes called by this one
    69  }