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

Method buildVariableMap

src/runtime/block.ts:26–65  ·  view source on GitHub ↗
(block, variableMap = {"any": {attributes: {}}})

Source from the content-addressed store, hash-verified

24 }
25
26 buildVariableMap(block, variableMap = {"any": {attributes: {}}}) {
27 for(let level of block.strata) {
28 for(let scan of level.scans) {
29 if(scan instanceof Scan) {
30 let {e,a,v} = scan;
31 let cur;
32 if(isVariable(e)) {
33 cur = variableMap[e.id];
34 if(cur === undefined) {
35 cur = variableMap[e.id] = {attributes: {}};
36 }
37 } else {
38 cur = variableMap["any"];
39 }
40 if(!isVariable(a)) {
41 let attrInfo = cur.attributes[a];
42 if(attrInfo === undefined) {
43 attrInfo = cur.attributes[a] = {values: []};
44 }
45 if(!isVariable(v)) {
46 cur.attributes[a].values.push(v);
47 } else {
48 attrInfo.any = true;
49 }
50 } else {
51 cur.any = true;
52 }
53 } else if(scan instanceof NotScan) {
54 // this.alwaysTrue = true;
55 this.buildVariableMap(scan, variableMap);
56 } else if(scan instanceof IfScan) {
57 // this.alwaysTrue = true;
58 for(let branch of scan.branches) {
59 this.buildVariableMap(branch, variableMap);
60 }
61 }
62 }
63 }
64 return variableMap;
65 }
66
67 _depsForTag(deps, attributes, tag) {
68 let attributeIndex = deps[tag];

Callers 1

constructorMethod · 0.95

Calls 1

isVariableFunction · 0.90

Tested by

no test coverage detected