Beispiel #1
0
        /// <summary>
        /// Adds
        /// <paramref name="parentTypeUse"/>as a parent type for this type definition
        /// </summary>
        /// <param name="parentTypeUse">The parent type to add</param>
        public void AddParentType(ITypeUse parentTypeUse)
        {
            if (null == parentTypeUse)
            {
                throw new ArgumentNullException("parentTypeUse");
            }

            parentTypeUse.ParentScope = this;
            ParentTypeCollection.Add(parentTypeUse);
        }
Beispiel #2
0
 public static bool TypeUsesAreEqual(ITypeUse a, ITypeUse b)
 {
     if (a == b)
     {
         return(true);
     }
     return(LocationsAreEqual(a.Location, b.Location) &&
            NamedScopeUsesAreEqual(a.Prefix, b.Prefix) &&
            a.Name == b.Name &&
            IResolvesToTypesAreEqual(a.CallingObject, b.CallingObject));
 }
Beispiel #3
0
        /// <summary>
        /// Checks if the
        /// <paramref name="use">given type use</paramref> is a built-in type.
        /// </summary>
        /// <param name="use">The type use to test</param>
        /// <returns>true if this is a built-in type; false otherwise</returns>
        public static bool IsBuiltIn(ITypeUse use)
        {
            if (use == null)
            {
                throw new ArgumentNullException("use");
            }

            switch (use.ProgrammingLanguage)
            {
            case Language.CPlusPlus:
                return(IsCppBuiltIn(use.Name));

            case Language.CSharp:
                return(IsCSharpBuiltIn(use.Name));

            case Language.Java:
                return(IsJavaBuiltIn(use.Name));
            }
            return(false);
        }
Beispiel #4
0
        /// <summary>
        /// Returns the built-in type for the given type use
        /// </summary>
        /// <param name="use">the type use to locate</param>
        /// <returns>A type definition that matches the type use; null if this is not a
        /// built-in</returns>
        public static ITypeDefinition GetBuiltIn(ITypeUse use)
        {
            if (!IsBuiltIn(use))
            {
                return(null);
            }

            var             key = new Tuple <Language, string>(use.ProgrammingLanguage, use.Name);
            ITypeDefinition builtIn;

            if (!builtInTypeMap.TryGetValue(key, out builtIn))
            {
                builtIn = new TypeDefinition()
                {
                    Accessibility       = AccessModifier.None,
                    Kind                = TypeKind.BuiltIn,
                    Name                = key.Item2,
                    ProgrammingLanguage = key.Item1,
                };
                builtInTypeMap[key] = builtIn;
            }
            return(builtIn);
        }
Beispiel #5
0
 /// <summary>
 /// Adds a generic type parameter to this type use
 /// </summary>
 /// <param name="typeParameter">The type parameter to add</param>
 public void AddTypeParameter(ITypeUse typeParameter)
 {
     this.internalTypeParameters.Add(typeParameter);
 }