GCC Code Coverage Report


Directory: src/
File: src/context/compiler-context.cpp
Date: 2025-10-24 11:14:59
Exec Total Coverage
Lines: 15 18 83.3%
Functions: 6 7 85.7%
Branches: 0 0 -%

Line Branch Exec Source
1 /* Copyright 2025 Jonathan S. Arney
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * https://github.com/jarney/gyoji/blob/master/LICENSE
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include <gyoji-context.hpp>
16
17 using namespace Gyoji::context;
18
19 294 CompilerContext::CompilerContext(std::string _filename)
20 {
21 294 token_stream = std::make_unique<TokenStream>();
22 294 errors = std::make_unique<Errors>(*token_stream);
23 294 filenames.push_back(_filename);
24 294 }
25 294 CompilerContext::~CompilerContext()
26 294 {}
27
28 bool
29 106 CompilerContext::has_errors() const
30 106 { return errors->size(); }
31
32 Errors &
33 210 CompilerContext::get_errors() const
34 210 { return *errors; }
35
36 TokenStream &
37 67412 CompilerContext::get_token_stream() const
38 67412 { return *token_stream; }
39
40 const std::string &
41 58876 CompilerContext::get_filename() const
42 58876 { return filenames.back(); }
43
44 void
45 CompilerContext::add_filename(const std::string & _filename)
46 {
47 filenames.push_back(_filename);
48 }
49