Ejemplo n.º 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)
	}
}
Ejemplo n.º 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")
	}
}
Ejemplo n.º 3
0
// getParentContainer returns the parent type member, module member or property getter/setter
// under which we are scoping, if any.
func (sc scopeContext) getParentContainer(g *srg.SRG) (srg.SRGImplementable, bool) {
	return g.AsImplementable(sc.rootNode)
}