예제 #1
0
 public PropertyDeclaration(TypeContainer parent, FullNamedExpression type, Modifiers mod,
                            MemberName name, VSharpAttributes attrs)
     : base(parent, type, mod, parent is InterfaceDeclaration ? AllowedModifiersInterface :
            parent is StructDeclaration? AllowedModifiersStruct :
            AllowedModifiersClass, name, attrs, SymbolKind.Property)
 {
 }
예제 #2
0
 public OperatorDeclaration(TypeContainer parent, VSC.TypeSystem.Resolver.OperatorType type, FullNamedExpression ret_type, Modifiers mod_flags, ParametersCompiled parameters,
                            ToplevelBlock block, VSharpAttributes attrs, Location loc)
     : base(parent, ret_type, mod_flags, AllowedModifiers, new MemberName(VSC.TypeSystem.Resolver.ResolveContext.GetMetadataName(type), loc), parameters, attrs, SymbolKind.Operator)
 {
     OperatorType = type;
     this.block   = block;
 }
예제 #3
0
        public DelegateDeclaration(TypeContainer parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, ParametersCompiled param_list,
                                   VSharpAttributes attrs, CompilationSourceFile file)
            : base(parent, mod_flags | Modifiers.SEALED, AllowedModifiers, name, attrs, name.Location, TypeKind.Delegate, file)

        {
            BaseTypes.Add(KnownTypeReference.MulticastDelegate);
            this.ReturnType = type;
            parameters      = param_list;
            List <IUnresolvedParameter> uparameters = new List <IUnresolvedParameter>();

            foreach (Parameter p in param_list.parameters)
            {
                uparameters.Add(p);
            }


            AddDefaultMethodsToDelegate(type as ITypeReference, uparameters);


            if (attrs != null)
            {
                IUnresolvedMethod invokeMethod = (IUnresolvedMethod)Members.Single(m => m.Name == "Invoke");
                foreach (IUnresolvedAttribute attr in attrs.Attrs.Where(x => x.ExplicitTarget == "ret").ToList())
                {
                    invokeMethod.ReturnTypeAttributes.Add(attr);
                }
            }
        }
예제 #4
0
 public MethodDeclaration(TypeContainer parent, FullNamedExpression returnType, Modifiers mod,
                          MemberName name, ParametersCompiled parameters, VSharpAttributes attrs)
     : base(parent, returnType, mod, parent is InterfaceDeclaration ? AllowedModifiersInterface :
            parent is StructDeclaration ? AllowedModifiersStruct :
            AllowedModifiersClass, name, parameters, attrs, SymbolKind.Method)
 {
     SetTypeParameters(name);
 }
예제 #5
0
 public void AddAttributes(VSharpAttributes attr)
 {
     if (attr != null)
     {
         foreach (var att in attr.Attrs)
         {
             moduleAttributes.Add(att);
         }
     }
 }
예제 #6
0
 public PropertyOrIndexer(TypeContainer parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod,
                          MemberName name, VSharpAttributes attrs, SymbolKind sym)
     : base(parent, type, mod, allowed_mod, name, attrs, sym)
 {
     this.SymbolKind = SymbolKind.Property;
     this.DeclaringTypeDefinition = parent;
     this.Name = name.Name;
     if (parent != null)
     {
         this.UnresolvedFile = parent.UnresolvedFile;
     }
 }
예제 #7
0
        public MethodCore(TypeContainer parent, FullNamedExpression returnType, Modifiers mod, Modifiers allowed,
                          MemberName name, ParametersCompiled parameters, VSharpAttributes attrs, SymbolKind sym)
            : base(parent, returnType, mod, allowed, name, attrs, sym)
        {
            this.DeclaringTypeDefinition = parent;
            this.Name = name.Name;
            if (parent != null)
            {
                this.UnresolvedFile = parent.UnresolvedFile;
            }
            this.typeParameters = new List <IUnresolvedTypeParameter>();

            this.aparameters = parameters;
            this.parameters  = aparameters.parameters;
        }
