| 1612 | } |
| 1613 | |
| 1614 | void GDScriptByteCodeGenerator::write_for(const Address &p_variable, bool p_use_conversion, bool p_is_range) { |
| 1615 | const Address &counter = for_counter_variables.back()->get(); |
| 1616 | const Address &container = p_is_range ? Address() : for_container_variables.back()->get(); |
| 1617 | const Address &range_from = p_is_range ? for_range_from_variables.back()->get() : Address(); |
| 1618 | const Address &range_to = p_is_range ? for_range_to_variables.back()->get() : Address(); |
| 1619 | const Address &range_step = p_is_range ? for_range_step_variables.back()->get() : Address(); |
| 1620 | |
| 1621 | current_breaks_to_patch.push_back(List<int>()); |
| 1622 | |
| 1623 | GDScriptFunction::Opcode begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN; |
| 1624 | GDScriptFunction::Opcode iterate_opcode = GDScriptFunction::OPCODE_ITERATE; |
| 1625 | |
| 1626 | if (p_is_range) { |
| 1627 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_RANGE; |
| 1628 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_RANGE; |
| 1629 | } else if (container.type.has_type) { |
| 1630 | if (container.type.kind == GDScriptDataType::BUILTIN) { |
| 1631 | switch (container.type.builtin_type) { |
| 1632 | case Variant::INT: |
| 1633 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_INT; |
| 1634 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_INT; |
| 1635 | break; |
| 1636 | case Variant::FLOAT: |
| 1637 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_FLOAT; |
| 1638 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_FLOAT; |
| 1639 | break; |
| 1640 | case Variant::VECTOR2: |
| 1641 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_VECTOR2; |
| 1642 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_VECTOR2; |
| 1643 | break; |
| 1644 | case Variant::VECTOR2I: |
| 1645 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_VECTOR2I; |
| 1646 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_VECTOR2I; |
| 1647 | break; |
| 1648 | case Variant::VECTOR3: |
| 1649 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_VECTOR3; |
| 1650 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_VECTOR3; |
| 1651 | break; |
| 1652 | case Variant::VECTOR3I: |
| 1653 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_VECTOR3I; |
| 1654 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_VECTOR3I; |
| 1655 | break; |
| 1656 | case Variant::STRING: |
| 1657 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_STRING; |
| 1658 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_STRING; |
| 1659 | break; |
| 1660 | case Variant::DICTIONARY: |
| 1661 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_DICTIONARY; |
| 1662 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_DICTIONARY; |
| 1663 | break; |
| 1664 | case Variant::ARRAY: |
| 1665 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_ARRAY; |
| 1666 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_ARRAY; |
| 1667 | break; |
| 1668 | case Variant::PACKED_BYTE_ARRAY: |
| 1669 | begin_opcode = GDScriptFunction::OPCODE_ITERATE_BEGIN_PACKED_BYTE_ARRAY; |
| 1670 | iterate_opcode = GDScriptFunction::OPCODE_ITERATE_PACKED_BYTE_ARRAY; |
| 1671 | break; |
no test coverage detected