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: implement variable declaration check #1517

Closed NhatMinh0208 closed 9 months ago

NhatMinh0208 commented 9 months ago

Description:

In the stepper and transpiler, the function checkForUndefinedVariables ensures that all variables used in the program are declared before the program is run. The CSE machine does not include this check, meaning that some programs containing undeclared variables run normally if such variables are never accessed. This PR implements a version of checkForUndefinedVariables for the CSE machine, which the stepper can also utilize.

Changes:

coveralls commented 9 months ago

Pull Request Test Coverage Report for Build 7680369385


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/transpiler/transpiler.ts 52 54 96.3%
<!-- Total: 59 61 96.72% -->
Files with Coverage Reduction New Missed Lines %
src/ec-evaluator/utils.ts 1 86.5%
<!-- Total: 1 -->
Totals Coverage Status
Change from base Build 7593229382: 0.1%
Covered Lines: 10908
Relevant Lines: 12711

💛 - Coveralls