Skip to content

Commit 3a51a9d

Browse files
committed
Remove non det
1 parent d84e9ca commit 3a51a9d

File tree

7 files changed

+15
-50
lines changed

7 files changed

+15
-50
lines changed

src/commons/__tests__/Markdown.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ test('Markdown page renders correct Source information', () => {
3737
const source3Default = <Markdown {...mockProps(Chapter.SOURCE_3, Variant.DEFAULT)} />;
3838
expect(source3Default.props.content).toContain('Source \xa73');
3939

40-
const source3NonDet = <Markdown {...mockProps(Chapter.SOURCE_3, Variant.NON_DET)} />;
41-
expect(source3NonDet.props.content).toContain('Source \xa73 Non-Det');
42-
4340
const source3Concurrent = <Markdown {...mockProps(Chapter.SOURCE_3, Variant.CONCURRENT)} />;
4441
expect(source3Concurrent.props.content).toContain('Source \xa73 Concurrent');
4542

src/commons/application/ApplicationTypes.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ type LanguageFeatures = Partial<{
156156
const variantDisplay: Map<Variant, string> = new Map([
157157
[Variant.TYPED, 'Typed'],
158158
[Variant.WASM, 'WebAssembly'],
159-
[Variant.NON_DET, 'Non-Det'],
160159
[Variant.CONCURRENT, 'Concurrent'],
161160
[Variant.LAZY, 'Lazy'],
162161
[Variant.GPU, 'GPU'],
@@ -268,7 +267,6 @@ const sourceSubLanguages: Array<Pick<SALanguage, 'chapter' | 'variant'>> = [
268267
{ chapter: Chapter.SOURCE_3, variant: Variant.DEFAULT },
269268
{ chapter: Chapter.SOURCE_3, variant: Variant.TYPED },
270269
{ chapter: Chapter.SOURCE_3, variant: Variant.CONCURRENT },
271-
{ chapter: Chapter.SOURCE_3, variant: Variant.NON_DET },
272270
{ chapter: Chapter.SOURCE_3, variant: Variant.NATIVE },
273271

274272
{ chapter: Chapter.SOURCE_4, variant: Variant.DEFAULT },
@@ -291,8 +289,7 @@ export const sourceLanguages: SALanguage[] = sourceSubLanguages.map(sublang => {
291289
(variant === Variant.DEFAULT || variant === Variant.NATIVE || variant === Variant.TYPED);
292290

293291
// Enable CSE Machine for Source Chapter 3 and above
294-
supportedFeatures.cseMachine =
295-
chapter >= Chapter.SOURCE_3 && variant !== Variant.CONCURRENT && variant !== Variant.NON_DET;
292+
supportedFeatures.cseMachine = chapter >= Chapter.SOURCE_3 && variant !== Variant.CONCURRENT;
296293

297294
// Local imports/exports require Source 2+ as Source 1 does not have lists.
298295
supportedFeatures.multiFile = chapter >= Chapter.SOURCE_2;
@@ -424,7 +421,6 @@ export const createDefaultWorkspace = (workspaceLocation: WorkspaceLocation): Wo
424421
enableDebugging: true,
425422
debuggerContext: {} as DebuggerContext,
426423
lastDebuggerResult: undefined,
427-
lastNonDetResult: null,
428424
files: {}
429425
});
430426

src/commons/application/__tests__/ApplicationTypes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ describe('available Source language configurations', () => {
6262
variant: Variant.CONCURRENT,
6363
supports: { dataVisualizer: true }
6464
},
65-
{ chapter: Chapter.SOURCE_3, variant: Variant.NON_DET, supports: { dataVisualizer: true } },
6665
{
6766
chapter: Chapter.SOURCE_3,
6867
variant: Variant.NATIVE,

src/commons/sagas/WorkspaceSaga/helpers/evalCode.ts

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { compileAndRun as compileAndRunCCode } from '@sourceacademy/c-slang/ctowasm/dist/index';
22
import { tokenizer } from 'acorn';
33
import { 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';
55
import { InterruptedError } from 'js-slang/dist/errors/errors';
66
import { manualToggleDebugger } from 'js-slang/dist/stdlib/inspector';
77
import { 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);

src/commons/workspace/WorkspaceActions.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createAction } from '@reduxjs/toolkit';
2-
import { Context, Result } from 'js-slang';
2+
import type { Context } from 'js-slang';
33
import { Chapter, Variant } from 'js-slang/dist/types';
44

55
import { AllColsSortStates, GradingColumnVisibility } from '../../features/grading/GradingTypes';
@@ -14,7 +14,6 @@ import {
1414
SubmissionsTableFilters,
1515
TOGGLE_USING_UPLOAD,
1616
UPDATE_LAST_DEBUGGER_RESULT,
17-
UPDATE_LAST_NON_DET_RESULT,
1817
UPLOAD_FILES,
1918
WorkspaceLocation,
2019
WorkspaceLocationsWithTools,
@@ -281,13 +280,6 @@ export const updateLastDebuggerResult = createAction(
281280
})
282281
);
283282

284-
export const updateLastNonDetResult = createAction(
285-
UPDATE_LAST_NON_DET_RESULT,
286-
(lastNonDetResult: Result, workspaceLocation: WorkspaceLocation) => ({
287-
payload: { lastNonDetResult, workspaceLocation }
288-
})
289-
);
290-
291283
export const toggleUsingUpload = createAction(
292284
TOGGLE_USING_UPLOAD,
293285
(usingUpload: boolean, workspaceLocation: WorkspaceLocationsWithTools) => ({
@@ -306,7 +298,6 @@ export const uploadFiles = createAction(
306298
export default {
307299
...newActions,
308300
updateLastDebuggerResult,
309-
updateLastNonDetResult,
310301
toggleUsingUpload,
311302
uploadFiles
312303
};

src/commons/workspace/WorkspaceReducer.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,6 @@ const newWorkspaceReducer = createReducer(defaultWorkspaceManager, builder => {
380380
.addCase(WorkspaceActions.updateLastDebuggerResult, (state, action) => {
381381
const workspaceLocation = getWorkspaceLocation(action);
382382
state[workspaceLocation].lastDebuggerResult = action.payload.lastDebuggerResult;
383-
})
384-
.addCase(WorkspaceActions.updateLastNonDetResult, (state, action) => {
385-
const workspaceLocation = getWorkspaceLocation(action);
386-
state[workspaceLocation].lastNonDetResult = action.payload.lastNonDetResult;
387383
});
388384
});
389385

src/commons/workspace/WorkspaceTypes.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Context, Result } from 'js-slang';
1+
import type { Context } from 'js-slang';
22

33
import { AllColsSortStates, GradingColumnVisibility } from '../../features/grading/GradingTypes';
44
import { SourcecastWorkspaceState } from '../../features/sourceRecorder/sourcecast/SourcecastTypes';
@@ -11,7 +11,6 @@ import { UploadResult } from '../sideContent/content/SideContentUpload';
1111

1212
export const EVAL_SILENT = 'EVAL_SILENT';
1313
export const UPDATE_LAST_DEBUGGER_RESULT = 'UPDATE_LAST_DEBUGGER_RESULT';
14-
export const UPDATE_LAST_NON_DET_RESULT = 'UPDATE_LAST_NON_DET_RESULT';
1514
export const TOGGLE_USING_UPLOAD = 'TOGGLE_USING_UPLOAD';
1615
export const UPLOAD_FILES = 'UPLOAD_FILES';
1716

@@ -106,7 +105,6 @@ export type WorkspaceState = {
106105
readonly globals: Array<[string, any]>;
107106
readonly debuggerContext: DebuggerContext;
108107
readonly lastDebuggerResult: any;
109-
readonly lastNonDetResult: Result | null;
110108
readonly files: UploadResult;
111109
};
112110

0 commit comments

Comments
 (0)