示例#1
0
        private bool CheckResultValueConsistency(IIndexerFeature node, IDictionary <ISourceTemplate, object> dataList, IScopeAttributeFeature resultFeature, IScopeAttributeFeature valueFeature, out object data)
        {
            data = null;
            bool Success = true;

            ISealableDictionary <string, IScopeAttributeFeature> CheckedScope    = new SealableDictionary <string, IScopeAttributeFeature>();
            ISealableDictionary <string, IScopeAttributeFeature> CheckedGetScope = new SealableDictionary <string, IScopeAttributeFeature>();
            ISealableDictionary <string, IScopeAttributeFeature> CheckedSetScope = new SealableDictionary <string, IScopeAttributeFeature>();

            string NameResult = resultFeature.ValidFeatureName.Item.Name;
            string NameValue  = valueFeature.ValidFeatureName.Item.Name;

            Success &= CheckParameters(node, resultFeature, valueFeature, CheckedScope);

            CheckedGetScope.Merge(CheckedScope);
            CheckedGetScope.Add(NameResult, resultFeature);

            CheckedSetScope.Merge(CheckedScope);
            CheckedSetScope.Add(NameValue, valueFeature);

            List <string> ConflictList = new List <string>();

            ScopeHolder.RecursiveCheck(CheckedGetScope, node.InnerScopes, ConflictList);
            ScopeHolder.RecursiveCheck(CheckedSetScope, node.InnerScopes, ConflictList);

            Debug.Assert(node.InnerScopes.Count == 0);

            // This has been checked in another rule.
            Debug.Assert(!ConflictList.Contains(NameResult));
            Debug.Assert(!ConflictList.Contains(NameValue));

            Success &= CheckIndexerKind(node, out BaseNode.UtilityType IndexerKind);

            if (Success)
            {
                data = new Tuple <BaseNode.UtilityType, ISealableDictionary <string, IScopeAttributeFeature>, ISealableDictionary <string, IScopeAttributeFeature>, ISealableDictionary <string, IScopeAttributeFeature> >(IndexerKind, CheckedScope, CheckedGetScope, CheckedSetScope);
            }

            return(Success);
        }