optimize nasal_import::check_import

This commit is contained in:
ValKmjolnir
2022-01-30 23:26:30 +08:00
parent 4def93b4ad
commit df24db5b58
2 changed files with 8 additions and 12 deletions
+8 -11
View File
@@ -26,17 +26,14 @@ only this kind of node can be recognized as 'import':
call_func
string:'filename'
*/
if(node.type()!=ast_call)
return false;
if(node.size()!=2)
return false;
if(node[0].str()!="import")
return false;
if(node[1].type()!=ast_callf)
return false;
if(node[1].size()!=1 || node[1][0].type()!=ast_str)
return false;
return true;
return (
node.type()==ast_call &&
node.size()==2 &&
node[0].str()=="import" &&
node[1].type()==ast_callf &&
node[1].size()==1 &&
node[1][0].type()==ast_str
);
}
bool nasal_import::check_exist(const std::string& file)