Exemple #1
0
 public static bool IsAstSafe(Ast ast, GetSafeValueVisitor.SafeValueContext safeValueContext)
 {
     IsSafeValueVisitor visitor = new IsSafeValueVisitor(safeValueContext);
     if ((bool)ast.Accept(visitor) && visitor._visitCount < MaxVisitCount)
     {
         return true;
     }
     return false;
 }
 public static bool IsAstSafe(Ast ast, GetSafeValueVisitor.SafeValueContext safeValueContext)
 {
     IsSafeValueVisitor visitor = new IsSafeValueVisitor(safeValueContext);
     if ((bool)ast.Accept(visitor) && visitor._visitCount < MaxVisitCount)
     {
         return true;
     }
     return false;
 }
Exemple #3
0
        public static object GetSafeValue(Ast ast, ExecutionContext context, SafeValueContext safeValueContext)
        {
            s_context = context;
            if (IsSafeValueVisitor.IsAstSafe(ast, safeValueContext))
            {
                return(ast.Accept(new GetSafeValueVisitor()));
            }

            if (safeValueContext == SafeValueContext.ModuleAnalysis)
            {
                return(null);
            }
            throw PSTraceSource.NewArgumentException("ast");
        }
Exemple #4
0
        public static object GetSafeValue(Ast ast, ExecutionContext context, SafeValueContext safeValueContext)
        {
            t_context = context;

            if (safeValueContext == SafeValueContext.SkipHashtableSizeCheck || IsSafeValueVisitor.IsAstSafe(ast, safeValueContext))
            {
                return(ast.Accept(new GetSafeValueVisitor()));
            }

            if (safeValueContext == SafeValueContext.ModuleAnalysis)
            {
                return(null);
            }

            throw PSTraceSource.NewArgumentException(nameof(ast));
        }
        public static bool IsAstSafe(Ast ast, GetSafeValueVisitor.SafeValueContext safeValueContext)
        {
            IsSafeValueVisitor visitor = new IsSafeValueVisitor(safeValueContext);

            return(visitor.IsAstSafe(ast));
        }