11import { compileAndRun as compileAndRunCCode } from '@sourceacademy/c-slang/ctowasm/dist/index' ;
22import { tokenizer } from 'acorn' ;
33import { Context , interrupt , Result , resume , runFilesInContext } from 'js-slang' ;
4- import { ACORN_PARSE_OPTIONS , TRY_AGAIN } from 'js-slang/dist/constants' ;
4+ import { ACORN_PARSE_OPTIONS } from 'js-slang/dist/constants' ;
55import { InterruptedError } from 'js-slang/dist/errors/errors' ;
66import { manualToggleDebugger } from 'js-slang/dist/stdlib/inspector' ;
77import { Chapter , ErrorSeverity , ErrorType , SourceError , Variant } from 'js-slang/dist/types' ;
@@ -110,22 +110,9 @@ export function* evalCodeSaga(
110110 ) ;
111111
112112 const entrypointCode = files [ entrypointFilePath ] ;
113- const lastNonDetResult = yield select (
114- ( state : OverallState ) => state . workspaces [ workspaceLocation ] . lastNonDetResult
115- ) ;
116113
117114 function call_variant ( variant : Variant ) {
118- if ( variant === Variant . NON_DET ) {
119- return entrypointCode . trim ( ) === TRY_AGAIN
120- ? call ( resume , lastNonDetResult )
121- : call ( runFilesInContext , files , entrypointFilePath , context , {
122- executionMethod : 'interpreter' ,
123- originalMaxExecTime : execTime ,
124- stepLimit : stepLimit ,
125- useSubst : substActiveAndCorrectChapter ,
126- envSteps : currentStep
127- } ) ;
128- } else if ( variant === Variant . LAZY ) {
115+ if ( variant === Variant . LAZY ) {
129116 return call ( runFilesInContext , files , entrypointFilePath , context , {
130117 scheduler : 'preemptive' ,
131118 originalMaxExecTime : execTime ,
@@ -251,7 +238,6 @@ export function* evalCodeSaga(
251238 } ) ;
252239 }
253240
254- const isNonDet : boolean = context . variant === Variant . NON_DET ;
255241 const isLazy : boolean = context . variant === Variant . LAZY ;
256242 const isWasm : boolean = context . variant === Variant . WASM ;
257243 const isC : boolean = context . chapter === Chapter . FULL_C ;
@@ -268,11 +254,19 @@ export function* evalCodeSaga(
268254 ? DisplayBufferService . attachConsole ( workspaceLocation )
269255 : ( ) => { } ;
270256
271- const { result, interrupted, paused } = yield race ( {
257+ const {
258+ result,
259+ interrupted,
260+ paused
261+ } : {
262+ result : Result ;
263+ interrupted : any ;
264+ paused : any ;
265+ } = yield race ( {
272266 result :
273267 actionType === InterpreterActions . debuggerResume . type
274268 ? call ( resume , lastDebuggerResult )
275- : isNonDet || isLazy || isWasm
269+ : isLazy || isWasm
276270 ? call_variant ( context . variant )
277271 : isC
278272 ? call ( cCompileAndRun , entrypointCode , context )
@@ -339,7 +333,6 @@ export function* evalCodeSaga(
339333 if (
340334 result . status !== 'suspended' &&
341335 result . status !== 'finished' &&
342- result . status !== 'suspended-non-det' &&
343336 result . status !== 'suspended-cse-eval'
344337 ) {
345338 yield * dumpDisplayBuffer ( workspaceLocation , isStoriesBlock , storyEnv ) ;
@@ -383,11 +376,6 @@ export function* evalCodeSaga(
383376 yield put ( actions . endDebuggerPause ( workspaceLocation ) ) ;
384377 yield put ( actions . evalInterpreterSuccess ( 'Breakpoint hit!' , workspaceLocation ) ) ;
385378 return ;
386- } else if ( isNonDet ) {
387- if ( result . value === 'cut' ) {
388- result . value = undefined ;
389- }
390- yield put ( actions . updateLastNonDetResult ( result , workspaceLocation ) ) ;
391379 }
392380
393381 yield * dumpDisplayBuffer ( workspaceLocation , isStoriesBlock , storyEnv ) ;
0 commit comments