Package org.eclipse.php.internal.core.typeinference.goals

Examples of org.eclipse.php.internal.core.typeinference.goals.MethodElementReturnTypeGoal


    IType[] modelElements = PHPTypeInferenceUtils.getModelElements(evaluatedType, (ISourceModuleContext) context, expression.sourceStart());
    if (modelElements != null) {
      return modelElements;
    }

    evaluatedType = TYPE_INFERENCER.evaluateType(new MethodElementReturnTypeGoal(context, receiverTypes, expression.getName()));
    if (evaluatedType instanceof PHPThisClassType && ((PHPThisClassType) evaluatedType).getType() != null) {
      modelElements = new IType[] { ((PHPThisClassType) evaluatedType).getType() };
    } else {
      modelElements = PHPTypeInferenceUtils.getModelElements(evaluatedType, (ISourceModuleContext) context, expression.sourceStart());
    }
View Full Code Here


      }

      return collectingTypes.toArray(new IType[collectingTypes.size()]);
    }

    evaluatedType = TYPE_INFERENCER.evaluateType(new MethodElementReturnTypeGoal(context, receiverTypes, expression.getName()));
    if (evaluatedType instanceof MultiTypeType) {
      List<IType> collectingTypes = new LinkedList<IType>();
      for (IEvaluatedType possibleType : ((MultiTypeType) evaluatedType).getTypes()) {
        IType[] types = PHPTypeInferenceUtils.getModelElements(possibleType, (ISourceModuleContext) context, expression.sourceStart(), (IModelAccessCache) null);
        if (types != null) {
View Full Code Here

      if (modelElements != null && modelElements.length > 0) {
        return modelElements;
      }
    }

    MethodElementReturnTypeGoal methodGoal = new MethodElementReturnTypeGoal(
        context, types, method, argNames);
    evaluatedType = typeInferencer.evaluateType(methodGoal);
    if (evaluatedType instanceof PHPThisClassType
        && ((PHPThisClassType) evaluatedType).getType() != null) {
      modelElements = new IType[] { ((PHPThisClassType) evaluatedType)
View Full Code Here

      // if (modelElements != null) {
      // return modelElements;
      // }
    }

    MethodElementReturnTypeGoal methodGoal = new MethodElementReturnTypeGoal(
        context, types, method, argNames);
    evaluatedType = typeInferencer.evaluateType(methodGoal);

    if (evaluatedType instanceof MultiTypeType) {
      List<IType> tmpList = new LinkedList<IType>();
View Full Code Here

  public MethodReturnTypeEvaluator(IGoal goal) {
    super(goal);
  }

  public IGoal[] init() {
    MethodElementReturnTypeGoal goal = (MethodElementReturnTypeGoal) getGoal();
    String methodName = goal.getMethodName();

    final List<IGoal> subGoals = new LinkedList<IGoal>();
    MethodsAndTypes mat = getMethodsAndTypes();
    for (int i = 0; i < mat.methods.length; i++) {
      IMethod method = mat.methods[i];

      ISourceModule sourceModule = method.getSourceModule();
      ModuleDeclaration module = SourceParserUtil
          .getModuleDeclaration(sourceModule);

      MethodDeclaration decl = null;
      try {
        decl = PHPModelUtils.getNodeByMethod(module, method);
      } catch (ModelException e) {
        if (DLTKCore.DEBUG) {
          e.printStackTrace();
        }
      }
      // final boolean found[] = new boolean[1];
      if (decl != null) {
        final IContext innerContext = ASTUtils.findContext(
            sourceModule, module, decl);
        if (innerContext instanceof MethodContext) {
          MethodContext mc = (MethodContext) innerContext;
          mc.setCurrentType(mat.types[i]);
        }
        if (goal.getContext() instanceof IModelCacheContext
            && innerContext instanceof IModelCacheContext) {
          ((IModelCacheContext) innerContext)
              .setCache(((IModelCacheContext) goal.getContext())
                  .getCache());
        }

        ASTVisitor visitor = new ASTVisitor() {
          public boolean visitGeneral(ASTNode node) throws Exception {
View Full Code Here

            argNames[i] = ASTUtils.stripQuotes(arg.getValue());
          }
          i++;
        }
      }
      return new MethodElementReturnTypeGoal(typedGoal.getContext(),
          receiverType, expression.getName(), argNames);
    }

    if (state == STATE_WAITING_METHOD) {
      if (goalState != GoalState.PRUNED && previousResult != null
View Full Code Here

                  return IGoal.NO_GOALS;
                }
              }

              if (isImplementedIterator(superTypes)) {
                subGoals.add(new MethodElementReturnTypeGoal(
                    subgoal.getContext(),
                    new IType[] { type }, "current")); //$NON-NLS-1$
                subGoals.add(new PHPDocMethodReturnTypeGoal(
                    subgoal.getContext(),
                    new IType[] { type }, "current")); //$NON-NLS-1$
View Full Code Here

        }
        // MethodContext context = (MethodContext) goal.getContext();
        // PHPClassType classType = (PHPClassType) context.getInstanceType();
        if (goalClass == MethodElementReturnTypeGoal.class) {
          MethodElementReturnTypeGoal g = (MethodElementReturnTypeGoal) goal;
          if (g.getArgNames() != null && g.getArgNames().length > 0 && g.getArgNames()[0] != null) {
            if (g.getMethodName().equals("get")) {
              return new ServiceGoalEvaluator(g, ASTUtils.stripQuotes(g.getArgNames()[0]));
            } else if (g.getMethodName().equals("getManager")) {
              return new DoctrineManagerGoalEvaluator(g, ASTUtils.stripQuotes(g.getArgNames()[0]));
            }
          }
        } else if (goalClass == ServiceTypeGoal.class) {
          return new ServiceTypeGoalEvaluator((ServiceTypeGoal)goal);
        }
View Full Code Here

    return IGoal.NO_GOALS;
  }

  private IGoal produceNextSubgoal(IGoal previousGoal,
      IEvaluatedType previousResult, GoalState goalState) {
    MethodElementReturnTypeGoal typedGoal = (MethodElementReturnTypeGoal) goal;
    // just starting to evaluate method, evaluate method receiver first:
    if (state == STATE_INIT) {
      if(typedGoal.getTypes() == null || typedGoal.getTypes().length < 1) {
        return null;
      }
      state = STATE_GOT_RECEIVER;
    }

    if (state == STATE_GOT_RECEIVER) {
      IModelAccessCache accessCache = null;
      if (goal.getContext() instanceof IModelCacheContext) {
        accessCache = ((IModelCacheContext)goal.getContext()).getCache();
      }
      try {
        IType[] types = typedGoal.getTypes();
        for (IType type : types) {
          String fq = type.getFullyQualifiedName(SLASH);
          IGoal result = checkName(fq);
          if (result != null) {
            return result;
View Full Code Here

    return IGoal.NO_GOALS;
  }

  private IGoal produceNextSubgoal(IGoal previousGoal,
      IEvaluatedType previousResult, GoalState goalState) {
    MethodElementReturnTypeGoal typedGoal = (MethodElementReturnTypeGoal) goal;
    // just starting to evaluate method, evaluate method receiver first:
    if (state == STATE_INIT) {
      if(typedGoal.getTypes() == null || typedGoal.getTypes().length < 1) {
        return null;
      }
      state = STATE_GOT_RECEIVER;
    }

    if (state == STATE_GOT_RECEIVER) {
      IModelAccessCache accessCache = null;
      if (goal.getContext() instanceof IModelCacheContext) {
        accessCache = ((IModelCacheContext)goal.getContext()).getCache();
      }
      try {
        IType[] types = typedGoal.getTypes();
        for (IType type : types) {
          String fq = type.getFullyQualifiedName(SLASH);
          IGoal result = checkName(fq);
          if (result != null) {
            return result;
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.typeinference.goals.MethodElementReturnTypeGoal

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.