Package javassist.compiler.ast

Examples of javassist.compiler.ast.ASTree


/*      */
/*  321 */       atMultiNewArray(type, classname, size);
/*  322 */       return;
/*      */     }
/*      */
/*  325 */     ASTree sizeExpr = size.head();
/*  326 */     atNewArrayExpr2(type, sizeExpr, Declarator.astToClassName(classname, '/'), init);
/*      */   }
View Full Code Here


/*      */   protected void atMultiNewArray(int type, ASTList classname, ASTList size)
/*      */     throws CompileError
/*      */   {
/*  423 */     int dim = size.length();
/*  424 */     for (int count = 0; size != null; size = size.tail()) {
/*  425 */       ASTree s = size.head();
/*  426 */       if (s == null) {
/*      */         break;
/*      */       }
/*  429 */       count++;
/*  430 */       s.accept(this);
/*  431 */       if (this.exprType != 324) {
/*  432 */         throw new CompileError("bad type for array size");
/*      */       }
/*      */     }
/*      */
View Full Code Here

/*      */   }
/*      */
/*      */   public void atCallExpr(CallExpr expr) throws CompileError {
/*  449 */     String mname = null;
/*  450 */     CtClass targetClass = null;
/*  451 */     ASTree method = expr.oprand1();
/*  452 */     ASTList args = (ASTList)expr.oprand2();
/*  453 */     boolean isStatic = false;
/*  454 */     boolean isSpecial = false;
/*  455 */     int aload0pos = -1;
/*      */
/*  457 */     MemberResolver.Method cached = expr.getMethod();
/*  458 */     if ((method instanceof Member)) {
/*  459 */       mname = ((Member)method).get();
/*  460 */       targetClass = this.thisClass;
/*  461 */       if ((this.inStaticMethod) || ((cached != null) && (cached.isStatic()))) {
/*  462 */         isStatic = true;
/*      */       } else {
/*  464 */         aload0pos = this.bytecode.currentPc();
/*  465 */         this.bytecode.addAload(0);
/*      */       }
/*      */     }
/*  468 */     else if ((method instanceof Keyword)) {
/*  469 */       isSpecial = true;
/*  470 */       mname = "<init>";
/*  471 */       targetClass = this.thisClass;
/*  472 */       if (this.inStaticMethod) {
/*  473 */         throw new CompileError("a constructor cannot be static");
/*      */       }
/*  475 */       this.bytecode.addAload(0);
/*      */
/*  477 */       if (((Keyword)method).get() == 336)
/*  478 */         targetClass = MemberResolver.getSuperclass(targetClass);
/*      */     }
/*  480 */     else if ((method instanceof Expr)) {
/*  481 */       Expr e = (Expr)method;
/*  482 */       mname = ((Symbol)e.oprand2()).get();
/*  483 */       int op = e.getOperator();
/*  484 */       if (op == 35) {
/*  485 */         targetClass = this.resolver.lookupClass(((Symbol)e.oprand1()).get(), false);
/*      */
/*  487 */         isStatic = true;
/*      */       }
/*  489 */       else if (op == 46) {
/*  490 */         ASTree target = e.oprand1();
/*  491 */         if (((target instanceof Keyword)) &&
/*  492 */           (((Keyword)target).get() == 336))
/*  493 */           isSpecial = true;
/*      */         try
/*      */         {
/*  496 */           target.accept(this);
/*      */         }
/*      */         catch (NoFieldException nfe) {
/*  499 */           if (nfe.getExpr() != target) {
/*  500 */             throw nfe;
/*      */           }
View Full Code Here

/*      */
/*      */   public void atMethodArgs(ASTList args, int[] types, int[] dims, String[] cnames) throws CompileError
/*      */   {
/*  716 */     int i = 0;
/*  717 */     while (args != null) {
/*  718 */       ASTree a = args.head();
/*  719 */       a.accept(this);
/*  720 */       types[i] = this.exprType;
/*  721 */       dims[i] = this.arrayDim;
/*  722 */       cnames[i] = this.className;
/*  723 */       i++;
/*  724 */       args = args.tail();
View Full Code Here

/*  856 */       atArrayLength(expr);
/*  857 */       return;
/*      */     }
/*      */
/*  860 */     boolean is_static = this.resultStatic;
/*  861 */     ASTree cexpr = TypeChecker.getConstantFieldValue(f);
/*  862 */     if (cexpr == null) {
/*  863 */       atFieldRead(f, is_static);
/*      */     } else {
/*  865 */       cexpr.accept(this);
/*  866 */       setFieldType(f.getFieldInfo2());
/*      */     }
/*      */   }
View Full Code Here

/*      */   private boolean needsSuperCall(Stmnt body) throws CompileError {
/*  302 */     if (body.getOperator() == 66) {
/*  303 */       body = (Stmnt)body.head();
/*      */     }
/*  305 */     if ((body != null) && (body.getOperator() == 69)) {
/*  306 */       ASTree expr = body.head();
/*  307 */       if ((expr != null) && ((expr instanceof Expr)) && (((Expr)expr).getOperator() == 67))
/*      */       {
/*  309 */         ASTree target = ((Expr)expr).head();
/*  310 */         if ((target instanceof Keyword)) {
/*  311 */           int token = ((Keyword)target).get();
/*  312 */           return (token != 339) && (token != 336);
/*      */         }
/*      */       }
View Full Code Here

/*  323 */     if (st == null) {
/*  324 */       return;
/*      */     }
/*  326 */     int op = st.getOperator();
/*  327 */     if (op == 69) {
/*  328 */       ASTree expr = st.getLeft();
/*  329 */       doTypeCheck(expr);
/*  330 */       if ((expr instanceof AssignExpr)) {
/*  331 */         atAssignExpr((AssignExpr)expr, false);
/*  332 */       } else if (isPlusPlusExpr(expr)) {
/*  333 */         Expr e = (Expr)expr;
/*  334 */         atPlusPlus(e.getOperator(), e.oprand1(), e, false);
/*      */       }
/*      */       else {
/*  337 */         expr.accept(this);
/*  338 */         if (is2word(this.exprType, this.arrayDim))
/*  339 */           this.bytecode.addOpcode(88);
/*  340 */         else if (this.exprType != 344)
/*  341 */           this.bytecode.addOpcode(87);
/*      */       }
/*      */     }
/*  344 */     else if ((op == 68) || (op == 66)) {
/*  345 */       ASTList list = st;
/*  346 */       while (list != null) {
/*  347 */         ASTree h = list.head();
/*  348 */         list = list.tail();
/*  349 */         if (h != null)
/*  350 */           h.accept(this);
/*      */       }
/*      */     }
/*  353 */     else if (op == 320) {
/*  354 */       atIfStmnt(st);
/*  355 */     } else if ((op == 346) || (op == 311)) {
View Full Code Here

/*      */     }
/*      */   }
/*      */
/*      */   private void atIfStmnt(Stmnt st) throws CompileError
/*      */   {
/*  380 */     ASTree expr = st.head();
/*  381 */     Stmnt thenp = (Stmnt)st.tail().head();
/*  382 */     Stmnt elsep = (Stmnt)st.tail().tail().head();
/*  383 */     compileBooleanExpr(false, expr);
/*  384 */     int pc = this.bytecode.currentPc();
/*  385 */     int pc2 = 0;
View Full Code Here

/*  413 */     ArrayList prevBreakList = this.breakList;
/*  414 */     ArrayList prevContList = this.continueList;
/*  415 */     this.breakList = new ArrayList();
/*  416 */     this.continueList = new ArrayList();
/*      */
/*  418 */     ASTree expr = st.head();
/*  419 */     Stmnt body = (Stmnt)st.tail();
/*      */
/*  421 */     int pc = 0;
/*  422 */     if (notDo) {
/*  423 */       this.bytecode.addOpcode(167);
View Full Code Here

/*  457 */     this.breakList = new ArrayList();
/*  458 */     this.continueList = new ArrayList();
/*      */
/*  460 */     Stmnt init = (Stmnt)st.head();
/*  461 */     ASTList p = st.tail();
/*  462 */     ASTree expr = p.head();
/*  463 */     p = p.tail();
/*  464 */     Stmnt update = (Stmnt)p.head();
/*  465 */     Stmnt body = (Stmnt)p.tail();
/*      */
/*  467 */     if (init != null) {
View Full Code Here

TOP

Related Classes of javassist.compiler.ast.ASTree

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.