// <summary> // Declares inline function in the query local metadata. // </summary> internal void DeclareInlineFunction(string name, InlineFunctionInfo functionInfo) { DebugCheck.NotEmpty(name); DebugCheck.NotNull(functionInfo); List <InlineFunctionInfo> overloads; if (!_functionDefinitions.TryGetValue(name, out overloads)) { overloads = new List <InlineFunctionInfo>(); _functionDefinitions.Add(name, overloads); } // // Check overload uniqueness. // if (overloads.Exists( overload => overload.Parameters.Select(p => p.ResultType).SequenceEqual( functionInfo.Parameters.Select(p => p.ResultType), TypeUsageStructuralComparer.Instance))) { var errCtx = functionInfo.FunctionDefAst.ErrCtx; var message = Strings.DuplicatedInlineFunctionOverload(name); throw EntitySqlException.Create(errCtx, message, null); } overloads.Add(functionInfo); }
internal void DeclareInlineFunction(string name, InlineFunctionInfo functionInfo) { List <InlineFunctionInfo> inlineFunctionInfoList; if (!this._functionDefinitions.TryGetValue(name, out inlineFunctionInfoList)) { inlineFunctionInfoList = new List <InlineFunctionInfo>(); this._functionDefinitions.Add(name, inlineFunctionInfoList); } if (inlineFunctionInfoList.Exists((Predicate <InlineFunctionInfo>)(overload => overload.Parameters.Select <DbVariableReferenceExpression, TypeUsage>((Func <DbVariableReferenceExpression, TypeUsage>)(p => p.ResultType)).SequenceEqual <TypeUsage>(functionInfo.Parameters.Select <DbVariableReferenceExpression, TypeUsage>((Func <DbVariableReferenceExpression, TypeUsage>)(p => p.ResultType)), (IEqualityComparer <TypeUsage>)TypeResolver.TypeUsageStructuralComparer.Instance)))) { throw EntitySqlException.Create(functionInfo.FunctionDefAst.ErrCtx, Strings.DuplicatedInlineFunctionOverload((object)name), (Exception)null); } inlineFunctionInfoList.Add(functionInfo); }