Exemple #1
0
 protected override void OnIdentifierChanged(IGenericParameterUniqueIdentifier oldIdentifier, DeclarationChangeCause cause)
 {
     if (uniqueIdentifier != null)
     {
         this.uniqueIdentifier = null;
     }
     base.OnIdentifierChanged(oldIdentifier, cause);
 }
Exemple #2
0
            protected internal override void _Add(IGenericParameterUniqueIdentifier key, IGenericTypeParameter <TTypeIdentifier, TType> value)
            {
                var oldIdentifier = this.Parent.UniqueIdentifier;

                _Parent.ItemAdded(value);
                base._Add(key, value);
                this._Parent.CardinalityChanged(oldIdentifier);
            }
Exemple #3
0
 protected override IGenericParameterUniqueIdentifier OnGetUniqueIdentifier()
 {
     if (this.uniqueIdentifier == null)
     {
         this.uniqueIdentifier = this.Parent.TypeParameters.Keys[this.Position];
     }
     return(this.uniqueIdentifier);
 }
Exemple #4
0
 protected override void ClearIdentifier()
 {
     lock (this.SyncObject)
         if (this.uniqueIdentifier != null)
         {
             this.uniqueIdentifier = null;
         }
 }
Exemple #5
0
 public bool ContainsKey(IGenericParameterUniqueIdentifier key)
 {
     for (int i = 0; i < this.Count; i++)
     {
         if (this.tParamNames[i].Equals(key))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #6
0
 public bool TryGetValue(IGenericParameterUniqueIdentifier key, out IGenericTypeParameter <IGeneralGenericTypeUniqueIdentifier, ISymbolType> value)
 {
     for (int i = 0; i < this.Count; i++)
     {
         if (this.tParamNames[i].Equals(key))
         {
             this.CheckItemAt(i);
             value = this.elements[i];
             return(true);
         }
     }
     value = null;
     return(false);
 }
Exemple #7
0
 protected override IGenericParameterUniqueIdentifier OnGetUniqueIdentifier()
 {
     if (this.uniqueIdentifier == null)
     {
         if (this.Position > -1)
         {
             this.uniqueIdentifier = TypeSystemIdentifiers.GetGenericParameterIdentifier(this.Position, this.Name, true);
         }
         else
         {
             this.uniqueIdentifier = TypeSystemIdentifiers.GetGenericParameterIdentifier(this.Name, true);
         }
     }
     return(this.uniqueIdentifier);
 }
        public TIntermediateGenericParameter[] AddRange(params GenericParameterData[] genericParameterData)
        {
            if (this.Locked)
            {
                throw new InvalidOperationException(Resources.ObjectStateThrowMessage);
            }
            if (genericParameterData == null)
            {
                throw new ArgumentNullException("genericParameterData");
            }
            TIntermediateGenericParameter[]     result      = new TIntermediateGenericParameter[genericParameterData.Length];
            IGenericParameterUniqueIdentifier[] currentKeys = new IGenericParameterUniqueIdentifier[result.Length];

            //Parallel.For(0, genericParameterData.Length, i =>
            for (int i = 0; i < genericParameterData.Length; i++)
            {
                var currentName     = genericParameterData[i].Name;
                var current         = this.GetNew(currentName);
                var currentUniqueId = TypeSystemIdentifiers.GetGenericParameterIdentifier(i + this.Count, currentName, Parent is IType);
                if (this.ContainsKey(currentUniqueId) ||
                    currentKeys.Contains(currentUniqueId))
                {
                    throw new ArgumentException("genericParameterData");
                }
                currentKeys[i] = currentUniqueId;
                result[i]      = current;
            }//**/);
            this._AddRange((from i in 0.RangeTo(genericParameterData.Length)
                            select new KeyValuePair <IGenericParameterUniqueIdentifier, TGenericParameter>(currentKeys[i], result[i])));
            //Parallel.For(0, genericParameterData.Length, i=>
            for (int i = 0; i < genericParameterData.Length; i++)
            {
                var currentParameterData = genericParameterData[i];
                var current = result[i];
                foreach (var constraint in currentParameterData.Constraints)
                {
                    current.Constraints.Add(TransposeType(constraint, current));
                }
                foreach (var ctorSig in currentParameterData.Constructors.Signatures)
                {
                    current.Constructors.Add(TransposeTypedNames(ctorSig.Parameters.ToSeries(), current));
                }
                foreach (var eventGroup in TransposeTypedNames(currentParameterData.Events, current))
                {
                    current.Events.Add(eventGroup);
                }
                foreach (var indexerSig in currentParameterData.Indexers.Signatures)
                {
                    current.Indexers.Add(TransposeTypedName(new TypedName(indexerSig.Name, indexerSig.ReturnType), current), TransposeTypedNames(indexerSig.Parameters.ToSeries(), current));
                }
                //result.Properties.Add
                current.SpecialConstraint = currentParameterData.SpecialConstraint;
                foreach (var method in currentParameterData.Methods.Signatures)
                {
                    current.Methods.Add(TransposeTypedName(new TypedName(method.Name, method.ReturnType), current), TransposeTypedNames(method.Parameters.ToSeries(), current));
                }
            }//*/);

            //Parallel.For(0, genericParameterData.Length, i =>
            //for (int i = 0; i < genericParameterData.Length; i++)
            //{
            //    var currentParameterData = genericParameterData[i];
            //    var current = result[i];
            //    foreach (var constraint in currentParameterData.Constraints)
            //        if (constraint.ContainsSymbols())
            //            current.Constraints.Add(constraint.SimpleSymbolDisambiguation(current));
            //        else
            //            current.Constraints.Add(constraint);
            //    foreach (var ctor in current.Constructors.Values)
            //        foreach (var param in ctor.Parameters.Values)
            //            if (param.ParameterType.ContainsSymbols())
            //                param.ParameterType = param.ParameterType.SimpleSymbolDisambiguation(current);
            //    foreach (var method in current.Methods.Values)
            //    {
            //        foreach (var param in method.Parameters.Values)
            //            if (param.ParameterType.ContainsSymbols())
            //                param.ParameterType = param.ParameterType.SimpleSymbolDisambiguation(current);
            //        if (method.ReturnType.ContainsSymbols())
            //            method.ReturnType = method.ReturnType.SimpleSymbolDisambiguation(current);
            //    }
            //    foreach (var property in current.Properties.Values)
            //        if (property.PropertyType.ContainsSymbols())
            //            property.PropertyType = property.PropertyType.SimpleSymbolDisambiguation(current);

            //    foreach (var indexer in current.Indexers.Values)
            //    {
            //        if (indexer.PropertyType.ContainsSymbols())
            //            indexer.PropertyType = indexer.PropertyType.SimpleSymbolDisambiguation(current);
            //        foreach (var param in indexer.Parameters.Values)
            //            if (param.ParameterType.ContainsSymbols())
            //                param.ParameterType = param.ParameterType.SimpleSymbolDisambiguation(current);
            //    }
            //}//);
            return(result);
        }
Exemple #9
0
 public new IIntermediateDelegateTypeParameterType this[IGenericParameterUniqueIdentifier uniqueIdentifier]
 {
     get { return((IIntermediateDelegateTypeParameterType) base[uniqueIdentifier]); }
 }
Exemple #10
0
 protected override void ClearIdentifier()
 {
     this.uniqueIdentifier = null;
 }
Exemple #11
0
 public IGenericTypeParameter <IGeneralGenericTypeUniqueIdentifier, ISymbolType> this[IGenericParameterUniqueIdentifier key]
 {
     get {
         for (int i = 0; i < this.Count; i++)
         {
             if (this.tParamNames[i].Equals(key))
             {
                 this.CheckItemAt(i);
                 return(this.elements[i]);
             }
         }
         throw new KeyNotFoundException();
     }
 }
Exemple #12
0
 protected internal override void _Add(IGenericParameterUniqueIdentifier key, IMethodSignatureGenericTypeParameterMember value)
 {
     base._Add(key, value);
     Parent.OnTypeParameterAdded((IIntermediateMethodSignatureGenericTypeParameterMember)value);
 }