void FindVariables(object obj, List <LogicVariable> singletons)
        {
            if (obj == null)
            {
                return;
            }
            var v = obj as LogicVariable;

            if (v != null)
            {
                bool inSingletons = singletons.Contains(v);

                if (FreeVariables.Contains(v))
                {
                    if (inSingletons)
                    {
                        singletons.Remove(v);
                    }
                }
                else
                {
                    FreeVariables.Add(v);
                    if (!v.Name.Name.StartsWith("_"))
                    {
                        singletons.Add(v);
                    }
                }
            }
            else
            {
                var t = obj as Structure;
                if (t != null)
                {
                    foreach (var a in t.Arguments)
                    {
                        FindVariables(a, singletons);
                    }
                }
            }
        }
예제 #2
0
 internal bool IsFreeVariable(PythonVariable variable)
 {
     return(FreeVariables?.Contains(variable?.LimitVariable) ?? false);
 }