private IEnumerable <IEntityDeclaration> GetSupertypes(IEntityDeclaration entityDeclaration) { var result = new HashSet <IEntityDeclaration>(); void visit(IEntityDeclaration entity) { foreach (var supertypeRef in entity.Supertypes) { var supertype = ResolveEntity(supertypeRef.EntityName); if (supertype == null) { throw new NotImplementedException(); } if (result.Add(supertype)) { visit(supertype); } } } visit(entityDeclaration); return(result); }
private static bool TupleTypeConformToTupleType(ITupleType derivedType, ITupleType baseType, IErrorList errorList, ISource sourceLocation) { bool Result = true; if (derivedType.EntityDeclarationList.Count < baseType.EntityDeclarationList.Count) { errorList.AddError(new ErrorFieldMismatchConformance(sourceLocation, derivedType, baseType)); Result = false; } for (int i = 0; i < derivedType.EntityDeclarationList.Count && i < baseType.EntityDeclarationList.Count; i++) { IEntityDeclaration BaseField = baseType.EntityDeclarationList[i]; IEntityDeclaration DerivedField = derivedType.EntityDeclarationList[i]; Debug.Assert(DerivedField.ValidEntity.IsAssigned); Debug.Assert(DerivedField.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Debug.Assert(BaseField.ValidEntity.IsAssigned); Debug.Assert(BaseField.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Result = TypeConformToBase(DerivedField.ValidEntity.Item.ResolvedEffectiveType.Item, BaseField.ValidEntity.Item.ResolvedEffectiveType.Item, errorList, sourceLocation, isConversionAllowed: false); } return(Result); }
private static bool QueryOverloadHasPropertyConformingBase(IQueryOverloadType derivedOverload, IPropertyType baseType, IErrorList errorList, ISource sourceLocation) { bool Result = true; if (derivedOverload.ParameterList.Count > 0 || derivedOverload.ResultList.Count != 1 || derivedOverload.ParameterEnd != BaseNode.ParameterEndStatus.Closed) { errorList.AddError(new ErrorOverloadParameterMismatchConformance(sourceLocation, derivedOverload, baseType)); Result = false; } if (derivedOverload.ResultList.Count == 1) { IEntityDeclaration OverloadResult = derivedOverload.ResultList[0]; Debug.Assert(baseType.ResolvedEntityType.IsAssigned); Debug.Assert(OverloadResult.ValidEntity.IsAssigned); Debug.Assert(OverloadResult.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Result &= TypeConformToBase(baseType.ResolvedEntityType.Item, OverloadResult.ValidEntity.Item.ResolvedEffectiveType.Item, errorList, sourceLocation, isConversionAllowed: false); } Result &= ExceptionListConformToBase(derivedOverload.ExceptionIdentifierList, baseType.GetExceptionIdentifierList, errorList, sourceLocation); return(Result); }
private static bool ProcedureTypeConformToIndexerTypeOverloads(ICommandOverloadType derivedOverload, IIndexerType baseType, IErrorList errorList, ISource sourceLocation) { bool Result = true; Result &= derivedOverload.ParameterList.Count == baseType.IndexParameterList.Count + 1 && derivedOverload.ParameterEnd == BaseNode.ParameterEndStatus.Closed; for (int i = 0; i + 1 < derivedOverload.ParameterList.Count && i < baseType.IndexParameterList.Count; i++) { IEntityDeclaration BaseParameter = baseType.IndexParameterList[i]; IEntityDeclaration DerivedParameter = derivedOverload.ParameterList[i]; Debug.Assert(DerivedParameter.ValidEntity.IsAssigned); Debug.Assert(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Debug.Assert(BaseParameter.ValidEntity.IsAssigned); Debug.Assert(BaseParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Result &= TypeConformToBase(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.Item, BaseParameter.ValidEntity.Item.ResolvedEffectiveType.Item, errorList, sourceLocation, isConversionAllowed: false); } if (derivedOverload.ParameterList.Count == baseType.IndexParameterList.Count + 1) { IEntityDeclaration OverloadValue = derivedOverload.ParameterList[baseType.IndexParameterList.Count]; Debug.Assert(OverloadValue.ValidEntity.IsAssigned); Debug.Assert(OverloadValue.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Debug.Assert(baseType.ResolvedEntityType.IsAssigned); Result &= TypeConformToBase(OverloadValue.ValidEntity.Item.ResolvedEffectiveType.Item, baseType.ResolvedEntityType.Item, ErrorList.Ignored, ErrorList.NoLocation, isConversionAllowed: false); Result &= ExceptionListConformToBase(derivedOverload.ExceptionIdentifierList, baseType.SetExceptionIdentifierList, errorList, sourceLocation); } return(Result); }
/// <summary> /// Checks that a command overload conforms to another. /// </summary> /// <param name="derivedType">The derived type.</param> /// <param name="baseType">The base type.</param> /// <param name="errorList">The list of errors found.</param> /// <param name="sourceLocation">The location for reporting errors.</param> public static bool CommandOverloadConformToBase(ICommandOverloadType derivedType, ICommandOverloadType baseType, IErrorList errorList, ISource sourceLocation) { bool Result = true; if (baseType.ParameterList.Count != derivedType.ParameterList.Count || baseType.ParameterEnd != derivedType.ParameterEnd) { errorList.AddError(new ErrorParameterMismatchConformance(sourceLocation, derivedType, baseType)); Result = false; } for (int i = 0; i < baseType.ParameterList.Count && i < derivedType.ParameterList.Count; i++) { IEntityDeclaration BaseParameter = baseType.ParameterList[i]; IEntityDeclaration DerivedParameter = derivedType.ParameterList[i]; Debug.Assert(DerivedParameter.ValidEntity.IsAssigned); Debug.Assert(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Debug.Assert(BaseParameter.ValidEntity.IsAssigned); Debug.Assert(BaseParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Result &= TypeConformToBase(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.Item, BaseParameter.ValidEntity.Item.ResolvedEffectiveType.Item, errorList, sourceLocation, isConversionAllowed: false); } Result &= ExceptionListConformToBase(derivedType.ExceptionIdentifierList, baseType.ExceptionIdentifierList, errorList, sourceLocation); return(Result); }
/// <summary> /// Checks for errors before applying a rule. /// </summary> /// <param name="node">The node instance to check.</param> /// <param name="dataList">Optional data collected during inspection of sources.</param> /// <param name="data">Private data to give to Apply() upon return.</param> /// <returns>True if an error occured.</returns> public override bool CheckConsistency(IOverLoopInstruction node, IDictionary <ISourceTemplate, object> dataList, out object data) { data = null; bool Success = true; IExpression OverList = (IExpression)node.OverList; IResultType OverTypeList = OverList.ResolvedResult.Item; IScope LoopInstructions = (IScope)node.LoopInstructions; IClass EmbeddingClass = node.EmbeddingClass; bool IsOverLoopSourceTypeAvailable = Expression.IsLanguageTypeAvailable(LanguageClasses.OverLoopSource.Guid, node, out ITypeName OverLoopSourceTypeName, out ICompiledType OverLoopSourceType); bool IsNumberTypeAvailable = Expression.IsLanguageTypeAvailable(LanguageClasses.Number.Guid, node, out ITypeName NumberTypeName, out ICompiledType NumberType); foreach (IExpressionType Item in OverTypeList) { ICompiledType ResultType = Item.ValueType; IErrorList OverSourceErrorList = new ErrorList(); bool IsConformantToEnumerable = false; bool IsConformantToNumericIndexer = false; if (IsOverLoopSourceTypeAvailable && ObjectType.TypeConformToBase(ResultType, OverLoopSourceType, isConversionAllowed: true)) { IsConformantToEnumerable = true; } if (IsNumberTypeAvailable && ResultType.FeatureTable.ContainsKey(FeatureName.IndexerFeatureName)) { IFeatureInstance IndexerInstance = ResultType.FeatureTable[FeatureName.IndexerFeatureName]; IIndexerFeature IndexerFeature = IndexerInstance.Feature as IIndexerFeature; Debug.Assert(IndexerFeature != null); if (IndexerFeature.IndexParameterList.Count == 1) { IEntityDeclaration IndexParameterDeclaration = IndexerFeature.IndexParameterList[0]; if (IndexParameterDeclaration.ValidEntity.Item.ResolvedEffectiveType.Item == NumberType) { IsConformantToNumericIndexer = true; } } } Debug.Assert(IsConformantToEnumerable != IsConformantToNumericIndexer); } IResultException ResolvedException = new ResultException(); ResultException.Merge(ResolvedException, OverList.ResolvedException.Item); ResultException.Merge(ResolvedException, LoopInstructions.ResolvedException.Item); foreach (IAssertion Item in node.InvariantList) { ResultException.Merge(ResolvedException, Item.ResolvedException.Item); } data = ResolvedException; return(Success); }
private static bool IndexerTypeConformToProcedureType(IIndexerType derivedType, IProcedureType baseType, IErrorList errorList, ISource sourceLocation) { bool Result = true; Debug.Assert(derivedType.ResolvedBaseType.IsAssigned); Debug.Assert(baseType.ResolvedBaseType.IsAssigned); Result &= TypeConformToBase(derivedType.ResolvedBaseType.Item, baseType.ResolvedBaseType.Item, errorList, sourceLocation, isConversionAllowed: false); if (derivedType.IndexerKind == BaseNode.UtilityType.ReadOnly) { errorList.AddError(new ErrorTypeKindConformance(sourceLocation, derivedType, baseType)); Result = false; } if (baseType.OverloadList.Count > 1) { errorList.AddError(new ErrorTypeKindConformance(sourceLocation, derivedType, baseType)); Result = false; } ICommandOverloadType SingleOverload = baseType.OverloadList[0]; if (SingleOverload.ParameterList.Count != derivedType.IndexParameterList.Count + 1 || SingleOverload.ParameterEnd != BaseNode.ParameterEndStatus.Closed) { errorList.AddError(new ErrorTypeKindConformance(sourceLocation, derivedType, baseType)); Result = false; } for (int i = 0; i + 1 < SingleOverload.ParameterList.Count && i < derivedType.IndexParameterList.Count; i++) { IEntityDeclaration BaseParameter = SingleOverload.ParameterList[i]; IEntityDeclaration DerivedParameter = derivedType.IndexParameterList[i]; Debug.Assert(BaseParameter.ValidEntity.IsAssigned); Debug.Assert(BaseParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Debug.Assert(DerivedParameter.ValidEntity.IsAssigned); Debug.Assert(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Result &= TypeConformToBase(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.Item, BaseParameter.ValidEntity.Item.ResolvedEffectiveType.Item, errorList, sourceLocation, isConversionAllowed: false); } if (SingleOverload.ParameterList.Count == derivedType.IndexParameterList.Count + 1) { Debug.Assert(derivedType.ResolvedEntityType.IsAssigned); IEntityDeclaration LastParameter = SingleOverload.ParameterList[derivedType.IndexParameterList.Count]; Debug.Assert(LastParameter.ValidEntity.IsAssigned); Debug.Assert(LastParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Result &= TypeConformToBase(derivedType.ResolvedEntityType.Item, LastParameter.ValidEntity.Item.ResolvedEffectiveType.Item, errorList, sourceLocation, isConversionAllowed: false); } Result &= ExceptionListConformToBase(derivedType.SetExceptionIdentifierList, SingleOverload.ExceptionIdentifierList, errorList, sourceLocation); return(Result); }
/// <summary> /// Initializes a new instance of the <see cref="EntityDeclaration"/> class. /// </summary> /// <param name="source">The source object.</param> /// <param name="resolvedTypeName">The resolved entity type name.</param> /// <param name="resolvedType">The resolved entity type.</param> public EntityDeclaration(IEntityDeclaration source, ITypeName resolvedTypeName, ICompiledType resolvedType) { Documentation = source.Documentation; EntityName = source.EntityName; EntityType = source.EntityType; DefaultValue = source.DefaultValue; ResolvedEntityTypeName.Item = resolvedTypeName; ResolvedEntityType.Item = resolvedType; }
private static bool IndexerTypeConformToIndexerType(IIndexerType derivedType, IIndexerType baseType, IErrorList errorList, ISource sourceLocation) { bool Result = true; Debug.Assert(derivedType.ResolvedBaseType.IsAssigned); Debug.Assert(baseType.ResolvedBaseType.IsAssigned); Result &= TypeConformToBase(derivedType.ResolvedBaseType.Item, baseType.ResolvedBaseType.Item, errorList, sourceLocation, isConversionAllowed: false); if ((baseType.IndexerKind == BaseNode.UtilityType.ReadOnly && derivedType.IndexerKind == BaseNode.UtilityType.WriteOnly) || (baseType.IndexerKind == BaseNode.UtilityType.WriteOnly && derivedType.IndexerKind == BaseNode.UtilityType.ReadOnly) || (baseType.IndexerKind == BaseNode.UtilityType.ReadWrite && derivedType.IndexerKind != BaseNode.UtilityType.ReadWrite)) { errorList.AddError(new ErrorGetterSetterConformance(sourceLocation, derivedType, baseType)); Result = false; } if (derivedType.IndexParameterList.Count != baseType.IndexParameterList.Count || derivedType.ParameterEnd != baseType.ParameterEnd) { errorList.AddError(new ErrorParameterMismatchConformance(sourceLocation, derivedType, baseType)); Result = false; } for (int i = 0; i < baseType.IndexParameterList.Count && i < derivedType.IndexParameterList.Count; i++) { IEntityDeclaration BaseParameter = baseType.IndexParameterList[i]; IEntityDeclaration DerivedParameter = derivedType.IndexParameterList[i]; Debug.Assert(DerivedParameter.ValidEntity.IsAssigned); Debug.Assert(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Debug.Assert(BaseParameter.ValidEntity.IsAssigned); Debug.Assert(BaseParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Result &= TypeConformToBase(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.Item, BaseParameter.ValidEntity.Item.ResolvedEffectiveType.Item, errorList, sourceLocation, isConversionAllowed: false); } Debug.Assert(derivedType.ResolvedEntityType.IsAssigned); Debug.Assert(baseType.ResolvedEntityType.IsAssigned); Result &= TypeConformToBase(derivedType.ResolvedEntityType.Item, baseType.ResolvedEntityType.Item, errorList, sourceLocation, isConversionAllowed: false); /* * if (!TypesHaveIdenticalSignature(derivedType.ResolvedEntityType.Item, baseType.ResolvedEntityType.Item)) * { * //errorList.Add(new ConformanceError(sourceLocation)); * return false; * } */ Result &= ExceptionListConformToBase(derivedType.GetExceptionIdentifierList, baseType.GetExceptionIdentifierList, errorList, sourceLocation); Result &= ExceptionListConformToBase(derivedType.SetExceptionIdentifierList, baseType.SetExceptionIdentifierList, errorList, sourceLocation); return(Result); }
private static bool IndexerTypeConformToFunctionType(IIndexerType derivedType, IFunctionType baseType, IErrorList errorList, ISource sourceLocation) { bool Result = true; Debug.Assert(derivedType.ResolvedBaseType.IsAssigned); Debug.Assert(baseType.ResolvedBaseType.IsAssigned); Result &= TypeConformToBase(derivedType.ResolvedBaseType.Item, baseType.ResolvedBaseType.Item, errorList, sourceLocation, isConversionAllowed: false); if (derivedType.IndexerKind == BaseNode.UtilityType.WriteOnly) { errorList.AddError(new ErrorTypeKindConformance(sourceLocation, derivedType, baseType)); Result = false; } if (baseType.OverloadList.Count > 1) { errorList.AddError(new ErrorTypeKindConformance(sourceLocation, derivedType, baseType)); Result = false; } IQueryOverloadType SingleOverload = baseType.OverloadList[0]; if (SingleOverload.ParameterList.Count != derivedType.IndexParameterList.Count || SingleOverload.ResultList.Count != 1 || SingleOverload.ParameterEnd != derivedType.ParameterEnd) { errorList.AddError(new ErrorTypeKindConformance(sourceLocation, derivedType, baseType)); Result = false; } for (int i = 0; i < SingleOverload.ParameterList.Count && i < derivedType.IndexParameterList.Count; i++) { IEntityDeclaration BaseParameter = SingleOverload.ParameterList[i]; IEntityDeclaration DerivedParameter = derivedType.IndexParameterList[i]; Debug.Assert(DerivedParameter.ValidEntity.IsAssigned); Debug.Assert(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Debug.Assert(BaseParameter.ValidEntity.IsAssigned); Debug.Assert(BaseParameter.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Result &= TypeConformToBase(DerivedParameter.ValidEntity.Item.ResolvedEffectiveType.Item, BaseParameter.ValidEntity.Item.ResolvedEffectiveType.Item, errorList, sourceLocation, isConversionAllowed: false); } IEntityDeclaration OverloadResult = SingleOverload.ResultList[0]; Debug.Assert(OverloadResult.ValidEntity.IsAssigned); Debug.Assert(OverloadResult.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Debug.Assert(derivedType.ResolvedEntityType.IsAssigned); Result &= TypeConformToBase(OverloadResult.ValidEntity.Item.ResolvedEffectiveType.Item, derivedType.ResolvedEntityType.Item, errorList, sourceLocation, isConversionAllowed: false); Result &= ExceptionListConformToBase(derivedType.GetExceptionIdentifierList, SingleOverload.ExceptionIdentifierList, errorList, sourceLocation); return(Result); }
public Scope CreateChildScope(IEntityDeclaration entity) { //TODO: Constant SELF var builder = DeclaredIdentifiers.ToBuilder(); //TODO: renaming foreach (var attribute in GetAttributesWithInherited(entity)) { builder[attribute.Name] = attribute; } return(new Scope(builder.ToImmutable(), DeclaredDataTypes)); }
private IEnumerable <IAttributeDeclaration> GetAttributes(IEntityDeclaration entityDeclaration) { foreach (var attribute in entityDeclaration.ExplicitAttributes) { yield return(attribute); } foreach (var attribute in entityDeclaration.InverseAttributes) { yield return(attribute); } foreach (var attribute in entityDeclaration.DerivedAttributes) { yield return(attribute); } }
private static bool PropertyTypeConformToProcedureType(IPropertyType derivedType, IProcedureType baseType, IErrorList errorList, ISource sourceLocation) { bool Result = true; Debug.Assert(derivedType.ResolvedBaseType.IsAssigned); Debug.Assert(baseType.ResolvedBaseType.IsAssigned); Result &= TypeConformToBase(derivedType.ResolvedBaseType.Item, baseType.ResolvedBaseType.Item, errorList, sourceLocation, isConversionAllowed: false); if (derivedType.PropertyKind == BaseNode.UtilityType.ReadOnly) { errorList.AddError(new ErrorTypeKindConformance(sourceLocation, derivedType, baseType)); Result = false; } if (baseType.OverloadList.Count > 1) { errorList.AddError(new ErrorTypeKindConformance(sourceLocation, derivedType, baseType)); Result = false; } ICommandOverloadType SingleOverload = baseType.OverloadList[0]; if (SingleOverload.ParameterList.Count != 1 || SingleOverload.ParameterEnd != BaseNode.ParameterEndStatus.Closed) { errorList.AddError(new ErrorTypeKindConformance(sourceLocation, derivedType, baseType)); Result = false; } if (SingleOverload.ParameterList.Count == 1) { IEntityDeclaration OverloadValue = SingleOverload.ParameterList[0]; Debug.Assert(derivedType.ResolvedEntityType.IsAssigned); Debug.Assert(OverloadValue.ValidEntity.IsAssigned); Debug.Assert(OverloadValue.ValidEntity.Item.ResolvedEffectiveType.IsAssigned); Result &= TypeConformToBase(derivedType.ResolvedEntityType.Item, OverloadValue.ValidEntity.Item.ResolvedEffectiveType.Item, errorList, sourceLocation, isConversionAllowed: false); Result &= ExceptionListConformToBase(derivedType.SetExceptionIdentifierList, SingleOverload.ExceptionIdentifierList, errorList, sourceLocation); } return(Result); }
private IEnumerable <IAttributeDeclaration> GetAttributesWithInherited(IEntityDeclaration entity) { var result = new Dictionary <string, IAttributeDeclaration>(StringComparer.OrdinalIgnoreCase); var visited = new HashSet <IEntityDeclaration>(); //TODO: duplicate attributes in inheritance hierarchy have to be disambiguated, so they cannot be added // twice here void visit(IEntityDeclaration entityDeclaration) { foreach (var attribute in GetAttributes(entityDeclaration)) { if (result.TryGetValue(attribute.Name, out var existing) && existing != attribute) { result[attribute.Name] = null; } else { result[attribute.Name] = attribute; } } foreach (var supertypeRef in entityDeclaration.Supertypes) { var supertype = ResolveEntity(supertypeRef.EntityName); if (visited.Add(supertype)) { visit(supertype); } } } visit(entity); return(result.Values.Where(a => a != null)); }
private bool FindIndexer(IClassType instancingClassType, ISource source, IFeatureInstance indexerInstance, out ITypeName indexTypeName, out ICompiledType indexType) { bool IsConformantToNumericIndexer = false; indexTypeName = null; indexType = null; IIndexerFeature AsIndexer = indexerInstance.Feature as IIndexerFeature; Debug.Assert(AsIndexer != null); if (AsIndexer.IndexParameterList.Count == 1) { if (Expression.IsLanguageTypeAvailable(LanguageClasses.Number.Guid, source, out ITypeName NumberTypeName, out ICompiledType NumberType)) { IEntityDeclaration IndexParameterDeclaration = AsIndexer.IndexParameterList[0]; ICompiledType IndexParameterType = IndexParameterDeclaration.ValidEntity.Item.ResolvedEffectiveType.Item; if (IndexParameterType is IClassType AsClassIndexType) { if (AsClassIndexType == NumberType) { ITypeName IndexResultTypeName = AsIndexer.ResolvedEntityTypeName.Item; ICompiledType IndexResultType = AsIndexer.ResolvedEntityType.Item; IndexResultType.InstanciateType(instancingClassType, ref IndexResultTypeName, ref IndexResultType); IsConformantToNumericIndexer = true; indexTypeName = IndexResultTypeName; indexType = IndexResultType; } } } } return(IsConformantToNumericIndexer); }
private static bool IsLocalEntity(string text, List <IEntityDeclaration> localEntityList, out IEntityDeclaration entity) { entity = null; bool Result = false; foreach (IEntityDeclaration Item in localEntityList) { IName EntityName = (IName)Item.EntityName; Debug.Assert(EntityName.ValidText.IsAssigned); if (text == EntityName.ValidText.Item) { Debug.Assert(entity == null); entity = Item; Result = true; } } return(Result); }
/// <summary> /// Checks for errors before applying a rule. /// </summary> /// <param name="node">The node instance to check.</param> /// <param name="dataList">Optional data collected during inspection of sources.</param> /// <param name="data">Private data to give to Apply() upon return.</param> /// <returns>True if an error occured.</returns> public override bool CheckConsistency(IQueryOverload node, IDictionary <ISourceTemplate, object> dataList, out object data) { bool Success = true; data = null; ISealableDictionary <string, IScopeAttributeFeature> CheckedScope = new SealableDictionary <string, IScopeAttributeFeature>(); Debug.Assert(node.ParameterTable.Count == node.ParameterList.Count); for (int i = 0; i < node.ParameterTable.Count; i++) { IParameter Parameter = node.ParameterTable[i]; IEntityDeclaration EntityDeclaration = node.ParameterList[i]; if (CheckedScope.ContainsKey(Parameter.Name)) { AddSourceError(new ErrorDuplicateName(EntityDeclaration, Parameter.Name)); Success = false; } else { CheckedScope.Add(Parameter.Name, EntityDeclaration.ValidEntity.Item); } } Debug.Assert(node.ResultTable.Count == node.ResultList.Count); for (int i = 0; i < node.ResultTable.Count; i++) { IParameter Result = node.ResultTable[i]; IEntityDeclaration EntityDeclaration = node.ResultList[i]; if (CheckedScope.ContainsKey(Result.Name)) { AddSourceError(new ErrorDuplicateName(EntityDeclaration, Result.Name)); Success = false; } else { CheckedScope.Add(Result.Name, EntityDeclaration.ValidEntity.Item); } } IList <string> ConflictList = new List <string>(); ScopeHolder.RecursiveCheck(CheckedScope, node.InnerScopes, ConflictList); foreach (IEntityDeclaration Item in node.ParameterList) { IScopeAttributeFeature LocalEntity = Item.ValidEntity.Item; string ValidFeatureName = LocalEntity.ValidFeatureName.Item.Name; if (ConflictList.Contains(ValidFeatureName)) { AddSourceError(new ErrorVariableAlreadyDefined(Item, ValidFeatureName)); Success = false; } } foreach (IEntityDeclaration Item in node.ResultList) { IScopeAttributeFeature LocalEntity = Item.ValidEntity.Item; string ValidFeatureName = LocalEntity.ValidFeatureName.Item.Name; if (ConflictList.Contains(ValidFeatureName)) { AddSourceError(new ErrorVariableAlreadyDefined(Item, ValidFeatureName)); Success = false; } } if (Success) { data = CheckedScope; } return(Success); }