Example usage for org.eclipse.jdt.internal.compiler.ast ExpressionContext ASSIGNMENT_CONTEXT

List of usage examples for org.eclipse.jdt.internal.compiler.ast ExpressionContext ASSIGNMENT_CONTEXT

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast ExpressionContext ASSIGNMENT_CONTEXT.

Prototype

ExpressionContext ASSIGNMENT_CONTEXT

To view the source code for org.eclipse.jdt.internal.compiler.ast ExpressionContext ASSIGNMENT_CONTEXT.

Click Source Link

Document

Assignment context: potential poly-expressions are: method invocations, lambdas, reference expressions, conditional expressions and allocation expressions.

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.MethodSpec.java

License:Open Source License

public ExpressionContext getExpressionContext() {
    return ExpressionContext.ASSIGNMENT_CONTEXT;
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.TypeAnalyzer.java

License:Open Source License

/**
 * Find a method in type or one of its super types.
 * @param scope where the method shall be invoked from
 * @param type  where to search/*from  w w w  .  j  a  va 2 s . c o m*/
 * @param selector name of the method
 * @param params params
 * @param decapsulationAllowed whether or not invisible methods should be found, too
 * @param site invocation site if available
 */
public static @Nullable MethodBinding findMethod(final Scope scope, ReferenceBinding type, char[] selector,
        TypeBinding[] params, boolean decapsulationAllowed, @Nullable InvocationSite site) {
    if (type == null || scope == null)
        return null;
    if (site == null) {
        final Expression[] fakeArguments = new Expression[params.length];
        for (int i = 0; i < params.length; i++) {
            fakeArguments[i] = new SingleNameReference(("fakeArg" + i).toCharArray(), 0L); //$NON-NLS-1$
            fakeArguments[i].resolvedType = params[i];
        }
        site = new InvocationSite() {
            @Override
            public int sourceStart() {
                return 0;
            }

            @Override
            public int sourceEnd() {
                return 0;
            }

            @Override
            public void setFieldIndex(int depth) {
                /* nop */ }

            @Override
            public void setDepth(int depth) {
                /* nop */ }

            @Override
            public void setActualReceiverType(ReferenceBinding receiverType) {
                /* nop */ }

            @Override
            public boolean receiverIsImplicitThis() {
                return false;
            }

            @Override
            public boolean isTypeAccess() {
                return false;
            }

            @Override
            public boolean isSuperAccess() {
                return false;
            }

            @Override
            public boolean isQualifiedSuper() {
                return false;
            }

            @Override
            public boolean checkingPotentialCompatibility() {
                return false;
            }

            @Override
            public void acceptPotentiallyCompatibleMethods(MethodBinding[] methods) {
                /* nop */ }

            @Override
            public TypeBinding invocationTargetType() {
                return scope.getJavaLangObject();
            }

            @Override
            public ExpressionContext getExpressionContext() {
                return ExpressionContext.ASSIGNMENT_CONTEXT;
            }

            @Override
            public TypeBinding[] genericTypeArguments() {
                return null;
            }

            @Override
            public InferenceContext18 freshInferenceContext(Scope someScope) {
                return new InferenceContext18(someScope, fakeArguments, this, null);
            }
        };
    }
    return scope.getMethod(type, selector, params, site);
}