예제 #8
0
        protected MemberContainer(TypeContainer parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, Modifiers def_mod, MemberName name, VSharpAttributes attrs, SymbolKind sym)
        {
            caching_flags   = Flags.Obsolete_Undetected;
            this.SymbolKind = sym;
            this.Parent     = parent;
            this.declaringTypeDefinition = parent;
            this.name = name.Name;
            if (parent != null)
            {
                this.UnresolvedFile = parent.UnresolvedFile;
            }
            this.type_expr = type;
            this.attribs   = attrs;
            member_name    = name;
            mod_flags      = mod;

            mod_flags = ModifiersExtensions.Check(allowed_mod, mod, def_mod, name.Location, Report);
            if (DeclaringTypeDefinition.Kind == TypeKind.Interface)
            {
                mod_flags |= Modifiers.PUBLIC | Modifiers.ABSTRACT;
            }


            if (attrs != null)
            {
                foreach (var a in attrs.Attrs)
                {
                    this.attributes.Add(a);
                }
            }

            this.returnType = type as ITypeReference;

            if (member_name.ExplicitInterface != null)
            {
                ApplyExplicit(null);
            }
        }
예제 #9
0
 public EnumMemberDeclaration(EnumDeclaration parent, MemberName name, VSharpAttributes attrs)
     : base(parent, parent as ITypeReference, Modifiers.PUBLIC, name, attrs)
 {
 }
예제 #10
0
 public ClassOrStructDeclaration(TypeContainer ns, Modifiers mods, Modifiers allowed, MemberName name, VSharpAttributes attr, Location l, TypeKind kind, CompilationSourceFile file)
     : base(ns, mods, allowed, name, attr, l, kind, file)
 {
 }
예제 #11
0
 public AddEventAccessor(EventDeclaration method, Modifiers mods, VSharpAttributes attrs, Location loc)
     : base(method, AddPrefix, mods, attrs, loc)
 {
 }
예제 #12
0
 public EnumDeclaration(TypeContainer parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, VSharpAttributes attrs, CompilationSourceFile file)
     : base(parent, mod_flags, AllowedModifiers, name, attrs, name.Location, TypeKind.Enum, file)
 {
     if (type != null)
     {
         SetBaseTypes(type);
     }
     mod_flags |= Modifiers.SEALED;
 }
예제 #13
0
 public FieldDeclaration(TypeContainer parent, FullNamedExpression type, Modifiers mods, Modifiers allowed, MemberName name, VSharpAttributes attr)
     : base(parent, type, mods, allowed, name, attr, SymbolKind.Field)
 {
 }
예제 #14
0
 public ConstantDeclaration(TypeContainer parent, FullNamedExpression type, Modifiers mods, MemberName name, VSharpAttributes attr)
     : base(parent, type, mods, AllowedModifiers, name, attr, SymbolKind.Field)
 {
     mod_flags |= Modifiers.STATIC;
 }
예제 #15
0
        //
        // If true, this is an explicit interface implementation
        //

        protected InterfaceMemberContainer(TypeContainer parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, MemberName name, VSharpAttributes attrs, SymbolKind sym)
            : base(parent, type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs, sym)
        {
            IsInterfaceMember = parent.Kind == TypeKind.Interface;
        }
예제 #16
0
 public StructDeclaration(TypeContainer parent, MemberName name, Modifiers mod, VSharpAttributes attrs, Location l, CompilationSourceFile file)
     : base(parent, mod, AllowedModifiers, name, attrs, l, TypeKind.Struct, file)
 {
     mod_flags |= Modifiers.SEALED;
 }
예제 #17
0
 public ClassDeclaration(PackageContainer parent, MemberName name, Modifiers mod, VSharpAttributes attrs, Location l, CompilationSourceFile file)
     : base(parent, mod, AllowedModifiers, name, attrs, l, TypeKind.Class, file)
 {
 }
예제 #18
0
 public GetterDeclaration(PropertyOrIndexer method, Modifiers modifiers, ParametersCompiled par, VSharpAttributes attrs, Location loc)
     : base(method, method.TypeExpression, modifiers, "get_", par, attrs, loc)
 {
 }
예제 #19
0
 public FieldContainer(TypeContainer parent, FullNamedExpression type, Modifiers mods, Modifiers allowed, MemberName name, VSharpAttributes attr, SymbolKind sym)
     : base(parent, type, mods, allowed, Modifiers.PRIVATE, name, attr, sym)
 {
     if ((mods & Modifiers.ABSTRACT) != 0)
     {
         Report.Error(233, Location, "The modifier 'abstract' is not valid on fields. Try using a property instead");
     }
 }
예제 #20
0
 public EventDeclaration(TypeContainer parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, VSharpAttributes attrs, bool autogen = false)
     : base(parent, type, mod_flags, name, attrs)
 {
     IsAutoGenerated = autogen;
 }
