MCPcopy Index your code
hub / github.com/witheve/Eve / checkSubBlockEqualities

Function checkSubBlockEqualities

src/runtime/builder.ts:222–251  ·  view source on GitHub ↗
(context, block)

Source from the content-addressed store, hash-verified

220}
221
222function checkSubBlockEqualities(context, block) {
223 // if we have an equality that is with a constant, then we need to add
224 // a node for that equality since we couldn't fold the constant into the variable
225 let equalityIx = 0;
226 for(let equality of block.equalities) {
227 if(!equality) continue;
228 let [left, right] = equality;
229 let needsEquality;
230 let hasLeft = context.hasVariable(left);
231 let hasRight = context.hasVariable(right);
232 if(left.type === "constant" && (hasRight || right.type === "constant")) {
233 needsEquality = true;
234 } else if(right.type === "constant" && (hasLeft || left.type === "constant")) {
235 needsEquality = true;
236 } else if(hasLeft && hasRight) {
237 needsEquality = true;
238 } else if(hasLeft && !join.isVariable(context.getValue(left))) {
239 needsEquality = true;
240 } else if(hasRight && !join.isVariable(context.getValue(right))) {
241 needsEquality = true;
242 }
243 // console.log("branch equality", left, right, leftVal, rightVal);
244 if(needsEquality) {
245 let expression = {type: "expression", op: "=", args: equality};
246 block.expressions.push(expression)
247 block.equalities[equalityIx] = undefined;
248 }
249 equalityIx++;
250 }
251}
252
253function buildScans(block, context, scanLikes, outputScans) {
254 let {unprovided} = block;

Callers 1

buildScansFunction · 0.85

Calls 2

hasVariableMethod · 0.80
getValueMethod · 0.65

Tested by

no test coverage detected