Babel.Compiler.TypeCheckingVisitor.VisitProtect C# (CSharp) 메소드

VisitProtect() 공개 메소드

public VisitProtect ( ProtectStatement protect ) : void
protect ProtectStatement
리턴 void
        public override void VisitProtect(ProtectStatement protect)
        {
            protect.StatementList.Accept(this);
            foreach (ProtectWhen when in protect.WhenPartList) {
                when.TypeSpecifier.Accept(this);
                TypeData prevExceptionType = currentExceptionType;
                currentExceptionType = when.TypeSpecifier.NodeType;
                when.ThenPart.Accept(this);
                currentExceptionType = prevExceptionType;
            }
            if (protect.ElsePart != null) {
                TypeData prevExceptionType = currentExceptionType;
                currentExceptionType =
                    typeManager.GetTypeData(typeof(Exception));
                protect.ElsePart.Accept(this);
                currentExceptionType = prevExceptionType;
            }
            if (protect.WhenPartList.Length == 0 &&
                protect.ElsePart == null) {
                report.Error(protect.Location,
                             "`protect' statements must have `when' or `else'");
            }
        }