Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 9174c5b

Browse files
author
Juanjo Alvarez
committed
Reverse op for opJoinNamesArray
Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent b41646a commit 9174c5b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

driver/normalizer/normalizer.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,26 @@ func (op opJoinNamesArray) Kinds() nodes.Kind {
6464
}
6565

6666
func (op opJoinNamesArray) Check(st *State, n nodes.Node) (bool, error) {
67+
// Reverse op: split string into Identifiers, load the QualifiedIdentifer and check it.
68+
s, ok := n.(nodes.String)
69+
if !ok {
70+
return false, ErrExpectedValue.New(n)
71+
}
72+
73+
tokens := strings.Split(string(s), "::")
74+
var qual = uast.QualifiedIdentifier{}
75+
76+
for _, t := range tokens {
77+
//id := Obj(nil)
78+
id := uast.Identifier{Name: t}
79+
qual.Names = append(qual.Names, id)
80+
}
81+
82+
n, err := uast.ToNode(qual)
83+
if err != nil {
84+
return false, err
85+
}
86+
6787
res, err := op.qualified.Check(st, n)
6888
if err != nil || !res {
6989
return false, err

0 commit comments

Comments
 (0)