Exemple #1
0
        /// <summary>
        /// Return all nodes with references to types that occur within a given type declaration.
        /// </summary>
        /// <returns>References of types within a given type declaration.</returns>
        public DirectTypeRef[] GetReferences()
        {
            var couplings = new DirectTypeRef[currentReferences.Count];

            // Copy result to an array to make it immutable
            currentReferences.Values.CopyTo(couplings, 0);
            return(couplings);
        }
Exemple #2
0
        /// <summary>
        /// Add found reference to a type used within the currently traversed type declaration.
        /// </summary>
        /// <param name="x">Reference to class or interface.</param>
        public void AddCoupling(DirectTypeRef x)
        {
            Debug.Assert(isInsideDeclaration);

            // Presence of itself is not taken into account
            // Class names are case-insensitive
            if (!x.ClassName.Equals(currentType.QualifiedName))
            {
                currentReferences[x.ClassName] = x;
            }
        }
Exemple #3
0
 /// <inheritdoc />
 public override void VisitDirectTypeRef(DirectTypeRef x)
 {
     AddCoupling(x);
     base.VisitDirectTypeRef(x);
 }
Exemple #4
0
 private VariableUse CreateStaticFieldUse(Position position, GenericQualifiedName /*!*/ className, Position classNamePosition, CompoundVarUse /*!*/ field)
 {
     return(CreateStaticFieldUse(position, DirectTypeRef.FromGenericQualifiedName(classNamePosition, className), field));
 }
Exemple #5
0
 public CatchBlock(DirectTypeRef typeRef, BoundVariableRef variable)
 {
     _typeRef  = typeRef;
     _variable = variable;
 }
Exemple #6
0
 /// <summary>
 /// Whether the given class name is equal to <c>Exception</c>.
 /// </summary>
 private static bool IsExceptionClassName(DirectTypeRef tref)
 {
     return
         (tref.GenericParams.Count == 0 &&
          tref.ClassName == NameUtils.SpecialNames.Exception);
 }