Esempio n. 1
0
        /// <summary>
        /// Used for retrieving applied source security attributes, i.e. attributes derived from well-known SecurityAttribute.
        /// </summary>
        public IEnumerable <Cci.SecurityAttribute> GetSecurityAttributes <T>(ImmutableArray <T> customAttributes)
            where T : Cci.ICustomAttribute
        {
            Debug.Assert(!customAttributes.IsDefault);
            Debug.Assert(_lazyPathsForPermissionSetFixup == null || _lazySecurityActions != null && _lazyPathsForPermissionSetFixup.Length == _lazySecurityActions.Length);

            if (_lazySecurityActions != null)
            {
                Debug.Assert(_lazySecurityActions != null);
                Debug.Assert(_lazySecurityActions.Length == customAttributes.Length);

                for (int i = 0; i < customAttributes.Length; i++)
                {
                    if (_lazySecurityActions[i] != 0)
                    {
                        DeclarativeSecurityAction action    = (DeclarativeSecurityAction)_lazySecurityActions[i];
                        Cci.ICustomAttribute      attribute = customAttributes[i];

                        if (_lazyPathsForPermissionSetFixup?[i] != null)
                        {
                            attribute = new PermissionSetAttributeWithFileReference(attribute, _lazyPathsForPermissionSetFixup[i]);
                        }

                        yield return(new Cci.SecurityAttribute(action, attribute));
                    }
                }
            }
        }
Esempio n. 2
0
        internal PrivateImplementationDetails(
            Cci.IModule moduleBuilder,
            string moduleName,
            int submissionSlotIndex,
            Cci.ITypeReference systemObject,
            Cci.ITypeReference systemValueType,
            Cci.ITypeReference systemInt8Type,
            Cci.ITypeReference systemInt16Type,
            Cci.ITypeReference systemInt32Type,
            Cci.ITypeReference systemInt64Type,
            Cci.ICustomAttribute compilerGeneratedAttribute)
        {
            Debug.Assert(systemObject != null);
            Debug.Assert(systemValueType != null);

            _moduleBuilder   = moduleBuilder;
            _systemObject    = systemObject;
            _systemValueType = systemValueType;

            _systemInt8Type  = systemInt8Type;
            _systemInt16Type = systemInt16Type;
            _systemInt32Type = systemInt32Type;
            _systemInt64Type = systemInt64Type;

            _compilerGeneratedAttribute = compilerGeneratedAttribute;

            var isNetModule = moduleBuilder.AsAssembly == null;

            _name = GetClassName(moduleName, submissionSlotIndex, isNetModule);
        }
Esempio n. 3
0
        public PermissionSetAttributeWithFileReference(Cci.ICustomAttribute sourceAttribute, string resolvedPermissionSetFilePath)
        {
            RoslynDebug.Assert(resolvedPermissionSetFilePath != null);

            _sourceAttribute = sourceAttribute;
            _resolvedPermissionSetFilePath = resolvedPermissionSetFilePath;
        }
        internal PrivateImplementationDetails(
            Cci.IModule module,
            int submissionSlotIndex,
            Cci.ITypeReference systemObject,
            Cci.ITypeReference systemValueType,
            Cci.ITypeReference systemInt8Type,
            Cci.ITypeReference systemInt16Type,
            Cci.ITypeReference systemInt32Type,
            Cci.ITypeReference systemInt64Type,
            Cci.ICustomAttribute compilerGeneratedAttribute)
        {
            Debug.Assert(module != null);
            Debug.Assert(systemObject != null);
            Debug.Assert(systemValueType != null);

            this.module = module;
            this.systemObject = systemObject;
            this.systemValueType = systemValueType;

            this.systemInt8Type = systemInt8Type;
            this.systemInt16Type = systemInt16Type;
            this.systemInt32Type = systemInt32Type;
            this.systemInt64Type = systemInt64Type;

            this.compilerGeneratedAttribute = compilerGeneratedAttribute;
            this.name = GetClassName(submissionSlotIndex);
        }
        internal PrivateImplementationDetails(
            Cci.IModule module,
            int submissionSlotIndex,
            Cci.ITypeReference systemObject,
            Cci.ITypeReference systemValueType,
            Cci.ITypeReference systemInt8Type,
            Cci.ITypeReference systemInt16Type,
            Cci.ITypeReference systemInt32Type,
            Cci.ITypeReference systemInt64Type,
            Cci.ICustomAttribute compilerGeneratedAttribute)
        {
            Debug.Assert(module != null);
            Debug.Assert(systemObject != null);
            Debug.Assert(systemValueType != null);

            this.module          = module;
            this.systemObject    = systemObject;
            this.systemValueType = systemValueType;

            this.systemInt8Type  = systemInt8Type;
            this.systemInt16Type = systemInt16Type;
            this.systemInt32Type = systemInt32Type;
            this.systemInt64Type = systemInt64Type;

            this.compilerGeneratedAttribute = compilerGeneratedAttribute;
            this.name = GetClassName(submissionSlotIndex);
        }
        public PermissionSetAttributeWithFileReference(Cci.ICustomAttribute sourceAttribute, string resolvedPermissionSetFilePath)
        {
            Debug.Assert(resolvedPermissionSetFilePath != null);

            _sourceAttribute = sourceAttribute;
            _resolvedPermissionSetFilePath = resolvedPermissionSetFilePath;
        }
        internal PrivateImplementationDetails(
            Cci.IModule moduleBuilder,
            string moduleName,
            int submissionSlotIndex,
            Cci.ITypeReference systemObject,
            Cci.ITypeReference systemValueType,
            Cci.ITypeReference systemInt8Type,
            Cci.ITypeReference systemInt16Type,
            Cci.ITypeReference systemInt32Type,
            Cci.ITypeReference systemInt64Type,
            Cci.ICustomAttribute compilerGeneratedAttribute)
        {
            Debug.Assert(systemObject != null);
            Debug.Assert(systemValueType != null);

            _moduleBuilder = moduleBuilder;
            _systemObject = systemObject;
            _systemValueType = systemValueType;

            _systemInt8Type = systemInt8Type;
            _systemInt16Type = systemInt16Type;
            _systemInt32Type = systemInt32Type;
            _systemInt64Type = systemInt64Type;

            _compilerGeneratedAttribute = compilerGeneratedAttribute;

            var isNetModule = moduleBuilder.AsAssembly == null;
            _name = GetClassName(moduleName, submissionSlotIndex, isNetModule);
        }
Esempio n. 8
0
        public PermissionSetAttributeWithFileReference(Cci.ICustomAttribute sourceAttribute, string resolvedPermissionSetFilePath)
        {
            Debug.Assert(!String.IsNullOrEmpty(resolvedPermissionSetFilePath));
            Debug.Assert(PathUtilities.IsAbsolute(resolvedPermissionSetFilePath));

            this.sourceAttribute = sourceAttribute;
            this.resolvedPermissionSetFilePath = resolvedPermissionSetFilePath;
        }
        public PermissionSetAttributeWithFileReference(Cci.ICustomAttribute sourceAttribute, string resolvedPermissionSetFilePath)
        {
            Debug.Assert(!String.IsNullOrEmpty(resolvedPermissionSetFilePath));
            Debug.Assert(PathUtilities.IsAbsolute(resolvedPermissionSetFilePath));

            this.sourceAttribute = sourceAttribute;
            this.resolvedPermissionSetFilePath = resolvedPermissionSetFilePath;
        }