Example usage for org.eclipse.jdt.internal.compiler.lookup ReferenceBinding syntheticEnclosingInstanceTypes

List of usage examples for org.eclipse.jdt.internal.compiler.lookup ReferenceBinding syntheticEnclosingInstanceTypes

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup ReferenceBinding syntheticEnclosingInstanceTypes.

Prototype

public ReferenceBinding[] syntheticEnclosingInstanceTypes() 

Source Link

Usage

From source file:com.google.gwt.dev.jjs.impl.ReferenceMapper.java

License:Apache License

JMethod createConstructor(SourceInfo info, MethodBinding b) {
    JDeclaredType enclosingType = (JDeclaredType) get(b.declaringClass);
    JMethod method = new JConstructor(info, (JClassType) enclosingType);
    enclosingType.addMethod(method);/*from   w w w.  j  a  v  a  2s  . co m*/

    /*
     * Don't need to synthesize enum intrinsic args because enum ctors can only
     * be called locally.
     */

    int argPosition = 0;

    ReferenceBinding declaringClass = b.declaringClass;
    if (declaringClass.isNestedType() && !declaringClass.isStatic()) {
        // add synthetic args for outer this
        if (declaringClass.syntheticEnclosingInstanceTypes() != null) {
            for (ReferenceBinding argType : declaringClass.syntheticEnclosingInstanceTypes()) {
                createParameter(info, argType, method, argPosition++);
            }
        }
    }

    // User args.
    argPosition = mapParameters(info, method, b, argPosition);

    if (declaringClass.isNestedType() && !declaringClass.isStatic()) {
        // add synthetic args for locals
        if (declaringClass.syntheticOuterLocalVariables() != null) {
            for (SyntheticArgumentBinding arg : declaringClass.syntheticOuterLocalVariables()) {
                createParameter(info, arg.type, method, argPosition++);
            }
        }
    }

    mapExceptions(method, b);
    if (b.isSynthetic()) {
        method.setSynthetic();
    }
    return method;
}