/// <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)); }
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; }
/// <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)); }
/// <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(); }
public TypeGraph(TypeSpecifier outputType) { TypeReturnNode = new TypeNode(this, outputType); }
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(); }
public Variable(string name, TypeSpecifier variableType) { Name = name; VariableType = variableType; }
/// <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; }
/// <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(); }