Esempio n. 1
0
    public System.Object VisitCatchClause(System.Management.Automation.Language.CatchClauseAst catchClauseAst)
    {
        IScriptExtent mappedExtent = MapExtent(catchClauseAst.Extent);

        LinkedList <TypeConstraintAst> mappedCatchTypes = new LinkedList <TypeConstraintAst>();

        foreach (TypeConstraintAst tc in catchClauseAst.CatchTypes)
        {
            mappedCatchTypes.AddLast((TypeConstraintAst)VisitTypeConstraint(tc));
        }
        StatementBlockAst mappedBody = (StatementBlockAst)VisitStatementBlock(catchClauseAst.Body);


        return(new CatchClauseAst(mappedExtent, mappedCatchTypes, mappedBody));
    }
Esempio n. 2
0
 public override AstVisitAction VisitTryStatement(TryStatementAst tryStatementAst)
 {
     if (tryStatementAst.CatchClauses.Count > 1)
     {
         for (int i = 0; i < (tryStatementAst.CatchClauses.Count - 1); i++)
         {
             CatchClauseAst ast = tryStatementAst.CatchClauses[i];
             for (int j = i + 1; j < tryStatementAst.CatchClauses.Count; j++)
             {
                 CatchClauseAst ast2 = tryStatementAst.CatchClauses[j];
                 if (ast.IsCatchAll)
                 {
                     this._parser.ReportError(Parser.Before(ast2.Extent), ParserStrings.EmptyCatchNotLast, new object[0]);
                     break;
                 }
                 if (!ast2.IsCatchAll)
                 {
                     foreach (TypeConstraintAst ast3 in ast.CatchTypes)
                     {
                         Type reflectionType = ast3.TypeName.GetReflectionType();
                         if (reflectionType != null)
                         {
                             foreach (TypeConstraintAst ast4 in ast2.CatchTypes)
                             {
                                 Type type2 = ast4.TypeName.GetReflectionType();
                                 if ((type2 != null) && ((reflectionType == type2) || type2.IsSubclassOf(reflectionType)))
                                 {
                                     this._parser.ReportError(ast4.Extent, ParserStrings.ExceptionTypeAlreadyCaught, new object[] { type2.FullName });
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return(AstVisitAction.Continue);
 }
 /// <summary/>
 public virtual object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return _decorated.VisitCatchClause(catchClauseAst);
 }
Esempio n. 4
0
 public override AstVisitAction VisitCatchClause(CatchClauseAst ast) { return CheckParent(ast); }
Esempio n. 5
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return(false);
 }
Esempio n. 6
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     throw PSTraceSource.NewArgumentException("ast");
 }
Esempio n. 7
0
 public override AstVisitAction VisitCatchClause(CatchClauseAst ast)
 {
     return(Check(ast));
 }
Esempio n. 8
0
 public virtual AstVisitAction VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return AstVisitAction.Continue;
 }
Esempio n. 9
0
 public override AstVisitAction VisitCatchClause(CatchClauseAst ast)
 {
     return this.Check(ast);
 }
 public override AstVisitAction VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return(AstVisitAction.Continue);
 }
 public object VisitCatchClause(CatchClauseAst catchClauseAst) { throw new UnexpectedElementException(); }
Esempio n. 12
0
        public override AstVisitAction VisitCatchClause(CatchClauseAst catchClauseAst)
        {
            Diagnostics.Assert(FoundError, "VisitTryStatement should have reported an error");

            return AstVisitAction.Continue;
        }
Esempio n. 13
0
 /// <summary/>
 public virtual AstVisitAction VisitCatchClause(CatchClauseAst catchClauseAst) => DefaultVisit(catchClauseAst);
Esempio n. 14
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return null;
 }
Esempio n. 15
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst) { return AutomationNull.Value; }
Esempio n. 16
0
 public override AstVisitAction VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     throw new NotImplementedException(); //VisitCatchClause(catchClauseAst);
 }
Esempio n. 17
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst) { throw PSTraceSource.NewArgumentException("ast"); }
Esempio n. 18
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     catchClauseAst.Body.Accept(this);
     return(null);
 }
Esempio n. 19
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     Diagnostics.Assert(false, "the catch body is visited directly from VisitTryStatement.");
     return null;
 }
Esempio n. 20
0
 /// <summary/>
 public virtual object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return(null);
 }
Esempio n. 21
0
 public override AstVisitAction VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return AstVisitAction.Continue;
 }
Esempio n. 22
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return false;
 }
Esempio n. 23
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     catchClauseAst.Body.Accept(this);
     return null;
 }
Esempio n. 24
0
 /// <summary/>
 public virtual AstVisitAction VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return(AstVisitAction.Continue);
 }
        /// <summary>
        /// Visit catch clause
        /// </summary>
        /// <param name="catchClauseAst"></param>
        /// <returns></returns>
        public object VisitCatchClause(CatchClauseAst catchClauseAst)
        {
            if (catchClauseAst == null) return null;

            catchClauseAst.Body.Visit(this.Decorator);
            return null;
        }
Esempio n. 26
0
 public object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     return(AutomationNull.Value);
 }
 public object VisitCatchClause(CatchClauseAst catchClauseAst)
 {
     throw new NotImplementedException();
 }