public override void visit(exception_handler eh)
        {
            if (eh.variable != null)
            {
                // Вначале переименовать везде кроме как в заголовке, потом добавить в блок операторов переприсваивание
                var vis = new RenameOnExceptVarsVisitor();
                vis.Rename(eh);

                var vs  = new var_statement(new ident(vis.NewName /*, eh.statements.source_context*/), new ident(vis.NameForRename, eh.variable.source_context) /*, eh.statements.source_context*/);
                var stl = new List <statement>();
                stl.Add(vs);
                if (eh.statements != null)
                {
                    stl.Add(eh.statements);
                    ReplaceStatementUsingParent(eh.statements, stl);
                }
                else
                {
                    var s = new statement_list(stl);
                    s.Parent         = eh;
                    s.source_context = eh.source_context;
                    eh.statements    = s;
                }
            }
            base.visit(eh);
        }
 public void Rename(exception_handler eh)
 {
     NameForRename = eh.variable?.name?.ToLower();
     if (NameForRename != null)
     {
         NewName = GetNewVariableName(NameForRename);
         ProcessNode(eh.statements);
     }
 }
        /*public override void visit(exception_handler eh)
         * {
         *  _visitor.visit(eh);
         *  SymbolInfo si = _visitor.context.find_first(eh.variable.name);
         *  _currentTreeNode.VariablesDefinedInScope.Add(new CapturedVariablesTreeNode.CapturedSymbolInfo(eh, si));
         *  ProcessNode(eh.statements);
         * }*/

        public override void visit(exception_handler eh)
        {
            // Отдельным визитором переменные в on присвою локальным переменным и переименую везде внутри блока
            statements_list sl = new statements_list(_visitor.get_location(eh.statements));

            _visitor.convertion_data_and_alghoritms.statement_list_stack_push(sl);

            _visitor.context.enter_code_block_without_bind();

            if (eh.variable != null)
            {
                _visitor.context.add_var_definition(eh.variable.name, _visitor.get_location(eh.variable), _visitor.convert_strong(eh.type_name), PascalABCCompiler.SemanticTree.polymorphic_state.ps_common, true);
            }
            //SymbolInfo si = _visitor.context.find_first(eh.variable.name);
            //var csi = new CapturedVariablesTreeNode.CapturedSymbolInfo(eh, si);
            //_currentTreeNode.VariablesDefinedInScope.Add(new CapturedVariablesTreeNode.CapturedSymbolInfo(eh, si));
            //_pendingCapturedSymbols.Add(csi);
            ProcessNode(eh.variable);

            ProcessNode(eh.statements);
            _visitor.context.leave_code_block();
            _visitor.convertion_data_and_alghoritms.statement_list_stack_pop();
            //_pendingCapturedSymbols.Remove(csi);
        }
Пример #4
0
 public override void visit(exception_handler _exception_handler)
 {
 }
Пример #5
0
 public virtual void visit(exception_handler _exception_handler)
 {
     DefaultVisit(_exception_handler);
 }
Пример #6
0
		public override void visit(exception_handler _exception_handler)
		{
			DefaultVisit(_exception_handler);
			pre_do_visit(_exception_handler);
			visit(exception_handler.variable);
			visit(exception_handler.type_name);
			visit(exception_handler.statements);
			post_do_visit(_exception_handler);
		}
Пример #7
0
		public virtual void post_do_visit(exception_handler _exception_handler)
		{
		}
 public override void visit(exception_handler _exception_handler)
 {
     ProcessNode(_exception_handler.statements);
 }
Пример #9
0
 public virtual void visit(exception_handler _exception_handler)
 {
 }
Пример #10
0
 public override void visit(exception_handler _exception_handler)
 {
     throw new NotImplementedException();
 }
Пример #11
0
		public virtual void visit(exception_handler _exception_handler)
		{
		}
		public virtual void visit(exception_handler _exception_handler)
		{
			DefaultVisit(_exception_handler);
		}
Пример #13
0
 public override void visit(exception_handler _exception_handler)
 {
     prepare_node(_exception_handler.variable, "variable");
     prepare_node(_exception_handler.type_name, "type_name");
     prepare_node(_exception_handler.statements, "statements");
 }
Пример #14
0
		public override void visit(exception_handler _exception_handler)
		{
			executer.visit(_exception_handler);
			if (_exception_handler.variable != null)
				this.visit((dynamic)_exception_handler.variable);
			if (_exception_handler.type_name != null)
				this.visit((dynamic)_exception_handler.type_name);
			if (_exception_handler.statements != null)
				this.visit((dynamic)_exception_handler.statements);
		}