asyncronise executor (#115)

* Intital async of executor

The execture now sends websocket message instead of calling functions
directly from the engine, When it does so it holds onto the id.
The engine is still returning geo/polys directly but I'm working make it
so that the UI doesn't need to know about that, so that we can switch
over the streaming ui.

Things left to do:
- it is still making both direct function calls and websockets, and the former should be removed.
- It does highlighting of segments and sourceRanges not through websockets and that needs to be fixed.
- Tests have not been adjusted for these changes.
- Selecting the head of a segment is not working correctly again yet.

* Rough engine prep changes (#135)

* rough changes for engine prep

* mouse movements working again

* connect to engine for startsketch, line, close and extrude
This commit is contained in:
Kurt Hutten
2023-06-22 16:43:33 +10:00
committed by GitHub
parent dd3117cf03
commit 2d3c73d46a
39 changed files with 1798 additions and 2443 deletions

View File

@ -1,13 +1,13 @@
import { processMemory } from './MemoryPanel'
import { lexer } from '../lang/tokeniser'
import { abstractSyntaxTree } from '../lang/abstractSyntaxTree'
import { executor } from '../lang/executor'
import { executor } from '../lib/testHelpers'
import { initPromise } from '../lang/rust'
beforeAll(() => initPromise)
describe('processMemory', () => {
it('should grab the values and remove and geo data', () => {
it('should grab the values and remove and geo data', async () => {
const code = `
const myVar = 5
const myFn = (a) => {
@ -28,7 +28,7 @@ describe('processMemory', () => {
show(theExtrude, theSketch)`
const tokens = lexer(code)
const ast = abstractSyntaxTree(tokens)
const programMemory = executor(ast, {
const programMemory = await executor(ast, {
root: {
log: {
type: 'userVal',
@ -38,7 +38,7 @@ describe('processMemory', () => {
__meta: [],
},
},
_sketch: [],
pendingMemory: {},
})
const output = processMemory(programMemory)
expect(output.myVar).toEqual(5)