Example #1
0
    public System.Object VisitThrowStatement(System.Management.Automation.Language.ThrowStatementAst throwStatementAst)
    {
        IScriptExtent mappedExtent = MapExtent(throwStatementAst.Extent);

        PipelineBaseAst mappedPipeline = _VisitPipelineBase(throwStatementAst.Pipeline);

        return(new ThrowStatementAst(mappedExtent, mappedPipeline));
    }
Example #2
0
 public override AstVisitAction VisitThrowStatement(ThrowStatementAst ast) { return CheckParent(ast); }
Example #3
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     return(false);
 }
Example #4
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     throw PSTraceSource.NewArgumentException("ast");
 }
Example #5
0
 public override AstVisitAction VisitThrowStatement(ThrowStatementAst ast)
 {
     return(Check(ast));
 }
Example #6
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     this.ControlFlowStatement(throwStatementAst.Pipeline);
     return(null);
 }
Example #7
0
 public override AstVisitAction VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     throw new NotImplementedException(); //VisitThrowStatement(throwStatementAst);
 }
Example #8
0
        public override AstVisitAction VisitThrowStatement(ThrowStatementAst throwStatementAst)
        {
            object targetObject = GetTargetObject(throwStatementAst);
            if (targetObject is Exception)
            {
                throw (Exception)targetObject;
            }

            string errorMessage = GetErrorMessageForThrowStatement(targetObject);
            throw new RuntimeException(errorMessage);
        }
Example #9
0
 public override AstVisitAction VisitThrowStatement(ThrowStatementAst ast)
 {
     return this.Check(ast);
 }
 public override AstVisitAction VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     this.ReportError(throwStatementAst, () => ParserStrings.FlowControlStatementNotSupportedInDataSection, new object[0]);
     return(AstVisitAction.Continue);
 }
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst) { throw new UnexpectedElementException(); }
Example #12
0
 /// <summary/>
 public virtual AstVisitAction VisitThrowStatement(ThrowStatementAst throwStatementAst) => DefaultVisit(throwStatementAst);
Example #13
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     Expression expr = throwStatementAst.IsRethrow ? _currentExceptionBeingHandled : ((throwStatementAst.Pipeline == null) ? ExpressionCache.NullConstant : this.CaptureStatementResults(throwStatementAst.Pipeline, CaptureAstContext.Assignment, null));
     return Expression.Block(this.UpdatePosition(throwStatementAst), Expression.Throw(Expression.Call(CachedReflectionInfo.ExceptionHandlingOps_ConvertToException, expr.Convert(typeof(object)), Expression.Constant(throwStatementAst.Extent))));
 }
Example #14
0
 /// <summary/>
 public virtual object VisitThrowStatement(ThrowStatementAst throwStatementAst) { return null; }
 /// <summary/>
 public virtual object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     return _decorated.VisitThrowStatement(throwStatementAst);
 }
Example #16
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst) { return AutomationNull.Value; }
Example #17
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst) { throw PSTraceSource.NewArgumentException("ast"); }
Example #18
0
 private object GetTargetObject(ThrowStatementAst throwStatementAst)
 {
     if (throwStatementAst.Pipeline != null)
     {
         object targetObject = EvaluateAst(throwStatementAst.Pipeline, false);
         if (targetObject is PSObject)
         {
             return ((PSObject)targetObject).BaseObject;
         }
         return targetObject;
     }
     return null;
 }
Example #19
0
        public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
        {
            // We should not preserve the partial output if exception is thrown when evaluating throwStmt.pipeline.
            Expression throwExpr = throwStatementAst.IsRethrow
                                       ? s_currentExceptionBeingHandled
                                       : (throwStatementAst.Pipeline == null)
                                             ? ExpressionCache.NullConstant
                                             : CaptureStatementResults(throwStatementAst.Pipeline,
                                                                       CaptureAstContext.AssignmentWithoutResultPreservation);

            return Expression.Block(
                UpdatePosition(throwStatementAst),
                Expression.Throw(Expression.Call(CachedReflectionInfo.ExceptionHandlingOps_ConvertToException,
                                                 throwExpr.Convert(typeof(object)),
                                                 Expression.Constant(throwStatementAst.Extent))));
        }
Example #20
0
 public virtual AstVisitAction VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     return AstVisitAction.Continue;
 }
Example #21
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     // Even if we are in try-catch, we still can safely assume that flow can go to exit from here.
     // Additional exit point would not affect correctness of analysis: we handle throwing of any statement inside try-body in VisitTryStatement.
     ControlFlowStatement(throwStatementAst.Pipeline)._throws = true;
     return null;
 }
Example #22
0
 /// <summary/>
 public virtual object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     return(null);
 }
 public override AstVisitAction VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     this.ReportError(throwStatementAst, () => ParserStrings.FlowControlStatementNotSupportedInDataSection, new object[0]);
     return AstVisitAction.Continue;
 }
Example #24
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     return false;
 }
Example #25
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     this.ControlFlowStatement(throwStatementAst.Pipeline);
     return null;
 }
Example #26
0
 /// <summary/>
 public virtual AstVisitAction VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     return(AstVisitAction.Continue);
 }
        /// <summary>
        /// Visit throw statement
        /// </summary>
        /// <param name="throwStatementAst"></param>
        /// <returns></returns>
        public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
        {
            if (throwStatementAst == null) return null;

            ControlFlowStatement(throwStatementAst.Pipeline)._throws = true;
            return null;
        }
Example #28
0
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     return(AutomationNull.Value);
 }
 public object VisitThrowStatement(ThrowStatementAst throwStatementAst)
 {
     throw new NotImplementedException();
 }