コード例 #1
0
 internal static SetterDelegate ScopeTypeSetterDelegate(ScopeLocation scopeLocation)
 {
     return(delegate(object value, IPropertyBag propertyBag)
     {
         RoleFlagsFormat.SetScopeBits((uint)((ScopeType)value), propertyBag, scopeLocation);
     });
 }
コード例 #2
0
            public override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration)
            {
                ADRawEntry adrawEntry = this.TargetObject ?? (RbacQuery.LegacyTargetObject as ADRawEntry);

                if (adrawEntry != null && !(adrawEntry is ADConfigurationObject) && !(adrawEntry is OrganizationConfig))
                {
                    ScopeLocation scopeLocation = this.CmdletName.StartsWith("get-", StringComparison.OrdinalIgnoreCase) ? ScopeLocation.RecipientRead : ScopeLocation.RecipientWrite;
                    return(new bool?(rbacConfiguration.IsCmdletAllowedInScope(this.CmdletName, this.ParameterNames ?? new string[0], adrawEntry, scopeLocation)));
                }
                return(new bool?(rbacConfiguration.IsCmdletAllowedInScope(this.QualifiedCmdletName, this.ParameterNames, this.ScopeSet)));
            }
コード例 #3
0
        /// <summary>
        /// Devuelve informacion asociada al tipo
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        public TypeInfo GetTypeInfo(string typeId)
        {
            ScopeLocation sl = HasType(typeId);

            if (sl == ScopeLocation.NotDeclared)
            {
                throw new ArgumentException("El tipo no esta declarado");
            }
            if (sl == ScopeLocation.DeclaredLocal)
            {
                return(types[typeId]);
            }
            return(Parent.GetTypeInfo(typeId));
        }
コード例 #4
0
        public TScope this[ScopeLocation scopeLocation]
        {
            get
            {
                switch (scopeLocation)
                {
                case ScopeLocation.RecipientRead:
                    return(this.recipientReadScope);

                case ScopeLocation.RecipientWrite:
                    return(this.recipientWriteScope);

                case ScopeLocation.ConfigRead:
                    return(this.configReadScope);

                case ScopeLocation.ConfigWrite:
                    return(this.configWriteScope);

                default:
                    throw new ArgumentException("scopeLocation");
                }
            }
        }
コード例 #5
0
        public override bool VisitVarDeclaration(VarDeclarationAST expr)
        {
            expr.CurrentScope = _scope;

            ScopeLocation idLocation = _scope.HasVar(expr.Id);

            if (idLocation == ScopeLocation.DeclaredLocal)
            {
                _errorListener.Add(new AnalysisError(string.Format(AnalysisError.LoadMessage("VarDecl"), expr.Id), expr.Line, expr.Columns));
                expr.ReturnType = TigerType.GetType <ErrorType>();
                return(false);
            }
            if (idLocation != ScopeLocation.NotDeclared)
            {
                _errorListener.Add(AnalysisError.VariableHidesAnotherOne(expr));
            }

            //TODO: Rename ExpressionValue to NamedExpression
            expr.ExpressionValue.Accept(this);


            //se asume q no habran problemas de compatibilidad
            expr.ReturnType = TigerType.GetType <NoType>();

            // si se expecifico de forma explicita el tipo de la variable...
            if (!string.IsNullOrEmpty(expr.TypeId))
            {
                TigerType tt;
                //existe el tipo
                if (_scope.HasType(expr.TypeId, out tt) != ScopeLocation.NotDeclared)
                {
                    //el tipo de la variable no machea con el de la expression
                    if (!expr.ExpressionValue.ReturnType.CanConvertTo(tt))
                    {
                        _errorListener.Add(
                            new AnalysisError(
                                string.Format(AnalysisError.LoadMessage("Match"), expr.TypeId, expr.ExpressionValue.ReturnType.TypeID),
                                expr.Line, expr.Columns));
                        expr.ReturnType = TigerType.GetType <ErrorType>();
                        _scope.AddVar(expr.Id, TigerType.GetType <ErrorType>().TypeID);
                        return(false);
                    }
                    expr.ReturnType = expr.ExpressionValue.ReturnType;
                    //si me especifica el tipo explicitamente .
                    _scope.AddVar(expr.Id, tt.TypeID);
                    return(true);
                }
                // no existe el tipo de la variable
                _errorListener.Add(AnalysisError.TypeIsNotDefined(expr, expr.TypeId));
                expr.ReturnType = TigerType.GetType <ErrorType>();
                _scope.AddVar(expr.Id, TigerType.GetType <ErrorType>().TypeID);
                return(false);
            }
            if (!expr.ExpressionValue.ReturnType.IsLegalType)
            {
                _errorListener.Add(AnalysisError.TypeCannotBeInferred(expr, expr.Id));
                expr.ReturnType = TigerType.GetType <ErrorType>();
                _scope.AddVar(expr.Id, TigerType.GetType <ErrorType>().TypeID);
                return(false);
            }
            _scope.AddVar(expr.Id, expr.ExpressionValue.ReturnType.TypeID);
            return(true);
        }
コード例 #6
0
 internal static GetterDelegate ScopeTypeGetterDelegate(ScopeLocation scopeLocation)
 {
     return((IPropertyBag propertyBag) => (ScopeType)RoleFlagsFormat.GetScopeBits(propertyBag, scopeLocation));
 }
コード例 #7
0
        private static void SetScopeBits(uint valueToSet, IPropertyBag propertyBag, ScopeLocation scopeLocation)
        {
            int num = (int)propertyBag[ExchangeRoleSchema.RoleFlags];

            propertyBag[ExchangeRoleSchema.RoleFlags] = (int)(((ulong)num & (ulong)(~(31L << (RoleFlagsFormat.ScopeShifts[(int)scopeLocation] & 31)))) | (ulong)((ulong)(valueToSet & 31U) << RoleFlagsFormat.ScopeShifts[(int)scopeLocation]));
        }
コード例 #8
0
        private static uint GetScopeBits(IPropertyBag propertyBag, ScopeLocation scopeLocation)
        {
            int num = (int)propertyBag[ExchangeRoleSchema.RoleFlags];

            return((uint)num >> RoleFlagsFormat.ScopeShifts[(int)scopeLocation] & 31U);
        }