No more "version" keyword, new syntax is "package foo.bar.baz@3.4;"
diff --git a/AST.cpp b/AST.cpp
index a527b46..7610ba5 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -45,27 +45,20 @@
mScanner = scanner;
}
-void AST::setVersion(const char *major, const char *minor) {
- mVersion = "@";
- mVersion.append(major);
- mVersion.append(".");
- mVersion.append(minor);
-}
-
bool AST::setPackage(const char *package) {
- FQName fqName(package);
- CHECK(fqName.isValid());
+ mPackage.setTo(package);
+ CHECK(mPackage.isValid());
- if (!fqName.package().empty() || !fqName.version().empty()) {
+ if (mPackage.package().empty()
+ || mPackage.version().empty()
+ || !mPackage.name().empty()) {
return false;
}
- mPackage = package;
-
return true;
}
-bool AST::addImport(const char *import) {
+bool AST::addImport(const char * /* import */) {
#if 0
CHECK(!importPath->empty());
@@ -90,11 +83,14 @@
}
Type *AST::lookupType(const char *name) {
- LOG(INFO) << "lookupType " << name;
-
FQName fqName(name);
CHECK(fqName.isValid());
+ if (fqName.name().empty()) {
+ // Given a package and version???
+ return NULL;
+ }
+
if (fqName.package().empty() && fqName.version().empty()) {
// This is just a plain identifier, resolve locally first if possible.
@@ -107,7 +103,7 @@
}
}
- fqName.applyDefaults(mPackage, mVersion);
+ fqName.applyDefaults(mPackage.package(), mPackage.version());
LOG(INFO) << "lookupType now looking for " << fqName.debugString();