From 0dd2b7e3487b1d41772a5ee84fce9162f407546b Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 31 Jan 2012 15:45:06 +1000 Subject: Put back function call stuff I removed before, and document why it needs to be there so I don't remove it again. lol --- LuaSL/src/LuaSL_LSL_tree.h | 2 +- LuaSL/src/LuaSL_compile.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'LuaSL') diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index dd46167..96ef5a9 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h @@ -273,7 +273,7 @@ struct _LSL_FunctionCall LSL_Function *function; Eina_Inarray params; // Eina Inarray has not been released yet (Eina 1.2). Eina_Clist dangler; // Entry for function calls used before the function is defined. - LSL_Leaf *call; // This is to stash the details for dangling ones, to search later. The line and column details are needed for bitching, so we need the leaf. + LSL_Leaf *call; // This is to stash the details for dangling ones, to search later. The line and column details are needed for bitching, so we need the leaf. Also need the stringValue for the search. }; struct _LSL_State diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index c01529a..f8310a6 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -596,8 +596,6 @@ LSL_Leaf *addFunctionCall(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Le LSL_Leaf *func = findFunction(compiler, identifier->value.stringValue); LSL_FunctionCall *call = calloc(1, sizeof(LSL_FunctionCall)); - identifier->toKen = tokens[LSL_UNKNOWN - lowestToken]; - if (func) { if (call) @@ -619,6 +617,8 @@ LSL_Leaf *addFunctionCall(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Le eina_clist_add_tail(&(compiler->danglingCalls), &(call->dangler)); call->call = identifier; } + // Here the identifier stringValue needs to be kept for later searching. + identifier->toKen = tokens[LSL_UNKNOWN - lowestToken]; identifier->basicType = OT_undeclared; compiler->undeclared = TRUE; } @@ -1733,7 +1733,13 @@ boolean compileLSL(gameGlobals *game, char *script, boolean doConstants) LSL_Leaf *func = findFunction(&(compiler), call->call->value.stringValue); if (func) + { call->function = func->value.functionValue; + // Coz the leaf still had the stringValue from before. + call->call->value.functionCallValue = call; + call->call->toKen = tokens[LSL_FUNCTION_CALL - lowestToken]; + call->call->basicType = func->basicType; + } else PE("Undeclared function %s called @ line %d, column %d!", call->call->value.stringValue, call->call->line, call->call->column); } -- cgit v1.1