(parse = this.lastParse)
| 42 | } |
| 43 | |
| 44 | makeEvaluation(parse = this.lastParse) { |
| 45 | if(this.evaluation) { |
| 46 | this.evaluation.close(); |
| 47 | this.evaluation = undefined; |
| 48 | } |
| 49 | |
| 50 | let build = builder.buildDoc(parse); |
| 51 | let {blocks, errors} = build; |
| 52 | this.sendErrors(errors); |
| 53 | // TODO: What is the right way to gate analysis? This seems hacky, but I'm not sure |
| 54 | // that the RuntimeClient should really know/care about whether or not the editor is |
| 55 | // hooked up. Maybe there should be a flag for analysis instead? |
| 56 | if(this.extraDBs["editor"]) { |
| 57 | analyzer.analyze(blocks.map((block) => block.parse), parse.spans, parse.extraInfo); |
| 58 | } |
| 59 | |
| 60 | let ev = new Evaluation(); |
| 61 | let session = new Database(); |
| 62 | session.blocks = blocks; |
| 63 | ev.registerDatabase("session", session); |
| 64 | |
| 65 | let extraDBs = this.extraDBs; |
| 66 | if(!extraDBs["browser"]) { |
| 67 | ev.registerDatabase("browser", new BrowserSessionDatabase(this)); |
| 68 | } |
| 69 | if(!extraDBs["event"]) { |
| 70 | ev.registerDatabase("event", new BrowserEventDatabase()); |
| 71 | } |
| 72 | |
| 73 | if(!extraDBs["system"]) { |
| 74 | ev.registerDatabase("system", system.instance); |
| 75 | } |
| 76 | |
| 77 | for(let dbName of Object.keys(this.extraDBs)) { |
| 78 | let db = extraDBs[dbName]; |
| 79 | ev.registerDatabase(dbName, db); |
| 80 | } |
| 81 | |
| 82 | ev.errorReporter = (kind, error) => { |
| 83 | this.send(JSON.stringify({type: "error", kind, message: error})); |
| 84 | } |
| 85 | |
| 86 | this.evaluation = ev; |
| 87 | |
| 88 | return ev; |
| 89 | } |
| 90 | |
| 91 | sendErrors(errors) { |
| 92 | if(!errors.length) return; |
nothing calls this directly
no test coverage detected