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
5package analysis
6
7// This file defines types used by client-side JavaScript.
8
9type anchorJSON struct {
10	Text string // HTML
11	Href string // URL
12}
13
14type commOpJSON struct {
15	Op anchorJSON
16	Fn string
17}
18
19// JavaScript's onClickComm() expects a commJSON.
20type 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 == "")
27type implFactJSON struct {
28	ByKind string `json:",omitempty"`
29	Other  anchorJSON
30}
31
32// Implements facts are grouped by form, for ease of reading.
33type implGroupJSON struct {
34	Descr string
35	Facts []implFactJSON
36}
37
38// JavaScript's onClickIdent() expects a TypeInfoJSON.
39type 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.
47type calleesJSON struct {
48	Descr   string
49	Callees []anchorJSON // markup for called function
50}
51
52type callerJSON struct {
53	Func  string
54	Sites []anchorJSON
55}
56
57// JavaScript's onClickCallers() expects a callersJSON.
58type 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".
66type PCGNodeJSON struct {
67	Func    anchorJSON
68	Callees []int // indices within CALLGRAPH of nodes called by this one
69}
70