Examples of CastExpr


Examples of japa.parser.ast.expr.CastExpr

        return Boolean.TRUE;
    }

    public Boolean visit(CastExpr n1, Node arg) {
        CastExpr n2 = (CastExpr) arg;

        if (!nodeEquals(n1.getType(), n2.getType())) {
            return Boolean.FALSE;
        }

        if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
            return Boolean.FALSE;
        }

        return Boolean.TRUE;
    }
View Full Code Here

Examples of japa.parser.ast.expr.CastExpr

        column = token.beginColumn;
        if (jj_2_24(2)) {
            type = PrimitiveType();
            jj_consume_token(RPAREN);
            ret = UnaryExpression();
            ret = new CastExpr(line, column, token.endLine, token.endColumn, type, ret);
        } else {
            switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                case BOOLEAN:
                case BYTE:
                case CHAR:
                case DOUBLE:
                case FLOAT:
                case INT:
                case LONG:
                case SHORT:
                case IDENTIFIER:
                    type = ReferenceType();
                    jj_consume_token(RPAREN);
                    ret = UnaryExpressionNotPlusMinus();
                    ret = new CastExpr(line, column, token.endLine, token.endColumn, type, ret);
                    break;
                default:
                    jj_la1[82] = jj_gen;
                    jj_consume_token(-1);
                    throw new ParseException();
View Full Code Here

Examples of japa.parser.ast.expr.CastExpr

  public Node visit(CastExpr _n, Object _arg) {
    Type type_ = cloneNodes(_n.getType(), _arg);
    Expression expr = cloneNodes(_n.getExpr(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);

    CastExpr r = new CastExpr(
        _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
        type_, expr
    );
    r.setComment(comment);
    return r;
  }
View Full Code Here

Examples of japa.parser.ast.expr.CastExpr

    return Boolean.TRUE;
  }

  @Override public Boolean visit(final CastExpr n1, final Node arg) {
    final CastExpr n2 = (CastExpr) arg;

    if (!nodeEquals(n1.getType(), n2.getType())) {
      return Boolean.FALSE;
    }

    if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
      return Boolean.FALSE;
    }

    return Boolean.TRUE;
  }
View Full Code Here

Examples of javassist.compiler.ast.CastExpr

/*  286 */     String cname1 = this.className;
/*  287 */     expr.elseExpr().accept(this);
/*      */
/*  289 */     if ((dim1 == 0) && (dim1 == this.arrayDim))
/*  290 */       if (CodeGen.rightIsStrong(type1, this.exprType)) {
/*  291 */         expr.setThen(new CastExpr(this.exprType, 0, expr.thenExpr()));
/*  292 */       } else if (CodeGen.rightIsStrong(this.exprType, type1)) {
/*  293 */         expr.setElse(new CastExpr(type1, 0, expr.elseExpr()));
/*  294 */         this.exprType = type1;
/*      */       }
/*      */   }
View Full Code Here

Examples of javassist.compiler.ast.CastExpr

/*      */
/*      */   private void insertCast(BinExpr expr, int type1, int type2)
/*      */     throws CompileError
/*      */   {
/*  538 */     if (CodeGen.rightIsStrong(type1, type2))
/*  539 */       expr.setLeft(new CastExpr(type2, 0, expr.oprand1()));
/*      */     else
/*  541 */       this.exprType = type1;
/*      */   }
View Full Code Here

Examples of javassist.compiler.ast.CastExpr

/*  903 */       this.lex.get();
/*  904 */       int dim = parseArrayDimension();
/*  905 */       if (this.lex.get() != 41) {
/*  906 */         throw new CompileError(") is missing", this.lex);
/*      */       }
/*  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));
/*      */     }
/*      */
/*  920 */     return parsePostfix(tbl);
/*      */   }
View Full Code Here

