Export CompilerStack state

This commit is contained in:
Alex Beregszaszi 2017-07-03 11:58:24 +01:00
parent d230048dc8
commit 08069bf4a4

View File

@ -77,6 +77,14 @@ enum class DocumentationType: uint8_t
class CompilerStack: boost::noncopyable class CompilerStack: boost::noncopyable
{ {
public: public:
enum State {
Empty,
SourcesSet,
ParsingSuccessful,
AnalysisSuccessful,
CompilationSuccessful
};
/// Creates a new compiler stack. /// Creates a new compiler stack.
/// @param _readFile callback to used to read files for import statements. Must return /// @param _readFile callback to used to read files for import statements. Must return
/// and must not emit exceptions. /// and must not emit exceptions.
@ -194,6 +202,8 @@ public:
/// @returns the list of errors that occured during parsing and type checking. /// @returns the list of errors that occured during parsing and type checking.
ErrorList const& errors() { return m_errorReporter.errors(); } ErrorList const& errors() { return m_errorReporter.errors(); }
State state() const { return m_stackState; }
private: private:
/** /**
* Information pertaining to one source unit, filled gradually during parsing and compilation. * Information pertaining to one source unit, filled gradually during parsing and compilation.
@ -220,14 +230,6 @@ private:
mutable std::unique_ptr<std::string const> sourceMapping; mutable std::unique_ptr<std::string const> sourceMapping;
mutable std::unique_ptr<std::string const> runtimeSourceMapping; mutable std::unique_ptr<std::string const> runtimeSourceMapping;
}; };
enum State {
Empty,
SourcesSet,
ParsingSuccessful,
AnalysisSuccessful,
CompilationSuccessful
};
/// Loads the missing sources from @a _ast (named @a _path) using the callback /// Loads the missing sources from @a _ast (named @a _path) using the callback
/// @a m_readFile and stores the absolute paths of all imports in the AST annotations. /// @a m_readFile and stores the absolute paths of all imports in the AST annotations.
/// @returns the newly loaded sources. /// @returns the newly loaded sources.