コード例 #1
0
ファイル: LocalTransform.cs プロジェクト: kant2002/infer
 private bool IndicesMatchIndexVars(IList <IExpression> indices, IReadOnlyList <IVariableDeclaration> indexVars)
 {
     for (int dim = 0; dim < indices.Count; dim++)
     {
         IExpression index = indices[dim];
         if (!GetPrefixIndexedByIndexVars(index).Equals(index))
         {
             return(false);
         }
         IVariableDeclaration indexVar = Recognizer.GetVariableDeclaration(index);
         if (indexVar != null && !indexVar.Equals(indexVars[dim]))
         {
             return(false);
         }
     }
     return(true);
 }
コード例 #2
0
 protected bool IsPartitionedExpr(IExpression expr)
 {
     return Recognizer.GetVariables(expr).Any(ivd =>
     {
         Containers c = context.InputAttributes.Get<Containers>(ivd);
         foreach (IStatement container in c.inputs)
         {
             if (container is IForStatement loop)
             {
                 IVariableDeclaration loopVar = Recognizer.LoopVariable(loop);
                 bool isPartitionedLoop = context.InputAttributes.Has<Partitioned>(loopVar);
                 if (isPartitionedLoop && loopVar.Equals(ivd)) return true;
             }
         }
         return false;
     });
 }
コード例 #3
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }

            IVariableReference reference = obj as IVariableReference;

            if (reference == null)
            {
                return(false);
            }

            IVariableDeclaration declThis = this.Resolve();
            IVariableDeclaration declThat = reference.Resolve();

            if (declThis == null || declThat == null)
            {
                return(false);
            }

            return(declThis.Equals(declThat));
        }