Recursively parse imported .hal files and perform global type lookup.
diff --git a/AST.h b/AST.h
index 227d80c..f58bf7e 100644
--- a/AST.h
+++ b/AST.h
@@ -10,12 +10,13 @@
namespace android {
+struct Coordinator;
struct Formatter;
struct Type;
struct Scope;
struct AST {
- AST();
+ AST(Coordinator *coordinator);
~AST();
static AST *Parse(const char *path);
@@ -30,11 +31,20 @@
void *scanner();
void setScanner(void *scanner);
- Type *lookupType(const char *name);
+ // Look up a type by FQName, "pure" names, i.e. those without package
+ // or version are first looked up in the current scope chain.
+ // After that lookup proceeds to imports.
+ Type *lookupType(const char *name) const;
+
+ // Takes dot-separated path components to a type possibly inside this AST.
+ // Name resolution goes from root scope downwards, i.e. the path must be
+ // absolute.
+ Type *lookupTypeInternal(const std::string &namePath) const;
void dump(Formatter &out) const;
private:
+ Coordinator *mCoordinator;
Vector<Scope *> mScopePath;
void *mScanner;