private static void ValidateSpecificTypes( string methodUsedName, DotMethodTypeEnum type, DotMethodFPParam[] foundParams, DotMethodFPProvidedParam[] @params) { for (int i = 0; i < foundParams.Length; i++) { DotMethodFPParam found = foundParams[i]; DotMethodFPProvidedParam provided = @params[i]; // Lambda-type expressions not validated here if (found.LambdaParamNum > 0) { continue; } EPLValidationUtil.ValidateParameterType( methodUsedName, type.GetTypeName(), false, found.ParamType, found.SpecificType, provided.ReturnType, i, provided.Expression); } }
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); }