Examples of soot.jimple.CastExpr

            Value lhs = ds.getLeftOp();
            Value rhs = ds.getRightOp();

            if (rhs instanceof CastExpr) {
              //un-box casted value
        CastExpr castExpr = (CastExpr) rhs;
              rhs = castExpr.getOp();
            }
           
            if ((lhs instanceof Local
                || (lhs instanceof FieldRef && this.localsAndFieldRefs.contains(new EquivalentValue(lhs))))
              && lhs.getType() instanceof RefLikeType) {
View Full Code Here

Examples of soot.jimple.CastExpr

                            //                             r.setField(changeClass.getFieldByName(
                            //                                     r.getField().getName()));
                        }
                    } else if (value instanceof CastExpr) {
                        // Fix casts
                        CastExpr r = (CastExpr) value;

                        try {
                            if (object != analysis.getObject((Local) r.getOp())) {
                                continue;
                            }
                        } catch (Exception ex) {
                            if (_debug) {
                                System.out.println("Exception on cast = " + ex);
                            }

                            continue;
                        }

                        Type type = r.getType();

                        if (type instanceof RefType) {
                            SootClass refClass = ((RefType) type)
                                    .getSootClass();

                            if (refClass == oldClass) {
                                r.setCastType(RefType.v(newClass));

                                //    System.out.println("newValue = " +
                                //        box.getValue());
                                //                             } else if (refClass.getName().startsWith(
                                //                                     oldClass.getName())) {
                                //                                 SootClass changeClass =
                                //                                     _getInnerClassCopy(oldClass,
                                //                                             refClass, newClass);
                                //                                 r.setCastType(RefType.v(changeClass));
                            }
                        }

                        //     } else if (value instanceof ThisRef) {
                        //                         // Fix references to 'this'
                        //                         ThisRef r = (ThisRef)value;
                        //                         Type type = r.getType();
                        //                         if (type instanceof RefType &&
                        //                                 ((RefType)type).getSootClass() == oldClass) {
                        //                             box.setValue(Jimple.v().newThisRef(
                        //                                     RefType.v(newClass)));
                        //                         }
                        //                     } else if (value instanceof ParameterRef) {
                        //                         // Fix references to a parameter
                        //                         ParameterRef r = (ParameterRef)value;
                        //                         Type type = r.getType();
                        //                         if (type instanceof RefType &&
                        //                                 ((RefType)type).getSootClass() == oldClass) {
                        //                             box.setValue(Jimple.v().newParameterRef(
                        //                                     RefType.v(newClass), r.getIndex()));
                        //                         }
                    } else if (value instanceof InstanceInvokeExpr) {
                        // Fix up the method invokes.
                        InstanceInvokeExpr r = (InstanceInvokeExpr) value;

                        try {
                            if (object != analysis.getObject((Local) r
                                    .getBase())) {
                                //                                 System.out.println("object = " + object);
                                //                                 System.out.println("analysis object = " + analysis.getObject((Local)r.getBase()));
                                //                                 System.out.println("not equal!");
                                continue;
                            }
                        } catch (Exception ex) {
                            if (_debug) {
                                System.out.println("Exception on invoke = "
                                        + ex);
                            }

                            continue;
                        }

                        if (SootUtilities.derivesFrom(oldClass, r.getMethod()
                                .getDeclaringClass())) {
                            if (newClass.declaresMethod(r.getMethod()
                                    .getSubSignature())) {
                                SootMethod replacementMethod = newClass
                                        .getMethod(r.getMethod()
                                                .getSubSignature());
                                r.setMethodRef(replacementMethod.makeRef());
                            }

                            //                         } else if (r.getMethod().getDeclaringClass().getName().
                            //                                 startsWith(oldClass.getName())) {
                            //                             SootClass changeClass =
                            //                                 _getInnerClassCopy(oldClass,
                            //                                         r.getMethod().getDeclaringClass(),
                            //                                         newClass);
                            //                             r.setMethod(changeClass.getMethod(
                            //                                     r.getMethod().getSubSignature()));
                        }
                    } else if (value instanceof NewExpr) {
                        // Fix up the object creations.
                        NewExpr r = (NewExpr) value;

                        if (!(unit instanceof AssignStmt)) {
                            continue;
                        }

                        AssignStmt stmt = (AssignStmt) unit;

                        try {
                            if (object != analysis.getObject((Local) stmt
                                    .getLeftOp())) {
                                continue;
                            }
                        } catch (Exception ex) {
                            if (_debug) {
                                System.out.println("Exception on new = " + ex);
                            }

                            continue;
                        }

                        if (r.getBaseType().getSootClass() == oldClass) {
                            r.setBaseType(RefType.v(newClass));

                            //   System.out.println("newValue = " +
                            //           box.getValue());
                            //                         } else if (r.getBaseType().getSootClass().getName().
                            //                                 startsWith(oldClass.getName())) {
View Full Code Here

Examples of soot.jimple.CastExpr

                            .hasNext();) {
                        ValueBox box = (ValueBox) boxes.next();
                        Value value = box.getValue();

                        if (value instanceof CastExpr) {
                            CastExpr expr = (CastExpr) value;
                            Type castType = expr.getCastType();

                            if (castType instanceof RefType) {
                                SootClass castClass = ((RefType) castType)
                                        .getSootClass();

                                if (castClass.isInterface()) {
                                    necessaryClasses.add(castClass);
                                } else {
                                    necessaryClasses
                                            .addAll(hierarchy
                                                    .getSuperclassesOfIncluding(castClass));
                                }

                                _addAllInterfaces(necessaryClasses, castClass);
                            }
                        } else if (value instanceof InstanceOfExpr) {
                            InstanceOfExpr expr = (InstanceOfExpr) value;
                            Type checkType = expr.getCheckType();

                            if (checkType instanceof RefType) {
                                SootClass checkClass = ((RefType) checkType)
                                        .getSootClass();
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.