代码告警清理

Signed-off-by: yue <yueyan4@huawei.com>
This commit is contained in:
yue
2021-09-18 20:17:48 +08:00
parent 4f596edc5a
commit edde6b3659
100 changed files with 2252 additions and 2019 deletions
+40 -6
View File
@@ -13,22 +13,56 @@
namespace OHOS {
namespace HDI {
JavaCodeEmitter::JavaCodeEmitter(const AutoPtr<AST>& ast, const String& targetDirectory)
:LightRefCountBase(), ast_(ast), directory_(targetDirectory)
bool JavaCodeEmitter::OutPut(const AutoPtr<AST>& ast, const String& targetDirectory)
{
if (ast_->GetASTFileType() == ASTFileType::AST_IFACE || ast_->GetASTFileType() == ASTFileType::AST_ICALLBACK) {
interface_ = ast_->GetInterfaceDef();
if (!Reset(ast, targetDirectory)) {
return false;
}
if (interface_ != nullptr) {
EmitCode();
return true;
}
bool JavaCodeEmitter::Reset(const AutoPtr<AST>& ast, const String& targetDirectory)
{
if (ast == nullptr) {
return false;
}
if (targetDirectory.Equals("")) {
return false;
}
CleanData();
ast_ = ast;
if (ast_->GetASTFileType() == ASTFileType::AST_IFACE || ast_->GetASTFileType() == ASTFileType::AST_ICALLBACK) {
interface_ = ast_->GetInterfaceDef();
interfaceName_ = interface_->GetName();
interfaceFullName_ = interface_->GetNamespace()->ToString() + interfaceName_;
infName_ = interfaceName_.StartsWith("I") ? interfaceName_.Substring(1) : interfaceName_;
proxyName_ = infName_ + "Proxy";
proxyFullName_ = interface_->GetNamespace()->ToString() + proxyName_;
} else {
} else if (ast_->GetASTFileType() == ASTFileType::AST_TYPES) {
infName_ = ast_->GetName();
}
if (!ResolveDirectory(targetDirectory)) {
return false;
}
return true;
}
void JavaCodeEmitter::CleanData()
{
ast_ = nullptr;
interface_ = nullptr;
directory_ = "";
interfaceName_ = "";
interfaceFullName_ = "";
infName_ = "";
proxyName_ = "";
proxyFullName_ = "";
}
String JavaCodeEmitter::FileName(const String& name)