Package com.strobel.decompiler.languages.java.ast

Examples of com.strobel.decompiler.languages.java.ast.AstNode


import com.strobel.decompiler.languages.java.ast.Expression;
import com.strobel.decompiler.languages.java.ast.UnaryOperatorExpression;

public final class UsageClassifier {
    public static UsageType getUsageType(final Expression expression) {
        final AstNode parent = expression.getParent();

        if (parent instanceof BinaryOperatorExpression) {
            return UsageType.Read;
        }
View Full Code Here


    }

    @Override
    public boolean matches(final INode other, final Match match) {
        if (other instanceof AstNode) {
            final AstNode reference = (AstNode) other;
            final MemberReference memberReference = reference.getUserData(Keys.MEMBER_REFERENCE);
           
            if (_target.matches(reference, match) &&
                _referenceType.isInstance(memberReference)) {

                match.add(_groupName, reference);
View Full Code Here

                if (memberReference instanceof FieldReference) {
                    final FieldDefinition resolvedField = ((FieldReference) memberReference).resolve();

                    if (resolvedField != null && resolvedField.hasConstantValue()) {
                        final AstNode parent = node.getParent();

                        if (parent instanceof ExpressionStatement) {
                            parent.remove();
                        }
                        else {
                            reference.remove();
                            node.replaceWith(reference);
                        }
View Full Code Here

    }

    @Override
    public boolean matches(final INode other, final Match match) {
        if (other instanceof AstNode) {
            final AstNode reference = (AstNode) other;
            final MemberReference memberReference = reference.getUserData(Keys.MEMBER_REFERENCE);
           
            if (_target.matches(reference, match) &&
                _referenceType.isInstance(memberReference)) {

                match.add(_groupName, reference);
View Full Code Here

import com.strobel.decompiler.languages.java.ast.Expression;
import com.strobel.decompiler.languages.java.ast.UnaryOperatorExpression;

public final class UsageClassifier {
    public static UsageType getUsageType(final Expression expression) {
        final AstNode parent = expression.getParent();

        if (parent instanceof BinaryOperatorExpression) {
            return UsageType.Read;
        }
View Full Code Here

        return null;
    }

    @Nullable
    private static AstNode skipParenthesesUp(final AstNode e) {
        AstNode result = e;

        while (result instanceof ParenthesizedExpression) {
            result = result.getParent();
        }

        return result;
    }
View Full Code Here

                if (memberReference instanceof FieldReference) {
                    final FieldDefinition resolvedField = ((FieldReference) memberReference).resolve();

                    if (resolvedField != null && resolvedField.hasConstantValue()) {
                        final AstNode parent = node.getParent();

                        if (parent instanceof ExpressionStatement) {
                            parent.remove();
                        }
                        else {
                            reference.remove();
                            node.replaceWith(reference);
                        }
View Full Code Here

      }
    }
    if( behaviorEntry != null )
    {
      // get the node for the token
      AstNode tokenNode = null;
      if( node.getTarget() instanceof MemberReferenceExpression )
      {
        tokenNode = ((MemberReferenceExpression)node.getTarget()).getMemberNameToken();
      }
      else if( node.getTarget() instanceof SuperReferenceExpression )
View Full Code Here

  public Void visitMethodDeclaration( MethodDeclaration node, SourceIndex index )
  {
    MethodDefinition def = node.getUserData( Keys.METHOD_DEFINITION );
    ClassEntry classEntry = new ClassEntry( def.getDeclaringType().getInternalName() );
    BehaviorEntry behaviorEntry = BehaviorEntryFactory.create( classEntry, def.getName(), def.getSignature() );
    AstNode tokenNode = node.getNameToken();
    if( behaviorEntry instanceof ConstructorEntry )
    {
      ConstructorEntry constructorEntry = (ConstructorEntry)behaviorEntry;
      if( constructorEntry.isStatic() )
      {
View Full Code Here

TOP

Related Classes of com.strobel.decompiler.languages.java.ast.AstNode

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.