.. _stdlib_ast_block_to_loop: ======================= DECS、AST 块到循环 ======================= .. include:: detail/ast_block_to_loop.rst ast_block_to_loop 模块将块到循环转换作为 DECS 基础设施的一部分实现。 所有函数和符号都在 “ast_block_to_loop” 模块中,使用 require 来访问它。 :: require daslib/ast_block_to_loop ++++++++++++++++++++++++ 块到循环转换 ++++++++++++++++++++++++ * :ref:`convert_block_to_loop (blk:smart_ptr\ -const;failOnReturn:bool const;replaceReturnWithContinue:bool const;requireContinueCond:bool const) : void ` .. _function-_at_ast_block_to_loop_c__c_convert_block_to_loop_1_ls_H_ls_ast_c__c_Expression_gr__gr__qm_M_Cb_Cb_Cb: .. das:function:: convert_block_to_loop(blk: smart_ptr; failOnReturn: bool const; replaceReturnWithContinue: bool const; requireContinueCond: bool const) +-------------------------+-----------------------------------------------------------+ +argument +argument type + +=========================+===========================================================+ +blk +smart_ptr< :ref:`ast::Expression ` >+ +-------------------------+-----------------------------------------------------------+ +failOnReturn +bool const + +-------------------------+-----------------------------------------------------------+ +replaceReturnWithContinue+bool const + +-------------------------+-----------------------------------------------------------+ +requireContinueCond +bool const + +-------------------------+-----------------------------------------------------------+ 将 Closure Block 转换为 loop。 如果 `failOnReturn` 为 true,则不允许在块内返回。 如果 `replaceReturnWithContinue` 为 true,则 `return cond;` 替换为 `if cond; continue;`。 如果 `requireContinueCond` 为 false,则 `return;` 替换为 `continue;`,否则为错误。