Package org.eclipse.dltk.ast.references

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


      popScope();
      return false;
    }
    for (Object o : node.getArguments()) {
      if (o instanceof FormalParameter) {
        VariableReference parameterName = ((FormalParameter) o).getParameterName();
        Variable v = new ImportedVariable(parameterName);
        v.setInitialized(((FormalParameter) o).start());
        current.variables.put(parameterName.getName(), v);
      }
    }
    if (inClassDecl + 1 == depth && !node.isStatic()) {
      Variable v = new ImportedVariable(node);
      v.setInitialized(node.start());
View Full Code Here


  public boolean visit(LambdaFunctionDeclaration decl) throws Exception {
    Scope prev = current;
    pushScope();
    for (Object o : decl.getArguments()) {
      if (o instanceof FormalParameter) {
        VariableReference parameterName = ((FormalParameter) o).getParameterName();
        Variable v = new ImportedVariable(parameterName);
        v.setInitialized(((FormalParameter) o).start());
        current.variables.put(parameterName.getName(), v);
      }
    }
    if (decl.getLexicalVars() != null) {
      for (Expression var : decl.getLexicalVars()) {
        if (var instanceof ReferenceExpression) {
View Full Code Here

   * TODO Allow mark Variable as global
   */
  public boolean visit(GlobalStatement s) throws Exception {
    for (Expression el : s.getVariables()) {
      if (el instanceof VariableReference) {
        VariableReference ref = (VariableReference) el;
        if (scopes.size() > 1) {
          Scope parentScope = scopes.get(scopes.size() - 2);
          if (parentScope.variables.containsKey(ref.getName())) {
            current.variables.put(ref.getName(), new ImportedVariable(parentScope.variables.get(ref.getName())));
            continue;
          }
        }
        Variable var = current.variables.get(ref.getName());
        if (var == null) {
          var = new Variable(ref);
          current.variables.put(ref.getName(), var);
        }
        if (var.initialized < 0) {
          var.initialized = ref.start();
        }
      } else {
        operations.push(Operation.ASSIGN);
        el.traverse(this);
        operations.pop();
View Full Code Here

    @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

  }

  @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

            }
           
            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

    @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

  }

  @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

          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

    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

TOP

Related Classes of org.eclipse.dltk.ast.references.VariableReference

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.