Пример #1
0
 private CodeCatchClause GenerateClause(ExceptHandler eh)
 {
     if (eh.type is Identifier ex)
     {
         return(gen.CatchClause(
                    null,
                    new CodeTypeReference(ex.Name),
                    () => eh.body.Accept(this)));
     }
     else
     {
         return(gen.CatchClause(
                    null,
                    null,
                    () => eh.body.Accept(this)));
     }
 }
Пример #2
0
        private CodeCatchClause GenerateClause(ExceptHandler eh)
        {
            var ex = eh.type as Identifier;

            if (ex != null)
            {
                return(gen.CatchClause(
                           null,
                           new CodeTypeReference(ex.Name),
                           () => eh.body.Accept(this)));
            }
            else
            {
                return(gen.CatchClause(
                           null,
                           null,
                           () => eh.body.Accept(this)));
            }
            throw new NotImplementedException();
        }
Пример #3
0
        public DataType VisitHandler(ExceptHandler h)
        {
            DataType typeval = DataType.Unknown;

            if (h.type != null)
            {
                typeval = h.type.Accept(this);
            }
            if (h.name != null)
            {
                scope.BindByScope(analyzer, h.name, typeval);
            }
            if (h.body != null)
            {
                return(h.body.Accept(this));
            }
            else
            {
                return(DataType.Unknown);
            }
        }
Пример #4
0
            internal static AST Convert(Node node) {
                AST ast;

                if (node is TryStatementHandler)
                    ast = new ExceptHandler((TryStatementHandler)node);
                else
                    throw new ArgumentTypeException("Unexpected node type: " + node.GetType());

                ast.GetSourceLocation(node);
                return ast;
            }