(nameOrPrefix, value)
| 1484 | return new ValueScopeName(prefix, this._newName(prefix)); |
| 1485 | } |
| 1486 | value(nameOrPrefix, value) { |
| 1487 | var _a; |
| 1488 | if (value.ref === undefined) |
| 1489 | throw new Error("CodeGen: ref must be passed in value"); |
| 1490 | const name = this.toName(nameOrPrefix); |
| 1491 | const { prefix } = name; |
| 1492 | const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref; |
| 1493 | let vs = this._values[prefix]; |
| 1494 | if (vs) { |
| 1495 | const _name = vs.get(valueKey); |
| 1496 | if (_name) |
| 1497 | return _name; |
| 1498 | } |
| 1499 | else { |
| 1500 | vs = this._values[prefix] = new Map(); |
| 1501 | } |
| 1502 | vs.set(valueKey, name); |
| 1503 | const s = this._scope[prefix] || (this._scope[prefix] = []); |
| 1504 | const itemIndex = s.length; |
| 1505 | s[itemIndex] = value.ref; |
| 1506 | name.setValue(value, { property: prefix, itemIndex }); |
| 1507 | return name; |
| 1508 | } |
| 1509 | getValue(prefix, keyOrRef) { |
| 1510 | const vs = this._values[prefix]; |
| 1511 | if (!vs) |
no test coverage detected