protected override void BeforeInsert(FunctionBinding binding) { // TODO: Ensure function does not have VOID return type. // TODO: Ensure function does not have REF or OUT parameter. List <FunctionBinding> functions; if (!_functionTable.TryGetValue(binding.Name, out functions)) { functions = new List <FunctionBinding>(); _functionTable.Add(binding.Name, functions); } else { // Check that no functions with the same parameter types already exists. Type[] newParameterTypes = binding.GetParameterTypes(); foreach (FunctionBinding existingFunctionBinding in functions) { Type[] existingParameterTypes = existingFunctionBinding.GetParameterTypes(); if (newParameterTypes.Length == existingParameterTypes.Length) { // Assume they are the same bool isSame = true; // Check if any parameter type is different. for (int i = 0; i < newParameterTypes.Length; i++) { if (newParameterTypes[i] != existingParameterTypes[i]) { isSame = false; break; } } if (isSame) { throw ExceptionBuilder.FunctionWithSameNameAndSignatureAlreadyInCollection("binding", binding); } } } } functions.Add(binding); }