Package com.strobel.decompiler.ast

Examples of com.strobel.decompiler.ast.Variable


            if (member != null) {
                members.add(member);
                continue;
            }

            final Variable variable = identifier.getUserData(Keys.VARIABLE);

            if (variable != null) {
                if (variable.isParameter()) {
                    member = variable.getOriginalParameter();
                }
                else if (variable.getOriginalVariable() != null) {
                    member = variable.getOriginalVariable();
                }

                if (member != null) {
                    members.add(member);
                }
View Full Code Here


    }

    private Object getCurrentLocalReference() {
        final AstNode node = nodeStack.peek();

        Variable variable = node.getUserData(Keys.VARIABLE);

        if (variable == null && node instanceof Identifier && node.getParent() != null) {
            variable = node.getParent().getUserData(Keys.VARIABLE);
        }

        if (variable != null) {
            if (variable.isParameter()) {
                return variable.getOriginalParameter();
            }
            return variable.getOriginalVariable();
        }

        return null;
    }
View Full Code Here

        if (parameter != null) {
            return parameter;
        }

        if (node instanceof VariableInitializer || node instanceof CatchClause/* || node instanceof ForEachStatement*/) {
            Variable variable = node.getUserData(Keys.VARIABLE);

            if (variable == null && node.getParent() instanceof VariableDeclarationStatement) {
                variable = node.getParent().getUserData(Keys.VARIABLE);
            }

            if (variable != null) {
                if (variable.getOriginalParameter() != null) {
                    return variable.getOriginalParameter();
                }

                return variable.getOriginalVariable();
            }
        }

        if (node instanceof LabelStatement) {
            final LabelStatement label = (LabelStatement) node;
View Full Code Here

            return;
        }

        if (operand instanceof Variable) {
            final Variable variable = (Variable) operand;

            if (variable.isParameter()) {
                writer.writeReference(variable.getName(), variable.getOriginalParameter());
            }
            else {
                writer.writeReference(variable.getName(), variable.getOriginalVariable());
            }

            return;
        }
View Full Code Here

        final VariableDeclarationStatement d = (VariableDeclarationStatement) previous;
        final AstNodeCollection<VariableInitializer> variables = d.getVariables();
        final VariableInitializer initializer = variables.firstOrNullObject();

        final Variable variable = initializer.getUserData(Keys.VARIABLE);

        if (variable != null &&
            variable.getOriginalVariable() != null &&
            variable.getOriginalVariable().isFromMetadata()) {

            return;
        }

        if (variables.hasSingleElement() &&
View Full Code Here

        return true;
    }

    @Override
    public Void visitIdentifierExpression(final IdentifierExpression node, final Void data) {
        final Variable variable = node.getUserData(Keys.VARIABLE);

        if (variable != null &&
            variable.isParameter() &&
            _parametersToRemove.contains(variable.getOriginalParameter())) {

            final TypeReference parameterType = variable.getOriginalParameter().getParameterType();

            if (!MetadataResolver.areEquivalent(context.getCurrentType(), parameterType) &&
                isContextWithinTypeInstance(parameterType)) {

                final TypeDefinition resolvedType = parameterType.resolve();
View Full Code Here

            final Expression left = node.getLeft();
            final Expression right = node.getRight();

            if (left instanceof MemberReferenceExpression) {
                if (right instanceof IdentifierExpression) {
                    final Variable variable = right.getUserData(Keys.VARIABLE);

                    if (variable == null || !variable.isParameter()) {
                        return null;
                    }

                    final MemberReferenceExpression memberReference = (MemberReferenceExpression) left;
                    final MemberReference member = memberReference.getUserData(Keys.MEMBER_REFERENCE);

                    if (member instanceof FieldReference &&
                        memberReference.getTarget() instanceof ThisReferenceExpression) {

                        final FieldDefinition resolvedField = ((FieldReference) member).resolve();

                        if (resolvedField != null &&
                            resolvedField.isSynthetic() &&
                            MetadataResolver.areEquivalent(resolvedField.getFieldType(), currentType.getDeclaringType())) {

                            final ParameterDefinition parameter = variable.getOriginalParameter();

                            _outerClassFields.add(resolvedField.getFullName());
                            _parametersToRemove.add(parameter);

                            final ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) firstOrDefault(
View Full Code Here

                if (declaration == null) {
                    firstInlinableInitializer = null;
                    continue;
                }

                final Variable underlyingVariable = declaration.getUserData(Keys.VARIABLE);

                if (underlyingVariable == null || underlyingVariable.isParameter()) {
                    firstInlinableInitializer = null;
                    continue;
                }

                if (!variableNames.add(underlyingVariable.getName())) {
                    firstInlinableInitializer = null;
                    continue;
                }

                if (variableType == null) {
                    variableType = underlyingVariable.getType();
                }
                else if (!variableType.equals(underlyingVariable.getType())) {
                    variableType = underlyingVariable.getType();
                    firstInlinableInitializer = null;
                }

                if (!(declaration.getParent() instanceof BlockStatement)) {
                    firstInlinableInitializer = null;
View Full Code Here

        while (current != null) {
            while (current.getPreviousSibling() != null) {
                current = current.getPreviousSibling();
                if (current instanceof VariableDeclarationStatement) {
                    final VariableDeclarationStatement variableDeclaration = (VariableDeclarationStatement) current;
                    final Variable variable = variableDeclaration.getUserData(Keys.VARIABLE);

                    if (variable != null && StringUtilities.equals(variable.getName(), identifier)) {
                        return variableDeclaration;
                    }

                    if (variableDeclaration.getVariables().size() == 1 &&
                        StringUtilities.equals(variableDeclaration.getVariables().firstOrNullObject().getName(), identifier)) {
View Full Code Here

        }

        @Override
        public Boolean visitAssignmentExpression(final AssignmentExpression node, final Void _) {
            final Expression left = node.getLeft();
            final Variable variable = left.getUserData(Keys.VARIABLE);

            if (variable != null && variable.isParameter()) {
                _unassignedParameters.remove(variable.getOriginalParameter());
                return super.visitAssignmentExpression(node, _);
            }

            ParameterDefinition parameter = left.getUserData(Keys.PARAMETER_DEFINITION);
View Full Code Here

TOP

Related Classes of com.strobel.decompiler.ast.Variable

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.