aboutsummaryrefslogtreecommitdiff
path: root/include/cps/SourceUnit.h
blob: 153d020d113a528f66c82747f5cef5ebe9dd2073 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

#pragma once
#include "cps/AST.h"
#include <string>
#include <vector>

namespace cps {
// The caller owns the parsed statements for the duration of compilation.
struct SourceUnit {
    std::string Path;
    const std::vector<std::unique_ptr<StmtAST>> &Statements;
    std::vector<bool> Visible;
    std::vector<bool> LibraryLines;
    bool isLibrary(int Line) const {
        return Line > 0 && static_cast<size_t>(Line) <= LibraryLines.size() && LibraryLines[Line - 1];
    }
};
}