Re-add enum support.
2 * Copyright (C) 2012 David Anderson
4 * This file is part of JITCraft.
6 * JITCraft is free software: you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free
8 * Software Foundation, either version 3 of the License, or (at your option)
11 * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * JITCraft. If not, see http://www.gnu.org/licenses/.
18 #ifndef _include_jitcraft_compile_context_h_
19 #define _include_jitcraft_compile_context_h_
23 #include "../Messages.h"
24 #include "../PoolAllocator.h"
25 #include "../Handles.h"
26 #include "../Modules.h"
35 struct SourcePosition;
36 struct TranslationUnit;
37 class ImportStatement;
39 struct TranslationUnit : public PoolObject
52 PoolList<TranslationUnit *> dependents_;
53 ImportScope *importScope_;
54 GlobalScope *globalScope_;
55 ScopedRoot<Module> module_;
57 ParseTree *tree() const {
60 PoolList<TranslationUnit *> &dependents() {
66 void setImportScope(ImportScope *scope) {
67 assert(!importScope_);
70 void setGlobalScope(GlobalScope *scope) {
71 assert(!globalScope_);
74 ImportScope *importScope() const {
77 GlobalScope *globalScope() const {
87 Vector<TranslationUnit *> units_;
88 Vector<TranslationUnit *> unparsed_;
91 char *loadSource(const char *file, size_t *length);
92 bool parse(TranslationUnit *unit);
93 bool evaluateImports(TranslationUnit *unit);
94 bool propagateFailure();
97 CompileContext(Zone *zone, const char *file);
100 bool addTranslationUnit(TranslationUnit *unit);
103 void reportErrorVa(const SourcePosition &pos, Message msg, va_list ap);
104 void reportError(const SourcePosition &pos, Message msg, ...);
106 unsigned failures() const {
113 #endif // _include_jitcraft_compile_context_h_