mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Use a buffer on the stack.
This commit is contained in:
parent
170a4ea08f
commit
5a66f00697
1 changed files with 6 additions and 4 deletions
|
|
@ -458,16 +458,18 @@ expr
|
||||||
{ $$ = (ExprNode*)VarNode::alloc( $1.lineNumber, $1.value, $3 ); }
|
{ $$ = (ExprNode*)VarNode::alloc( $1.lineNumber, $1.value, $3 ); }
|
||||||
| rwDEFINE '(' var_list_decl ')' '{' statement_list '}'
|
| rwDEFINE '(' var_list_decl ')' '{' statement_list '}'
|
||||||
{
|
{
|
||||||
String fnname = String("__anonymous_function_" + String::ToString(gAnonFunctionID++));
|
const U32 bufLen = 64;
|
||||||
StringTableEntry afnName = StringTable->insert(fnname.c_str());
|
UTF8 buffer[bufLen];
|
||||||
StmtNode *fndef = FunctionDeclStmtNode::alloc($1.lineNumber, afnName, NULL, $3, $6);
|
dSprintf(buffer, bufLen, "__anonymous_function%d", gAnonFunctionID++);
|
||||||
|
StringTableEntry fName = StringTable->insert(buffer);
|
||||||
|
StmtNode *fndef = FunctionDeclStmtNode::alloc($1.lineNumber, fName, NULL, $3, $6);
|
||||||
|
|
||||||
if(!gAnonFunctionList)
|
if(!gAnonFunctionList)
|
||||||
gAnonFunctionList = fndef;
|
gAnonFunctionList = fndef;
|
||||||
else
|
else
|
||||||
gAnonFunctionList->append(fndef);
|
gAnonFunctionList->append(fndef);
|
||||||
|
|
||||||
$$ = StrConstNode::alloc( $1.lineNumber, (UTF8*)fnname.utf8(), false );
|
$$ = StrConstNode::alloc( $1.lineNumber, (UTF8*)fName, false );
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue