コード例 #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
ファイル: MethodCore.cs プロジェクト: Arsslensoft/VSharp
        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
ファイル: EnumDeclaration.cs プロジェクト: Arsslensoft/VSharp
 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
ファイル: FieldContainer.cs プロジェクト: Arsslensoft/VSharp
 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
ファイル: TypeDeclaration.cs プロジェクト: Arsslensoft/VSharp
 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
ファイル: Parameter.cs プロジェクト: Arsslensoft/VSharp
        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)
 {
 }