lang: Add var prefix to var expr to avoid ambiguity

This commit is contained in:
James Shubin
2019-04-29 06:21:17 -04:00
parent 3bcb697662
commit 4aa3cfad40
12 changed files with 61 additions and 61 deletions

View File

@@ -112,7 +112,7 @@ func TestAstFunc0(t *testing.T) {
{ {
graph, _ := pgraph.NewGraph("g") graph, _ := pgraph.NewGraph("g")
v1, v2 := vtex("int(42)"), vtex("var(x)") v1, v2 := vtex("int(42)"), vtex("var(x)")
e1 := edge("x") e1 := edge("var:x")
graph.AddVertex(&v1, &v2) graph.AddVertex(&v1, &v2)
graph.AddEdge(&v1, &v2, &e1) graph.AddEdge(&v1, &v2, &e1)
testCases = append(testCases, test{ testCases = append(testCases, test{
@@ -141,7 +141,7 @@ func TestAstFunc0(t *testing.T) {
{ {
graph, _ := pgraph.NewGraph("g") graph, _ := pgraph.NewGraph("g")
v1, v2, v3, v4, v5 := vtex("int(42)"), vtex("var(a)"), vtex("var(b)"), vtex("var(c)"), vtex(`str("t")`) v1, v2, v3, v4, v5 := vtex("int(42)"), vtex("var(a)"), vtex("var(b)"), vtex("var(c)"), vtex(`str("t")`)
e1, e2, e3 := edge("a"), edge("b"), edge("c") e1, e2, e3 := edge("var:a"), edge("var:b"), edge("var:c")
graph.AddVertex(&v1, &v2, &v3, &v4, &v5) graph.AddVertex(&v1, &v2, &v3, &v4, &v5)
graph.AddEdge(&v1, &v2, &e1) graph.AddEdge(&v1, &v2, &e1)
graph.AddEdge(&v2, &v3, &e2) graph.AddEdge(&v2, &v3, &e2)
@@ -164,7 +164,7 @@ func TestAstFunc0(t *testing.T) {
graph, _ := pgraph.NewGraph("g") graph, _ := pgraph.NewGraph("g")
v1, v2 := vtex("bool(true)"), vtex("var(b)") v1, v2 := vtex("bool(true)"), vtex("var(b)")
graph.AddVertex(&v1, &v2) graph.AddVertex(&v1, &v2)
e1 := edge("b") e1 := edge("var:b")
graph.AddEdge(&v1, &v2, &e1) graph.AddEdge(&v1, &v2, &e1)
testCases = append(testCases, test{ testCases = append(testCases, test{
name: "simple bool", name: "simple bool",
@@ -233,7 +233,7 @@ func TestAstFunc0(t *testing.T) {
v5, v6 := vtex("var(i)"), vtex("var(x)") v5, v6 := vtex("var(i)"), vtex("var(x)")
v7, v8 := vtex(`str("+")`), vtex(fmt.Sprintf(`call:%s(str("+"), int(42), var(i))`, operatorFuncName)) v7, v8 := vtex(`str("+")`), vtex(fmt.Sprintf(`call:%s(str("+"), int(42), var(i))`, operatorFuncName))
e1, e2, e3, e4, e5 := edge("x"), edge("a"), edge("b"), edge("i"), edge("x") e1, e2, e3, e4, e5 := edge("x"), edge("a"), edge("b"), edge("var:i"), edge("var:x")
graph.AddVertex(&v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8) graph.AddVertex(&v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8)
graph.AddEdge(&v3, &v5, &e4) graph.AddEdge(&v3, &v5, &e4)
@@ -289,7 +289,7 @@ func TestAstFunc0(t *testing.T) {
v4, v5 := vtex("var(x)"), vtex(`str("t")`) v4, v5 := vtex("var(x)"), vtex(`str("t")`)
graph.AddVertex(&v1, &v2, &v3, &v4, &v5) graph.AddVertex(&v1, &v2, &v3, &v4, &v5)
e1 := edge("x") e1 := edge("var:x")
// only one edge! (cool) // only one edge! (cool)
graph.AddEdge(&v1, &v4, &e1) graph.AddEdge(&v1, &v4, &e1)
@@ -315,7 +315,7 @@ func TestAstFunc0(t *testing.T) {
v4, v5 := vtex("var(x)"), vtex(`str("t")`) v4, v5 := vtex("var(x)"), vtex(`str("t")`)
graph.AddVertex(&v1, &v2, &v3, &v4, &v5) graph.AddVertex(&v1, &v2, &v3, &v4, &v5)
e1 := edge("x") e1 := edge("var:x")
// only one edge! (cool) // only one edge! (cool)
graph.AddEdge(&v2, &v4, &e1) graph.AddEdge(&v2, &v4, &e1)
@@ -344,7 +344,7 @@ func TestAstFunc0(t *testing.T) {
// v5, v6 := vtex(`str("t1")`), vtex(`str("t2")`) // v5, v6 := vtex(`str("t1")`), vtex(`str("t2")`)
// //
// graph.AddVertex(&v0, &v1, &v2, &v3, &v4, &v5, &v6) // graph.AddVertex(&v0, &v1, &v2, &v3, &v4, &v5, &v6)
// e1, e2 := edge("x"), edge("x") // e1, e2 := edge("var:x"), edge("var:x")
// graph.AddEdge(&v1, &v3, &e1) // graph.AddEdge(&v1, &v3, &e1)
// graph.AddEdge(&v2, &v4, &e2) // graph.AddEdge(&v2, &v4, &e2)
// //

View File

@@ -1,7 +1,7 @@
Edge: str("hey") -> var(foo) # foo Edge: str("hey") -> var(foo) # var:foo
Edge: str("hey") -> var(foo) # foo Edge: str("hey") -> var(foo) # var:foo
Edge: str("t1") -> var(a) # a Edge: str("t1") -> var(a) # var:a
Edge: str("t2") -> var(a) # a Edge: str("t2") -> var(a) # var:a
Vertex: str("hey") Vertex: str("hey")
Vertex: str("t1") Vertex: str("t1")
Vertex: str("t2") Vertex: str("t2")

View File

@@ -1,4 +1,4 @@
Edge: list(str("hey")) -> var(names) # names Edge: list(str("hey")) -> var(names) # var:names
Edge: str("hello") -> list(str("hello"), str("world")) # 0 Edge: str("hello") -> list(str("hello"), str("world")) # 0
Edge: str("hey") -> list(str("hey")) # 0 Edge: str("hey") -> list(str("hey")) # 0
Edge: str("world") -> list(str("hello"), str("world")) # 1 Edge: str("world") -> list(str("hello"), str("world")) # 1

View File

@@ -1,5 +1,5 @@
Edge: str("hello: %s") -> call:fmt.printf(str("hello: %s"), var(s)) # a Edge: str("hello: %s") -> call:fmt.printf(str("hello: %s"), var(s)) # a
Edge: str("world") -> var(s) # s Edge: str("world") -> var(s) # var:s
Edge: var(s) -> call:fmt.printf(str("hello: %s"), var(s)) # b Edge: var(s) -> call:fmt.printf(str("hello: %s"), var(s)) # b
Vertex: call:fmt.printf(str("hello: %s"), var(s)) Vertex: call:fmt.printf(str("hello: %s"), var(s))
Vertex: str("greeting") Vertex: str("greeting")

View File

@@ -1,5 +1,5 @@
Edge: call:os.is_debian() -> if(call:os.is_debian()) # c Edge: call:os.is_debian() -> if(call:os.is_debian()) # c
Edge: if(call:os.is_debian()) -> var(aaa) # aaa Edge: if(call:os.is_debian()) -> var(aaa) # var:aaa
Edge: str("bbb") -> if(call:os.is_debian()) # a Edge: str("bbb") -> if(call:os.is_debian()) # a
Edge: str("ccc") -> if(call:os.is_debian()) # b Edge: str("ccc") -> if(call:os.is_debian()) # b
Vertex: call:os.is_debian() Vertex: call:os.is_debian()

View File

@@ -1,5 +1,5 @@
Edge: call:os.is_debian() -> if(call:os.is_debian()) # c Edge: call:os.is_debian() -> if(call:os.is_debian()) # c
Edge: if(call:os.is_debian()) -> var(aaa) # aaa Edge: if(call:os.is_debian()) -> var(aaa) # var:aaa
Edge: str("bbb") -> if(call:os.is_debian()) # a Edge: str("bbb") -> if(call:os.is_debian()) # a
Edge: str("ccc") -> if(call:os.is_debian()) # b Edge: str("ccc") -> if(call:os.is_debian()) # b
Vertex: call:os.is_debian() Vertex: call:os.is_debian()

View File

@@ -4,8 +4,8 @@ Edge: bool(true) -> struct(noop: bool(false); retry: int(-1); delay: int(0); pol
Edge: bool(true) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # autogroup Edge: bool(true) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # autogroup
Edge: bool(true) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # realize Edge: bool(true) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # realize
Edge: bool(true) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # reverse Edge: bool(true) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # reverse
Edge: bool(true) -> var(b) # b Edge: bool(true) -> var(b) # var:b
Edge: bool(true) -> var(b) # b Edge: bool(true) -> var(b) # var:b
Edge: float(4.2) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # limit Edge: float(4.2) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # limit
Edge: int(-1) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # retry Edge: int(-1) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # retry
Edge: int(0) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # delay Edge: int(0) -> struct(noop: bool(false); retry: int(-1); delay: int(0); poll: int(5); limit: float(4.2); burst: int(3); sema: list(str("foo:1"), str("bar:3")); rewatch: bool(false); realize: bool(true); reverse: bool(true); autoedge: bool(true); autogroup: bool(true)) # delay

View File

@@ -1,8 +1,8 @@
Edge: call:_operator(str("+"), int(42), var(third.three)) -> var(h2g2.answer) # h2g2.answer Edge: call:_operator(str("+"), int(42), var(third.three)) -> var(h2g2.answer) # var:h2g2.answer
Edge: call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) -> var(example1.name) # example1.name Edge: call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) -> var(example1.name) # var:example1.name
Edge: call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) -> var(example1.name) # example1.name Edge: call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) -> var(example1.name) # var:example1.name
Edge: call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) -> var(mod1.name) # mod1.name Edge: call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) -> var(mod1.name) # var:mod1.name
Edge: int(3) -> var(third.three) # third.three Edge: int(3) -> var(third.three) # var:third.three
Edge: int(42) -> call:_operator(str("+"), int(42), var(third.three)) # a Edge: int(42) -> call:_operator(str("+"), int(42), var(third.three)) # a
Edge: str("+") -> call:_operator(str("+"), int(42), var(third.three)) # x Edge: str("+") -> call:_operator(str("+"), int(42), var(third.three)) # x
Edge: str("+") -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # x Edge: str("+") -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # x
@@ -16,16 +16,16 @@ Edge: str("i imported local: %s") -> call:fmt.printf(str("i imported local: %s")
Edge: str("i imported remote: %s and %s") -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # a Edge: str("i imported remote: %s and %s") -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # a
Edge: str("the answer is: %d") -> call:fmt.printf(str("the answer is: %d"), var(answer)) # a Edge: str("the answer is: %d") -> call:fmt.printf(str("the answer is: %d"), var(answer)) # a
Edge: str("this is module mod1 which contains: ") -> call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) # a Edge: str("this is module mod1 which contains: ") -> call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) # a
Edge: str("this is the nested git module mod1") -> var(mod1.name) # mod1.name Edge: str("this is the nested git module mod1") -> var(mod1.name) # var:mod1.name
Edge: str("this is the nested git module mod1") -> var(mod1.name) # mod1.name Edge: str("this is the nested git module mod1") -> var(mod1.name) # var:mod1.name
Edge: str("this is the nested local module mod1") -> var(mod1.name) # mod1.name Edge: str("this is the nested local module mod1") -> var(mod1.name) # var:mod1.name
Edge: var(answer) -> call:fmt.printf(str("the answer is: %d"), var(answer)) # b Edge: var(answer) -> call:fmt.printf(str("the answer is: %d"), var(answer)) # b
Edge: var(ex1) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example2/ and i contain: "), var(ex1)) # b Edge: var(ex1) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example2/ and i contain: "), var(ex1)) # b
Edge: var(example1.name) -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # b Edge: var(example1.name) -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # b
Edge: var(example1.name) -> var(ex1) # ex1 Edge: var(example1.name) -> var(ex1) # var:ex1
Edge: var(example1.name) -> var(example2.ex1) # example2.ex1 Edge: var(example1.name) -> var(example2.ex1) # var:example2.ex1
Edge: var(example2.ex1) -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # c Edge: var(example2.ex1) -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # c
Edge: var(h2g2.answer) -> var(answer) # answer Edge: var(h2g2.answer) -> var(answer) # var:answer
Edge: var(mod1.name) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # b Edge: var(mod1.name) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # b
Edge: var(mod1.name) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # b Edge: var(mod1.name) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # b
Edge: var(mod1.name) -> call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) # b Edge: var(mod1.name) -> call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) # b

View File

@@ -4,12 +4,12 @@ Edge: int(-37) -> list(int(13), int(42), int(0), int(-37)) # 3
Edge: int(0) -> list(int(13), int(42), int(0), int(-37)) # 2 Edge: int(0) -> list(int(13), int(42), int(0), int(-37)) # 2
Edge: int(13) -> list(int(13), int(42), int(0), int(-37)) # 0 Edge: int(13) -> list(int(13), int(42), int(0), int(-37)) # 0
Edge: int(42) -> list(int(13), int(42), int(0), int(-37)) # 1 Edge: int(42) -> list(int(13), int(42), int(0), int(-37)) # 1
Edge: list(int(13), int(42), int(0), int(-37)) -> var(b) # b Edge: list(int(13), int(42), int(0), int(-37)) -> var(b) # var:b
Edge: str("hello") -> var(b) # b Edge: str("hello") -> var(b) # var:b
Edge: str("len is: %d") -> call:fmt.printf(str("len is: %d"), call:len(var(b))) # a Edge: str("len is: %d") -> call:fmt.printf(str("len is: %d"), call:len(var(b))) # a
Edge: str("len is: %d") -> call:fmt.printf(str("len is: %d"), call:len(var(b))) # a Edge: str("len is: %d") -> call:fmt.printf(str("len is: %d"), call:len(var(b))) # a
Edge: str("t1") -> var(a) # a Edge: str("t1") -> var(a) # var:a
Edge: str("t2") -> var(a) # a Edge: str("t2") -> var(a) # var:a
Edge: var(b) -> call:len(var(b)) # 0 Edge: var(b) -> call:len(var(b)) # 0
Edge: var(b) -> call:len(var(b)) # 0 Edge: var(b) -> call:len(var(b)) # 0
Vertex: call:fmt.printf(str("len is: %d"), call:len(var(b))) Vertex: call:fmt.printf(str("len is: %d"), call:len(var(b)))

View File

@@ -1,8 +1,8 @@
Edge: call:_operator(str("+"), int(42), var(third.three)) -> var(h2g2.answer) # h2g2.answer Edge: call:_operator(str("+"), int(42), var(third.three)) -> var(h2g2.answer) # var:h2g2.answer
Edge: call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) -> var(example1.name) # example1.name Edge: call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) -> var(example1.name) # var:example1.name
Edge: call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) -> var(example1.name) # example1.name Edge: call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) -> var(example1.name) # var:example1.name
Edge: call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) -> var(mod1.name) # mod1.name Edge: call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) -> var(mod1.name) # var:mod1.name
Edge: int(3) -> var(third.three) # third.three Edge: int(3) -> var(third.three) # var:third.three
Edge: int(42) -> call:_operator(str("+"), int(42), var(third.three)) # a Edge: int(42) -> call:_operator(str("+"), int(42), var(third.three)) # a
Edge: str("+") -> call:_operator(str("+"), int(42), var(third.three)) # x Edge: str("+") -> call:_operator(str("+"), int(42), var(third.three)) # x
Edge: str("+") -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # x Edge: str("+") -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # x
@@ -16,16 +16,16 @@ Edge: str("i imported local: %s") -> call:fmt.printf(str("i imported local: %s")
Edge: str("i imported remote: %s and %s") -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # a Edge: str("i imported remote: %s and %s") -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # a
Edge: str("the answer is: %d") -> call:fmt.printf(str("the answer is: %d"), var(answer)) # a Edge: str("the answer is: %d") -> call:fmt.printf(str("the answer is: %d"), var(answer)) # a
Edge: str("this is module mod1 which contains: ") -> call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) # a Edge: str("this is module mod1 which contains: ") -> call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) # a
Edge: str("this is the nested git module mod1") -> var(mod1.name) # mod1.name Edge: str("this is the nested git module mod1") -> var(mod1.name) # var:mod1.name
Edge: str("this is the nested git module mod1") -> var(mod1.name) # mod1.name Edge: str("this is the nested git module mod1") -> var(mod1.name) # var:mod1.name
Edge: str("this is the nested local module mod1") -> var(mod1.name) # mod1.name Edge: str("this is the nested local module mod1") -> var(mod1.name) # var:mod1.name
Edge: var(answer) -> call:fmt.printf(str("the answer is: %d"), var(answer)) # b Edge: var(answer) -> call:fmt.printf(str("the answer is: %d"), var(answer)) # b
Edge: var(ex1) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example2/ and i contain: "), var(ex1)) # b Edge: var(ex1) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example2/ and i contain: "), var(ex1)) # b
Edge: var(example1.name) -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # b Edge: var(example1.name) -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # b
Edge: var(example1.name) -> var(ex1) # ex1 Edge: var(example1.name) -> var(ex1) # var:ex1
Edge: var(example1.name) -> var(example2.ex1) # example2.ex1 Edge: var(example1.name) -> var(example2.ex1) # var:example2.ex1
Edge: var(example2.ex1) -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # c Edge: var(example2.ex1) -> call:fmt.printf(str("i imported remote: %s and %s"), var(example1.name), var(example2.ex1)) # c
Edge: var(h2g2.answer) -> var(answer) # answer Edge: var(h2g2.answer) -> var(answer) # var:answer
Edge: var(mod1.name) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # b Edge: var(mod1.name) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # b
Edge: var(mod1.name) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # b Edge: var(mod1.name) -> call:_operator(str("+"), str("i am github.com/purpleidea/mgmt-example1/ and i contain: "), var(mod1.name)) # b
Edge: var(mod1.name) -> call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) # b Edge: var(mod1.name) -> call:_operator(str("+"), str("this is module mod1 which contains: "), var(mod1.name)) # b

View File

@@ -1,27 +1,27 @@
Edge: call:_operator(str("=="), var(state), str("default")) -> call:_operator(str("||"), call:_operator(str("=="), var(state), str("one")), call:_operator(str("=="), var(state), str("default"))) # b Edge: call:_operator(str("=="), var(state), str("default")) -> call:_operator(str("||"), call:_operator(str("=="), var(state), str("one")), call:_operator(str("=="), var(state), str("default"))) # b
Edge: call:_operator(str("=="), var(state), str("one")) -> call:_operator(str("||"), call:_operator(str("=="), var(state), str("one")), call:_operator(str("=="), var(state), str("default"))) # a Edge: call:_operator(str("=="), var(state), str("one")) -> call:_operator(str("||"), call:_operator(str("=="), var(state), str("one")), call:_operator(str("=="), var(state), str("default"))) # a
Edge: call:maplookup(var(exchanged), var(hostname), str("default")) -> var(state) # state Edge: call:maplookup(var(exchanged), var(hostname), str("default")) -> var(state) # var:state
Edge: call:maplookup(var(exchanged), var(hostname), str("default")) -> var(state) # state Edge: call:maplookup(var(exchanged), var(hostname), str("default")) -> var(state) # var:state
Edge: call:maplookup(var(exchanged), var(hostname), str("default")) -> var(state) # state Edge: call:maplookup(var(exchanged), var(hostname), str("default")) -> var(state) # var:state
Edge: call:maplookup(var(exchanged), var(hostname), str("default")) -> var(state) # state Edge: call:maplookup(var(exchanged), var(hostname), str("default")) -> var(state) # var:state
Edge: call:world.kvlookup(var(ns)) -> var(exchanged) # exchanged Edge: call:world.kvlookup(var(ns)) -> var(exchanged) # var:exchanged
Edge: str("") -> var(hostname) # hostname Edge: str("") -> var(hostname) # var:hostname
Edge: str("==") -> call:_operator(str("=="), var(state), str("default")) # x Edge: str("==") -> call:_operator(str("=="), var(state), str("default")) # x
Edge: str("==") -> call:_operator(str("=="), var(state), str("one")) # x Edge: str("==") -> call:_operator(str("=="), var(state), str("one")) # x
Edge: str("==") -> call:_operator(str("=="), var(state), str("three")) # x Edge: str("==") -> call:_operator(str("=="), var(state), str("three")) # x
Edge: str("==") -> call:_operator(str("=="), var(state), str("two")) # x Edge: str("==") -> call:_operator(str("=="), var(state), str("two")) # x
Edge: str("default") -> call:_operator(str("=="), var(state), str("default")) # b Edge: str("default") -> call:_operator(str("=="), var(state), str("default")) # b
Edge: str("default") -> call:maplookup(var(exchanged), var(hostname), str("default")) # default Edge: str("default") -> call:maplookup(var(exchanged), var(hostname), str("default")) # default
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("estate") -> var(ns) # ns Edge: str("estate") -> var(ns) # var:ns
Edge: str("one") -> call:_operator(str("=="), var(state), str("one")) # b Edge: str("one") -> call:_operator(str("=="), var(state), str("one")) # b
Edge: str("three") -> call:_operator(str("=="), var(state), str("three")) # b Edge: str("three") -> call:_operator(str("=="), var(state), str("three")) # b
Edge: str("two") -> call:_operator(str("=="), var(state), str("two")) # b Edge: str("two") -> call:_operator(str("=="), var(state), str("two")) # b

View File

@@ -5617,7 +5617,7 @@ func (obj *ExprVar) Graph() (*pgraph.Graph, error) {
return nil, err return nil, err
} }
edge := &funcs.Edge{Args: []string{obj.Name}} edge := &funcs.Edge{Args: []string{fmt.Sprintf("var:%s", obj.Name)}}
var once bool var once bool
edgeGenFn := func(v1, v2 pgraph.Vertex) pgraph.Edge { edgeGenFn := func(v1, v2 pgraph.Vertex) pgraph.Edge {
@@ -5671,7 +5671,7 @@ func (obj *ExprVar) Func() (interfaces.Func, error) {
return &structs.VarFunc{ return &structs.VarFunc{
Type: typ, Type: typ,
Func: f, Func: f,
Edge: obj.Name, // the edge name used above in Graph is this... Edge: fmt.Sprintf("var:%s", obj.Name), // the edge name used above in Graph is this...
}, nil }, nil
} }