@@ -23,7 +23,7 @@ func subtractOperator(d *dataTreeNavigator, context Context, expressionNode *Exp
2323 return crossFunction (d , context .ReadOnlyClone (), expressionNode , subtract , false )
2424}
2525
26- func subtractArray (lhs * CandidateNode , rhs * CandidateNode ) ( * CandidateNode , error ) {
26+ func subtractArray (lhs * CandidateNode , rhs * CandidateNode ) [] * CandidateNode {
2727 newLHSArray := make ([]* CandidateNode , 0 )
2828
2929 for lindex := 0 ; lindex < len (lhs .Content ); lindex = lindex + 1 {
@@ -37,9 +37,7 @@ func subtractArray(lhs *CandidateNode, rhs *CandidateNode) (*CandidateNode, erro
3737 newLHSArray = append (newLHSArray , lhs .Content [lindex ])
3838 }
3939 }
40- // removing children from LHS, parent hasn't changed
41- lhs .Content = newLHSArray
42- return lhs , nil
40+ return newLHSArray
4341}
4442
4543func subtract (_ * dataTreeNavigator , context Context , lhs * CandidateNode , rhs * CandidateNode ) (* CandidateNode , error ) {
@@ -56,7 +54,7 @@ func subtract(_ *dataTreeNavigator, context Context, lhs *CandidateNode, rhs *Ca
5654 if rhs .Kind != SequenceNode {
5755 return nil , fmt .Errorf ("%v (%v) cannot be subtracted from %v" , rhs .Tag , rhs .GetNicePath (), lhs .Tag )
5856 }
59- return subtractArray (lhs , rhs )
57+ target . Content = subtractArray (lhs , rhs )
6058 case ScalarNode :
6159 if rhs .Kind != ScalarNode {
6260 return nil , fmt .Errorf ("%v (%v) cannot be subtracted from %v" , rhs .Tag , rhs .GetNicePath (), lhs .Tag )
0 commit comments