예제 #1
0
        internal override bool Match(CodeExpression expression, CodeExpression comperand)
        {
            CodeArrayCreateExpression expression2 = (CodeArrayCreateExpression)expression;
            CodeArrayCreateExpression expression3 = comperand as CodeArrayCreateExpression;

            if (((expression3 == null) || (expression2.Size != expression3.Size)) || !TypeReferenceExpression.MatchType(expression2.CreateType, expression3.CreateType))
            {
                return(false);
            }
            if (expression2.SizeExpression != null)
            {
                if (expression3.SizeExpression == null)
                {
                    return(false);
                }
                if (!RuleExpressionWalker.Match(expression2.SizeExpression, expression3.SizeExpression))
                {
                    return(false);
                }
            }
            else if (expression3.SizeExpression != null)
            {
                return(false);
            }
            if (expression2.Initializers.Count != expression3.Initializers.Count)
            {
                return(false);
            }
            for (int i = 0; i < expression2.Initializers.Count; i++)
            {
                if (!RuleExpressionWalker.Match(expression2.Initializers[i], expression3.Initializers[i]))
                {
                    return(false);
                }
            }
            return(true);
        }