@@ -158,11 +158,13 @@ mod tests {
158158
159159 #[ test]
160160 fn test_control_flow_analyzer_simple ( ) {
161- let lines = vec ! [ Line :: FunctionRet ( crate :: lang:: ast:: statement:: FunctionRet {
162- return_data: vec![ Expression :: Value ( SimpleExpr :: Constant (
163- ConstExpression :: scalar( 42 ) ,
164- ) ) ] ,
165- } ) ] ;
161+ let lines = vec ! [ Line :: FunctionRet (
162+ crate :: lang:: ast:: statement:: FunctionRet {
163+ return_data: vec![ Expression :: Value ( SimpleExpr :: Constant (
164+ ConstExpression :: scalar( 42 ) ,
165+ ) ) ] ,
166+ } ,
167+ ) ] ;
166168
167169 let analysis = ControlFlowAnalyzer :: analyze ( & lines) ;
168170 assert ! ( analysis. has_returns) ;
@@ -172,18 +174,22 @@ mod tests {
172174
173175 #[ test]
174176 fn test_control_flow_analyzer_nested ( ) {
175- let lines = vec ! [ Line :: IfCondition ( crate :: lang:: ast:: statement:: IfCondition {
176- condition: Boolean :: Equal {
177- left: Expression :: Value ( SimpleExpr :: Constant ( ConstExpression :: scalar( 1 ) ) ) ,
178- right: Expression :: Value ( SimpleExpr :: Constant ( ConstExpression :: scalar( 1 ) ) ) ,
177+ let lines = vec ! [ Line :: IfCondition (
178+ crate :: lang:: ast:: statement:: IfCondition {
179+ condition: Boolean :: Equal {
180+ left: Expression :: Value ( SimpleExpr :: Constant ( ConstExpression :: scalar( 1 ) ) ) ,
181+ right: Expression :: Value ( SimpleExpr :: Constant ( ConstExpression :: scalar( 1 ) ) ) ,
182+ } ,
183+ then_branch: vec![ Line :: FunctionRet (
184+ crate :: lang:: ast:: statement:: FunctionRet {
185+ return_data: vec![ Expression :: Value ( SimpleExpr :: Constant (
186+ ConstExpression :: scalar( 100 ) ,
187+ ) ) ] ,
188+ } ,
189+ ) ] ,
190+ else_branch: vec![ ] ,
179191 } ,
180- then_branch: vec![ Line :: FunctionRet ( crate :: lang:: ast:: statement:: FunctionRet {
181- return_data: vec![ Expression :: Value ( SimpleExpr :: Constant (
182- ConstExpression :: scalar( 100 ) ,
183- ) ) ] ,
184- } ) ] ,
185- else_branch: vec![ ] ,
186- } ) ] ;
192+ ) ] ;
187193
188194 let analysis = ControlFlowAnalyzer :: analyze ( & lines) ;
189195 assert ! ( analysis. has_returns) ;
@@ -199,11 +205,13 @@ mod tests {
199205 left: Expression :: Value ( SimpleExpr :: Constant ( ConstExpression :: scalar( 1 ) ) ) ,
200206 right: Expression :: Value ( SimpleExpr :: Constant ( ConstExpression :: scalar( 1 ) ) ) ,
201207 } ,
202- then_branch: vec![ Line :: FunctionRet ( crate :: lang:: ast:: statement:: FunctionRet {
203- return_data: vec![ Expression :: Value ( SimpleExpr :: Constant (
204- ConstExpression :: scalar( 100 ) ,
205- ) ) ] ,
206- } ) ] ,
208+ then_branch: vec![ Line :: FunctionRet (
209+ crate :: lang:: ast:: statement:: FunctionRet {
210+ return_data: vec![ Expression :: Value ( SimpleExpr :: Constant (
211+ ConstExpression :: scalar( 100 ) ,
212+ ) ) ] ,
213+ } ,
214+ ) ] ,
207215 else_branch: vec![ ] ,
208216 } ) ,
209217 Line :: FunctionRet ( crate :: lang:: ast:: statement:: FunctionRet {
0 commit comments