Package com.strobel.decompiler.patterns

Examples of com.strobel.decompiler.patterns.Match.success()


    }

    public final ForEachStatement transformForEach(final ExpressionStatement node) {
        final Match m1 = GET_ITERATOR_PATTERN.match(node);

        if (!m1.success()) {
            return null;
        }

        AstNode next = node.getNextSibling();
View Full Code Here


            return null;
        }

        final Match match = FIELD_ASSIGNMENT.match(node);

        if (match.success()) {
            final Expression target = (Expression) firstOrDefault(match.get("target"));
            final MemberReference reference = target.getUserData(Keys.MEMBER_REFERENCE);

            _initializers.put(reference.getFullName(), node);
        }
View Full Code Here

            return null;
        }

        final Match m2 = HASH_CODE_PATTERN.match(input);

        if (!m2.success()) {
            return null;
        }

        final InvocationExpression hashCodeCall = first(m2.<InvocationExpression>get("hashCodeCall"));
        final MemberReference hashCodeMethod = hashCodeCall.getUserData(Keys.MEMBER_REFERENCE);
View Full Code Here

                return null;
            }

            final Match m3 = CASE_BODY_PATTERN.match(section.getStatements().firstOrNullObject());

            if (m3.success()) {
                matches.add(m3);
            }
            else {
                return null;
            }
View Full Code Here

            next = next.getNextSibling();
        }

        final Match m2 = FOR_EACH_PATTERN.match(next);

        if (!m2.success()) {
            return null;
        }

        final IdentifierExpression iterator = m2.<IdentifierExpression>get("iterator").iterator().next();
        final IdentifierExpression item = m2.<IdentifierExpression>get("item").iterator().next();
View Full Code Here

    }

    public final DoWhileStatement transformDoWhile(final WhileStatement loop) {
        final Match m = DO_WHILE_PATTERN.match(loop);

        if (!m.success() || !canConvertWhileToDoWhile(loop)) {
            return null;
        }

        final DoWhileStatement doWhile = new DoWhileStatement();
View Full Code Here

    }

    public final WhileStatement transformContinueOuter(final WhileStatement loop) {
        final Match m = CONTINUE_OUTER_PATTERN.match(loop);

        if (!m.success()) {
            return null;
        }

        final LabelStatement label = (LabelStatement) m.get("label").iterator().next();
View Full Code Here

                }

                final BlockStatement body = transformBlock(lambda.getBody());
                final Match m = LAMBDA_BODY_PATTERN.match(body);

                if (m.success()) {
                    final AstNode bodyNode = first(m.<AstNode>get("body"));
                    bodyNode.remove();
                    lambdaExpression.setBody(bodyNode);

                    if (EMPTY_LAMBDA_BODY_PATTERN.matches(bodyNode)) {
View Full Code Here

            for (final EntityDeclaration d : declaration.getMembers()) {
                if (d instanceof MethodDeclaration) {
                    final Match match = pattern.match(d);

                    if (match.success()) {
                        final MemberReferenceExpression reference = firstOrDefault(match.<MemberReferenceExpression>get("valuesField"));
                        return reference.getUserData(Keys.MEMBER_REFERENCE);
                    }
                }
            }
View Full Code Here

            return null;
        }

        final Match match = FIELD_ASSIGNMENT.match(node);

        if (match.success()) {
            final Expression target = (Expression) firstOrDefault(match.get("target"));
            final FieldReference reference = (FieldReference) target.getUserData(Keys.MEMBER_REFERENCE);
            final FieldDefinition definition = reference.resolve();

            //
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.