MCPcopy Create free account
hub / github.com/witheve/Eve / assignRuntimeVariables

Method assignRuntimeVariables

src/runtime/builder.ts:155–193  ·  view source on GitHub ↗
(block)

Source from the content-addressed store, hash-verified

153 }
154
155 assignRuntimeVariables(block) {
156 let registerToVars = this.registerToVars;
157 let groupToValue = this.groupToValue;
158 for(let varName in block.variables) {
159 let variable = block.variables[varName];
160 let group = this.getGroup(variable);
161 if(group !== undefined) {
162 let value = groupToValue[group];
163 if(value === undefined) {
164 if(variable.constant) {
165 value = variable.constant.value;
166 } else {
167 value = this.createVariable();
168 registerToVars[value.id].push(varName);
169 }
170 groupToValue[group] = value;
171 } else {
172 if(variable.constant) {
173 if(!join.isVariable(value) && variable.constant.value !== value) {
174 this.errors.push(errors.incompatabileTransitiveEquality(block, variable, value));
175 }
176 value = variable.constant.value;
177 if(this.myRegisters[value.id]) {
178 groupToValue[group] = value;
179 }
180 } else if(join.isVariable(value)) {
181 registerToVars[value.id].push(varName);
182 }
183 }
184 }
185 }
186
187 let unprovided = this.unprovided;
188 for(let ix = 0; ix < this.varIx; ix++) {
189 if(unprovided[ix] === undefined && this.myRegisters[ix]) {
190 unprovided[ix] = true;
191 }
192 }
193 }
194
195 createVariable() {
196 this.registerToVars[this.varIx] = [];

Callers 1

constructorMethod · 0.95

Calls 2

getGroupMethod · 0.95
createVariableMethod · 0.95

Tested by

no test coverage detected