Package org.eclipse.dltk.ast.expressions

Examples of org.eclipse.dltk.ast.expressions.Expression


    if (isConditional(parent)) {
      getScope().enterInnerBlock((Statement) parent);
    }

    if (node instanceof Assignment) {
      Expression variable = ((Assignment) node).getVariable();
      addDeclaredVariables(variable, node);
    }

    postProcess(node);
View Full Code Here


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

      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) {
View Full Code Here

              && e.sourceEnd() - e.sourceStart() == length) {
            result = ((Assignment) e).getValue();
            context = contextStack.peek();
          } else if (variableName != null) {
            Assignment assignment = (Assignment) e;
            Expression left = assignment.getVariable();
            Expression right = assignment.getValue();

            if (left instanceof StaticFieldAccess) {
              StaticFieldAccess fieldAccess = (StaticFieldAccess) left;
              Expression dispatcher = fieldAccess.getDispatcher();
              if (isSelf(dispatcher)) {
                Expression field = fieldAccess.getField();
                if (field instanceof VariableReference
                    && variableName
                        .equals(((VariableReference) field)
                            .getName())) {
                  staticDeclarations.put(right,
                      contextStack.peek());
                }
              }
            } else if (left instanceof FieldAccess) {
              FieldAccess fieldAccess = (FieldAccess) left;
              Expression dispatcher = fieldAccess.getDispatcher();
              if (dispatcher instanceof VariableReference
                  && "$this".equals(((VariableReference) dispatcher).getName())) { //$NON-NLS-1$
                Expression field = fieldAccess.getField();
                if (field instanceof SimpleReference
                    && variableName
                        .equals('$' + ((SimpleReference) field)
                            .getName())) {
                  staticDeclarations.put(right,
View Full Code Here

          .sourceEnd(), constDecl.sourceStart(), constDecl
          .sourceEnd());
      decl.setModifiers(Modifiers.AccConstant);
      locator.match(decl, getNodeSet());
    } else if (node instanceof FieldAccess) {
      Expression field = ((FieldAccess) node).getField();
      if (field instanceof SimpleReference) {
        SimpleReference ref = (SimpleReference) field;
        SimpleReferenceLocation refLoc = new SimpleReferenceLocation(
            ref.sourceStart(), ref.sourceEnd(), '$' + ref.getName());
        locator.match(refLoc, getNodeSet());
      }
    } else if (node instanceof StaticFieldAccess) {
      Expression field = ((StaticFieldAccess) node).getField();
      if (field instanceof SimpleReference) {
        SimpleReference ref = (SimpleReference) field;
        SimpleReferenceLocation refLoc = new SimpleReferenceLocation(
            ref.sourceStart(), ref.sourceEnd(), '$' + ref.getName());
        locator.match(refLoc, getNodeSet());
      }
    } else if (node instanceof StaticConstantAccess) {
      ConstantReference constantRef = ((StaticConstantAccess) node)
          .getConstant();
      locator.match(constantRef, getNodeSet());
    }
    /*
     * else if (node instanceof ConstantReference) {
     * locator.match((ConstantReference)node, getNodeSet()); }
     */
    else if (node instanceof Assignment) {
      Expression left = ((Assignment) node).getVariable();
      if (left instanceof FieldAccess) { // class variable ($this->a = .)
        FieldAccess fieldAccess = (FieldAccess) left;
        Expression dispatcher = fieldAccess.getDispatcher();
        if (dispatcher instanceof VariableReference) { // && "$this".equals(((VariableReference) dispatcher).getName())) { //$NON-NLS-1$
          Expression field = fieldAccess.getField();
          if (field instanceof SimpleReference) {
            SimpleReference ref = (SimpleReference) field;
            FieldDeclaration decl = new FieldDeclarationLocation(
                '$' + ref.getName(), ref.sourceStart(), ref
                    .sourceEnd(), node.sourceStart(), node
                    .sourceEnd());
            locator.match(decl, getNodeSet());
          }
        }
      } else if (left instanceof VariableReference) {
        FieldDeclaration decl = new FieldDeclarationLocation(
            ((VariableReference) left).getName(), left
                .sourceStart(), left.sourceEnd(), node
                .sourceStart(), node.sourceEnd());
        locator.match(decl, getNodeSet());
      }
    } else if (node instanceof ListVariable) {
      recursiveListMatch(node, locator);
    } else if (node instanceof TypeReference) {
      locator.match((TypeReference) node, getNodeSet());
    } else if (node instanceof VariableReference) {
      locator.match((VariableReference) node, getNodeSet());
    } else if (node instanceof CallExpression) {
      FieldDeclaration constantDecl = ASTUtils
          .getConstantDeclaration((CallExpression) node);
      if (constantDecl != null) {
        locator.match(constantDecl, getNodeSet());
      } else {
        locator.match((CallExpression) node, getNodeSet());
      }
    } else if (node instanceof Include) {
      Include include = (Include) node;
      if (include.getExpr() instanceof Scalar) {
        Scalar filePath = (Scalar) include.getExpr();
        CallExpression callExpression = new CallExpressionLocation(
            filePath.sourceStart(), filePath.sourceEnd(), null,
            "include", new CallArgumentsList()); //$NON-NLS-1$
        locator.match(callExpression, getNodeSet());
      }
    } else if (node instanceof Argument) {
      SimpleReference ref = ((Argument) node).getRef();
      FieldDeclaration decl = new FieldDeclarationLocation(ref.getName(),
          ref.sourceStart(), ref.sourceEnd(), node.sourceStart(),
          node.sourceEnd());
      locator.match(decl, getNodeSet());
    } else if (node instanceof ForEachStatement) {
      Expression key = ((ForEachStatement) node).getKey();
      Expression value = ((ForEachStatement) node).getValue();
      if (key instanceof SimpleReference) {
        SimpleReference ref = (SimpleReference) key;
        FieldDeclaration decl = new FieldDeclarationLocation(ref
            .getName(), ref.sourceStart(), ref.sourceEnd(), node
            .sourceStart(), node.sourceEnd());
View Full Code Here

  public IGoal[] init() {
    ExpressionTypeGoal typedGoal = (ExpressionTypeGoal) goal;
    ClassInstanceCreation expression = (ClassInstanceCreation) typedGoal
        .getExpression();
    Expression className = expression.getClassName();
    if ((className instanceof TypeReference)) {
      if (isSelf((TypeReference) className)
          && (goal.getContext() instanceof MethodContext)) {
        MethodContext methodContext = (MethodContext) goal.getContext();
        result = methodContext.getInstanceType();
View Full Code Here

  public IGoal[] init() {
    ExpressionTypeGoal typedGoal = (ExpressionTypeGoal) goal;
    StaticConstantAccess expr = (StaticConstantAccess) typedGoal
        .getExpression();

    Expression dispatcher = expr.getDispatcher();
    if (dispatcher instanceof TypeReference) {
      TypeReference typeReference = (TypeReference) dispatcher;
      return new IGoal[] { new ConstantDeclarationGoal(goal.getContext(),
          expr.getConstant().getName(), typeReference.getName()) };
    }
View Full Code Here

    xmlWriter.startTag("Condition", new HashMap<String, String>()); //$NON-NLS-1$
    s.getCondition().traverse(this);
    xmlWriter.endTag("Condition"); //$NON-NLS-1$

    Expression ifTrue = s.getIfTrue();
    if (ifTrue != null) {
      xmlWriter.startTag("IfTrue", new HashMap<String, String>()); //$NON-NLS-1$
      ifTrue.traverse(this);
      xmlWriter.endTag("IfTrue"); //$NON-NLS-1$
    }

    Expression falseExp = s.getIfFalse();
    if (falseExp != null) {
      xmlWriter.startTag("IfFalse", new HashMap<String, String>()); //$NON-NLS-1$
      falseExp.traverse(this);
      xmlWriter.endTag("IfFalse"); //$NON-NLS-1$
    }

    return false;
  }
View Full Code Here

    if (visit) {
      if (parameterType != null) {
        parameterType.traverse(visitor);
      }
      parameterName.traverse(visitor);
      Expression defaultValue = (Expression) getInitialization();
      if (defaultValue != null) {
        defaultValue.traverse(visitor);
      }
    }
    visitor.endvisit(this);
  }
View Full Code Here

    public boolean visit(ConstantDeclaration node) throws Exception {
      if (!interesting(node)) {
        return false;
      }
      Expression value = node.getConstantValue();
      if (value instanceof Scalar) {
        declarations.add((Scalar) value);
      }
      return visitGeneral(node);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.ast.expressions.Expression

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.