@@ -184,13 +184,21 @@ func (c *OpContext) getNextDefID() defID {
184
184
type refInfo struct {
185
185
v * Vertex
186
186
id defID
187
- // exclude
187
+
188
+ // exclude defines a subtree of CloseInfo.def that should not be
189
+ // transitively added to the set of allowed fields.
190
+ //
188
191
// It would probably be more efficient to track a separate allow and deny
189
192
// list, rather than tracking the entire tree except for the excluded.
190
193
exclude defID
191
194
192
- ignore bool
193
- placeholder bool
195
+ // ignore defines whether we should not do typo checking for this defID.
196
+ ignore bool
197
+
198
+ // isOuterStruct indicates that this struct is marked as "outerID" in a
199
+ // CloseInfo. The debug visualization in ./debug.go uses this to show a
200
+ // mark ("S") next to the defID to visualize that this fact.
201
+ isOuterStruct bool
194
202
}
195
203
196
204
type conjunctFlags uint8
@@ -323,7 +331,7 @@ func (n *nodeContext) addResolver(v *Vertex, id CloseInfo, forceIgnore bool) Clo
323
331
if id .enclosingEmbed != 0 && ! ignore {
324
332
ph := id .outerID
325
333
n .addReplacement (replaceID {from : dstID , to : ph , add : true })
326
- id , dstID = n .newGroup (id )
334
+ id , dstID = n .newGroup (id , false )
327
335
id .enclosingEmbed = dstID
328
336
}
329
337
@@ -337,13 +345,15 @@ func (c *OpContext) subField(ci CloseInfo) CloseInfo {
337
345
return ci
338
346
}
339
347
340
- func (n * nodeContext ) newGroup (id CloseInfo ) (CloseInfo , defID ) {
348
+ func (n * nodeContext ) newGroup (id CloseInfo , placeholder bool ) (CloseInfo , defID ) {
341
349
srcID := id .defID
342
350
dstID := n .ctx .getNextDefID ()
351
+ // TODO: consider only adding when record || OpenGraph
343
352
n .reqDefIDs = append (n .reqDefIDs , refInfo {
344
- v : emptyNode ,
345
- id : dstID ,
346
- ignore : true ,
353
+ v : emptyNode ,
354
+ id : dstID ,
355
+ ignore : true ,
356
+ isOuterStruct : placeholder ,
347
357
})
348
358
id .defID = dstID
349
359
n .addReplacement (replaceID {from : srcID , to : dstID , add : true })
@@ -396,7 +406,7 @@ func (n *nodeContext) injectEmbedNode(x Decl, id CloseInfo) CloseInfo {
396
406
}
397
407
}
398
408
399
- id , dstID := n .newGroup (id )
409
+ id , dstID := n .newGroup (id , false )
400
410
id .enclosingEmbed = dstID
401
411
402
412
return id
@@ -430,7 +440,7 @@ func (n *nodeContext) splitDefID(s *StructLit, id CloseInfo) CloseInfo {
430
440
return id
431
441
}
432
442
433
- id , dstID := n .newGroup (id )
443
+ id , dstID := n .newGroup (id , true )
434
444
435
445
if id .outerID == 0 {
436
446
id .outerID = dstID
0 commit comments