blob: b9eb88547090727485156ecfa15ce256493df37b [file] [log] [blame]
Andreas Huberc9410c72016-07-28 12:18:40 -07001#include "Method.h"
2
3#include "Formatter.h"
4#include "Type.h"
5
6namespace android {
7
8TypedVar::TypedVar(const char *name, Type *type)
9 : mName(name),
10 mType(type) {
11}
12
13void TypedVar::dump(Formatter &out) const {
14 mType->dump(out);
15 out << " ";
16 out << mName;
17}
18
19Method::Method(
20 const char *name,
21 Vector<TypedVar *> *args,
22 Vector<TypedVar *> *results)
23 : mName(name),
24 mArgs(args),
25 mResults(results) {
26}
27
28void Method::dump(Formatter &out) const {
29 out << mName << "(";
30
31 for (size_t i = 0; i < mArgs->size(); ++i) {
32 if (i > 0) {
33 out << ", ";
34 }
35
36 mArgs->itemAt(i)->dump(out);
37 }
38
39 out << ")";
40
41 if (mResults != NULL) {
42 out << " generates (";
43
44 for (size_t i = 0; i < mResults->size(); ++i) {
45 if (i > 0) {
46 out << ", ";
47 }
48
49 mResults->itemAt(i)->dump(out);
50 }
51
52 out << ")";
53 }
54
55 out << ";";
56}
57
58} // namespace android
59