Beispiel #1
0
        /// <summary>
        /// Decompile the specified expression, given the network, process, method, and statement
        /// </summary>
        /// <param name="network">The top-level network.</param>
        /// <param name="proc">The process where the method is located.</param>
        /// <param name="method">The method where the statement is found.</param>
        /// <param name="statement">The statement where the expression is found.</param>
        /// <param name="expression">The expression to decompile</param>
        protected IndexerExpression Decompile(NetworkState network, ProcessState proc, MethodState method, Statement statement, ICSharpCode.Decompiler.CSharp.Syntax.IndexerExpression expression)
        {
            if (expression.Arguments.Count != 1)
            {
                throw new Exception($"Indexer expression had {expression.Arguments.Count} index arguments, only one is supported");
            }

            var res = new IndexerExpression()
            {
                SourceResultType = ResolveExpressionType(network, proc, method, statement, expression),
                SourceExpression = expression,
                Target           = LocateDataElement(network, proc, method, statement, expression),
                TargetExpression = Decompile(network, proc, method, statement, expression.Target),
                IndexExpression  = Decompile(network, proc, method, statement, expression.Arguments.First()),
                Parent           = statement
            };

            res.TargetExpression.Parent = res;
            res.IndexExpression.Parent  = res;

            return(res);
        }
Beispiel #2
0
        protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
        {
            IndexerExpression o = other as IndexerExpression;

            return(o != null && this.Target.DoMatch(o.Target, match) && this.Arguments.DoMatch(o.Arguments, match));
        }