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.h b/Method.h
index 3faab57..aba7755 100644
--- a/Method.h
+++ b/Method.h
@@ -20,7 +20,6 @@
#include <android-base/macros.h>
#include <string>
-#include <utils/KeyedVector.h>
#include <vector>
namespace android {
@@ -31,21 +30,18 @@
struct Type;
struct TypedVar;
-using AnnotationVector =
- DefaultKeyedVector<std::string, Annotation *>;
-
struct Method {
Method(const char *name,
std::vector<TypedVar *> *args,
std::vector<TypedVar *> *results,
bool oneway,
- AnnotationVector *annotations);
+ std::vector<Annotation *> *annotations);
std::string name() const;
const std::vector<TypedVar *> &args() const;
const std::vector<TypedVar *> &results() const;
bool isOneway() const { return mOneway; }
- const AnnotationVector &annotations() const;
+ const std::vector<Annotation *> &annotations() const;
void generateCppSignature(Formatter &out,
const std::string &className,
@@ -66,7 +62,7 @@
std::vector<TypedVar *> *mArgs;
std::vector<TypedVar *> *mResults;
bool mOneway;
- AnnotationVector *mAnnotationsByName;
+ std::vector<Annotation *> *mAnnotations;
DISALLOW_COPY_AND_ASSIGN(Method);
};