| 11638 | |
| 11639 | |
| 11640 | ResultType Line::PerformAssign() |
| 11641 | { |
| 11642 | // Note: This line's args have not yet been dereferenced in this case (i.e. ExpandArgs() hasn't been called). |
| 11643 | // Currently, ACT_ASSIGNEXPR can occur even when mArg[1].is_expression==false, such as things like var:=5 |
| 11644 | // and var:="string". Search on "is_expression = " to find such cases in the script-loading/parsing routines. |
| 11645 | |
| 11646 | if (!mArg[1].is_expression) |
| 11647 | { |
| 11648 | ASSERT(mArg[1].postfix); |
| 11649 | // Examples of assignments this covers: |
| 11650 | // x := 123 |
| 11651 | // x := 1.0 |
| 11652 | // x := "quoted literal string" |
| 11653 | // x := normal_var ; but not VAR_VIRTUAL or VAR_CONSTANT |
| 11654 | if (mArg[1].postfix->symbol == SYM_VAR && mArg[1].postfix->var->IsUninitialized()) |
| 11655 | return g_script.VarUnsetError(mArg[1].postfix->var); // !is_expression implies VAR_NORMAL, so InitializeConstant() isn't needed here. |
| 11656 | Var *output_var = VAR(mArg[0]); |
| 11657 | return output_var->Assign(*mArg[1].postfix); |
| 11658 | } |
| 11659 | |
| 11660 | return ExpandArgs(); // ExpandExpression() will also take care of the assignment (for performance). |
| 11661 | } |
| 11662 | |
| 11663 | |
| 11664 |
no test coverage detected