Examples of JParameter


Examples of com.google.gwt.dev.jjs.ast.JParameter

      // All of the params in the target method are considered to be assigned by
      // the arguments from the caller
      Iterator<JExpression> argIt = x.getArgs().iterator();
      List<JParameter> params = x.getTarget().getParams();
      for (int i = 0; i < params.size(); ++i) {
        JParameter param = params.get(i);
        JExpression arg = argIt.next();
        if (param.getType() instanceof JReferenceType) {
          addAssignment(param, arg);
        }
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JParameter

        Set<JMethod> overrides = program.typeOracle.getAllOverrides(x);
        if (overrides.isEmpty()) {
          return true;
        }
        for (int j = 0, c = x.getParams().size(); j < c; ++j) {
          JParameter param = x.getParams().get(j);
          Set<JParameter> set = paramUpRefs.get(param);
          if (set == null) {
            set = new HashSet<JParameter>();
            paramUpRefs.put(param, set);
          }
          for (JMethod baseMethod : overrides) {
            JParameter baseParam = baseMethod.getParams().get(j);
            set.add(baseParam);
          }
        }
      } else if (program.isStaticImpl(x)) {
        /*
         * Special case: also add upRefs from a staticImpl's params to the
         * params of the instance method it is implementing. Most of the time,
         * this would happen naturally since the instance method delegates to
         * the static. However, in cases where the static has been inlined into
         * the instance method, future optimization could tighten an instance
         * call into a static call at some other call site, and fail to inline.
         * If we allowed a staticImpl param to be tighter than its instance
         * param, badness would ensue.
         */
        JMethod staticImplFor = program.staticImplFor(x);
        if (staticImplFor == null
            || !staticImplFor.getEnclosingType().getMethods().contains(staticImplFor)) {
          // The instance method has already been pruned.
          return true;
        }
        assert (x.getParams().size() == staticImplFor.getParams().size() + 1);
        for (int j = 0, c = x.getParams().size(); j < c; ++j) {
          JParameter param = x.getParams().get(j);
          Set<JParameter> set = paramUpRefs.get(param);
          if (set == null) {
            set = new HashSet<JParameter>();
            paramUpRefs.put(param, set);
          }
          if (j == 0) {
            // Fake an assignment-to-self to prevent tightening; consider this
            // an implicit assignment from a this reference of the looser type.
            assert (param.isThis());
            set.add(param);
          } else {
            JParameter baseParam = staticImplFor.getParams().get(j - 1);
            set.add(baseParam);
          }
        }
      }

View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JParameter

    private JParameter createParameter(LocalVariableBinding binding,
        JMethod enclosingMethod) {
      JType type = (JType) typeMap.get(binding.type);
      SourceInfo info = makeSourceInfo(binding.declaration, enclosingMethod);
      JParameter param = program.createParameter(info, binding.name, type,
          binding.isFinal(), false, enclosingMethod);
      typeMap.put(binding, param);
      return param;
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JParameter

    }

    private JParameter createParameter(SyntheticArgumentBinding arg,
        String argName, JMethod enclosingMethod) {
      JType type = (JType) typeMap.get(arg.type);
      JParameter param = program.createParameter(
          enclosingMethod.getSourceInfo().makeChild(BuildTypeMap.class,
              "Parameter " + argName), argName.toCharArray(), type, true,
          false, enclosingMethod);
      return param;
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JParameter

      /*
       * If the type isn't static, make the first parameter a reference to the
       * instance of the enclosing class. It's the first instance to allow the
       * JSNI qualifier to be moved without affecting evaluation order.
       */
      JParameter enclosingInstance = null;
      if (!staticClass) {
        enclosingInstance = program.createParameter(
            synthetic.getSourceInfo().makeChild(BuildDeclMapVisitor.class,
                "outer instance"), "this$outer".toCharArray(), enclosingType,
            false, false, synthetic);
      }

      /*
       * In one pass, add the parameters to the synthetic constructor and
       * arguments to the method call.
       */
      for (Iterator<JParameter> i = constructor.getParams().iterator(); i.hasNext();) {
        JParameter param = i.next();
        /*
         * This supports x.new Inner() by passing the enclosing instance
         * implicitly as the last argument to the constructor.
         */
        if (enclosingInstance != null && !i.hasNext()) {
          call.addArg(new JParameterRef(synthetic.getSourceInfo().makeChild(
              BuildDeclMapVisitor.class, "enclosing instance"),
              enclosingInstance));
        } else {
          JParameter syntheticParam = program.createParameter(
              synthetic.getSourceInfo().makeChild(BuildDeclMapVisitor.class,
                  "Argument " + param.getName()),
              param.getName().toCharArray(), param.getType(), true, false,
              synthetic);
          call.addArg(new JParameterRef(
              syntheticParam.getSourceInfo().makeChild(
                  BuildDeclMapVisitor.class, "reference"), syntheticParam));
        }
      }

      // Lock the method.
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JParameter

        if (superBinding.syntheticOuterLocalVariables() != null) {
          for (SyntheticArgumentBinding arg : superBinding.syntheticOuterLocalVariables()) {
            // Got to be one of my params
            JType varType = (JType) typeMap.get(arg.type);
            String varName = String.valueOf(arg.name);
            JParameter param = null;
            for (int i = 0; i < currentMethod.getParams().size(); ++i) {
              JParameter paramIt = currentMethod.getParams().get(i);
              if (varType == paramIt.getType()
                  && varName.equals(paramIt.getName())) {
                param = paramIt;
              }
            }
            if (param == null) {
              throw new InternalCompilerException(
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JParameter

          program.getExprThisRef(program.createSourceInfoSynthetic(
              GenerateJavaAST.class, "part of a bridge method"), clazz),
          implmeth);

      for (int i = 0; i < bridgeMethod.getParams().size(); i++) {
        JParameter param = bridgeMethod.getParams().get(i);
        JParameterRef paramRef = new JParameterRef(
            program.createSourceInfoSynthetic(GenerateJavaAST.class,
                "part of a bridge method"), param);
        call.addArg(maybeCast(implmeth.getParams().get(i).getType(), paramRef));
      }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JParameter

          throw new InternalCompilerException(
              "LocalRef referencing local in a different method.");
        }
        return new JLocalRef(info, local);
      } else if (variable instanceof JParameter) {
        JParameter parameter = (JParameter) variable;
        if (parameter.getEnclosingMethod() != currentMethod) {
          throw new InternalCompilerException(
              "ParameterRef referencing param in a different method.");
        }
        return new JParameterRef(info, parameter);
      } else if (variable instanceof JField) {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JParameter

          // See if there's an available parameter
          if (varBinding instanceof SyntheticArgumentBinding) {
            JType type = (JType) typeMap.get(varBinding.type);
            String name = String.valueOf(varBinding.name);
            for (int i = 0; i < currentMethod.getParams().size(); ++i) {
              JParameter param = currentMethod.getParams().get(i);
              if (type == param.getType() && name.equals(param.getName())) {
                variable = param;
                break;
              }
            }
          }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JParameter

    // Find the correct valueOf() method.
    JMethod valueOfMethod = null;
    for (JMethod method : wrapperType.getMethods()) {
      if ("valueOf".equals(method.getName())) {
        if (method.getParams().size() == 1) {
          JParameter param = method.getParams().get(0);
          if (param.getType() == primitiveType) {
            // Found it.
            valueOfMethod = method;
            break;
          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.