Remove dependency on libutils.

As part of this, TypeDef has also been converted to a NamedType. This is
because originally, Scope contained just a KeyedVector<localname, idx> of
types which it contained, and an std::vector<type> which idx indexes into
(KeyedVector<localname, type> alone would have also worked). However, now
it contains a std::map<localname, idx> instead. Because of this, we have lost
the ability to iterate over the keys (localnames) in O(n). By converting
TypeDef to a NamedType, name => idx => type such that name == type->name.
This also means that in function hierarchy calling Scope::addType, we no
longer have to pass around the tuple (name, type) since type->name == name,
and we can pass around only type.

Change-Id: I8f85afe0e389979a2fd98ff5eeccf47e3fcc8307
diff --git a/Method.cpp b/Method.cpp
index d9a6a8c..c051a77 100644
--- a/Method.cpp
+++ b/Method.cpp
@@ -28,12 +28,12 @@
        std::vector<TypedVar *> *args,
        std::vector<TypedVar *> *results,
        bool oneway,
-       AnnotationVector *annotations)
+       std::vector<Annotation *> *annotations)
     : mName(name),
       mArgs(args),
       mResults(results),
       mOneway(oneway),
-      mAnnotationsByName(annotations) {
+      mAnnotations(annotations) {
 }
 
 std::string Method::name() const {
@@ -48,8 +48,8 @@
     return *mResults;
 }
 
-const AnnotationVector &Method::annotations() const {
-    return *mAnnotationsByName;
+const std::vector<Annotation *> &Method::annotations() const {
+    return *mAnnotations;
 }
 
 void Method::generateCppSignature(Formatter &out,
@@ -135,16 +135,16 @@
 }
 
 void Method::dumpAnnotations(Formatter &out) const {
-    if (mAnnotationsByName->size() == 0) {
+    if (mAnnotations->size() == 0) {
         return;
     }
 
     out << "// ";
-    for (size_t i = 0; i < mAnnotationsByName->size(); ++i) {
+    for (size_t i = 0; i < mAnnotations->size(); ++i) {
         if (i > 0) {
             out << " ";
         }
-        mAnnotationsByName->valueAt(i)->dump(out);
+        mAnnotations->at(i)->dump(out);
     }
     out << "\n";
 }