Refactoring: Removed unneeded parameter PointerType
This commit is contained in:
parent
72d9e43f92
commit
7ee67f2e64
|
@ -20,7 +20,7 @@ extern bool ShowAll;
|
||||||
// Create statement list
|
// Create statement list
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static void AppendStatement(STATEMENT::etype Type, TOKEN *tok, std::string Var="", const char PointerType[]=0)
|
static void AppendStatement(STATEMENT::etype Type, TOKEN *tok, std::string Var="")
|
||||||
{
|
{
|
||||||
STATEMENT NewStatement;
|
STATEMENT NewStatement;
|
||||||
NewStatement.Type = Type;
|
NewStatement.Type = Type;
|
||||||
|
@ -212,11 +212,9 @@ void CreateStatementList()
|
||||||
{
|
{
|
||||||
TOKEN *rs = eq->next;
|
TOKEN *rs = eq->next;
|
||||||
|
|
||||||
const char *pointertype = 0;
|
|
||||||
bool ismalloc = false;
|
bool ismalloc = false;
|
||||||
if (match(rs, "strdup ("))
|
if (match(rs, "strdup ("))
|
||||||
{
|
{
|
||||||
pointertype = "char";
|
|
||||||
ismalloc = true;
|
ismalloc = true;
|
||||||
}
|
}
|
||||||
else if (rs->str[0]=='(' && IsName(getstr(rs,1)))
|
else if (rs->str[0]=='(' && IsName(getstr(rs,1)))
|
||||||
|
@ -225,21 +223,19 @@ void CreateStatementList()
|
||||||
ismalloc |= match(rs, "( type * * ) malloc (");
|
ismalloc |= match(rs, "( type * * ) malloc (");
|
||||||
ismalloc |= match(rs, "( type type * ) malloc (");
|
ismalloc |= match(rs, "( type type * ) malloc (");
|
||||||
ismalloc |= match(rs, "( type type * * ) malloc (");
|
ismalloc |= match(rs, "( type type * * ) malloc (");
|
||||||
if (ismalloc)
|
|
||||||
pointertype = getstr(rs, rs->next->next->str[0]=='*' ? 1 : 2 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ismalloc )
|
if ( ismalloc )
|
||||||
AppendStatement(STATEMENT::MALLOC, tok2, varname, pointertype);
|
AppendStatement(STATEMENT::MALLOC, tok2, varname);
|
||||||
|
|
||||||
else if ( match(rs,"new type ;") )
|
else if ( match(rs,"new type ;") )
|
||||||
AppendStatement(STATEMENT::NEW, tok2, varname, getstr(rs,1));
|
AppendStatement(STATEMENT::NEW, tok2, varname);
|
||||||
|
|
||||||
else if ( match(rs, "new type (") )
|
else if ( match(rs, "new type (") )
|
||||||
AppendStatement(STATEMENT::NEW, tok2, varname, getstr(rs,1));
|
AppendStatement(STATEMENT::NEW, tok2, varname);
|
||||||
|
|
||||||
else if ( match(rs, "new type [") )
|
else if ( match(rs, "new type [") )
|
||||||
AppendStatement(STATEMENT::NEWARRAY, tok2, varname, getstr(rs,1));
|
AppendStatement(STATEMENT::NEWARRAY, tok2, varname);
|
||||||
|
|
||||||
else
|
else
|
||||||
AppendStatement(STATEMENT::ASSIGN, tok2, varname);
|
AppendStatement(STATEMENT::ASSIGN, tok2, varname);
|
||||||
|
|
Loading…
Reference in New Issue