(Decl.Unit unit)
| 519 | } |
| 520 | |
| 521 | public Decl.Unit putExtern(Decl.Unit unit) { |
| 522 | Tuple<Decl.Unit> externs = getExterns(); |
| 523 | // Check whether replacing unit or adding new |
| 524 | for (int i = 0; i != externs.size(); ++i) { |
| 525 | Decl.Unit ith = externs.get(i); |
| 526 | if (ith.getName().equals(unit.getName())) { |
| 527 | // We're replacing an existing unit |
| 528 | externs.setOperand(i, unit); |
| 529 | return ith; |
| 530 | } |
| 531 | } |
| 532 | // We're adding a new unit |
| 533 | setOperand(2, getHeap().allocate(externs.append(unit))); |
| 534 | // Nothing was replaced |
| 535 | return null; |
| 536 | } |
| 537 | |
| 538 | public void addAttribute(Syntactic.Marker attribute) { |
| 539 | setOperand(3, getHeap().allocate(getAttributes().append(attribute))); |
no test coverage detected