| 519 | } |
| 520 | |
| 521 | size_t AssemblyItem::opcodeCount() const noexcept |
| 522 | { |
| 523 | switch (m_type) |
| 524 | { |
| 525 | case AssemblyItemType::AssignImmutable: |
| 526 | // Append empty items if this AssignImmutable was referenced more than once. |
| 527 | // For n immutable occurrences the first (n - 1) occurrences will |
| 528 | // generate 5 opcodes and the last will generate 3 opcodes, |
| 529 | // because it is reusing the 2 top-most elements on the stack. |
| 530 | solAssert(m_immutableOccurrences, ""); |
| 531 | |
| 532 | if (m_immutableOccurrences.value() != 0) |
| 533 | return (*m_immutableOccurrences - 1) * 5 + 3; |
| 534 | else |
| 535 | return 2; // two POP's |
| 536 | default: |
| 537 | return 1; |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | std::string AssemblyItem::computeSourceMapping( |
| 542 | AssemblyItems const& _items, |
no test coverage detected