private static int ExtendArrayHelper(Variable parent, Variable indexVar) { parent.SetAsArray(); int arrayIndex = parent.GetArrayIndex(indexVar); if (arrayIndex < 0) { // This is not a "normal index" but a new string for the dictionary. string hash = indexVar.AsString(); arrayIndex = parent.SetHashVariable(hash, Variable.NewEmpty()); return(arrayIndex); } if (parent.Tuple.Count <= arrayIndex) { for (int i = parent.Tuple.Count; i <= arrayIndex; i++) { parent.Tuple.Add(Variable.NewEmpty()); } } return(arrayIndex); }