Fixes several valgrind spotted issues.

This commit is contained in:
2020-10-10 20:02:47 +02:00
parent ce9ad2c9ba
commit 6a0ec63a7e
3 changed files with 55 additions and 31 deletions

View File

@@ -129,7 +129,7 @@ PARSER_TEST("Parse scoped function with parameters without body.",
auto paramList = (const MalachScript::Parser::ParsedParamListStatement*)funcStat->GetParamList().get();
CHECK(paramList->GetParameters().size() == 2);
auto& par1 = paramList->GetParameters()[0];
auto& par1 = *paramList->GetParameters()[0];
CHECK_FALSE(par1.GetTypeStatement()->IsConst());
CHECK_FALSE(par1.GetTypeStatement()->IsArray());
CHECK_FALSE(par1.GetTypeStatement()->IsHandle());
@@ -139,7 +139,7 @@ PARSER_TEST("Parse scoped function with parameters without body.",
CHECK(par1.GetIdentifier().GetString() == u8"par1");
CHECK(par1.GetDefaultExpression() == nullptr);
auto& par2 = paramList->GetParameters()[1];
auto& par2 = *paramList->GetParameters()[1];
CHECK_FALSE(par2.GetTypeStatement()->IsConst());
CHECK_FALSE(par2.GetTypeStatement()->IsArray());
CHECK_FALSE(par2.GetTypeStatement()->IsHandle());
@@ -200,7 +200,7 @@ PARSER_TEST("Parse scoped function with reference parameters without body.",
auto paramList = (const MalachScript::Parser::ParsedParamListStatement*)funcStat->GetParamList().get();
CHECK(paramList->GetParameters().size() == 2);
auto& par1 = paramList->GetParameters()[0];
auto& par1 = *paramList->GetParameters()[0];
CHECK_FALSE(par1.GetTypeStatement()->IsConst());
CHECK_FALSE(par1.GetTypeStatement()->IsArray());
CHECK_FALSE(par1.GetTypeStatement()->IsHandle());
@@ -210,7 +210,7 @@ PARSER_TEST("Parse scoped function with reference parameters without body.",
CHECK(par1.GetIdentifier().GetString() == u8"par1");
CHECK(par1.GetDefaultExpression() == nullptr);
auto& par2 = paramList->GetParameters()[1];
auto& par2 = *paramList->GetParameters()[1];
CHECK_FALSE(par2.GetTypeStatement()->IsConst());
CHECK_FALSE(par2.GetTypeStatement()->IsArray());
CHECK_FALSE(par2.GetTypeStatement()->IsHandle());