Package org.eclipse.dltk.ast

Examples of org.eclipse.dltk.ast.ASTVisitor


    IProblemReporter problemReporter = context.getProblemReporter();
    // get Types:
    ISourceModule smod = context.getSourceModule();
    ISourceLineTracker linetracker = context.getLineTracker();
    try {
      ASTVisitor visitor = new VarRefVisitor(problemReporter, linetracker, smod);
      md.traverse(visitor);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here


    // traverse:
    ISourceLineTracker linetracker = context.getLineTracker();

    Set<String> shortTypes = getShortTypeNames(types);
    try {
      ASTVisitor visitor = new TypeCheckerVisitor(problemReporter, linetracker, smod, types,
              shortTypes);
      md.traverse(visitor);
    } catch (Exception e) {
      RutaIdePlugin.error(e);
    }
View Full Code Here

      ModuleDeclaration rootNode = SourceParserUtil
          .getModuleDeclaration(method.getSourceModule());
      MethodDeclaration methodDeclaration = PHPModelUtils
          .getNodeByMethod(rootNode, method);
      if (methodDeclaration != null) {
        methodDeclaration.traverse(new ASTVisitor() {
          public boolean visit(Statement s) throws Exception {
            if (s instanceof GlobalStatement) {
              GlobalStatement globalStatement = (GlobalStatement) s;
              for (Expression e : globalStatement.getVariables()) {
                if (e instanceof VariableReference) {
View Full Code Here

      if (namespace != null) {
        start = namespace.getSourceRange().getOffset();
      }
      final int searchStart = start;

      moduleDeclaration.traverse(new ASTVisitor() {

        public boolean visit(Statement s) throws Exception {
          if (s instanceof UseStatement) {
            UseStatement useStatement = (UseStatement) s;
            for (UsePart usePart : useStatement.getParts()) {
View Full Code Here

    final List<Expression> returnExpressions = new LinkedList<Expression>();
    final List<Expression> yieldExpressions = new LinkedList<Expression>();

    if (functionDeclaration != null) {

      ASTVisitor visitor = new ASTVisitor() {
        public boolean visitGeneral(ASTNode node) throws Exception {
          if (node instanceof ReturnStatement) {
            ReturnStatement statement = (ReturnStatement) node;
            Expression expr = statement.getExpr();
            if (expr == null) {
View Full Code Here

  public static ASTNode[] restoreWayToNode(ModuleDeclaration module,
      final ASTNode node) {

    final Stack<ASTNode> stack = new Stack<ASTNode>();

    ASTVisitor visitor = new ASTVisitor() {
      boolean found = false;

      public boolean visitGeneral(ASTNode n) throws Exception {
        if (found) {
          return super.visitGeneral(n);
View Full Code Here

  public static Declaration findDeclarationAfterPHPdoc(
      ModuleDeclaration moduleDeclaration, final int offset) {

    final Declaration[] decl = new Declaration[1];

    ASTVisitor visitor = new ASTVisitor() {
      boolean found = false;

      public boolean visit(MethodDeclaration m) {
        if (!found && m.sourceStart() > offset) {
          decl[0] = m;
View Full Code Here

    if (statements != null) {
      Iterator i = statements.iterator();
      while (i.hasNext()) {
        final ASTNode node = (ASTNode) i.next();
        try {
          node.traverse(new ASTVisitor() {
            private Stack<ASTNode> parentStack = new Stack<ASTNode>();

            public boolean visit(MethodDeclaration s)
                throws Exception {
              if (s != node
View Full Code Here

            .getMethodNode();

        // Look for parent class types:
        final List<IEvaluatedType> types = new LinkedList<IEvaluatedType>();
        try {
          rootNode.traverse(new ASTVisitor() {
            private TypeDeclaration currentType;
            private boolean found;

            public boolean visit(MethodDeclaration s)
                throws Exception {
View Full Code Here

          ((IModelCacheContext) innerContext)
              .setCache(((IModelCacheContext) goal.getContext())
                  .getCache());
        }

        ASTVisitor visitor = new ASTVisitor() {
          public boolean visitGeneral(ASTNode node) throws Exception {
            if (node instanceof ReturnStatement) {
              ReturnStatement statement = (ReturnStatement) node;
              Expression expr = statement.getExpr();
              if (expr == null) {
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.ast.ASTVisitor

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.