private ExprDotEvalParam GetBodyAndParameter( String enumMethodUsedName, int parameterNum, ExprNode parameterNode, EventType inputEventType, Type collectionComponentType, ExprValidationContext validationContext, IList <ExprDotEvalParam> priorParameters, DotMethodFP footprint) { // handle an expression that is a constant or other (not =>) if (!(parameterNode is ExprLambdaGoesNode)) { // no node subtree validation is required here, the chain parameter validation has taken place in ExprDotNode.validate // validation of parameter types has taken place in footprint matching return(new ExprDotEvalParamExpr(parameterNum, parameterNode, parameterNode.ExprEvaluator)); } var goesNode = (ExprLambdaGoesNode)parameterNode; // Get secondary var additionalTypes = GetAddStreamTypes( enumMethodUsedName, goesNode.GoesToNames, inputEventType, collectionComponentType, priorParameters, validationContext.EventAdapterService); var additionalStreamNames = goesNode.GoesToNames.ToArray(); ValidateDuplicateStreamNames(validationContext.StreamTypeService.StreamNames, additionalStreamNames); // add name and type to list of known types var addTypes = (EventType[]) CollectionUtil.ArrayExpandAddElements( validationContext.StreamTypeService.EventTypes, additionalTypes); var addNames = (String[]) CollectionUtil.ArrayExpandAddElements( validationContext.StreamTypeService.StreamNames, additionalStreamNames); var types = new StreamTypeServiceImpl( addTypes, addNames, new bool[addTypes.Length], null, false); // validate expression body var filter = goesNode.ChildNodes[0]; try { var filterValidationContext = new ExprValidationContext(types, validationContext); filter = ExprNodeUtility.GetValidatedSubtree(ExprNodeOrigin.DECLAREDEXPRBODY, filter, filterValidationContext); } catch (ExprValidationException ex) { throw new ExprValidationException( "Error validating enumeration method '" + enumMethodUsedName + "' parameter " + parameterNum + ": " + ex.Message, ex); } var filterEvaluator = filter.ExprEvaluator; var expectedType = footprint.Parameters[parameterNum].ParamType; // Lambda-methods don't use a specific expected return-type, so passing null for type is fine. DotMethodUtil.ValidateSpecificType( enumMethodUsedName, DotMethodTypeEnum.ENUM, expectedType, null, filterEvaluator.ReturnType, parameterNum, filter); var numStreamsIncoming = validationContext.StreamTypeService.EventTypes.Length; return(new ExprDotEvalParamLambda( parameterNum, filter, filterEvaluator, numStreamsIncoming, goesNode.GoesToNames, additionalTypes)); }
public virtual void AddChildNodes(ICollection<ExprNode> childNodeColl) { ChildNodes = (ExprNode[]) CollectionUtil.ArrayExpandAddElements(ChildNodes, childNodeColl); }
public virtual void AddChildNodeToFront(ExprNode childNode) { _childNodes = (ExprNode[])CollectionUtil.ArrayExpandAddElements(new ExprNode[] { childNode }, _childNodes); }
public void AddChildNodeToFront(ExprNode childNode) { ChildNodes = CollectionUtil.ArrayExpandAddElements<ExprNode>(new[] {childNode}, ChildNodes); }
private ExprDotEvalParam GetBodyAndParameter( EnumForgeDescFactory forgeDescFactory, string enumMethodUsedName, int parameterNum, ExprNode parameterNode, ExprValidationContext validationContext, DotMethodFP footprint) { // handle an expression that is a constant or other (not =>) if (!(parameterNode is ExprLambdaGoesNode)) { // no node subtree validation is required here, the chain parameter validation has taken place in ExprDotNode.validate // validation of parameter types has taken place in footprint matching return new ExprDotEvalParamExpr(parameterNum, parameterNode, parameterNode.Forge); } var goesNode = (ExprLambdaGoesNode) parameterNode; // Get secondary var lambdaDesc = forgeDescFactory.GetLambdaStreamTypesForParameter(parameterNum); string[] additionalStreamNames = lambdaDesc.StreamNames; var additionalEventTypes = lambdaDesc.Types; ValidateDuplicateStreamNames(validationContext.StreamTypeService.StreamNames, goesNode.GoesToNames); // add name and type to list of known types var addTypes = CollectionUtil.ArrayExpandAddElements<EventType>( validationContext.StreamTypeService.EventTypes, additionalEventTypes); var addNames = CollectionUtil.ArrayExpandAddElements<string>( validationContext.StreamTypeService.StreamNames, additionalStreamNames); var types = new StreamTypeServiceImpl( addTypes, addNames, new bool[addTypes.Length], false, validationContext.StreamTypeService.IsOptionalStreams); // validate expression body var filter = goesNode.ChildNodes[0]; try { var filterValidationContext = new ExprValidationContext(types, validationContext); filter = ExprNodeUtilityValidate.GetValidatedSubtree(ExprNodeOrigin.DECLAREDEXPRBODY, filter, filterValidationContext); } catch (ExprValidationException ex) { throw new ExprValidationException( "Failed to validate enumeration method '" + enumMethodUsedName + "' parameter " + parameterNum + ": " + ex.Message, ex); } var filterForge = filter.Forge; var expectedType = footprint.Parameters[parameterNum].ParamType; // Lambda-methods don't use a specific expected return-type, so passing null for type is fine. EPLValidationUtil.ValidateParameterType( enumMethodUsedName, DotMethodTypeEnum.ENUM.GetTypeName(), false, expectedType, null, filterForge.EvaluationType, parameterNum, filter); var numStreamsIncoming = validationContext.StreamTypeService.EventTypes.Length; return new ExprDotEvalParamLambda( parameterNum, filter, filterForge, numStreamsIncoming, goesNode.GoesToNames, lambdaDesc); }