Package com.google.gwt.dev.jjs.ast.JMethod

Examples of com.google.gwt.dev.jjs.ast.JMethod.Specialization


    for (JMethod method : toBeMadeStatic) {
      creator.accept(method);
    }
    for (JMethod method : toBeMadeStatic) {
      // if method has specialization, add it to the static method
      Specialization specialization = method.getSpecialization();
      if (specialization != null) {
        JMethod staticMethod = program.getStaticImpl(method);
        List<JType> params = new ArrayList<JType>(specialization.getParams());
        params.add(0, staticMethod.getParams().get(0).getType());
        staticMethod.setSpecialization(params, specialization.getReturns(),
            staticMethod.getName());
        staticMethod.getSpecialization().resolve(params,
            specialization.getReturns(), program.getStaticImpl(specialization
                .getTargetMethod()));
      }
    }

    /*
 
View Full Code Here


  private void resolveSpecialization(JMethod method) {
    // TODO (cromwellian): Move to GwtAstBuilder eventually
    if (method.getSpecialization() == null) {
      return;
    }
    Specialization specialization = method.getSpecialization();
    List<JType> resolvedParams = new ArrayList<JType>();
    if (specialization.getParams() == null) {
      logger.log(Type.ERROR, "Missing 'params' attribute at @SpecializeMethod for method "
          + method.getSignature());
      errorsFound = true;
      return;
    }

    for (JType param : specialization.getParams()) {
      resolvedParams.add(translate(param));
    }
    JType resolvedReturn =
        specialization.getReturns() == null ? null : translate(specialization.getReturns());

    JMethod targetMethod = program.typeOracle.getInstanceMethodBySignature(
        (JClassType) method.getEnclosingType(), specialization.getTargetSignature(method));

    if (targetMethod == null) {
      errorsFound = true;
      logger.log(Type.ERROR, "Unable to locate @SpecializeMethod target "
          + specialization.getTargetSignature(method) + " for method " + method.getSignature());
      return;
    }

    flowInto(targetMethod);
    specialization.resolve(resolvedParams, resolvedReturn, targetMethod);
  }
View Full Code Here

    for (JMethod method : toBeMadeStatic) {
      creator.accept(method);
    }
    for (JMethod method : toBeMadeStatic) {
      // if method has specialization, add it to the static method
      Specialization specialization = method.getSpecialization();
      if (specialization != null) {
        JMethod staticMethod = program.getStaticImpl(method);
        List<JType> params = new ArrayList<JType>(specialization.getParams());
        params.add(0, staticMethod.getParams().get(0).getType());
        staticMethod.setSpecialization(params, specialization.getReturns(),
            staticMethod.getName());
        staticMethod.getSpecialization().resolve(params,
            specialization.getReturns(), program.getStaticImpl(specialization
                .getTargetMethod()));
      }
    }

    /*
 
View Full Code Here

        }
      }

      // TODO (cromwellian): Move to GwtAstBuilder eventually
      if (method.getSpecialization() != null) {
        Specialization specialization = method.getSpecialization();
        List<JType> resolvedParams = new ArrayList<JType>();
        if (specialization.getParams() == null) {
          logger.log(Type.WARN, "Forgot to specify params= attribute on "
            + "method " + method.getSignature());
          method.removeSpecialization();
        } else {
          for (JType param : specialization.getParams()) {
            resolvedParams.add(translate(param));
          }
        }
        JType resolvedReturn = null;
        if (specialization.getReturns() != null) {
          resolvedReturn = translate(specialization.getReturns());
        }

        JMethod targetMethod = program.typeOracle
          .getMethodBySignature((JClassType) method.getEnclosingType()
            , specialization.getTargetSignature(method));
        if (targetMethod != null) {
          flowInto(targetMethod);
          specialization.resolve(resolvedParams, resolvedReturn,
            targetMethod);
        } else {
          if (specialization.getTarget() == null ||
            "".equals(specialization.getTarget())) {
            logger.log(Type.WARN, "Unable to locate @SpecializeMethod target, "
              + " forgot to specify target= attribute on method " +
              method.getSignature());
          } else {
            logger.log(Type.WARN, "Unable to locate @SpecializeMethod target "
              + specialization.getTargetSignature(method) + " for method " +
              method.getSignature());
          }
          method.removeSpecialization();
        }
      }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.ast.JMethod.Specialization

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.