mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Added anomymous functions as in Konrad Kiss's resource.
This commit is contained in:
parent
e9308e40ed
commit
1204b81a78
4 changed files with 35 additions and 1 deletions
|
|
@ -456,6 +456,19 @@ expr
|
|||
{ $$ = (ExprNode*)VarNode::alloc( $1.lineNumber, $1.value, NULL); }
|
||||
| VAR '[' aidx_expr ']'
|
||||
{ $$ = (ExprNode*)VarNode::alloc( $1.lineNumber, $1.value, $3 ); }
|
||||
| rwDEFINE '(' var_list_decl ')' '{' statement_list '}'
|
||||
{
|
||||
String fnname = String("__anonymous_function_" + String::ToString(gAnonFunctionID++));
|
||||
StringTableEntry afnName = StringTable->insert(fnname.c_str());
|
||||
StmtNode *fndef = FunctionDeclStmtNode::alloc($1.lineNumber, afnName, NULL, $3, $6);
|
||||
|
||||
if(!gAnonFunctionList)
|
||||
gAnonFunctionList = fndef;
|
||||
else
|
||||
gAnonFunctionList->append(fndef);
|
||||
|
||||
$$ = StrConstNode::alloc( $1.lineNumber, (UTF8*)fnname.utf8(), false );
|
||||
}
|
||||
;
|
||||
|
||||
slot_acc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue