Beispiel #1
0
        void run_assign_statement(Statement statement)
        {
            var s      = (AssignStatement)statement;
            var result = s.expression.eval(symbol_table);

            // x = list --- special handling
            // For list slice, if system ($) variable, store the list slice
            // to symbol table.
            //
            // If user variable, meaning no $ start, make a copy of the
            // list and store that copy to the symbol table
            if (result.Type == ValueType.List && s.lvalue.StartsWith('$') == false)
            {
                // user variable case
                var list_result = (ListValue)result;

                if (list_result.is_slice())
                {
                    result = list_result.get_shallow_copy();
                }
            }

            symbol_table.store(s.lvalue, result);
            prog_counter++;
        }