source-academy / js-slang

Implementations of sublanguages of JavaScript, TypeScript, Scheme and Python
https://source-academy.github.io/source/
Apache License 2.0
70 stars 104 forks source link

CSE Machine: `hasXStatement` fixes #1521

Closed NhatMinh0208 closed 9 months ago

NhatMinh0208 commented 9 months ago

Description:

The functions hasContinueStatement, hasReturnStatement and hasBreakStatement are used to detect continue, return and break statements. These functions expect a block statement and recurse into if statements, meaning they fail on else if constructs since these constructs nest an if statement inside an if statement.

This PR adds variants of the above functions ( hasContinueStatementIf, hasReturnStatementIf and hasBreakStatementIf) so that else if constructs can now be properly recursed into.

Changes:

coveralls commented 9 months ago

Pull Request Test Coverage Report for Build 7765429242


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/cse-machine/utils.ts 33 38 86.84%
<!-- Total: 33 38 86.84% -->
Totals Coverage Status
Change from base Build 7758878252: 0.002%
Covered Lines: 10926
Relevant Lines: 12732

💛 - Coveralls