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

vla5924-practice / compiler-project / 13882632105

16 Mar 2025 10:53AM UTC coverage: 77.273% (+1.1%) from 76.198%
13882632105

Pull #220

github

web-flow
Merge 82e5a7d0f into b0d9df536
Pull Request #220: Support lists as function arguments

66 of 85 new or added lines in 5 files covered. (77.65%)

108 existing lines in 3 files now uncovered.

4369 of 5654 relevant lines covered (77.27%)

248.14 hits per line

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

77.27
/compiler/lib/frontend/parser/type_registry.cpp
1
#include "parser/type_registry.hpp"
2

3
#include <map>
4

5
#include "compiler/ast/types.hpp"
6

7
#include "lexer/token_types.hpp"
8

9
using ast::TypeId;
10
using namespace lexer;
11
using namespace parser;
12

13
namespace {
14

15
std::map<std::string, TypeId> userDefinedTypes = {};
16

17
} // namespace
18

19
bool TypeRegistry::isTypename(const Token &token) {
319✔
20
    return token.is(Keyword::Int) || token.is(Keyword::Float) || token.is(Keyword::Bool) || token.is(Keyword::Str) ||
612✔
21
           token.is(Keyword::None) || token.is(Keyword::List) ||
778✔
22
           (token.type == TokenType::Identifier && userDefinedTypes.find(token.id()) != userDefinedTypes.end());
485✔
23
}
24

25
ast::TypeId TypeRegistry::typeId(const Token &token) {
292✔
26
    if (token.type == TokenType::Identifier) {
292✔
UNCOV
27
        const std::string &id = token.id();
×
UNCOV
28
        auto it = userDefinedTypes.find(id);
×
UNCOV
29
        return it != userDefinedTypes.end() ? it->second : ast::UnknownType;
×
30
    }
31
    if (token.is(Keyword::Int))
292✔
32
        return ast::IntType;
104✔
33
    if (token.is(Keyword::Float))
188✔
34
        return ast::FloatType;
61✔
35
    if (token.is(Keyword::Bool))
127✔
36
        return ast::BoolType;
3✔
37
    if (token.is(Keyword::Str))
124✔
UNCOV
38
        return ast::StrType;
×
39
    if (token.is(Keyword::List))
124✔
40
        return ast::ListType;
9✔
41
    if (token.is(Keyword::None))
115✔
42
        return ast::NoneType;
115✔
UNCOV
43
    return ast::UnknownType;
×
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc