diff options
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index c2efd8e..3dea80c 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -370,6 +370,7 @@ LSL_Leaf *addParameter(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *ident | |||
370 | if ( (identifier) && (result)) | 370 | if ( (identifier) && (result)) |
371 | { | 371 | { |
372 | result->name = identifier->value.stringValue; | 372 | result->name = identifier->value.stringValue; |
373 | result->value.token = tokens[LSL_UNKNOWN - lowestToken]; | ||
373 | identifier->value.identifierValue = result; | 374 | identifier->value.identifierValue = result; |
374 | identifier->token = tokens[LSL_PARAMETER - lowestToken]; | 375 | identifier->token = tokens[LSL_PARAMETER - lowestToken]; |
375 | identifier->left = type; | 376 | identifier->left = type; |
@@ -377,6 +378,7 @@ LSL_Leaf *addParameter(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *ident | |||
377 | { | 378 | { |
378 | identifier->basicType = type->basicType; | 379 | identifier->basicType = type->basicType; |
379 | result->value.basicType = type->basicType; | 380 | result->value.basicType = type->basicType; |
381 | result->value.token = type->token; // This is the LSL_TYPE_* token instead of the LSL_* token. Not sure if that's a problem. | ||
380 | } | 382 | } |
381 | } | 383 | } |
382 | return identifier; | 384 | return identifier; |
@@ -444,7 +446,7 @@ LSL_Leaf *addFunctionBody(LuaSL_compiler *compiler, LSL_Leaf *function, LSL_Leaf | |||
444 | 446 | ||
445 | LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Type type, LSL_Leaf *rval) | 447 | LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Type type, LSL_Leaf *rval) |
446 | { | 448 | { |
447 | LSL_Parenthesis *parens = malloc(sizeof(LSL_Parenthesis)); | 449 | LSL_Parenthesis *parens = calloc(1, sizeof(LSL_Parenthesis)); |
448 | 450 | ||
449 | if (parens) | 451 | if (parens) |
450 | { | 452 | { |
@@ -479,7 +481,7 @@ LSL_Leaf *addState(LuaSL_compiler *compiler, LSL_Leaf *identifier, LSL_Leaf *blo | |||
479 | 481 | ||
480 | LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *expr) | 482 | LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *expr) |
481 | { | 483 | { |
482 | LSL_Statement *stat = malloc(sizeof(LSL_Statement)); | 484 | LSL_Statement *stat = calloc(1, sizeof(LSL_Statement)); |
483 | 485 | ||
484 | if (stat) | 486 | if (stat) |
485 | { | 487 | { |
@@ -494,7 +496,7 @@ LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *expr) | |||
494 | 496 | ||
495 | LSL_Leaf *addTypecast(LSL_Leaf *lval, LSL_Leaf *type, LSL_Leaf *rval, LSL_Leaf *expr) | 497 | LSL_Leaf *addTypecast(LSL_Leaf *lval, LSL_Leaf *type, LSL_Leaf *rval, LSL_Leaf *expr) |
496 | { | 498 | { |
497 | LSL_Parenthesis *parens = malloc(sizeof(LSL_Parenthesis)); | 499 | LSL_Parenthesis *parens = calloc(1, sizeof(LSL_Parenthesis)); |
498 | 500 | ||
499 | if (parens) | 501 | if (parens) |
500 | { | 502 | { |
@@ -524,6 +526,7 @@ LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi | |||
524 | if ( (identifier) && (result)) | 526 | if ( (identifier) && (result)) |
525 | { | 527 | { |
526 | result->name = identifier->value.stringValue; | 528 | result->name = identifier->value.stringValue; |
529 | result->value.token = tokens[LSL_UNKNOWN - lowestToken]; | ||
527 | identifier->value.identifierValue = result; | 530 | identifier->value.identifierValue = result; |
528 | identifier->left = type; | 531 | identifier->left = type; |
529 | identifier->right = assignment; | 532 | identifier->right = assignment; |
@@ -533,6 +536,7 @@ LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi | |||
533 | { | 536 | { |
534 | identifier->basicType = type->basicType; | 537 | identifier->basicType = type->basicType; |
535 | result->value.basicType = type->basicType; | 538 | result->value.basicType = type->basicType; |
539 | result->value.token = type->token; // This is the LSL_TYPE_* token instead of the LSL_* token. Not sure if that's a problem. | ||
536 | } | 540 | } |
537 | if (compiler->currentBlock) | 541 | if (compiler->currentBlock) |
538 | eina_hash_add(compiler->currentBlock->variables, result->name, identifier); | 542 | eina_hash_add(compiler->currentBlock->variables, result->name, identifier); |