Exemple #1
0
 /// <summary>
 /// Performs a look-up on the <see cref="InterfaceType"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="InterfaceType"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     base.GatherTypeReferences(ref result, options);
     if (this.IsRoot && this.implementsList != null)
     {
         foreach (ITypeReference itr in this.ImplementsList)
         {
             result.Add(itr);
         }
     }
     if (options.AllowPartials)
     {
         this.Properties.GatherTypeReferences(ref result, options);
         this.Methods.GatherTypeReferences(ref result, options);
     }
     else
     {
         if (this.properties != null && this.IsRoot)
         {
             this.Properties.GatherTypeReferences(ref result, options);
         }
         if (this.methods != null && this.IsRoot)
         {
             this.Methods.GatherTypeReferences(ref result, options);
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Performs a look-up on the <see cref="DeclaredType{TDom}"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="DeclaredType{TDom}"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.Attributes != null)
     {
         this.Attributes.GatherTypeReferences(ref result, options);
     }
 }
Exemple #3
0
 /// <summary>
 /// Performs a look-up on the <see cref="AttributeDeclarations"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="AttributeDeclarations"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     foreach (IAttributeDeclaration iad in this)
     {
         iad.GatherTypeReferences(ref result, options);
     }
 }
Exemple #4
0
 /// <summary>
 /// Performs a look-up on the <see cref="AttributeConstructorParameters"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="AttributeConstructorParameters"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     foreach (IAttributeConstructorParameter iacp in this)
     {
         iacp.GatherTypeReferences(ref result, options);
     }
 }
Exemple #5
0
 /// <summary>
 /// Performs a look-up on the <see cref="AttributeConstructorParameter"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="AttributeConstructorParameter"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.value != null)
     {
         this.Value.GatherTypeReferences(ref result, options);
     }
 }
Exemple #6
0
 /// <summary>
 /// Performs a look-up on the <see cref="EnumeratorType"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="EnumeratorType"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     base.GatherTypeReferences(ref result, options);
     if (this.fields != null)
     {
         this.Fields.GatherTypeReferences(ref result, options);
     }
 }
Exemple #7
0
 /// <summary>
 /// Performs a look-up on the <see cref="DelegateTypeParameterMember"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="DelegateTypeParameterMember"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     base.GatherTypeReferences(ref result, options);
     if (this.parameterType != null)
     {
         result.Add(this.ParameterType);
     }
 }
Exemple #8
0
 /// <summary>
 /// Performs a look-up on the <see cref="NameSpaceDeclarations"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="NameSpaceDeclarations"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     foreach (INameSpaceDeclaration ti in this.Values)
     {
         if (options.AllowPartials)
         {
             if (this.targetDeclaration is ISegmentableDeclarationTarget)
             {
                 if (ti.ParentTarget == this.targetDeclaration)
                 {
                     ti.GatherTypeReferences(ref result, options);
                 }
             }
             else
             {
                 ti.GatherTypeReferences(ref result, options);
             }
             foreach (INameSpaceDeclaration insd in ti.Partials)
             {
                 if (this.targetDeclaration is ISegmentableDeclarationTarget)
                 {
                     if (insd.ParentTarget == this.targetDeclaration)
                     {
                         insd.GatherTypeReferences(ref result, options);
                     }
                 }
                 else
                 {
                     insd.GatherTypeReferences(ref result, options);
                 }
             }
         }
         else
         if (this.targetDeclaration is ISegmentableDeclarationTarget)
         {
             if (((ISegmentableDeclarationTarget)this.targetDeclaration).IsRoot)
             {
                 ti.GatherTypeReferences(ref result, options);
             }
         }
         else
         {
             ti.GatherTypeReferences(ref result, options);
         }
     }
 }
Exemple #9
0
 /// <summary>
 /// Performs a look-up on the <see cref="StructType"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="StructType"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     base.GatherTypeReferences(ref result, options);
     if (this.implementsList != null)
     {
         foreach (ITypeReference itr in this.ImplementsList)
         {
             result.Add(itr);
         }
     }
 }
Exemple #10
0
 /// <summary>
 /// Performs a look-up on the <see cref="AttributeDeclaration"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="AttributeDeclaration"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (this.attributeType != null)
     {
         result.Add(this.AttributeType);
     }
     if (this.parameters != null)
     {
         this.parameters.GatherTypeReferences(ref result, options);
     }
 }
Exemple #11
0
 /// <summary>
 /// Performs a look-up on the <see cref="ClassType"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="ClassType"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     base.GatherTypeReferences(ref result, options);
     if (this.IsRoot && (this.BaseType != null) && (!(this.BaseType.Equals(typeof(object).GetTypeReference()))))
     {
         result.Add(this.BaseType);
     }
     if (this.implementsList != null)
     {
         foreach (ITypeReference itr in this.ImplementsList)
         {
             result.Add(itr);
         }
     }
 }
