Exemplo n.º 1
0
        /// <summary>
        /// Returns whether a given visibility for a member of a type is visible from another type.
        /// </summary>
        /// <param name="fromType">Type that we are seeing from.</param>
        /// <param name="type">Type that we are looking at.</param>
        /// <param name="visibility">Visibility of the member on type.</param>
        /// <returns></returns>
        public static bool IsVisible(TypeSpecifier fromType, TypeSpecifier type, MemberVisibility visibility, Func <TypeSpecifier, TypeSpecifier, bool> isSubclassOf)
        {
            // TODO: Internal

            if (fromType == type)
            {
                return(true);
            }
            else if (isSubclassOf(fromType, type))
            {
                return(visibility.HasFlag(MemberVisibility.ProtectedOrPublic));
            }

            return(visibility.HasFlag(MemberVisibility.Public));
        }
Exemplo n.º 2
0
 public VariableSpecifier
 (
     string name,
     TypeSpecifier type,
     MemberVisibility getterVisibility,
     MemberVisibility setterVisibility,
     TypeSpecifier declaringType,
     VariableModifiers modifiers
 )
 {
     this.Name             = name;
     this.Type             = type;
     this.GetterVisibility = getterVisibility;
     this.SetterVisibility = setterVisibility;
     this.DeclaringType    = declaringType;
     this.Modifiers        = modifiers;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Returns whether the generic arguments for this type and a given type match.
 /// </summary>
 /// <param name="t">Specifier for the type to check.</param>
 /// <returns>Whether the generic arguments for the types match.</returns>
 public bool GenericArgumentsEqual(TypeSpecifier t)
 {
     return(GenericArguments.SequenceEqual(t.GenericArguments));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a ConstructorSpecifier given specifiers for the constructor's arguments and the type it is for.
 /// </summary>
 /// <param name="arguments">Specifiers for the arguments the constructor takes.</param>
 /// <param name="declaringType">Specifier for the type the constructor is for.</param>
 public ConstructorSpecifier(IEnumerable <Named <BaseType> > arguments, TypeSpecifier declaringType)
 {
     DeclaringType = declaringType;
     Arguments     = arguments.ToList();
 }
Exemplo n.º 5
0
 public TypeGraph(TypeSpecifier outputType)
 {
     TypeReturnNode = new TypeNode(this, outputType);
 }
Exemplo n.º 6
0
 public MethodSpecifier(string name, IEnumerable <BaseType> arguments,
                        IEnumerable <BaseType> returnTypes, MethodModifiers modifiers, TypeSpecifier declaringType,
                        IList <BaseType> genericArguments)
 {
     Name             = name;
     DeclaringType    = declaringType;
     Arguments        = arguments.ToList();
     ReturnTypes      = returnTypes.ToList();
     Modifiers        = modifiers;
     GenericArguments = genericArguments.ToList();
 }
Exemplo n.º 7
0
 public Variable(string name, TypeSpecifier variableType)
 {
     Name         = name;
     VariableType = variableType;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a variable.
 /// </summary>
 /// <param name="name">Name of the variable.</param>
 /// <param name="variableType">Specifier for the type of the variable.</param>
 public OldVariable(string name, TypeSpecifier variableType, BaseType declaringType)
 {
     Name          = name;
     VariableType  = variableType;
     DeclaringType = declaringType;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a ConstructorSpecifier given specifiers for the constructor's arguments and the type it is for.
 /// </summary>
 /// <param name="arguments">Specifiers for the arguments the constructor takes.</param>
 /// <param name="declaringType">Specifier for the type the constructor is for.</param>
 public ConstructorSpecifier(IEnumerable <MethodParameter> arguments, TypeSpecifier declaringType)
 {
     DeclaringType = declaringType;
     Arguments     = arguments.ToList();
 }