Example #1
0
        private IAnalysisSet NumericOp(Node node, AnalysisUnit unit, Parsing.PythonOperator operation, IAnalysisSet rhs)
        {
            string methodName = InstanceInfo.BinaryOpToString(operation);

            if (methodName != null)
            {
                var method = GetMember(node, unit, methodName);
                if (method.Count > 0)
                {
                    var res = method.Call(
                        node,
                        unit,
                        new[] { this, rhs },
                        ExpressionEvaluator.EmptyNames
                        );

                    if (res.IsObjectOrUnknown())
                    {
                        // the type defines the operator, assume it returns
                        // some combination of the input types.
                        return(SelfSet.Union(rhs));
                    }

                    return(res);
                }
            }

            return(base.BinaryOperation(node, unit, operation, rhs));
        }
Example #2
0
 public virtual ISet <Namespace> BinaryOperation(Node node, AnalysisUnit unit, PythonOperator operation, ISet <Namespace> rhs)
 {
     switch (operation)
     {
     case PythonOperator.Is:
     case PythonOperator.IsNot:
         return(unit.DeclaringModule.ProjectEntry.ProjectState._boolType.Instance);
     }
     return(SelfSet.Union(rhs));
 }
Example #3
0
 public virtual IAnalysisSet BinaryOperation(BinaryOperator node, AnalysisUnit unit, IAnalysisSet value)
 {
     return(SelfSet.Union(value));
 }