protected override bool AddMemberType (DeclSpace ds) { if (!AddToContainer (ds, ds.Name)) return false; ds.NamespaceEntry.NS.AddDeclSpace (ds.Basename, ds); return true; }
public MethodCore (DeclSpace parent, GenericMethod generic, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, MemberName name, Attributes attrs, ParametersCompiled parameters) : base (parent, generic, type, mod, allowed_mod, name, attrs) { this.parameters = parameters; }
public Const (DeclSpace parent, FullNamedExpression type, string name, Expression expr, int mod_flags, Attributes attrs, Location loc) : base (parent, type, mod_flags, AllowedModifiers, new MemberName (name, loc), attrs) { initializer = expr; ModFlags |= Modifiers.STATIC; }
protected Event(DeclSpace parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, Attributes attrs) : base(parent, null, type, mod_flags, parent.PartialContainer.Kind == MemberKind.Interface ? AllowedModifiersInterface : parent.PartialContainer.Kind == MemberKind.Struct ? AllowedModifiersStruct : AllowedModifiersClass, name, attrs) { }
public Class(NamespaceEntry ns, DeclSpace parent, MemberName name, Modifiers mod, Attributes attrs) : base(ns, parent, name, attrs, MemberKind.Class) { var accmods = (Parent == null || Parent.Parent == null) ? Modifiers.INTERNAL : Modifiers.PRIVATE; this.ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod, accmods, Location, Report); spec = new TypeSpec (Kind, null, this, null, ModFlags); }
protected FieldBase (DeclSpace parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, MemberName name, Attributes attrs) : base (parent, null, type, mod, allowed_mod | Modifiers.ABSTRACT, Modifiers.PRIVATE, name, attrs) { if ((mod & Modifiers.ABSTRACT) != 0) Report.Error (681, Location, "The modifier 'abstract' is not valid on fields. Try using a property instead"); }
public Enum(NamespaceEntry ns, DeclSpace parent, TypeExpr type, Modifiers mod_flags, MemberName name, Attributes attrs) : base(ns, parent, name, attrs, MemberKind.Enum) { this.base_type = type; var accmods = IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE; ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod_flags, accmods, Location, Report); spec = new EnumSpec (null, this, null, null, ModFlags); }
public HoistedStoreyClass (DeclSpace parent, MemberName name, TypeParameter[] tparams, Modifiers mod) : base (parent, name, mod | Modifiers.PRIVATE) { if (tparams != null) { type_params = new TypeParameter[tparams.Length]; for (int i = 0; i < type_params.Length; ++i) { type_params[i] = tparams[i].CreateHoistedCopy (this, spec); } } }
public Const(DeclSpace parent, FullNamedExpression type, string name, Expression expr, Modifiers mod_flags, Attributes attrs, Location loc) : base(parent, type, mod_flags, AllowedModifiers, new MemberName (name, loc), attrs) { if (expr != null) initializer = new ConstInitializer (this, expr); ModFlags |= Modifiers.STATIC; }
protected CompilerGeneratedClass (DeclSpace parent, GenericMethod generic, MemberName name, int mod) : this (parent, name, mod) { if (generic != null) { ArrayList list = new ArrayList (); foreach (TypeParameter tparam in generic.TypeParameters) { if (tparam.Constraints != null) list.Add (tparam.Constraints.Clone ()); } SetParameterInfo (list); } }
public Class(NamespaceEntry ns, DeclSpace parent, MemberName name, Modifiers mod, Attributes attrs) : base(ns, parent, name, attrs, MemberKind.Class) { var accmods = (Parent == null || Parent.Parent == null) ? Modifiers.INTERNAL : Modifiers.PRIVATE; this.ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod, accmods, Location, Report); spec = new TypeSpec (Kind, null, this, null, ModFlags); if (IsStatic && RootContext.Version == LanguageVersion.ISO_1) { Report.FeatureIsNotAvailable (Location, "static classes"); } }
public Delegate (NamespaceEntry ns, DeclSpace parent, FullNamedExpression type, int mod_flags, MemberName name, ParametersCompiled param_list, Attributes attrs) : base (ns, parent, name, attrs, Kind.Delegate) { this.ReturnType = type; ModFlags = Modifiers.Check (AllowedModifiers, mod_flags, IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE, name.Location, Report); Parameters = param_list; }
public Delegate(NamespaceEntry ns, DeclSpace parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, ParametersCompiled param_list, Attributes attrs) : base(ns, parent, name, attrs, MemberKind.Delegate) { this.ReturnType = type; ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod_flags, IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE, name.Location, Report); parameters = param_list; spec = new TypeSpec (Kind, null, this, null, ModFlags | Modifiers.SEALED); }
// TypeContainer // // Generates xml doc comments (if any), and if required, // handle warning report. // internal static void GenerateTypeDocComment (TypeContainer t, DeclSpace ds, Report Report) { GenerateDocComment (t, ds, Report); if (t.DefaultStaticConstructor != null) t.DefaultStaticConstructor.GenerateDocComment (t); if (t.InstanceConstructors != null) foreach (Constructor c in t.InstanceConstructors) c.GenerateDocComment (t); if (t.Types != null) foreach (TypeContainer tc in t.Types) tc.GenerateDocComment (t); if (t.Delegates != null) foreach (Delegate de in t.Delegates) de.GenerateDocComment (t); if (t.Constants != null) foreach (Const c in t.Constants) c.GenerateDocComment (t); if (t.Fields != null) foreach (FieldBase f in t.Fields) f.GenerateDocComment (t); if (t.Events != null) foreach (Event e in t.Events) e.GenerateDocComment (t); if (t.Indexers != null) foreach (Indexer ix in t.Indexers) ix.GenerateDocComment (t); if (t.Properties != null) foreach (Property p in t.Properties) p.GenerateDocComment (t); if (t.Methods != null) foreach (MethodOrOperator m in t.Methods) m.GenerateDocComment (t); if (t.Operators != null) foreach (Operator o in t.Operators) o.GenerateDocComment (t); }
public HoistedStoreyClass (DeclSpace parent, MemberName name, TypeParameter[] tparams, Modifiers mod) : base (parent, name, mod | Modifiers.PRIVATE) { if (tparams != null) { type_params = new TypeParameter[tparams.Length]; var src = new TypeParameterSpec[tparams.Length]; var dst = new TypeParameterSpec[tparams.Length]; for (int i = 0; i < type_params.Length; ++i) { type_params[i] = tparams[i].CreateHoistedCopy (this, spec); src[i] = tparams[i].Type; dst[i] = type_params[i].Type; } // A copy is not enough, inflate any type parameter constraints // using a new type parameters var inflator = new TypeParameterInflator (null, src, dst); for (int i = 0; i < type_params.Length; ++i) { src[i].InflateConstraints (inflator, dst[i]); } } }
public InterfaceMemberBase (DeclSpace parent, GenericMethod generic, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, MemberName name, Attributes attrs) : base (parent, generic, type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs) { IsInterface = parent.PartialContainer.Kind == MemberKind.Interface; IsExplicitImpl = (MemberName.ExplicitInterface != null); explicit_mod_flags = mod; }
public Interface (NamespaceContainer ns, DeclSpace parent, MemberName name, Modifiers mod, Attributes attrs) : base (ns, parent, name, attrs, MemberKind.Interface) { var accmods = parent.Parent == null ? Modifiers.INTERNAL : Modifiers.PRIVATE; this.ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod, accmods, name.Location, Report); spec = new TypeSpec (Kind, null, this, null, ModFlags); }
public override void AddBasesForPart (DeclSpace part, List<FullNamedExpression> bases) { if (part.Name == "System.Object") Report.Error (537, part.Location, "The class System.Object cannot have a base class or implement an interface."); base.AddBasesForPart (part, bases); }
public TypeContainer (NamespaceContainer ns, DeclSpace parent, MemberName name, Attributes attrs, MemberKind kind) : base (ns, parent, name, attrs) { if (parent != null && parent.NamespaceEntry != ns) throw new InternalErrorException ("A nested type should be in the same NamespaceEntry as its enclosing class"); this.Kind = kind; this.PartialContainer = this; }
public ClassOrStruct (NamespaceContainer ns, DeclSpace parent, MemberName name, Attributes attrs, MemberKind kind) : base (ns, parent, name, attrs, kind) { }
void AddConstraints (AbstractCSharpNode parent, DeclSpace d) { if (d == null || d.Constraints == null) return; for (int i = 0; i < d.Constraints.Count; i++) { Constraints c = d.Constraints[i]; var location = LocationsBag.GetLocations (c); var constraint = new Constraint (); parent.AddChild (new CSharpTokenNode (Convert (location[0]), "where".Length), InvocationExpression.Roles.Keyword); parent.AddChild (new Identifier (c.TypeParameter.Value, Convert (c.TypeParameter.Location)), InvocationExpression.Roles.Identifier); parent.AddChild (new CSharpTokenNode (Convert (location[1]), 1), InvocationExpression.Roles.Colon); foreach (var expr in c.ConstraintExpressions) parent.AddChild ((INode)expr.Accept (this), InvocationExpression.Roles.TypeArgument); } }
public void AddTypeParameter (AbstractTypeParameterMember member, DeclSpace decl) { if (!decl.IsGeneric || decl.CurrentTypeParameters == null) return; foreach (var typeParameter in decl.CurrentTypeParameters) { var par = ConvertTemplateDefinition (typeParameter); member.AddTypeParameter (par); } }
protected virtual void RemoveMemberType (DeclSpace ds) { RemoveFromContainer (ds.Basename); }
// // Generates xml doc comments (if any), and if required, // handle warning report. // internal override void GenerateDocComment (DeclSpace ds) { DocUtil.GenerateTypeDocComment (this, ds, Report); }
public Const (DeclSpace parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, Attributes attrs) : base (parent, type, mod_flags, AllowedModifiers, name, attrs) { ModFlags |= Modifiers.STATIC; }
public MemberCore (DeclSpace parent, MemberName name, Attributes attrs) { this.Parent = parent as TypeContainer; member_name = name; caching_flags = Flags.Obsolete_Undetected | Flags.ClsCompliance_Undetected | Flags.HasCompliantAttribute_Undetected | Flags.Excluded_Undetected; AddAttributes (attrs, this); }
public DeclSpace (NamespaceContainer ns, DeclSpace parent, MemberName name, Attributes attrs) : base (parent, name, attrs) { NamespaceEntry = ns; Basename = name.Basename; defined_names = new Dictionary<string, MemberCore> (); PartialContainer = null; if (name.TypeArguments != null) { is_generic = true; count_type_params = name.TypeArguments.Count; } if (parent != null) count_type_params += parent.count_type_params; }
protected MemberBase (DeclSpace parent, GenericMethod generic, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, Modifiers def_mod, MemberName name, Attributes attrs) : base (parent, name, attrs) { this.ds = generic != null ? generic : (DeclSpace) parent; this.type_expr = type; ModFlags = ModifiersExtensions.Check (allowed_mod, mod, def_mod, Location, Report); GenericMethod = generic; if (GenericMethod != null) GenericMethod.ModFlags = ModFlags; }
public virtual void AddBasesForPart (DeclSpace part, List<FullNamedExpression> bases) { // FIXME: get rid of partial_parts and store lists of bases of each part here // assumed, not verified: 'part' is in 'partial_parts' ((TypeContainer) part).type_bases = bases; }
void AddConstraints (AstNode parent, DeclSpace d) { if (d == null || d.Constraints == null) return; for (int i = 0; i < d.PlainConstraints.Count; i++) { Constraints c = d.PlainConstraints [i]; var location = LocationsBag.GetLocations (c); var constraint = new Constraint (); constraint.AddChild (new CSharpTokenNode (Convert (c.Location), "where".Length), InvocationExpression.Roles.Keyword); constraint.AddChild (new SimpleType (Identifier.Create (c.TypeParameter.Value, Convert (c.TypeParameter.Location))), Constraint.TypeParameterRole); if (location != null) constraint.AddChild (new CSharpTokenNode (Convert (location [0]), 1), Constraint.ColonRole); var commaLocs = LocationsBag.GetLocations (c.ConstraintExpressions); int curComma = 0; foreach (var expr in c.ConstraintExpressions) { constraint.AddChild (ConvertToType (expr), Constraint.BaseTypeRole); if (commaLocs != null && curComma < commaLocs.Count) constraint.AddChild (new CSharpTokenNode (Convert (commaLocs[curComma++]), 1), InvocationExpression.Roles.Comma); } parent.AddChild (constraint, AstNode.Roles.Constraint); } }