(block, context, scanLikes, outputScans)
| 251 | } |
| 252 | |
| 253 | function buildScans(block, context, scanLikes, outputScans) { |
| 254 | let {unprovided} = block; |
| 255 | for(let scanLike of scanLikes) { |
| 256 | if(scanLike.type === "record") { |
| 257 | let entity = context.getValue(scanLike.variable); |
| 258 | context.provide(entity); |
| 259 | for(let attribute of scanLike.attributes) { |
| 260 | if(attribute.value.type === "parenthesis") { |
| 261 | for(let item of attribute.value.items) { |
| 262 | let value = context.getValue(item) |
| 263 | context.provide(value); |
| 264 | let final = new join.Scan(item.id + "|build", entity, attribute.attribute, value, undefined, scanLike.scopes); |
| 265 | outputScans.push(final); |
| 266 | item.buildId = final; |
| 267 | } |
| 268 | } else { |
| 269 | let value = context.getValue(attribute.value) |
| 270 | context.provide(value); |
| 271 | let final = new join.Scan(attribute.id + "|build", entity, attribute.attribute, value, undefined, scanLike.scopes); |
| 272 | outputScans.push(final); |
| 273 | attribute.buildId = final.id; |
| 274 | } |
| 275 | } |
| 276 | } else if(scanLike.type === "scan") { |
| 277 | let entity; |
| 278 | if(scanLike.entity) { |
| 279 | entity = context.getValue(scanLike.entity); |
| 280 | } |
| 281 | if(!scanLike.needsEntity) { |
| 282 | context.provide(entity); |
| 283 | } |
| 284 | let attribute; |
| 285 | if(scanLike.attribute) { |
| 286 | attribute = context.getValue(scanLike.attribute); |
| 287 | context.provide(attribute); |
| 288 | } |
| 289 | let value; |
| 290 | if(scanLike.value) { |
| 291 | value = context.getValue(scanLike.value) |
| 292 | context.provide(value); |
| 293 | } |
| 294 | let node; |
| 295 | if(scanLike.node) { |
| 296 | node = context.getValue(scanLike.node) |
| 297 | context.provide(node); |
| 298 | } |
| 299 | |
| 300 | if(!(entity || attribute || value || node)) { |
| 301 | context.errors.push(errors.blankScan(block, scanLike)); |
| 302 | } else { |
| 303 | entity = entity || context.createVariable(); |
| 304 | attribute = attribute || context.createVariable(); |
| 305 | value = value || context.createVariable(); |
| 306 | } |
| 307 | |
| 308 | let final = new join.Scan(scanLike.id + "|build", entity, attribute, value, node, scanLike.scopes); |
| 309 | outputScans.push(final); |
| 310 | scanLike.buildId = final.id; |
no test coverage detected