Parse assignment RTL instead of LTR, fixes multiple assignment (
bug 5420).
2 * Copyright (C) 2012 David Anderson
4 * This file is part of SourcePawn.
6 * SourcePawn 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 * SourcePawn 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 * SourcePawn. If not, see http://www.gnu.org/licenses/.
18 #ifndef _include_jc_module_h_
19 #define _include_jc_module_h_
23 #include "Functions.h"
24 #include "FixedArray.h"
32 struct TranslationUnit;
34 class Module : public Importable
36 Barriered<Code> code_;
37 Barriered<Struct> globals_;
38 void *nativeIdentity_;
39 TranslationUnit *unit_;
40 Barriered<FixedArray> imports_;
43 static Module *New(Zone *zone, Handle<Package> package, Handle<String> path, Handle<String> name);
56 // Modules are pre-created, and may have their intermediate compilation
57 // data attached while they are being compiled.
61 TranslationUnit *translationUnit() {
64 void setTranslationUnit(TranslationUnit *unit) {
69 return imports_ ? imports_->length() / 2 : 0;
71 Importable *getImportAt(unsigned index) {
72 return Importable::cast(imports_->at(index * 2));
74 FixedArray *importPathAt(unsigned index) {
75 return FixedArray::cast(imports_->at(index * 2 + 1));
77 void setImports(Handle<FixedArray> imports) {
80 void setCode(Handle<Code> code) {
83 void setGlobals(Handle<Struct> globals) {
87 // Begin GC Descriptor.
88 static inline size_t offsetOfCode() {
89 return OFFSETOF(Module, code_);
91 static inline size_t offsetOfGlobals() {
92 return OFFSETOF(Module, globals_);
94 static inline size_t offsetOfImports() {
95 return OFFSETOF(Module, imports_);
99 static inline Module *cast(Object *obj) {
100 assert(!obj || obj->is(MapKind_Module));
101 return reinterpret_cast<Module *>(obj);
107 #endif // _include_jc_module_h_