Beispiel #1
0
func (r *ScopeReference) GetNode(srg *srg.SRG, tg *typegraph.TypeGraph) compilergraph.GraphNode {
	nodeId := compilergraph.GraphNodeId(r.GetReferencedNode())
	if r.GetIsSRGNode() {
		return srg.GetNode(nodeId)
	} else {
		return tg.GetNode(nodeId)
	}
}
Beispiel #2
0
func (t *ScopeInfo) TargetedNode(srg *srg.SRG) (compilergraph.GraphNode, bool) {
	if t.TargetedReference == nil {
		return compilergraph.GraphNode{}, false
	}

	nodeId := compilergraph.GraphNodeId(t.TargetedReference.GetReferencedNode())
	if t.TargetedReference.GetIsSRGNode() {
		return srg.GetNode(nodeId), true
	} else {
		panic("Cannot have a non-SRG targeted node")
	}
}