Beispiel #1
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");
        }
Beispiel #2
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));
        }
Beispiel #3
0
        public static bool IsAstSafe(Ast ast, GetSafeValueVisitor.SafeValueContext safeValueContext)
        {
            IsSafeValueVisitor visitor = new IsSafeValueVisitor(safeValueContext);

            return(visitor.IsAstSafe(ast));
        }