/* (non-Javadoc)
  * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.InstanceofExpression)
  */
 public boolean visit(InstanceofExpression node) {
   PTInstanceof inof = InstantiationFactory.eINSTANCE.createPTInstanceof();
   inof.setOperand(perform(node.getLeftOperand()));
   inof.setType(resolver.resolveType(node.getRightOperand()));
   expression = inof;
   return false;
 }
 /* (non-Javadoc)
  * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.CastExpression)
  */
 public boolean visit(CastExpression node) {
   PTCastExpression ct = InstantiationFactory.eINSTANCE.createPTCastExpression();
   ct.setType(resolver.resolveType(node.getType()));
   ct.setExpression(perform(node.getExpression()));
   expression = ct;
   return false;
 }
 /* (non-Javadoc)
  * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ClassInstanceCreation)
  */
 public boolean visit(ClassInstanceCreation node) {
   if (node.getAnonymousClassDeclaration() != null) {
     PTAnonymousClassDeclaration adecl =
         InstantiationFactory.eINSTANCE.createPTAnonymousClassDeclaration();
     adecl.setDeclaration(node.toString());
     expression = adecl;
   } else {
     PTClassInstanceCreation cic = InstantiationFactory.eINSTANCE.createPTClassInstanceCreation();
     // If ast level = 2, then you must use getName, but the name needs to be turned into a type
     // so that it can be resolved. If ast level > 2, then it will return a type to be resolved.
     // Note: can't just use resolve name on the name because if a field and a class were spelled
     // the same then the codegen resolver would return an instance ref to the field instead.
     String type =
         node.getAST().apiLevel() == AST.JLS2
             ? resolver.resolveType(node.getName())
             : resolver.resolveType(node.getType());
     if (type == null) {
       type =
           node.getAST().apiLevel() == AST.JLS2
               ? node.getName().getFullyQualifiedName()
               : node.getType().toString();
     }
     cic.setType(type);
     List args = cic.getArguments();
     List nargs = node.arguments();
     int nsize = nargs.size();
     for (int i = 0; i < nsize; i++) {
       args.add(perform((Expression) nargs.get(i)));
     }
     expression = cic;
   }
   return false;
 }
 /* (non-Javadoc)
  * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ArrayCreation)
  */
 public boolean visit(ArrayCreation node) {
   PTArrayCreation ac = InstantiationFactory.eINSTANCE.createPTArrayCreation();
   ac.setType(resolver.resolveType(node.getType()));
   List acDims = ac.getDimensions();
   List nDims = node.dimensions();
   int nsize = nDims.size();
   for (int i = 0; i < nsize; i++) {
     acDims.add(perform((Expression) nDims.get(i)));
   }
   ac.setInitializer((PTArrayInitializer) perform(node.getInitializer()));
   expression = ac;
   return false;
 }
 /* (non-Javadoc)
  * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeLiteral)
  */
 public boolean visit(TypeLiteral node) {
   PTTypeLiteral ptl = InstantiationFactory.eINSTANCE.createPTTypeLiteral();
   ptl.setType(resolver.resolveType(node.getType()));
   expression = ptl;
   return false;
 }