Removed "bool AST::isInterface(std::string*)"
Test: links
Change-Id: I603831ed8aa8a8794a54d38ce0e1d0b6c68701cb
diff --git a/generateVts.cpp b/generateVts.cpp
index b7e2e2b..f695bec 100644
--- a/generateVts.cpp
+++ b/generateVts.cpp
@@ -30,49 +30,36 @@
namespace android {
status_t AST::emitVtsTypeDeclarations(Formatter &out) const {
- std::string ifaceName;
- if (AST::isInterface(&ifaceName)) {
- const Interface *iface = mRootScope->getInterface();
- status_t status = iface->emitVtsAttributeDeclaration(out);
- if (status != OK) {
- return status;
+ if (AST::isInterface()) {
+ const Interface *iface = mRootScope->getInterface();
+ return iface->emitVtsAttributeDeclaration(out);
}
- } else {
+
for (const auto &type : mRootScope->getSubTypes()) {
- // Skip for TypeDef as it is just an alias of a defined type.
- if (type->isTypeDef()) {
- continue;
- }
- out << "attribute: {\n";
- out.indent();
- status_t status = type->emitVtsTypeDeclarations(out);
- if (status != OK) {
- return status;
- }
- out.unindent();
- out << "}\n\n";
+ // Skip for TypeDef as it is just an alias of a defined type.
+ if (type->isTypeDef()) {
+ continue;
+ }
+ out << "attribute: {\n";
+ out.indent();
+ status_t status = type->emitVtsTypeDeclarations(out);
+ if (status != OK) {
+ return status;
+ }
+ out.unindent();
+ out << "}\n\n";
}
- }
- return OK;
+
+ return OK;
}
status_t AST::generateVts(const std::string &outputPath) const {
+ std::string baseName = AST::getBaseName();
+ const Interface *iface = AST::getInterface();
+
std::string path = outputPath;
path.append(mCoordinator->convertPackageRootToPath(mPackage));
path.append(mCoordinator->getPackagePath(mPackage, true /* relative */));
-
- std::string ifaceName;
- std::string baseName;
-
- bool isInterface = true;
- if (!AST::isInterface(&ifaceName)) {
- baseName = "types";
- isInterface = false;
- } else {
- const Interface *iface = mRootScope->getInterface();
- baseName = iface->getBaseName();
- }
-
path.append(baseName);
path.append(".vts");
@@ -89,7 +76,7 @@
out << "component_type_version: " << mPackage.version()
<< "\n";
out << "component_name: \""
- << (isInterface ? ifaceName : "types")
+ << (iface ? iface->localName() : "types")
<< "\"\n\n";
out << "package: \"" << mPackage.package() << "\"\n\n";
@@ -106,7 +93,7 @@
out << "\n";
- if (isInterface) {
+ if (isInterface()) {
const Interface *iface = mRootScope->getInterface();
out << "interface: {\n";
out.indent();