예제 #21
0
 public ConstructorDeclaration(TypeContainer parent, string name, Modifiers mod, VSharpAttributes attrs, ParametersCompiled args, Location loc)
     : base(parent, new TypeExpression(parent, loc), mod, AllowedModifiers, new MemberName(name, loc), args, attrs, SymbolKind.Constructor)
 {
 }
예제 #22
0
 public TypeDeclaration(TypeContainer ns, Modifiers mods, Modifiers allowed, MemberName name, VSharpAttributes attr, Location l, TypeKind kind, CompilationSourceFile file)
     : base(ns, name, l, file)
 {
     if (attr != null)
     {
         this.AddAttributes(attr);
     }
     this.mod_flags = mods;
     this.mod_flags = ModifiersExtensions.Check(allowed, mods, ns.Name == "default" ? Modifiers.INTERNAL : Modifiers.PRIVATE, l, Report);
     this.Kind      = kind;
 }
예제 #23
0
 public DestructorDeclaration(TypeContainer parent, Modifiers mod, ParametersCompiled parameters, VSharpAttributes attrs, Location l)
     : base(parent, new TypeExpression(KnownTypeReference.Void, l), mod, AllowedModifiers, new MemberName(MetadataName, l), parameters, attrs, SymbolKind.Destructor)
 {
     ModFlags &= ~Modifiers.PRIVATE;
     ModFlags |= Modifiers.PROTECTED | Modifiers.OVERRIDE;
 }
예제 #24
0
 public PropertyMethod(PropertyBasedMember method, FullNamedExpression returnType, Modifiers modifiers, string prefix, ParametersCompiled parameters, VSharpAttributes attrs, Location loc)
     : base(method, returnType, modifiers, AllowedModifiers, prefix, parameters, attrs, loc)
 {
 }
예제 #25
0
 public IndexerDeclaration(TypeContainer parent, FullNamedExpression type, MemberName name, Modifiers mod, ParametersCompiled parameters, VSharpAttributes attrs)
     : base(parent, type, mod,
            parent is InterfaceDeclaration ? AllowedInterfaceModifiers : AllowedModifiers,
            name, attrs, SymbolKind.Indexer)
 {
     this.parameters = parameters;
 }
예제 #26
0
 protected PropertyBasedMember(TypeContainer parent, FullNamedExpression type, Modifiers mod,
                               Modifiers allowed_mod, MemberName name, VSharpAttributes attrs, SymbolKind sym)
     : base(parent, type, mod, allowed_mod, name, attrs, sym)
 {
 }
예제 #27
0
 public ConstantDeclaration(TypeContainer parent, ITypeReference type, Modifiers mods, MemberName name, VSharpAttributes attr)
     : base(parent, new TypeExpression(type, name.Location), mods, AllowedModifiers, name, attr, SymbolKind.Field)
 {
     mod_flags |= Modifiers.STATIC;
 }
예제 #28
0
 public IndexerSetterDeclaration(PropertyOrIndexer property, Modifiers modifiers, ParametersCompiled parameters, VSharpAttributes attrs, Location loc)
     : base(property, modifiers, parameters, attrs, loc)
 {
 }
예제 #29
0
        public Parameter(FullNamedExpression type, string name, ParameterModifier mods, VSharpAttributes attr, Location loc)
            : this(type as ITypeReference, name, loc)
        {
            if ((mods & ParameterModifier.Out) == ParameterModifier.Out)
            {
                IsOut = true;
                CompilerContext.InternProvider.Intern(new ByReferenceTypeReference(this.type));
            }

            if ((mods & ParameterModifier.Ref) == ParameterModifier.Ref)
            {
                IsRef = true;
                CompilerContext.InternProvider.Intern(new ByReferenceTypeReference(this.type));
            }

            if ((mods & ParameterModifier.Self) == ParameterModifier.Self)
            {
                IsSelf = true;
            }
            if ((mods & ParameterModifier.Params) == ParameterModifier.Params)
            {
                IsParams = true;
            }


            if (attr != null)
            {
                foreach (var a in attr.Attrs)
                {
                    this.attributes.Add(a);
                }
            }
        }
예제 #30
0
 public FieldDeclaration(TypeContainer parent, FullNamedExpression type, Modifiers mods, MemberName name, VSharpAttributes attr)
     : this(parent, type, mods, AllowedFieldModifiers, name, attr)
 {
 }