Debian Codegraph @

internal/core/dep/testdata/inline.txtar

raw
1 -- in.cue --
2 import (
3 "regexp"
4 "strings"
5 )
6
7 a: b: {
8 c: [int, int]
9 d: [c][0] // a.b.c (dynamic/inner only)
10
11 e: s.k
12
13 f1: {out: c}.out // a.b.c (dynamic/inner only)
14 f2: {out: q}.out // q
15 f3: {out: q}.out // q
16 f4: {out: q}.out.x // q.x
17
18 h1: {out: r: s: string}.out
19 h2: {out: {out: r: q}.out}.out.r // q
20 h3: {out: {out: r: c}.out}.out.r[0] // a.b.c[0] (dynamic/inner only)
21 h4: {out: r: q}.out.r.x // q.x
22 h5: {out: {out: r: q}.out}.out.r.x // q.x
23 h6: {out: {out: r: q}.out.r}.out.x // q.x
24
25 // Dynamic processing reports dependencies within the root.
26 i: h1.r // a.b.h1.r
27 j: h1.r.s // a.b.h1.r.s
28
29 k: r.k // r.k
30 l: r.k.l // r.k.l
31
32 // Do not report dependencies that are not selected and not needed for
33 // evaluating the ultimate value.
34 m1: {
35 out: q
36 other: s // should not appear in output
37 }.out
38
39 m2: {
40 out: other
41 other: s // should appear in output
42 }.out
43
44 m3: {
45 // report msg
46 regexp.FindNamedSubmatch(#"Hello (?P<out>\w*)!"#, msg)
47 }.out
48
49 m4: {
50 // Theoretically could not report message, but it is hard to know in
51 // general whether a function will return a result. So report.
52 regexp.FindNamedSubmatch(#"Hello (?P<person>\w*)!"#, msg)
53 out: "foo"
54 }.out
55
56 m5: {
57 // report msg
58 regexp.FindNamedSubmatch(#"Hello (?P<person>\w*)!"#, msg)
59 out: person
60 person: string
61 }.out
62
63 m6: {
64 person: strings.ToUpper(msg) // do not report msg
65 out: "foo"
66 }.out
67
68 t1: {
69 runs: t1: {
70 cmd: ["sh", "-c", "sleep 1; echo t1"]
71 stdout: string
72 }
73 runs: t2: {
74 cmd: ["sh", "-c", "sleep 1; echo t2"]
75 stdout: string
76 }
77 print: {
78 // report the references in arg
79 text: (#f & {arg: runs.t1.stdout + runs.t2.stdout}).result
80 }
81 }
82
83 t2: {
84 runs: t1: {
85 cmd: ["sh", "-c", "sleep 1; echo t1"]
86 stdout: string
87 }
88 runs: t2: {
89 cmd: ["sh", "-c", "sleep 1; echo t2"]
90 stdout: string
91 }
92 print: {
93 // do not report the references in arg
94 text: (#g & {arg: runs.t1.stdout + runs.t2.stdout}).result
95 }
96 }
97 }
98
99 q: x: y: [...int]
100 r: {out: k: l: string}.out
101 s: k: l: int
102
103 msg: string
104
105 #f: {
106 arg: string
107 result: strings.Join(strings.Split(arg, ""), ".")
108 }
109 #g: result: strings.Join(strings.Split("foo.bar", ""), ".")
110
111 a: issue2512: (extIf & {}).env
112 extIf: {
113 if true {
114 env: msg
115 }
116 }
117
118 -- out/dependencies/field --
119 line reference path of resulting vertex
120 -- out/dependencies/all --
121 line reference path of resulting vertex
122 10: s.k => s.k
123 13: q => q
124 14: q => q
125 15: {out: q}.out.x => q.x
126 18: q => q
127 20: {out: r: q}.out.r.x => q.x
128 21: {out: {out: r: q}.out}.out.r.x => q.x
129 22: {out: {out: r: q}.out.r}.out.x => q.x
130 28: r.k => r.k
131 29: r.k.l => r.k.l
132 34: q => q
133 40: s => s
134 45: regexp.FindNamedSubmatch => "regexp".FindNamedSubmatch
135 45: msg => msg
136 51: regexp.FindNamedSubmatch => "regexp".FindNamedSubmatch
137 51: msg => msg
138 57: regexp.FindNamedSubmatch => "regexp".FindNamedSubmatch
139 57: msg => msg
140 106: strings.Join => "strings".Join
141 106: strings.Split => "strings".Split
142 106: arg => **non-rooted**
143 78: (#f & {arg: runs.t1.stdout + runs.t2.stdout}).result => #f.result
144 108: strings.Join => "strings".Join
145 108: strings.Split => "strings".Split
146 93: (#g & {arg: runs.t1.stdout + runs.t2.stdout}).result => #g.result
147 113: msg => msg
148 110: (extIf & {}).env => extIf.env
149 -- out/dependencies/dynamic --
150 line reference path of resulting vertex
151 8: [c][0] => a.b.c
152 10: s.k => s.k
153 12: {out: c}.out => a.b.c
154 13: {out: q}.out => q
155 14: {out: q}.out => q
156 15: {out: q}.out.x => q.x
157 18: {out: {out: r: q}.out}.out.r => q
158 19: {out: {out: r: c}.out}.out.r[0] => a.b.c[0]
159 20: {out: r: q}.out.r.x => q.x
160 21: {out: {out: r: q}.out}.out.r.x => q.x
161 22: {out: {out: r: q}.out.r}.out.x => q.x
162 25: h1.r => a.b.h1.r
163 26: h1.r.s => a.b.h1.r.s
164 28: r.k => r.k
165 29: r.k.l => r.k.l
166 33: {
167 out: q
168 other: s // should not appear in output
169 }.out => q
170 38: {
171 out: other
172 other: s // should appear in output
173 }.out => s
174 45: regexp.FindNamedSubmatch => "regexp".FindNamedSubmatch
175 45: msg => msg
176 51: regexp.FindNamedSubmatch => "regexp".FindNamedSubmatch
177 51: msg => msg
178 57: regexp.FindNamedSubmatch => "regexp".FindNamedSubmatch
179 57: msg => msg
180 106: strings.Join => "strings".Join
181 106: strings.Split => "strings".Split
182 78: runs.t1.stdout => a.b.t1.runs.t1.stdout
183 78: runs.t2.stdout => a.b.t1.runs.t2.stdout
184 78: (#f & {arg: runs.t1.stdout + runs.t2.stdout}).result => #f.result
185 108: strings.Join => "strings".Join
186 108: strings.Split => "strings".Split
187 93: (#g & {arg: runs.t1.stdout + runs.t2.stdout}).result => #g.result
188 113: msg => msg
189 110: (extIf & {}).env => extIf.env