Esempio n. 1
0
        internal void ReportIndexingError(Array array, object index, Exception reason)
        {
            string str = ArrayReferenceNode.IndexStringMessage(index);

            if (reason == null)
            {
                throw InterpreterError.NewInterpreterException(index, typeof(RuntimeException), this.NodeToken, "NeedMultidimensionalIndex", (object)array.Rank, (object)str);
            }
            throw InterpreterError.NewInterpreterExceptionWithInnerException(index, typeof(RuntimeException), this.NodeToken, "NeedMultidimensionalIndex", reason, (object)array.Rank, (object)str);
        }
Esempio n. 2
0
 internal override void Visit(ArrayReferenceNode node) => this.preOrderNodes.Add((ParseTreeNode)node);
Esempio n. 3
0
        private void DoSetValue(Array array, object index, object value)
        {
            if (index is IList list)
            {
                if (array.Rank != 1)
                {
                    if (list.Count > 1)
                    {
                        if (!(list[0] is IList))
                        {
                            goto label_5;
                        }
                    }
                    else
                    {
                        goto label_5;
                    }
                }
                throw InterpreterError.NewInterpreterException(index, typeof(RuntimeException), this.NodeToken, "ArraySliceAssignmentFailed", (object)ArrayReferenceNode.IndexStringMessage(index));
            }
label_5:
            try
            {
                this.SetArrayElement(array, index, value);
            }
            catch (IndexOutOfRangeException ex)
            {
                throw InterpreterError.NewInterpreterExceptionWithInnerException(index, typeof(RuntimeException), this.NodeToken, "IndexOutOfRange", (Exception)ex, (object)ArrayReferenceNode.IndexStringMessage(index));
            }
            catch (Exception ex)
            {
                CommandProcessorBase.CheckForSevereException(ex);
                throw InterpreterError.NewInterpreterExceptionWithInnerException(value, typeof(RuntimeException), this.NodeToken, "ArrayAssignmentFailed", ex, (object)ArrayReferenceNode.IndexStringMessage(index), (object)ex.Message);
            }
        }
 internal override void Visit(ArrayReferenceNode node) => this.ReportError((ParseTreeNode)node, "ArrayReferenceNotSupportedInDataSection");