Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ Please note that doing this will disable the test suite, so you will need to run
cd scripts\
bash test.sh

## For Testing of js-slang
## js-slang

### Alpha version

Use branch js-slang-alpha-preview to see the new changes (native and verbose errors).

Have `"enable verbose";` as the first line of your program to activate verbose messages.
Currently using a version of js-slang with native and verbose errors.

Edit https://github.com/source-academy/cadet-frontend/blob/57ba44f6b55c214d0f20339cd45bece57f24f48c/src/sagas/index.ts#L260

to toggle native.
to toggle native (default is native enabled).

### To run local copy of js-slang

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"draft-js": "^0.10.5",
"flexboxgrid": "^6.3.1",
"flexboxgrid-helpers": "^1.1.3",
"js-slang": "0.2.0",
"js-slang": "0.2.1-alpha.4",
"lodash": "^4.17.11",
"lz-string": "^1.4.4",
"moment": "^2.22.2",
Expand Down
6 changes: 3 additions & 3 deletions src/mocks/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { parse } from 'acorn';
import { FunctionExpression } from 'estree';
import Closure from 'js-slang/dist/closure';
import createContext from 'js-slang/dist/createContext';
import { Context, Frame } from 'js-slang/dist/types';
import { Context, Environment } from 'js-slang/dist/types';
import { TypeError } from 'js-slang/dist/utils/rttc';

export function mockContext(chapter = 1): Context {
Expand All @@ -13,7 +13,7 @@ export function mockRuntimeContext(): Context {
const context = createContext();
context.runtime = {
isRunning: true,
frames: [],
environments: [],
nodes: [
{
type: 'Literal',
Expand All @@ -31,7 +31,7 @@ export function mockRuntimeContext(): Context {
}

export function mockClosure(): Closure {
return new Closure({} as FunctionExpression, {} as Frame, {} as Context);
return new Closure({} as FunctionExpression, {} as Environment, {} as Context);
}

export function mockTypeError(): TypeError {
Expand Down
2 changes: 1 addition & 1 deletion src/sagas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function* playgroundSaga(): SagaIterator {

function* evalCode(code: string, context: Context, location: WorkspaceLocation) {
const { result, interrupted } = yield race({
result: call(runInContext, code, context, { scheduler: 'preemptive' }),
result: call(runInContext, code, context, { scheduler: 'preemptive', isNativeRunnable: true }),
/**
* A BEGIN_INTERRUPT_EXECUTION signals the beginning of an interruption,
* i.e the trigger for the interpreter to interrupt execution.
Expand Down
13 changes: 10 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5227,9 +5227,10 @@ js-base64@^2.1.9:
version "2.4.3"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.3.tgz#2e545ec2b0f2957f41356510205214e98fad6582"

js-slang@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/js-slang/-/js-slang-0.2.0.tgz#15b998d2e67bc2834421235f96408b4015bb322c"
js-slang@0.2.1-alpha.3:
version "0.2.1-alpha.3"
resolved "https://registry.yarnpkg.com/js-slang/-/js-slang-0.2.1-alpha.3.tgz#8e93828c67e0eb729ce229f66cadc5e081730541"
integrity sha512-iLEhlsrW1kbZ1OZ0rlVrhrFSsAacLAjqSqLuMqO+bAbdbZq2xc1wtQk+/xrj1hnRFRJhPqZH5qQetQm8vkQqFg==
dependencies:
"@types/estree" "0.0.39"
acorn "^6.0.5"
Expand All @@ -5238,6 +5239,7 @@ js-slang@0.2.0:
commander "^2.19.0"
common-tags "^1.8.0"
invariant "^2.2.4"
source-map "^0.7.3"

js-tokens@^3.0.0, js-tokens@^3.0.2:
version "3.0.2"
Expand Down Expand Up @@ -8998,6 +9000,11 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"

source-map@^0.7.3:
version "0.7.3"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==

spdx-correct@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82"
Expand Down