Skip to content

Commit

Permalink
PowerShell: change the variable type in parseClass()
Browse files Browse the repository at this point in the history
The tokenInfo type is too much, so I changed it to vString, which is the
minimum needed.
  • Loading branch information
kumarstack55 committed Dec 9, 2022
1 parent 60cc214 commit b307057
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions parsers/powershell.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,30 +574,28 @@ static bool parseFunction (tokenInfo *const token, int kind)
static bool parseClass (tokenInfo *const token)
{
bool readNext = true;
tokenInfo *nameFree = NULL;
vString *nameFree = NULL;

readToken (token);

if (token->type != TOKEN_IDENTIFIER)
return false;

nameFree = newToken ();
copyToken (nameFree, token, true);
makeClassTag (token);
nameFree = vStringNewCopy (token->string);
readToken (token);

makeClassTag (nameFree);

while (token->type != TOKEN_OPEN_CURLY && token->type != TOKEN_EOF)
{
readToken (token);
}

if (token->type == TOKEN_OPEN_CURLY)
enterScope (token, nameFree->string, K_CLASS);
enterScope (token, nameFree, K_CLASS);
else
readNext = false;

deleteToken (nameFree);
vStringDelete (nameFree);

return readNext;
}
Expand Down

0 comments on commit b307057

Please sign in to comment.