Skip to content

Commit

Permalink
Add support for list value nodes (ChilliCream#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Sampson committed May 15, 2019
1 parent bb9d0c6 commit 0d4e164
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/Core/Core/Validation/AllVariablesUsedVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,30 @@ private void VisitArguments(IEnumerable<ArgumentNode> arguments)
{
foreach (ArgumentNode argumentNode in arguments)
{
if (argumentNode.Value is VariableNode v)
{
_usedVariables.Add(v.Value);
}

if (argumentNode.Value is ObjectValueNode o)
{
VisitObjectValue(o);
}
VisitValue(argumentNode.Value);
}
}

private void VisitObjectValue(ObjectValueNode objectNode)
private void VisitValue(IValueNode value)
{
foreach (ObjectFieldNode field in objectNode.Fields)
if (value is VariableNode v)
{
if (field.Value is VariableNode v)
_usedVariables.Add(v.Value);
}

if (value is ObjectValueNode o)
{
foreach(ObjectFieldNode field in o.Fields)
{
_usedVariables.Add(v.Value);
VisitValue(field.Value);
}
}

if (field.Value is ObjectValueNode o)
if (value is ListValueNode l)
{
foreach (IValueNode item in l.Items)
{
VisitObjectValue(o);
VisitValue(item);
}
}
}
Expand Down

0 comments on commit 0d4e164

Please sign in to comment.