diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 6d82fb6..5bdfa9b 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -257,14 +257,14 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, | |||
257 | lType = OT_nothing; | 257 | lType = OT_nothing; |
258 | else | 258 | else |
259 | { | 259 | { |
260 | // if ((LSL_IDENTIFIER == left->token->type) && (left->value.identifierValue)) | 260 | if ((LSL_IDENTIFIER == left->token->type) && (left->value.identifierValue)) |
261 | // { | 261 | { |
262 | // LSL_Leaf *var = findVariable(compiler, left->value.identifierValue->name); | 262 | LSL_Leaf *var = findVariable(compiler, left->value.identifierValue->name); |
263 | 263 | ||
264 | // if (var) | 264 | if (var) |
265 | // lType = var->basicType; | 265 | lType = var->basicType; |
266 | // } | 266 | } |
267 | // else | 267 | else |
268 | lType = left->basicType; | 268 | lType = left->basicType; |
269 | if (OT_vector < lType) | 269 | if (OT_vector < lType) |
270 | lType = allowed[lType].result; | 270 | lType = allowed[lType].result; |
@@ -273,7 +273,15 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, | |||
273 | rType = OT_nothing; | 273 | rType = OT_nothing; |
274 | else | 274 | else |
275 | { | 275 | { |
276 | rType = right->basicType; | 276 | if ((LSL_IDENTIFIER == right->token->type) && (right->value.identifierValue)) |
277 | { | ||
278 | LSL_Leaf *var = findVariable(compiler, right->value.identifierValue->name); | ||
279 | |||
280 | if (var) | ||
281 | rType = var->basicType; | ||
282 | } | ||
283 | else | ||
284 | rType = right->basicType; | ||
277 | if (OT_vector < rType) | 285 | if (OT_vector < rType) |
278 | rType = allowed[rType].result; | 286 | rType = allowed[rType].result; |
279 | } | 287 | } |
@@ -317,20 +325,20 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, | |||
317 | } | 325 | } |
318 | if (OT_invalid == lval->basicType) | 326 | if (OT_invalid == lval->basicType) |
319 | { | 327 | { |
320 | const char *leftType = "", *rightType = ""; | 328 | const char *leftType = "", *rightType = "", *leftToken = "", *rightToken = ""; |
321 | 329 | ||
322 | if (left) | 330 | if (left) |
323 | { | 331 | { |
324 | printf("left token type %s\n", left->token->token); | 332 | leftToken = left->token->token; |
325 | leftType = allowed[left->basicType].name; | 333 | leftType = allowed[left->basicType].name; |
326 | } | 334 | } |
327 | if (right) | 335 | if (right) |
328 | { | 336 | { |
329 | printf("right token type %s\n", right->token->token); | 337 | rightToken = right->token->token; |
330 | rightType = allowed[right->basicType].name; | 338 | rightType = allowed[right->basicType].name; |
331 | } | 339 | } |
332 | 340 | ||
333 | PE("Invalid operation [%s %s %s] @ line %d column %d", leftType, lval->token->token, rightType, lval->line, lval->column); | 341 | PE("Invalid operation [%s(%s) %s %s(%s)] @ line %d column %d", leftType, leftToken, lval->token->token, rightType, rightToken, lval->line, lval->column); |
334 | } | 342 | } |
335 | } | 343 | } |
336 | 344 | ||