public void SetUp() { _blacklist = new IDbCommandBlacklistManagerStub(); _problemPipeStub = new ProblemPipeStub(); _returnPreCondition = new ReturnCondition("returnPreCondition", Fragment.CreateNamed("ReturnPreConditionFragmentType")); List <ReturnCondition> returnPreConditions = new List <ReturnCondition> { _returnPreCondition }; _blockParser = new BlockParser(_blacklist, _problemPipeStub, c_returnFragmentType, returnPreConditions); }
private List <ReturnCondition> ReferenceAndOutConditions(Method method) { List <ReturnCondition> referenceAndOutConditions = new List <ReturnCondition>(); foreach (var parameter in method.Parameters) { if (parameter.Type is Reference && parameter.Attributes != null) { Fragment parameterFragmentType = FragmentUtility.GetFragmentType(parameter.Attributes); if (parameterFragmentType != null) { string parameterName = IntrospectionUtility.GetVariableName(parameter); ReturnCondition returnCondition = new ReturnCondition(parameterName, parameterFragmentType); referenceAndOutConditions.Add(returnCondition); } } } return(referenceAndOutConditions); }
private void ProcessBlockInternalPreConditionViolation( ReturnNode returnNode, ReturnCondition returnCondition, Fragment blockInternalFragmentType, HandleContext context) { ProblemMetadata problemMetadata = new ProblemMetadata( returnNode.UniqueKey, returnNode.SourceContext, returnCondition.Fragment, blockInternalFragmentType); returnCondition.ProblemMetadata = problemMetadata; if (!context.AssignmentTargetVariables.Contains(returnCondition.Symbol)) { context.PreConditions.Add(returnCondition); } else { _blockParserContext.ProblemPipe.AddProblem(problemMetadata); } }