Exemplo n.º 1
0
func (this *writer) newNodeStmt(name string) *ast.NodeStmt {
	node := this.Nodes.Lookup[name]
	id := ast.MakeNodeId(node.Name, "")
	this.writtenLocations[node.Name] = true
	return &ast.NodeStmt{
		id,
		ast.PutMap(node.Attrs.toStringMap()),
	}
}
Exemplo n.º 2
0
func (this *writer) newEdgeStmt(edge *Edge) *ast.EdgeStmt {
	src := this.newLocation(edge.Src, edge.SrcPort)
	dst := this.newLocation(edge.Dst, edge.DstPort)
	stmt := &ast.EdgeStmt{
		Source: src,
		EdgeRHS: ast.EdgeRHS{
			&ast.EdgeRH{
				ast.EdgeOp(edge.Dir),
				dst,
			},
		},
		Attrs: ast.PutMap(edge.Attrs.toStringMap()),
	}
	return stmt
}