Ejemplo n.º 1
0
        private static SyntaxTree.if_node CreateNestedRegionBorder(bool ifEnter)
        {
            SyntaxTree.if_node result = new PascalABCCompiler.SyntaxTree.if_node();
            SyntaxTree.un_expr ue = new PascalABCCompiler.SyntaxTree.un_expr();
            ue.operation_type = PascalABCCompiler.SyntaxTree.Operators.LogicalNOT;
            ue.subnode = new SyntaxTree.ident(TreeConverter.compiler_string_consts.OMP_NESTED);
            result.condition = ue;

            SyntaxTree.assign AssignInParVar = new PascalABCCompiler.SyntaxTree.assign();
            AssignInParVar.operator_type = PascalABCCompiler.SyntaxTree.Operators.Assignment;
            AssignInParVar.from = new SyntaxTree.ident(ifEnter ? "true" : "false");
            AssignInParVar.to = new SyntaxTree.ident(InParallelSection);

            result.then_body = AssignInParVar;

            return result;
        }
Ejemplo n.º 2
0
 private static if_node CreateIfCondition(syntax_tree_visitor syntax_tree_visitor, statements_list ifthen, statements_list ifelse, location loc)
 {
     //сохраняем контекст
     ContextInfo contextInfo = new ContextInfo(syntax_tree_visitor);
     
     if_node res = null;
     try
     {
         SyntaxTree.if_node if_node = new PascalABCCompiler.SyntaxTree.if_node();
         SyntaxTree.un_expr une = new PascalABCCompiler.SyntaxTree.un_expr();
         une.operation_type = SyntaxTree.Operators.LogicalNOT;
         une.subnode = new SyntaxTree.ident(InParallelSection);
         if_node.condition = une;
         if_node.then_body = new SyntaxTree.empty_statement();
         if_node.then_body = new SyntaxTree.empty_statement();
         res = syntax_tree_visitor.convert_strong(if_node) as if_node;
         res.then_body = ifthen;
         res.else_body = ifelse;
         res.location = loc;
     }
     finally
     {
         //восстанавливаем контекст
         contextInfo.RestoreContext(syntax_tree_visitor);
     }
     return res;
 }