Examples of VariableReference


Examples of org.eclipse.dltk.ast.references.VariableReference

  }

  @Override
  public boolean visit(Expression expression) throws Exception {
    if (expression instanceof VariableReference) {
      VariableReference varRef = (VariableReference) expression;
      this.fRequestor.acceptFieldReference(varRef.getName(), varRef.sourceStart());
    }
    return super.visit(expression);
  }
View Full Code Here

Examples of org.eclipse.dltk.ast.references.VariableReference

            }
           
            if (element.getValue() instanceof InfixExpression) {
                Scalar namespace = (Scalar) element.getKey();
                Scalar path = (Scalar) ((InfixExpression) element.getValue()).getRight();
                VariableReference reference = (VariableReference) ((InfixExpression) element.getValue()).getLeft();
                extractPsr0(namespace, path, reference);
                return false;
            } else if(element.getValue() instanceof ArrayCreation) {
                Scalar namespace = (Scalar) element.getKey();
                ArrayCreation paths = (ArrayCreation) element.getValue();
                for (ArrayElement elem  : paths.getElements()) {
                  if (elem.getValue() instanceof InfixExpression) {
                    Scalar path = (Scalar) ((InfixExpression) elem.getValue()).getRight();
                        VariableReference reference = (VariableReference) ((InfixExpression) elem.getValue()).getLeft();
                        extractPsr0(namespace, path, reference);
                  }
                  return false;
                }
            }
View Full Code Here

Examples of org.eclipse.dltk.ast.references.VariableReference

    @Override
    public boolean visit(Expression s) throws Exception {
      if (s.sourceStart() <= offset && offset <= s.sourceEnd()) {
        if (s instanceof VariableReference) {
          VariableReference ref = (VariableReference) s;
          // TODO refactor: extern declaration always checked, even if
          // local decl found
          String name = ((VariableReference) s).getName();
          findLocalDeclaration(name, results, IField.class);
          if (impFields.containsKey(name)) {
View Full Code Here

Examples of org.eclipse.dltk.ast.references.VariableReference

  }

  @Override
  public boolean visit(Expression expression) throws Exception {
    if (expression instanceof VariableReference) {
      VariableReference varRef = (VariableReference) expression;
      this.fRequestor.acceptFieldReference(varRef.getName(), varRef.sourceStart());
    }
    return super.visit(expression);
  }
View Full Code Here

Examples of org.eclipse.dltk.ast.references.VariableReference

          public boolean visit(Statement s) throws Exception {
            if (s instanceof GlobalStatement) {
              GlobalStatement globalStatement = (GlobalStatement) s;
              for (Expression e : globalStatement.getVariables()) {
                if (e instanceof VariableReference) {
                  VariableReference varReference = (VariableReference) e;
                  String varName = varReference.getName();
                  if (!processedVars.contains(varName)
                      && (exactName
                          && varName
                              .equalsIgnoreCase(prefix) || !exactName
                          && varName
View Full Code Here

Examples of org.eclipse.dltk.ast.references.VariableReference

    ModuleDeclaration moduleDeclaration = SourceParserUtil
        .getModuleDeclaration(sourceModule, null);
    IContext context = ASTUtils.findContext(sourceModule,
        moduleDeclaration, position);
    if (context != null) {
      VariableReference varReference = getVariableReference(variableName,
          position);
      ExpressionTypeGoal goal = new ExpressionTypeGoal(context,
          varReference);
      PHPTypeInferencer typeInferencer = new PHPTypeInferencer();
      IEvaluatedType evaluatedType = typeInferencer.evaluateType(goal);
View Full Code Here

Examples of org.eclipse.dltk.ast.references.VariableReference

    ModuleDeclaration moduleDeclaration = SourceParserUtil
        .getModuleDeclaration(sourceModule, null);
    IContext context = ASTUtils.findContext(sourceModule,
        moduleDeclaration, position);
    if (context != null) {
      VariableReference varReference = getVariableReference(variableName,
          position);
      ExpressionTypeGoal goal = new ExpressionTypeGoal(context,
          varReference);
      PHPTypeInferencer typeInferencer = new PHPTypeInferencer();
      IEvaluatedType evaluatedType = typeInferencer.evaluateType(goal);
View Full Code Here

Examples of org.eclipse.dltk.ast.references.VariableReference

      int startIndex = variableName.indexOf(start);
      String name = variableName.substring(0, startIndex);
      return new ArrayVariableReference(position, position
          + variableName.length(), name, null, arrayType);
    }
    return new VariableReference(position,
        position + variableName.length(), variableName);
  }
View Full Code Here

Examples of org.eclipse.dltk.ast.references.VariableReference

    return super.visit(node);
  }

  private void addDeclaredVariables(Expression variable, Expression node) {
    if (variable instanceof VariableReference) {
      VariableReference varReference = (VariableReference) variable;
      getScope().addDeclaration(varReference.getName(), node);
    } else if (variable instanceof ListVariable) {
      ListVariable varReference = (ListVariable) variable;
      for (Expression nestedVar : varReference.getVariables()) {
        addDeclaredVariables(nestedVar, node);
      }
    } else if (variable instanceof ReflectionArrayVariableReference) {
      Expression expression = ((ReflectionArrayVariableReference) variable)
          .getExpression();
View Full Code Here

Examples of org.eclipse.dltk.ast.references.VariableReference

    if (node instanceof GlobalStatement) {
      GlobalStatement globalStatement = (GlobalStatement) node;
      for (Expression variable : globalStatement.getVariables()) {
        if (variable instanceof VariableReference) {
          VariableReference varReference = (VariableReference) variable;
          getScope().addDeclaration(varReference.getName(),
              globalStatement);
        }
      }
    } else if (node instanceof FormalParameter) {
      FormalParameter parameter = (FormalParameter) node;
      getScope().addDeclaration(parameter.getName(), parameter);
    } else if (node instanceof CatchClause) {
      CatchClause clause = (CatchClause) node;
      VariableReference varReference = clause.getVariable();
      getScope().addDeclaration(varReference.getName(), clause);
    } else if (node instanceof ForEachStatement) {
      ForEachStatement foreachStatement = (ForEachStatement) node;

      Expression value = foreachStatement.getValue();
      if (value instanceof ReferenceExpression) { // foreach ( $array as
        // &$value )
        value = ((ReferenceExpression) value).getVariable();
      }

      if (value instanceof SimpleReference) {
        String variableName = ((SimpleReference) value).getName();
        getScope().addDeclaration(variableName, foreachStatement);
      }

      final Expression key = foreachStatement.getKey();
      if (key instanceof SimpleReference) {
        String variableName = ((SimpleReference) key).getName();
        getScope().addDeclaration(variableName, foreachStatement);
      }
    } else if (node instanceof StaticStatement) {
      StaticStatement staticStatement = (StaticStatement) node;
      // Collection<? extends Expression> expressions =
      // staticStatement.getExpressions();
      for (Expression variable : staticStatement.getExpressions()) {
        if (variable instanceof VariableReference) {
          VariableReference varReference = (VariableReference) variable;
          getScope().addDeclaration(varReference.getName(),
              staticStatement);
        }
      }
      // VariableReference varReference =
      // staticStatement.getExpressions();
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.