Beispiel #1
0
        private void PassProblem(Expression problemSource, ProblemMetadata problemMetadata)
        {
            string   variableName;
            Fragment expectedFragment = problemMetadata.ExpectedFragment;

            if (ExpressionIsVariableFromPrecedingBlock(problemSource, out variableName))
            {
                _preConditions.Add(new AssignabilityPreCondition(variableName, expectedFragment, problemMetadata));
            }
            else if (problemSource is MethodCall)
            {
                MethodCall methodCall   = (MethodCall)problemSource;
                Method     calleeMethod = IntrospectionUtility.ExtractMethod(methodCall);

                if (_customInferenceController.Analyzes(calleeMethod))
                {
                    _customInferenceController.PassProblem(methodCall, _preConditions, problemMetadata, _symbolTable, _problemPipe);
                }
                else
                {
                    _problemPipe.AddProblem(problemMetadata);
                }
            }
            else
            {
                _problemPipe.AddProblem(problemMetadata);
            }
        }
        private void HandleFragmentConflict(ISymbolTable context, IProblemPipe problemPipe)
        {
            if (ProblemMetadata != null)
            problemPipe.AddProblem (_problemMetadata);

              context.MakeUnsafe (_symbol);
        }
 public virtual void HandleViolation(ISymbolTable context, IProblemPipe problemPipe)
 {
     if (_problemMetadata != null)
       {
     problemPipe.AddProblem (_problemMetadata);
       }
 }
 public virtual void HandleViolation(ISymbolTable context, IProblemPipe problemPipe)
 {
     if (_problemMetadata != null)
     {
         problemPipe.AddProblem(_problemMetadata);
     }
 }
Beispiel #5
0
 public void AddProblem(ProblemMetadata problemMetadata)
 {
     if (!_filteredIds.Contains(problemMetadata.SourceExpressionId))
     {
         _filteredIds.Add(problemMetadata.SourceExpressionId);
         _problemDestination.AddProblem(problemMetadata);
     }
 }
        private void HandleFragmentConflict(ISymbolTable context, IProblemPipe problemPipe)
        {
            if (ProblemMetadata != null)
            {
                problemPipe.AddProblem(_problemMetadata);
            }

            context.MakeUnsafe(_symbol);
        }
        public void AddProblem_MultipleProblemMetadataObjectsWithDifferentSourceExpressionIds_PassesObjects_()
        {
            ProblemMetadata problem1 = new ProblemMetadata(c_sourceExpressionId1, new SourceContext(), Fragment.CreateNamed("dummy"), Fragment.CreateNamed("dummy"));
            ProblemMetadata problem2 = new ProblemMetadata(c_sourceExpressionId2, new SourceContext(), Fragment.CreateNamed("dummy"), Fragment.CreateNamed("dummy"));

            using (_mocks.Record())
            {
                _problemDestination.AddProblem(problem1);
                _problemDestination.AddProblem(problem2);
            }

            var problemDuplicateFilter = new ProblemDuplicateFilter(_problemDestination);

            problemDuplicateFilter.AddProblem(problem1);
            problemDuplicateFilter.AddProblem(problem2);

            _mocks.Verify(_problemDestination);
        }
        public void PassProblem(
            MethodCall methodCall, List <IPreCondition> preConditions, ProblemMetadata problemMetadata, ISymbolTable symbolTable, IProblemPipe problemPipe)
        {
            Method calleeMethod = IntrospectionUtility.ExtractMethod(methodCall);

            if (_coveredMethods.Contains(calleeMethod.FullName))
            {
                foreach (var operand in methodCall.Operands)
                {
                    string nestedVariableName;
                    if (OperandIsVariableFromPrecedingBlock(operand, symbolTable, out nestedVariableName))
                    {
                        preConditions.Add(new AssignabilityPreCondition(nestedVariableName, problemMetadata.ExpectedFragment, problemMetadata));
                    }
                    else
                    {
                        problemPipe.AddProblem(problemMetadata);
                    }
                }
            }
        }
 public void PassProblem(
 MethodCall methodCall, List<IPreCondition> preConditions, ProblemMetadata problemMetadata, ISymbolTable symbolTable, IProblemPipe problemPipe)
 {
     Method calleeMethod = IntrospectionUtility.ExtractMethod (methodCall);
       if(_coveredMethods.Contains(calleeMethod.FullName))
       {
     foreach (var operand in methodCall.Operands)
     {
       string nestedVariableName;
       if (OperandIsVariableFromPrecedingBlock (operand, symbolTable, out nestedVariableName))
       {
     preConditions.Add (new AssignabilityPreCondition (nestedVariableName, problemMetadata.ExpectedFragment, problemMetadata));
       }
       else
       {
     problemPipe.AddProblem (problemMetadata);
       }
     }
       }
 }