Package com.strobel.decompiler.patterns

Examples of com.strobel.decompiler.patterns.Role


        if (sourceType == null) {
            return;
        }

        final Role role = node.getRole();

        if (role == Roles.ARGUMENT) {
            tryRemoveCastForArgument(node, value, parent, sourceType, valueResult.getType());
            return;
        }
View Full Code Here


            );
        }

        verifyNotFrozen();

        final Role role = getRole();

        if (!role.isValid(newNode)) {
            throw new IllegalArgumentException(
                String.format(
                    "The new node '%s' is not valid for role '%s'.",
                    newNode.getClass().getName(),
                    role.toString()
                )
            );
        }

        if (newNode._parent != null) {
View Full Code Here

            );
        }

        final AstNode oldParent = _parent;
        final AstNode oldSuccessor = _nextSibling;
        final Role oldRole = this.getRole();

        remove();

        final AstNode replacement = replaceFunction.apply(this);

        if (oldSuccessor != null && oldSuccessor._parent != oldParent) {
            throw new IllegalStateException("Replace function changed next sibling of node being replaced.");
        }

        if (replacement != null && !replacement.isNull()) {
            if (replacement._parent != null) {
                throw new IllegalStateException("replace function must return the root of a tree");
            }

            if (!oldRole.isValid(replacement)) {
                throw new IllegalStateException(
                    String.format(
                        "The new node '%s' is not valid in the role %s.",
                        replacement.getClass().getSimpleName(),
                        oldRole
View Full Code Here

            );
        }

        verifyNotFrozen();

        final Role role = getRole();

        if (!role.isValid(newNode)) {
            throw new IllegalArgumentException(
                String.format(
                    "The new node '%s' is not valid for role '%s'.",
                    newNode.getClass().getName(),
                    role.toString()
                )
            );
        }

        if (newNode._parent != null) {
View Full Code Here

            );
        }

        final AstNode oldParent = _parent;
        final AstNode oldSuccessor = _nextSibling;
        final Role oldRole = this.getRole();

        remove();

        final T replacement = replaceFunction.apply(this);

        if (oldSuccessor != null && oldSuccessor._parent != oldParent) {
            throw new IllegalStateException("Replace function changed next sibling of node being replaced.");
        }

        if (replacement != null && !replacement.isNull()) {
            if (replacement.getParent() != null) {
                throw new IllegalStateException("replace function must return the root of a tree");
            }

            if (!oldRole.isValid(replacement)) {
                throw new IllegalStateException(
                    String.format(
                        "The new node '%s' is not valid in the role %s.",
                        replacement.getClass().getSimpleName(),
                        oldRole
View Full Code Here

        return new TextLocation(_startLocation.line(), _startLocation.column() + getTokenLength());
    }

    @Override
    public String getText(final JavaFormattingOptions options) {
        final Role role = getRole();

        if (role instanceof TokenRole) {
            return ((TokenRole) role).getToken();
        }
View Full Code Here

TOP

Related Classes of com.strobel.decompiler.patterns.Role

Copyright © 2018 www.massapicom. 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.