File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,29 @@ FASTPythonCFGTest >> setUp [
3131 builder := FASTPythonCFGBuilder new
3232]
3333
34+ { #category : ' tests' }
35+ FASTPythonCFGTest >> testFunctionWithIf [
36+
37+ | nextBlock |
38+ self skip.
39+ self flag: #todo . " Finish"
40+ self buildCFGFor: ' def f(i):
41+ if i > 3:
42+ print(i)' .
43+
44+ self assert: startBlock isConditional.
45+ self assert: startBlock isFinal. " If the condition is false then the block is indeed final"
46+ self assert: startBlock statements size equals: 1 .
47+ self assert: (startBlock statements first class isOfType: FASTPyComparisonOperator ).
48+ self assert: startBlock nextBlocks size equals: 2 .
49+ self assert: (startBlock nextBlock select: #isNullBlock ) size equals: 1 .
50+
51+ nextBlock := startBlock nextBlockForValue: true .
52+ self assert: nextBlock isConditional not .
53+ self assert: nextBlock isFinal.
54+ self assertEmpty: nextBlock statements
55+ ]
56+
3457{ #category : ' tests' }
3558FASTPythonCFGTest >> testFunctionWithOneStatement [
3659
Original file line number Diff line number Diff line change @@ -35,6 +35,14 @@ FASTPythonCFGVisitor >> visitFASTPyReturnStatement: aReturn [
3535 cfgBuilder currentBlock nextBlock: FASTNullBlock new
3636]
3737
38+ { #category : ' visiting' }
39+ FASTPythonCFGVisitor >> visitFASTTConditionalStatement: aStatement [
40+
41+ cfgBuilder newConditionalBlock: aStatement.
42+
43+ super visitFASTTConditionalStatement: aStatement
44+ ]
45+
3846{ #category : ' visiting' }
3947FASTPythonCFGVisitor >> visitFASTTStatement: aStatement [
4048
You can’t perform that action at this time.
0 commit comments