• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ArkScript-lang / Ark / 29851449016

21 Jul 2026 05:05PM UTC coverage: 94.39% (+0.005%) from 94.385%
29851449016

push

github

SuperFola
fix(compiler): keep provenance information of IR blocks inside the IROptimiser

9 of 9 new or added lines in 1 file covered. (100.0%)

122 existing lines in 10 files now uncovered.

10700 of 11336 relevant lines covered (94.39%)

1164644.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.59
/src/arkreactor/Compiler/IntermediateRepresentation/Entity.cpp
1
#include <Ark/Compiler/IntermediateRepresentation/Entity.hpp>
2

3
namespace Ark::internal::IR
4
{
5
    Entity::Entity(const Kind kind) :
99,292✔
6
        m_kind(kind),
99,292✔
7
        m_inst(NOP)
99,292✔
8
    {}
198,584✔
9

10
    Entity::Entity(const Instruction inst, const uint16_t arg) :
287,019✔
11
        m_kind(Kind::Opcode),
287,019✔
12
        m_inst(inst), m_primary_arg(arg)
287,019✔
13
    {}
574,038✔
14

15
    Entity::Entity(const Instruction inst, const uint16_t primary_arg, const uint16_t secondary_arg) :
65,108✔
16
        m_kind(Kind::Opcode2Args),
65,108✔
17
        m_inst(inst), m_primary_arg(primary_arg), m_secondary_arg(secondary_arg)
65,108✔
18
    {}
130,216✔
19

20
    Entity::Entity(const Instruction inst, const uint8_t inst2, const uint8_t inst3, const uint8_t inst4) :
675✔
21
        m_kind(Kind::Opcode3Args),
675✔
22
        m_inst(inst), m_primary_arg(inst2), m_secondary_arg(inst3), m_tertiary_arg(inst4)
675✔
23
    {}
1,350✔
24

25
    void Entity::replaceInstruction(const Instruction replacement)
1,931✔
26
    {
1,931✔
27
        m_inst = replacement;
1,931✔
28
    }
1,931✔
29

30
    void Entity::replaceLabel(const label_t replacement)
2,566✔
31
    {
2,566✔
32
        m_label = replacement;
2,566✔
33
    }
2,566✔
34

35
    Entity Entity::Label(const label_t value)
47,985✔
36
    {
47,985✔
37
        auto entity = Entity(Kind::Label);
47,985✔
38
        entity.m_label = value;
47,985✔
39

40
        return entity;
47,985✔
41
    }
47,985✔
42

43
    Entity Entity::Goto(const Entity& label, const Instruction inst)
47,985✔
44
    {
47,985✔
45
        auto jump = Entity(Kind::Goto);
47,985✔
46
        jump.m_label = label.m_label;
47,985✔
47
        jump.m_inst = inst;
47,985✔
48

49
        return jump;
47,985✔
50
    }
47,985✔
51

52
    Entity Entity::GotoWithArg(const Entity& label, const Instruction inst, const uint16_t primary_arg)
3,322✔
53
    {
3,322✔
54
        auto jump = Entity(Kind::GotoWithArg);
3,322✔
55
        jump.m_label = label.m_label;
3,322✔
56
        jump.m_inst = inst;
3,322✔
57
        jump.m_primary_arg = primary_arg;
3,322✔
58

59
        return jump;
3,322✔
60
    }
3,322✔
61

62
    Entity Entity::GotoIf(const Entity& label, const bool cond)
11,020✔
63
    {
11,020✔
64
        return Goto(label, cond ? POP_JUMP_IF_TRUE : POP_JUMP_IF_FALSE);
11,020✔
65
    }
66

67
    Word Entity::bytecode() const
225,336✔
68
    {
225,336✔
69
        if (m_kind == Kind::Opcode)
225,336✔
70
            return Word(m_inst, m_primary_arg);
164,426✔
71
        if (m_kind == Kind::Opcode2Args)
60,910✔
72
            return Word(m_inst, m_primary_arg, m_secondary_arg);
60,235✔
73
        if (m_kind == Kind::Opcode3Args)
675✔
74
            return Word(
675✔
75
                m_inst,
675✔
76
                static_cast<uint8_t>(m_primary_arg),
675✔
77
                static_cast<uint8_t>(m_secondary_arg),
675✔
78
                static_cast<uint8_t>(m_tertiary_arg));
675✔
UNCOV
79
        return Word(0, 0);
×
80
    }
225,336✔
81

82
    void Entity::setSourceLocation(const std::string& filename, const std::size_t line)
299,195✔
83
    {
299,195✔
84
        m_metadata.source_file = filename;
299,195✔
85
        m_metadata.source_line = line;
299,195✔
86
    }
299,195✔
87

88
    void Entity::setRelatedResourceId(const std::optional<uint16_t> id)
50,248✔
89
    {
50,248✔
90
        m_metadata.related_res_id = id;
50,248✔
91
    }
50,248✔
92
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc