How to use the js-slang/dist/createContext function in js-slang

To help you get started, we’ve selected a few js-slang examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github source-academy / cadet-frontend / src / mocks / context.ts View on Github external
export function mockRuntimeContext(): Context {
  const context = createContext();
  context.runtime = {
    isRunning: true,
    environments: [],
    nodes: [
      {
        type: 'Literal',
        loc: {
          start: { line: 1, column: 0 },
          end: { line: 1, column: 1 }
        },
        value: 0,
        raw: '0',
        range: [0, 1]
      }
    ]
  };
github source-academy / cadet-frontend / src / utils / slangHelper.ts View on Github external
export function createContext(chapter: number, externals: string[], externalContext: T) {
  return createSlangContext(chapter, externals, externalContext, externalBuiltIns);
}
github source-academy / cadet-frontend / src / mocks / context.ts View on Github external
export function mockContext(chapter = 1): Context {
  return createContext(chapter);
}