MCPcopy
hub / github.com/witheve/Eve / accept

Method accept

src/runtime/join.ts:496–527  ·  view source on GitHub ↗
(multiIndex: MultiIndex, prefix, solvingFor, force?, prejoin?)

Source from the content-addressed store, hash-verified

494 resolveProposal() { throw new Error("Resolving a not proposal"); }
495
496 accept(multiIndex: MultiIndex, prefix, solvingFor, force?, prejoin?) {
497 // if we're in the prejoin phase and this not has no args, then we need
498 // to evaluate the not to see if we should run. If we didn't do this, arg-less
499 // nots won't get evaluated during Generic Join since we're never solving for a
500 // variable that this scan cares about.
501 if((!prejoin || this.args.length)
502 // if we aren't forcing and not solving for the current variable, then we just accept
503 // as it is
504 && (!force && !this.internalVars[solvingFor.id] && this.internalVars.length)
505 // we also blind accept if we have args that haven't been filled in yet, as we don't
506 // have the dependencies necessary to make a decision
507 || !fullyResolved(this.args, prefix)) return true;
508 let resolved = this.resolve(prefix);
509 let notPrefix = [];
510 let ix = 0;
511 for(let arg of this.args) {
512 notPrefix[arg.id] = resolved[ix];
513 ix++;
514 }
515 // console.log("checking not", notPrefix, this.internalVars);
516 let results = [notPrefix];
517 if(this.strata.length === 1) {
518 results = this.strata[0].execute(multiIndex, results, {single: true});
519 } else {
520 for(let stratum of this.strata) {
521 results = stratum.execute(multiIndex, results);
522 if(results.length === 0) break;
523 }
524 }
525 // console.log("checked not!", results.length);
526 return !results.length;
527 }
528
529}
530

Callers

nothing calls this directly

Calls 3

resolveMethod · 0.95
fullyResolvedFunction · 0.85
executeMethod · 0.45

Tested by

no test coverage detected