Examples of ASTree


Examples of javassist.compiler.ast.ASTree

/*     */   }
/*     */
/*     */   public void atCastExpr(CastExpr expr) throws CompileError {
/*  87 */     ASTList classname = expr.getClassName();
/*  88 */     if ((classname != null) && (expr.getArrayDim() == 0)) {
/*  89 */       ASTree p = classname.head();
/*  90 */       if (((p instanceof Symbol)) && (classname.tail() == null)) {
/*  91 */         String typename = ((Symbol)p).get();
/*  92 */         if (typename.equals(this.codeGen.returnCastName)) {
/*  93 */           atCastToRtype(expr);
/*  94 */           return;
View Full Code Here

Examples of javassist.compiler.ast.ASTree

/*     */   }
/*     */
/*     */   public void atCallExpr(CallExpr expr)
/*     */     throws CompileError
/*     */   {
/* 141 */     ASTree method = expr.oprand1();
/* 142 */     if ((method instanceof Member)) {
/* 143 */       String name = ((Member)method).get();
/* 144 */       if ((this.codeGen.procHandler != null) && (name.equals(this.codeGen.proceedName)))
/*     */       {
/* 146 */         this.codeGen.procHandler.setReturnType(this, (ASTList)expr.oprand2());
View Full Code Here

Examples of javassist.compiler.ast.ASTree

/*     */
/*     */   public boolean isParamListName(ASTList args)
/*     */   {
/* 171 */     if ((this.codeGen.paramTypeList != null) && (args != null) && (args.tail() == null))
/*     */     {
/* 173 */       ASTree left = args.head();
/* 174 */       return ((left instanceof Member)) && (((Member)left).get().equals(this.codeGen.paramListName));
/*     */     }
/*     */
/* 178 */     return false;
/*     */   }
View Full Code Here

Examples of javassist.compiler.ast.ASTree

/*     */
/*     */   public int getMethodArgsLength(ASTList args) {
/* 182 */     String pname = this.codeGen.paramListName;
/* 183 */     int n = 0;
/* 184 */     while (args != null) {
/* 185 */       ASTree a = args.head();
/* 186 */       if (((a instanceof Member)) && (((Member)a).get().equals(pname))) {
/* 187 */         if (this.codeGen.paramTypeList != null)
/* 188 */           n += this.codeGen.paramTypeList.length;
/*     */       }
/*     */       else {
View Full Code Here

Examples of javassist.compiler.ast.ASTree

/*     */   {
/* 201 */     CtClass[] params = this.codeGen.paramTypeList;
/* 202 */     String pname = this.codeGen.paramListName;
/* 203 */     int i = 0;
/* 204 */     while (args != null) {
/* 205 */       ASTree a = args.head();
/* 206 */       if (((a instanceof Member)) && (((Member)a).get().equals(pname))) {
/* 207 */         if (params != null) {
/* 208 */           int n = params.length;
/* 209 */           for (int k = 0; k < n; k++) {
/* 210 */             CtClass p = params[k];
/* 211 */             setType(p);
/* 212 */             types[i] = this.exprType;
/* 213 */             dims[i] = this.arrayDim;
/* 214 */             cnames[i] = this.className;
/* 215 */             i++;
/*     */           }
/*     */         }
/*     */       }
/*     */       else {
/* 220 */         a.accept(this);
/* 221 */         types[i] = this.exprType;
/* 222 */         dims[i] = this.arrayDim;
/* 223 */         cnames[i] = this.className;
/* 224 */         i++;
/*     */       }
View Full Code Here

Examples of javassist.compiler.ast.ASTree

/*     */
/*     */   public void recordProceed(String target, String method)
/*     */     throws CompileError
/*     */   {
/* 434 */     Parser p = new Parser(new Lex(target));
/* 435 */     ASTree texpr = p.parseExpression(this.stable);
/* 436 */     String m = method;
/*     */
/* 438 */     ProceedHandler h = new ProceedHandler(m, texpr) { private final String val$m;
/*     */       private final ASTree val$texpr;
/*     */
/* 442 */       public void doit(JvstCodeGen gen, Bytecode b, ASTList args) throws CompileError { ASTree expr = new Member(this.val$m);
/* 443 */         if (this.val$texpr != null) {
/* 444 */           expr = Expr.make(46, this.val$texpr, expr);
/*     */         }
/* 446 */         expr = CallExpr.makeCall(expr, args);
/* 447 */         gen.compileExpr(expr);
/* 448 */         gen.addNullIfVoid();
/*     */       }
/*     */
/*     */       public void setReturnType(JvstTypeChecker check, ASTList args)
/*     */         throws CompileError
/*     */       {
/* 454 */         ASTree expr = new Member(this.val$m);
/* 455 */         if (this.val$texpr != null) {
/* 456 */           expr = Expr.make(46, this.val$texpr, expr);
/*     */         }
/* 458 */         expr = CallExpr.makeCall(expr, args);
/* 459 */         expr.accept(check);
/* 460 */         check.addNullIfVoid();
/*     */       }
/*     */     };
/* 464 */     this.gen.setProceedHandler(h, "$proceed");
/*     */   }
View Full Code Here

Examples of javassist.compiler.ast.ASTree

/*     */
/*     */   public void recordSpecialProceed(String target, String classname, String methodname, String descriptor)
/*     */     throws CompileError
/*     */   {
/* 522 */     Parser p = new Parser(new Lex(target));
/* 523 */     ASTree texpr = p.parseExpression(this.stable);
/* 524 */     String cname = classname;
/* 525 */     String method = methodname;
/* 526 */     String desc = descriptor;
/*     */
/* 528 */     ProceedHandler h = new ProceedHandler(texpr, cname, method, desc) { private final ASTree val$texpr;
View Full Code Here

Examples of javassist.compiler.ast.ASTree

/*     */   }
/*     */
/*     */   public void compileExpr(String src)
/*     */     throws CompileError
/*     */   {
/* 582 */     ASTree e = parseExpr(src, this.stable);
/* 583 */     compileExpr(e);
/*     */   }
View Full Code Here

Examples of javassist.compiler.ast.ASTree

/*      */   }
/*      */
/*      */   private Expr atPlusExpr(BinExpr expr)
/*      */     throws CompileError
/*      */   {
/*  345 */     ASTree left = expr.oprand1();
/*  346 */     ASTree right = expr.oprand2();
/*  347 */     if (right == null)
/*      */     {
/*  350 */       left.accept(this);
/*  351 */       return null;
/*      */     }
/*      */
/*  354 */     if (isPlusExpr(left)) {
/*  355 */       Expr newExpr = atPlusExpr((BinExpr)left);
/*  356 */       if (newExpr != null) {
/*  357 */         right.accept(this);
/*  358 */         this.exprType = 307;
/*  359 */         this.arrayDim = 0;
/*  360 */         this.className = "java/lang/StringBuffer";
/*  361 */         return makeAppendCall(newExpr, right);
/*      */       }
/*      */     }
/*      */     else {
/*  365 */       left.accept(this);
/*      */     }
/*  367 */     int type1 = this.exprType;
/*  368 */     int dim1 = this.arrayDim;
/*  369 */     String cname = this.className;
/*  370 */     right.accept(this);
/*      */
/*  372 */     if (isConstant(expr, 43, left, right)) {
/*  373 */       return null;
/*      */     }
/*  375 */     if (((type1 == 307) && (dim1 == 0) && ("java/lang/String".equals(cname))) || ((this.exprType == 307) && (this.arrayDim == 0) && ("java/lang/String".equals(this.className))))
/*      */     {
/*  378 */       ASTList sbufClass = ASTList.make(new Symbol("java"), new Symbol("lang"), new Symbol("StringBuffer"));
/*      */
/*  380 */       ASTree e = new NewExpr(sbufClass, null);
/*  381 */       this.exprType = 307;
/*  382 */       this.arrayDim = 0;
/*  383 */       this.className = "java/lang/StringBuffer";
/*  384 */       return makeAppendCall(makeAppendCall(e, left), right);
/*      */     }
View Full Code Here

Examples of javassist.compiler.ast.ASTree

/*      */   private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right)
/*      */     throws CompileError
/*      */   {
/*  395 */     left = stripPlusExpr(left);
/*  396 */     right = stripPlusExpr(right);
/*  397 */     ASTree newExpr = null;
/*  398 */     if (((left instanceof StringL)) && ((right instanceof StringL)) && (op == 43)) {
/*  399 */       newExpr = new StringL(((StringL)left).get() + ((StringL)right).get());
/*      */     }
/*  401 */     else if ((left instanceof IntConst))
/*  402 */       newExpr = ((IntConst)left).compute(op, right);
/*  403 */     else if ((left instanceof DoubleConst)) {
/*  404 */       newExpr = ((DoubleConst)left).compute(op, right);
/*      */     }
/*  406 */     if (newExpr == null) {
/*  407 */       return false;
/*      */     }
/*  409 */     expr.setOperator(43);
/*  410 */     expr.setOprand1(newExpr);
/*  411 */     expr.setOprand2(null);
/*  412 */     newExpr.accept(this);
/*  413 */     return true;
/*      */   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.