Introduce integer constants
We can now declare a "const int" variable in an AIDL interface, in
addition to methods. These constants will become static members of the
interface/base class in the generated code.
Change-Id: I6b690ecbbe2acae37abb106510e42283f0753f26
Test: Unit and integration tests updated and pass
Bug: 23600061
Signed-off-by: Casey Dahlin <sadmac@google.com>
diff --git a/ast_java.cpp b/ast_java.cpp
index 6689111..c347d30 100644
--- a/ast_java.cpp
+++ b/ast_java.cpp
@@ -578,6 +578,13 @@
}
void
+Constant::Write(CodeWriter* to) const
+{
+ WriteModifiers(to, STATIC | FINAL | PUBLIC, ALL_MODIFIERS);
+ to->Write("int %s = %d;\n", name.c_str(), value);
+}
+
+void
Class::Write(CodeWriter* to) const
{
size_t N, i;