Package org.eclipse.dltk.ast.declarations

Examples of org.eclipse.dltk.ast.declarations.FieldDeclaration


      this.processPackage(statement);
      super.fNodes.pop();
      return false;
    }
    if (statement instanceof FieldDeclaration) {
      FieldDeclaration fieldDecl = (FieldDeclaration) statement;
      processFieldDeclaration(fieldDecl.getRef(), fieldDecl);
      super.fNodes.pop();
      return false;
    }
    // TODO handle tm-import statement
    if (statement instanceof RutaImportStatement) {
View Full Code Here


      this.processPackage(statement);
      super.fNodes.pop();
      return false;
    }
    if (statement instanceof FieldDeclaration) {
      FieldDeclaration fieldDecl = (FieldDeclaration) statement;
      processFieldDeclaration(fieldDecl.getRef(), fieldDecl);
      super.fNodes.pop();
      return false;
    }
    // TODO handle tm-import statement
    if (statement instanceof RutaImportStatement) {
View Full Code Here

    if (node instanceof FieldDeclaration) {
      locator.match((FieldDeclaration) node, getNodeSet());
    } else if (node instanceof ConstantDeclaration) {
      ConstantDeclaration constDecl = (ConstantDeclaration) node;
      ConstantReference constantName = constDecl.getConstantName();
      FieldDeclaration decl = new FieldDeclarationLocation(constantName
          .getName(), constantName.sourceStart(), constantName
          .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());
        locator.match(decl, getNodeSet());
      }
      if (value instanceof SimpleReference) {
        SimpleReference ref = (SimpleReference) value;
        FieldDeclaration decl = new FieldDeclarationLocation(ref
            .getName(), ref.sourceStart(), ref.sourceEnd(), ref
            .sourceStart(), ref.sourceEnd());
        locator.match(decl, getNodeSet());
      }
    } else if (node instanceof CatchClause) {
      VariableReference ref = ((CatchClause) node).getVariable();
      FieldDeclaration decl = new FieldDeclarationLocation(ref.getName(),
          ref.sourceStart(), ref.sourceEnd(), node.sourceStart(),
          node.sourceEnd());
      locator.match(decl, getNodeSet());
    }
  }
View Full Code Here

        .getVariables();
    for (Expression expression : variables) {
      if (expression instanceof ListVariable) {
        recursiveListMatch(expression, locator);
      } else if (expression instanceof VariableReference) {
        FieldDeclaration decl = new FieldDeclarationLocation(
            ((VariableReference) expression).getName(), expression
                .sourceStart(), expression.sourceEnd(),
            expression.sourceStart(), expression.sourceEnd());
        locator.match(decl, getNodeSet());
      }
View Full Code Here

    }

    public boolean visit(Expression expression) {
      if (expression instanceof CallExpression) {
        try {
          FieldDeclaration constantDecl = ASTUtils
              .getConstantDeclaration((CallExpression) expression);
          if (constantDecl != null) {
            Integer level = (Integer) nodeSet.matchingNodes
                .removeKey(constantDecl);
            reportMatching(null, constantDecl, parent,
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.ast.declarations.FieldDeclaration

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.