Package javassist.compiler.ast

Examples of javassist.compiler.ast.ASTList


/*      */       }
/*  908 */       return new CastExpr(t, dim, parseUnaryExpr(tbl));
/*      */     }
/*  910 */     if ((t == 400) && (nextIsClassCast())) {
/*  911 */       this.lex.get();
/*  912 */       ASTList name = parseClassType(tbl);
/*  913 */       int dim = parseArrayDimension();
/*  914 */       if (this.lex.get() != 41) {
/*  915 */         throw new CompileError(") is missing", this.lex);
/*      */       }
/*  917 */       return new CastExpr(name, dim, parseUnaryExpr(tbl));
View Full Code Here


/*      */   }
/*      */
/*      */   private ASTList parseClassType(SymbolTable tbl)
/*      */     throws CompileError
/*      */   {
/*  980 */     ASTList list = null;
/*      */     while (true) {
/*  982 */       if (this.lex.get() != 400) {
/*  983 */         throw new SyntaxError(this.lex);
/*      */       }
/*  985 */       list = ASTList.append(list, new Symbol(this.lex.getString()));
View Full Code Here

/*      */   {
/* 1264 */     ArrayInit init = null;
/* 1265 */     int t = this.lex.lookAhead();
/* 1266 */     if (isBuiltinType(t)) {
/* 1267 */       this.lex.get();
/* 1268 */       ASTList size = parseArraySize(tbl);
/* 1269 */       if (this.lex.lookAhead() == 123) {
/* 1270 */         init = parseArrayInitializer(tbl);
/*      */       }
/* 1272 */       return new NewExpr(t, size, init);
/*      */     }
/* 1274 */     if (t == 400) {
/* 1275 */       ASTList name = parseClassType(tbl);
/* 1276 */       t = this.lex.lookAhead();
/* 1277 */       if (t == 40) {
/* 1278 */         ASTList args = parseArgumentList(tbl);
/* 1279 */         return new NewExpr(name, args);
/*      */       }
/* 1281 */       if (t == 91) {
/* 1282 */         ASTList size = parseArraySize(tbl);
/* 1283 */         if (this.lex.lookAhead() == 123) {
/* 1284 */           init = parseArrayInitializer(tbl);
/*      */         }
/* 1286 */         return NewExpr.makeObjectArray(name, size, init);
/*      */       }
View Full Code Here

/*      */   }
/*      */
/*      */   private ASTList parseArraySize(SymbolTable tbl)
/*      */     throws CompileError
/*      */   {
/* 1296 */     ASTList list = null;
/* 1297 */     while (this.lex.lookAhead() == 91) {
/* 1298 */       list = ASTList.append(list, parseArrayIndex(tbl));
/*      */     }
/* 1300 */     return list;
/*      */   }
View Full Code Here

/*      */     throws CompileError
/*      */   {
/* 1323 */     if (this.lex.get() != 40) {
/* 1324 */       throw new CompileError("( is missing", this.lex);
/*      */     }
/* 1326 */     ASTList list = null;
/* 1327 */     if (this.lex.lookAhead() != 41) {
/*      */       while (true) {
/* 1329 */         list = ASTList.append(list, parseExpression(tbl));
/* 1330 */         if (this.lex.lookAhead() != 44) break;
/* 1331 */         this.lex.get();
View Full Code Here

/*  189 */     Bytecode bc = this.bytecode;
/*  190 */     Stmnt body = (Stmnt)st.getLeft();
/*  191 */     if (body == null) {
/*  192 */       return;
/*      */     }
/*  194 */     ASTList catchList = (ASTList)st.getRight().getLeft();
/*  195 */     Stmnt finallyBlock = (Stmnt)st.getRight().getRight().getLeft();
/*  196 */     ArrayList gotoList = new ArrayList();
/*      */
/*  198 */     JsrHook jsrHook = null;
/*  199 */     if (finallyBlock != null) {
/*  200 */       jsrHook = new JsrHook(this);
/*      */     }
/*  202 */     int start = bc.currentPc();
/*  203 */     body.accept(this);
/*  204 */     int end = bc.currentPc();
/*  205 */     if (start == end) {
/*  206 */       throw new CompileError("empty try block");
/*      */     }
/*  208 */     boolean tryNotReturn = !this.hasReturned;
/*  209 */     if (tryNotReturn) {
/*  210 */       bc.addOpcode(167);
/*  211 */       gotoList.add(new Integer(bc.currentPc()));
/*  212 */       bc.addIndex(0);
/*      */     }
/*      */
/*  215 */     int var = getMaxLocals();
/*  216 */     incMaxLocals(1);
/*  217 */     while (catchList != null)
/*      */     {
/*  219 */       Pair p = (Pair)catchList.head();
/*  220 */       catchList = catchList.tail();
/*  221 */       Declarator decl = (Declarator)p.getLeft();
/*  222 */       Stmnt block = (Stmnt)p.getRight();
/*      */
/*  224 */       decl.setLocalVar(var);
/*      */
View Full Code Here

/*  292 */     if (expr.isArray()) {
/*  293 */       atNewArrayExpr(expr);
/*      */     } else {
/*  295 */       CtClass clazz = this.resolver.lookupClassByName(expr.getClassName());
/*  296 */       String cname = clazz.getName();
/*  297 */       ASTList args = expr.getArguments();
/*  298 */       this.bytecode.addNew(cname);
/*  299 */       this.bytecode.addOpcode(89);
/*      */
/*  301 */       atMethodCallCore(clazz, "<init>", args, false, true, -1, null);
/*      */
View Full Code Here

/*      */     }
/*      */   }
/*      */
/*      */   public void atNewArrayExpr(NewExpr expr) throws CompileError {
/*  311 */     int type = expr.getArrayType();
/*  312 */     ASTList size = expr.getArraySize();
/*  313 */     ASTList classname = expr.getClassName();
/*  314 */     ArrayInit init = expr.getInitializer();
/*  315 */     if (size.length() > 1) {
/*  316 */       if (init != null) {
/*  317 */         throw new CompileError("sorry, multi-dimensional array initializer for new is not supported");
/*      */       }
View Full Code Here

/*  383 */       this.bytecode.add(atype);
/*      */     }
/*      */
/*  386 */     if (init != null) {
/*  387 */       int s = init.length();
/*  388 */       ASTList list = init;
/*  389 */       for (int i = 0; i < s; i++) {
/*  390 */         this.bytecode.addOpcode(89);
/*  391 */         this.bytecode.addIconst(i);
/*  392 */         list.head().accept(this);
/*  393 */         if (!isRefType(type)) {
/*  394 */           atNumCastExpr(this.exprType, type);
/*      */         }
/*  396 */         this.bytecode.addOpcode(getArrayWriteOp(type, 0));
/*  397 */         list = list.tail();
/*      */       }
/*      */     }
/*      */
/*  401 */     this.exprType = type;
/*  402 */     this.arrayDim = 1;
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();
View Full Code Here

TOP

Related Classes of javassist.compiler.ast.ASTList

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.