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;
            }