Exemple #12
0
 /// <summary>
 /// Performs a look-up on the <see cref="NameSpaceDeclaration"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="NameSpaceDeclaration"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     if (options.AllowPartials)
     {
         this.Classes.GatherTypeReferences(ref result, options);
         this.Delegates.GatherTypeReferences(ref result, options);
         this.Enumerators.GatherTypeReferences(ref result, options);
         this.Interfaces.GatherTypeReferences(ref result, options);
         this.Structures.GatherTypeReferences(ref result, options);
         this.ChildSpaces.GatherTypeReferences(ref result, options);
     }
     else
     {
         if (this.IsRoot)
         {
             this.Classes.GatherTypeReferences(ref result, options);
         }
         if (this.IsRoot)
         {
             this.Delegates.GatherTypeReferences(ref result, options);
         }
         if (this.IsRoot)
         {
             this.Enumerators.GatherTypeReferences(ref result, options);
         }
         if (this.IsRoot)
         {
             this.Interfaces.GatherTypeReferences(ref result, options);
         }
         if (this.IsRoot)
         {
             this.Structures.GatherTypeReferences(ref result, options);
         }
         if (this.IsRoot)
         {
             this.ChildSpaces.GatherTypeReferences(ref result, options);
         }
     }
 }
Exemple #13
0
        protected virtual ITypeReferenceCollection FillInTypeParameters(ITypeReferenceCollection originalSet)
        {
            List <IDeclarationTarget> parents = new List <IDeclarationTarget>();
            ITypeReferenceCollection  resultSet;

            if (originalSet == null)
            {
                resultSet = new TypeReferenceCollection();
            }
            else
            {
                resultSet = new TypeReferenceCollection(originalSet.ToArray());
            }
            for (IDeclarationTarget parent = this; ((parent != null) && (!(parent is INameSpaceDeclaration))); parent = parent.ParentTarget)
            {
                parents.Add(parent);
            }
            parents.Reverse();
            int skip = 0;

            for (IDeclarationTarget parent = parents[0]; parents.Count > 0; parents.RemoveAt(0), parent = parents.Count > 0 ? parents[0] : null)
            {
                if (parent is IParameteredDeclaredType)
                {
                    if (((IParameteredDeclaredType)parent).TypeParameters == null)
                    {
                        continue;
                    }
                    foreach (ITypeParameterMember itpm in ((IParameteredDeclaredType)parent).TypeParameters.Values)
                    {
                        if (skip++ >= resultSet.Count)
                        {
                            resultSet.Add(itpm);
                        }
                    }
                }
            }
            return(resultSet);
        }
Exemple #14
0
 /// <summary>
 /// Performs a look-up on the <see cref="SegmentableParameteredMemberTypeParentType{TItem, TDom, TPartials}"/> to determine its
 /// dependencies.
 /// </summary>
 /// <param name="result">A <see cref="ITypeReferenceCollection"/> which
 /// relates to the <see cref="ITypeReference"/> instance implementations
 /// that the <see cref="SegmentableParameteredMemberTypeParentType{TItem, TDom, TPartials}"/> relies on.</param>
 /// <param name="options">The <see cref="ICodeTranslationOptions"/> which is used to
 /// guide the gathering process.</param>
 public override void GatherTypeReferences(ref ITypeReferenceCollection result, ICodeTranslationOptions options)
 {
     if (result == null)
     {
         result = new TypeReferenceCollection();
     }
     base.GatherTypeReferences(ref result, options);
     if (options.AllowPartials)
     {
         if (this.fields != null)
         {
             this.Fields.GatherTypeReferences(ref result, options);
         }
         if (this.properties != null)
         {
             this.Properties.GatherTypeReferences(ref result, options);
         }
         if (this.methods != null)
         {
             this.Methods.GatherTypeReferences(ref result, options);
         }
         if (this.constructors != null)
         {
             this.Constructors.GatherTypeReferences(ref result, options);
         }
         if (this.Classes != null)
         {
             this.Classes.GatherTypeReferences(ref result, options);
         }
         if (this.Delegates != null)
         {
             this.Delegates.GatherTypeReferences(ref result, options);
         }
         if (this.Enumerators != null)
         {
             this.Enumerators.GatherTypeReferences(ref result, options);
         }
         if (this.Interfaces != null)
         {
             this.Interfaces.GatherTypeReferences(ref result, options);
         }
         if (this.Structures != null)
         {
             this.Structures.GatherTypeReferences(ref result, options);
         }
         if (this.resources != null)
         {
             this.resources.GatherTypeReferences(ref result, options);
         }
     }
     else
     {
         if (this.fields != null && this.IsRoot)
         {
             this.Fields.GatherTypeReferences(ref result, options);
         }
         if (this.properties != null && this.IsRoot)
         {
             this.Properties.GatherTypeReferences(ref result, options);
         }
         if (this.methods != null && this.IsRoot)
         {
             this.Methods.GatherTypeReferences(ref result, options);
         }
         if (this.constructors != null && this.IsRoot)
         {
             this.Constructors.GatherTypeReferences(ref result, options);
         }
         if (this.IsRoot)
         {
             if (this.Classes != null)
             {
                 this.Classes.GatherTypeReferences(ref result, options);
             }
             if (this.Delegates != null)
             {
                 this.Delegates.GatherTypeReferences(ref result, options);
             }
             if (this.Enumerators != null)
             {
                 this.Enumerators.GatherTypeReferences(ref result, options);
             }
             if (this.Interfaces != null)
             {
                 this.Interfaces.GatherTypeReferences(ref result, options);
             }
             if (this.Structures != null)
             {
                 this.Structures.GatherTypeReferences(ref result, options);
             }
             if (this.resources != null)
             {
                 this.resources.GatherTypeReferences(ref result, options);
             }
         }
     }
 }